CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFJetAlgorithm.h
Go to the documentation of this file.
1 #ifndef __PFJetAlgorithm__
2 #define __PFJetAlgorithm__
3 
4 #include <TLorentzVector.h>
5 #include <map>
6 #include <vector>
7 
8 
9 
10 
12 
13  public:
14 
15  class Jet {
16 
17  private:
18  const std::vector<TLorentzVector>* fAllVecs;
19 
20  TLorentzVector fMomentum;
21  std::vector<int> fVecIndexes;
22 
23  public:
24  Jet() : fAllVecs(0) {}
25  Jet( int i, const std::vector<TLorentzVector>* allvecs) : fAllVecs(allvecs) {
26  Add(i);
27  }
28  ~Jet() {}
29 
30  void Add(int i) {
31  fVecIndexes.push_back(i);
32  fMomentum += (*fAllVecs)[i];
33  }
34 
35  void Clear() { fVecIndexes.clear(); fMomentum *= 0;}
36 
37  Jet& operator+=(const Jet& other) {
38  fVecIndexes.insert( fVecIndexes.begin(), other.fVecIndexes.begin(), other.fVecIndexes.end());
39  fMomentum += other.fMomentum;
40  return *this;
41  }
42 
43  const TLorentzVector& GetMomentum() const {return fMomentum;}
44  const std::vector<int>& GetIndexes() const {return fVecIndexes;}
45 
46  friend std::ostream& operator<<(std::ostream& out, const PFJetAlgorithm::Jet& jet);
47  };
48 
49 
50  private:
51 
52  const std::vector<TLorentzVector>* fAllVecs;
53  std::vector< PFJetAlgorithm::Jet > fJets;
54  std::vector< int > fAssignedVecs;
55  std::map<double, int, std::greater<double> > fEtOrderedSeeds;
56 
57 
58  double fConeAngle;
59  double fSeedEt;
60  double fConeMerge;
61 
62 
63  public:
64 
65 
66  typedef std::map< double, PFJetAlgorithm::Jet, std::greater<double> >::iterator IJ;
67  typedef std::map<double, int, std::greater<double> >::const_iterator IV;
68 
70 
71  PFJetAlgorithm(double cone, double et, double conemerge) :
72  fConeAngle(cone),
73  fSeedEt(et),
74  fConeMerge(conemerge)
75  {}
76 
77  virtual ~PFJetAlgorithm() {}
78 
79  const std::vector< PFJetAlgorithm::Jet >&
80  FindJets( const std::vector<TLorentzVector>* vecs);
81 
82 
83  void SetConeAngle(double coneAngle) {fConeAngle = coneAngle;}
84  void SetSeedEt(double et) {fSeedEt = et;}
85  void SetConeMerge(double coneMerge) {fConeMerge = coneMerge;}
86 
87 
88  static double DeltaR(double eta1, double phi1, double eta2, double phi2);
89 
90  void Update();
91 
92  void Clear() {
93  fJets.clear();
94  fAssignedVecs.clear();
95  fEtOrderedSeeds.clear();
96  }
97 
98  void CleanUp();
99  void
101  std::greater<double> >& etjets);
102 
103  double GetConeAngle() const { return fConeAngle;}
104  const std::vector< PFJetAlgorithm::Jet >& GetJets() const { return fJets;}
105 };
106 
107 #endif
int i
Definition: DBlmapReader.cc:9
void SetConeMerge(double coneMerge)
double GetConeAngle() const
void MergeJets(std::map< double, PFJetAlgorithm::Jet, std::greater< double > > &etjets)
std::map< double, int, std::greater< double > >::const_iterator IV
Jet & operator+=(const Jet &other)
virtual ~PFJetAlgorithm()
const std::vector< PFJetAlgorithm::Jet > & FindJets(const std::vector< TLorentzVector > *vecs)
std::map< double, int, std::greater< double > > fEtOrderedSeeds
const std::vector< int > & GetIndexes() const
const std::vector< TLorentzVector > * fAllVecs
std::vector< PFJetAlgorithm::Jet > fJets
const std::vector< PFJetAlgorithm::Jet > & GetJets() const
Jet(int i, const std::vector< TLorentzVector > *allvecs)
void SetConeAngle(double coneAngle)
void SetSeedEt(double et)
std::vector< int > fAssignedVecs
friend std::ostream & operator<<(std::ostream &out, const PFJetAlgorithm::Jet &jet)
tuple out
Definition: dbtoconf.py:99
std::map< double, PFJetAlgorithm::Jet, std::greater< double > >::iterator IJ
const TLorentzVector & GetMomentum() const
PFJetAlgorithm(double cone, double et, double conemerge)
std::vector< int > fVecIndexes
TLorentzVector fMomentum
const std::vector< TLorentzVector > * fAllVecs
static double DeltaR(double eta1, double phi1, double eta2, double phi2)