CMS 3D CMS Logo

PFJetAlgorithm.h

Go to the documentation of this file.
00001 #ifndef __PFJetAlgorithm__
00002 #define __PFJetAlgorithm__
00003 
00004 #include <TLorentzVector.h>
00005 #include <map>
00006 #include <vector>
00007 
00008 
00009 
00010 
00011 class PFJetAlgorithm {
00012 
00013  public:
00014 
00015   class Jet {
00016     
00017   private:
00018     const std::vector<TLorentzVector>*              fAllVecs;
00019     
00020     TLorentzVector  fMomentum;
00021     std::vector<int>    fVecIndexes;
00022 
00023   public:
00024     Jet() : fAllVecs(0) {}
00025     Jet( int i, const std::vector<TLorentzVector>* allvecs) : fAllVecs(allvecs) {
00026       Add(i);
00027     }
00028     ~Jet() {}
00029     
00030     void Add(int i) {
00031       fVecIndexes.push_back(i);      
00032       fMomentum += (*fAllVecs)[i];
00033     }
00034 
00035     void Clear() { fVecIndexes.clear(); fMomentum *= 0;} 
00036 
00037     Jet& operator+=(const Jet& other) {
00038       fVecIndexes.insert( fVecIndexes.begin(), other.fVecIndexes.begin(), other.fVecIndexes.end());
00039       fMomentum += other.fMomentum;
00040       return *this;
00041     }
00042 
00043     const TLorentzVector& GetMomentum() const {return fMomentum;}
00044     const std::vector<int>&    GetIndexes() const {return fVecIndexes;}
00045 
00046     friend ostream& operator<<(ostream& out, const PFJetAlgorithm::Jet& jet);
00047   };
00048 
00049 
00050  private:
00051 
00052   const std::vector<TLorentzVector>*              fAllVecs;
00053   std::vector< PFJetAlgorithm::Jet >              fJets;
00054   std::vector< int >                              fAssignedVecs; 
00055   std::map<double,  int, std::greater<double> >   fEtOrderedSeeds;
00056   
00057 
00058   double                                    fConeAngle;
00059   double                                    fSeedEt;
00060   double                                    fConeMerge;
00061 
00062 
00063  public:
00064 
00065 
00066   typedef std::map< double, PFJetAlgorithm::Jet, std::greater<double> >::iterator IJ;
00067   typedef  std::map<double, int, std::greater<double> >::const_iterator IV;
00068 
00069   PFJetAlgorithm() : fConeAngle(0.5), fSeedEt(2),  fConeMerge(0.5) {}
00070 
00071   PFJetAlgorithm(double cone, double et, double conemerge) : 
00072     fConeAngle(cone), 
00073     fSeedEt(et),
00074     fConeMerge(conemerge)
00075     {}
00076 
00077   virtual ~PFJetAlgorithm() {}
00078 
00079   const std::vector< PFJetAlgorithm::Jet >& 
00080     FindJets( const std::vector<TLorentzVector>* vecs);
00081 
00082 
00083   void SetConeAngle(double coneAngle) {fConeAngle = coneAngle;}
00084   void SetSeedEt(double et) {fSeedEt = et;}
00085   void SetConeMerge(double coneMerge) {fConeMerge = coneMerge;}
00086 
00087 
00088   static double DeltaR(double eta1, double phi1, double eta2, double phi2);
00089 
00090   void Update();
00091   
00092   void Clear() { 
00093     fJets.clear(); 
00094     fAssignedVecs.clear(); 
00095     fEtOrderedSeeds.clear();
00096   } 
00097 
00098   void CleanUp();
00099   void 
00100     MergeJets(std::map< double, PFJetAlgorithm::Jet, 
00101               std::greater<double> >& etjets);
00102 
00103   double GetConeAngle() const { return fConeAngle;}
00104   const std::vector< PFJetAlgorithm::Jet >& GetJets() const { return fJets;}
00105 };
00106 
00107 #endif

Generated on Tue Jun 9 17:44:45 2009 for CMSSW by  doxygen 1.5.4