fastjet 2.4.5
|
00001 // file taken from SpartyJet v2.20.0 00002 // 00003 // added #include <algorithms> 00004 00005 00006 #ifndef _JET_HH_ 00007 #define _JET_HH_ 00008 00009 #include "LorentzVector.hh" 00010 #include <list> 00011 #include <vector> 00012 #include <algorithm> 00013 00014 #include <fastjet/internal/base.hh> 00015 00016 FASTJET_BEGIN_NAMESPACE 00017 00018 namespace atlas { 00019 00020 class Jet : public LorentzVector { 00021 public : 00022 00023 typedef std::list<Jet*> constit_vect_t; 00024 typedef std::vector<Jet*> jet_list_t; 00025 00026 Jet(): LorentzVector(0,0,0,0) {} 00027 Jet(double p1, double p2, double p3, double p0, int index=0): LorentzVector(p1,p2,p3,p0), m_index(index){} 00028 Jet(LorentzVector v): LorentzVector(v) {m_index = 0;} 00029 Jet(Jet &j); 00030 Jet(Jet *j); 00031 00032 00034 void addJet(Jet& j); 00035 void addJet(Jet* j); 00036 00037 00039 int getConstituentNum(){return m_constituents.size();} 00040 constit_vect_t::iterator firstConstituent(){ return m_constituents.begin();}; 00041 constit_vect_t::iterator lastConstituent(){ return m_constituents.end();}; 00042 00043 00044 00045 // convenience methods 00046 void addConstituent(Jet* jet) {m_constituents.push_back(jet);this->add(*jet);}; 00047 void addConstituent(constit_vect_t::iterator first, constit_vect_t::iterator last); 00048 void removeConstituent(Jet* jet) {m_constituents.remove(jet);this->subtract(*jet);}; 00049 00050 void addConstituent_notMoment(Jet* jet){m_constituents.push_back(jet);} 00051 //void removeConstituent(constit_vect_t::iterator first, constit_vect_t::iterator last); 00052 00053 00054 // return position in intial collection 00055 int index() const {return m_index;} 00056 void set_index(int i){m_index= i;} 00057 00058 00060 LorentzVector hlv() {return *this;} 00061 00062 00063 //bool split_merged; // from siscone/jetclu/midpoint algorithms 00064 00065 protected : 00066 int m_index; 00067 constit_vect_t m_constituents; 00068 00069 }; 00070 00071 00072 00073 void find_jet_in_list(Jet* j); 00074 00075 // using functors is supposed to be faster... (??) 00076 class JetSorter_Et { 00077 public: 00078 bool operator()(Jet* j1, Jet* j2){ 00079 // deal with numerical uncertainty : 00080 if(fabs( j1->et() - j2->et())<0.001 ) return 0; 00081 else return j1->et() > j2->et(); 00082 //return (j1->et() > j2->et()); 00083 } 00084 }; 00085 00086 class JetSorter_Pt { 00087 public: 00088 bool operator()(Jet* j1, Jet* j2){ 00089 return (j1->pt() > j2->pt()); 00090 } 00091 }; 00092 00093 class JetSorter_Eta { 00094 public: 00095 bool operator()(Jet* j1, Jet* j2){ 00096 return (j1->eta() > j2->eta()); 00097 } 00098 }; 00099 00100 class JetSorter_E { 00101 public: 00102 bool operator()(Jet* j1, Jet* j2){ 00103 return (j1->e() > j2->e()); 00104 } 00105 }; 00106 00107 00108 00109 template<class T> 00110 inline void sort_jet_list(Jet::jet_list_t &list){ 00111 std::sort(list.begin(),list.end(), T()); 00112 } 00113 inline void sort_list_et(Jet::jet_list_t &list){ 00114 //std::sort(list.begin(),list.end(),et_compare); 00115 std::sort(list.begin(),list.end(), JetSorter_Et()); 00116 } 00117 inline void sort_list_pt(Jet::jet_list_t &list){ 00118 std::sort(list.begin(),list.end(),JetSorter_Pt()); 00119 } 00120 00121 Jet* jet_from_overlap(Jet* j1, Jet* j2); 00122 00123 } // namespace atlas 00124 00125 FASTJET_END_NAMESPACE 00126 #endif 00127 00128