FastJet 3.0.4
Jet.hh
00001 #ifndef _JET_HH_
00002 #define _JET_HH_
00003 
00004 //----------------------------------------------------------------------
00005 // This file distributed with FastJet has been obtained from SpartyJet
00006 // v2.20.0 by Pierre-Antoine Delsart, Kurtis L. Geerlings, Joey
00007 // Huston, Brian T. Martin and Chris Vermilion
00008 // For details, see http://www.pa.msu.edu/~huston/SpartyJet/
00009 //                  http://projects.hepforge.org/spartyjet/
00010 //
00011 // Changes from the original file are listed below.
00012 //----------------------------------------------------------------------
00013 
00014 // History of changes from the original Jet.hh file in SpartyJet v2.20
00015 //  
00016 // 2011-11-14  Gregory Soyez  <soyez@fastjet.fr>
00017 // 
00018 //        * removed some harmless warnings coming with the -Wshadow gcc option
00019 // 
00020 // 2011-06-28  Gregory Soyez  <soyez@fastjet.fr>
00021 // 
00022 //        * used stable_sort instead of sort to fix some ordering issues
00023 // 
00024 // 2009-01-15  Gregory Soyez  <soyez@fastjet.fr>
00025 // 
00026 //        * put the code in the fastjet::atlas namespace
00027 
00028 #include "LorentzVector.hh"
00029 #include <list>
00030 #include <vector>
00031 #include <algorithm>
00032 
00033 #include <fastjet/internal/base.hh>
00034 
00035 FASTJET_BEGIN_NAMESPACE
00036 
00037 namespace atlas { 
00038 
00039 class Jet : public LorentzVector {
00040 public :
00041   
00042   typedef std::list<Jet*> constit_vect_t;
00043   typedef std::vector<Jet*> jet_list_t;
00044   
00045   Jet(): LorentzVector(0,0,0,0) {}
00046   Jet(double p1, double p2, double p3, double p0, int index_in=0): LorentzVector(p1,p2,p3,p0), m_index(index_in){}
00047   Jet(LorentzVector v): LorentzVector(v)  {m_index = 0;}
00048   Jet(Jet &j);
00049   Jet(Jet *j);
00050   
00051   
00052   /// The standard way of merging jets
00053   void addJet(Jet& j);
00054   void addJet(Jet* j);
00055 
00056  
00057   /// Access jet constituents
00058   int getConstituentNum(){return m_constituents.size();}
00059   constit_vect_t::iterator firstConstituent(){ return m_constituents.begin();};
00060   constit_vect_t::iterator lastConstituent(){ return m_constituents.end();};
00061 
00062   
00063 
00064   // convenience methods 
00065   void addConstituent(Jet* jet) {m_constituents.push_back(jet);this->add(*jet);};
00066   void addConstituent(constit_vect_t::iterator first, constit_vect_t::iterator last);
00067   void removeConstituent(Jet* jet) {m_constituents.remove(jet);this->subtract(*jet);};
00068 
00069   void addConstituent_notMoment(Jet* jet){m_constituents.push_back(jet);}
00070   //void removeConstituent(constit_vect_t::iterator first, constit_vect_t::iterator last);
00071 
00072 
00073   // return position in intial collection
00074   int index() const {return m_index;}  
00075   void set_index(int i){m_index= i;}
00076 
00077 
00078   /// Atlas compatibility code :
00079   LorentzVector hlv() {return *this;}
00080 
00081 
00082   //bool split_merged;   // from siscone/jetclu/midpoint algorithms
00083 
00084 protected :
00085   int m_index;  /// position in a jet list (used for constituents positions)
00086   constit_vect_t m_constituents;
00087 
00088 };
00089 
00090 
00091  
00092 void find_jet_in_list(Jet* j);
00093 
00094 // using functors is supposed to be faster... (??)
00095 class JetSorter_Et {
00096 public:
00097   bool operator()(Jet* j1, Jet* j2){
00098     // deal with numerical uncertainty : 
00099     if(fabs( j1->et() - j2->et())<0.001 ) return 0;
00100     else return j1->et() > j2->et();
00101     //return (j1->et() > j2->et());    
00102   }
00103 };
00104 
00105 class JetSorter_Pt {
00106 public:
00107   bool operator()(Jet* j1, Jet* j2){
00108     return (j1->pt() > j2->pt());
00109   }
00110 };
00111 
00112 class JetSorter_Eta {
00113 public:
00114   bool operator()(Jet* j1, Jet* j2){
00115     return (j1->eta() > j2->eta());
00116   }
00117 };
00118 
00119 class JetSorter_E {
00120 public:
00121   bool operator()(Jet* j1, Jet* j2){
00122     return (j1->e() > j2->e());
00123   }
00124 };
00125 
00126 
00127 
00128 template<class T>
00129 inline void sort_jet_list(Jet::jet_list_t &list){
00130   std::stable_sort(list.begin(),list.end(), T());
00131 }
00132 inline void sort_list_et(Jet::jet_list_t &list){
00133   //std::sort(list.begin(),list.end(),et_compare);
00134   std::stable_sort(list.begin(),list.end(), JetSorter_Et());
00135 }
00136 inline void sort_list_pt(Jet::jet_list_t &list){
00137   std::stable_sort(list.begin(),list.end(),JetSorter_Pt());
00138 }
00139 
00140 Jet* jet_from_overlap(Jet* j1, Jet* j2);
00141 
00142 }  // namespace atlas
00143 
00144 FASTJET_END_NAMESPACE
00145 #endif
00146 
00147 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends