Fork me on GitHub

source: git/external/fastjet/plugins/ATLASCone/Jet.hh@ c1780a5

Last change on this file since c1780a5 was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 3.8 KB
Line 
1#ifndef _JET_HH_
2#define _JET_HH_
3
4//----------------------------------------------------------------------
5// This file distributed with FastJet has been obtained from SpartyJet
6// v2.20.0 by Pierre-Antoine Delsart, Kurtis L. Geerlings, Joey
7// Huston, Brian T. Martin and Chris Vermilion
8// For details, see http://www.pa.msu.edu/~huston/SpartyJet/
9// http://projects.hepforge.org/spartyjet/
10//
11// Changes from the original file are listed below.
12//----------------------------------------------------------------------
13
14// History of changes from the original Jet.hh file in SpartyJet v2.20
15//
16// 2011-11-14 Gregory Soyez <soyez@fastjet.fr>
17//
18// * removed some harmless warnings coming with the -Wshadow gcc option
19//
20// 2011-06-28 Gregory Soyez <soyez@fastjet.fr>
21//
22// * used stable_sort instead of sort to fix some ordering issues
23//
24// 2009-01-15 Gregory Soyez <soyez@fastjet.fr>
25//
26// * put the code in the fastjet::atlas namespace
27
28#include "LorentzVector.hh"
29#include <list>
30#include <vector>
31#include <algorithm>
32
33#include <fastjet/internal/base.hh>
34
35FASTJET_BEGIN_NAMESPACE
36
37namespace atlas {
38
39class Jet : public LorentzVector {
40public :
41
42 typedef std::list<Jet*> constit_vect_t;
43 typedef std::vector<Jet*> jet_list_t;
44
45 Jet(): LorentzVector(0,0,0,0) {}
46 Jet(double p1, double p2, double p3, double p0, int index_in=0): LorentzVector(p1,p2,p3,p0), m_index(index_in){}
47 Jet(LorentzVector v): LorentzVector(v) {m_index = 0;}
48 Jet(Jet &j);
49 Jet(Jet *j);
50
51
52 /// The standard way of merging jets
53 void addJet(Jet& j);
54 void addJet(Jet* j);
55
56
57 /// Access jet constituents
58 int getConstituentNum(){return m_constituents.size();}
59 constit_vect_t::iterator firstConstituent(){ return m_constituents.begin();};
60 constit_vect_t::iterator lastConstituent(){ return m_constituents.end();};
61
62
63
64 // convenience methods
65 void addConstituent(Jet* jet) {m_constituents.push_back(jet);this->add(*jet);};
66 void addConstituent(constit_vect_t::iterator first, constit_vect_t::iterator last);
67 void removeConstituent(Jet* jet) {m_constituents.remove(jet);this->subtract(*jet);};
68
69 void addConstituent_notMoment(Jet* jet){m_constituents.push_back(jet);}
70 //void removeConstituent(constit_vect_t::iterator first, constit_vect_t::iterator last);
71
72
73 // return position in intial collection
74 int index() const {return m_index;}
75 void set_index(int i){m_index= i;}
76
77
78 /// Atlas compatibility code :
79 LorentzVector hlv() {return *this;}
80
81
82 //bool split_merged; // from siscone/jetclu/midpoint algorithms
83
84protected :
85 int m_index; /// position in a jet list (used for constituents positions)
86 constit_vect_t m_constituents;
87
88};
89
90
91
92void find_jet_in_list(Jet* j);
93
94// using functors is supposed to be faster... (??)
95class JetSorter_Et {
96public:
97 bool operator()(Jet* j1, Jet* j2){
98 // deal with numerical uncertainty :
99 if(fabs( j1->et() - j2->et())<0.001 ) return 0;
100 else return j1->et() > j2->et();
101 //return (j1->et() > j2->et());
102 }
103};
104
105class JetSorter_Pt {
106public:
107 bool operator()(Jet* j1, Jet* j2){
108 return (j1->pt() > j2->pt());
109 }
110};
111
112class JetSorter_Eta {
113public:
114 bool operator()(Jet* j1, Jet* j2){
115 return (j1->eta() > j2->eta());
116 }
117};
118
119class JetSorter_E {
120public:
121 bool operator()(Jet* j1, Jet* j2){
122 return (j1->e() > j2->e());
123 }
124};
125
126
127
128template<class T>
129inline void sort_jet_list(Jet::jet_list_t &list){
130 std::stable_sort(list.begin(),list.end(), T());
131}
132inline void sort_list_et(Jet::jet_list_t &list){
133 //std::sort(list.begin(),list.end(),et_compare);
134 std::stable_sort(list.begin(),list.end(), JetSorter_Et());
135}
136inline void sort_list_pt(Jet::jet_list_t &list){
137 std::stable_sort(list.begin(),list.end(),JetSorter_Pt());
138}
139
140Jet* jet_from_overlap(Jet* j1, Jet* j2);
141
142} // namespace atlas
143
144FASTJET_END_NAMESPACE
145#endif
146
147
Note: See TracBrowser for help on using the repository browser.