DESY Hbb Analysis Framework
Candidate.h
Go to the documentation of this file.
1 #ifndef Analysis_Tools_Candidate_h
2 #define Analysis_Tools_Candidate_h 1
3 
4 // -*- C++ -*-
5 //
6 // Package: Analysis/Tools
7 // Class: Candidate
8 //
16 //
17 // Original Author: Roberval Walsh Bastos Rangel
18 // Created: Mon, 20 Oct 2014 14:24:08 GMT
19 //
20 //
21 
22 // system include files
23 #include <memory>
24 #include <map>
25 #include <iostream>
26 //
27 // user include files
28 #include "TLorentzVector.h"
29 
30 //
31 // class declaration
32 //
33 
34 namespace analysis {
35  namespace tools {
36 
37  class Candidate {
38  typedef std::vector<Candidate> Candidates;
39  public:
41  Candidate();
43  Candidate(const float & pt, const float & eta, const float & phi, const float & e, const float & q);
45  Candidate(const float & px, const float & py, const float & pz);
47  Candidate(const float & px, const float & py, const float & pz, const float & q);
49  virtual ~Candidate();
50 
51  // Get
53  float px() const;
55  float py() const;
57  float pz() const;
59  float pt() const;
61  float eta() const;
63  float phi() const;
65  float e() const;
67  float m() const;
69  float mass() const;
71  int q() const;
73  TLorentzVector p4() const;
75  TVector3 p3() const;
76 
77  // Set
79  void p4 (const TLorentzVector &);
81  void px (const float &);
83  void py (const float &);
85  void pz (const float &);
87  void e (const float &);
89  void q (const float &);
90 
92  float deltaR(const Candidate & ) const;
94  float deltaPhi(const Candidate & ) const;
95 
96 
97  // made below virtual as this may be different for MET, or vertex
99  virtual bool matchTo(const std::vector<Candidate> * cands, const std::string & name, const float & deltaR = 0.5);
100  virtual bool matchTo(const std::vector<Candidate> * cands, const std::string & name, const float & delta_pT, const float & deltaR);
102  const Candidate * matched(const std::string & name);
104  const Candidate * matched(const std::string & name) const;
106  void unmatch(const std::string &);
107  protected:
108  // ----------member data ---------------------------
109 
110  //
112  float q_ ;
114  TLorentzVector p4_;
116  std::map<std::string, const Candidate * > matched_;
117 
118  private:
119  };
120  }
121 }
122 
123 #endif // Analysis_Tools_Candidate_h
TLorentzVector p4() const
returns the 4-momentum (TLorentzVector)
Definition: Candidate.cc:143
Candidate()
default constructor
Definition: Candidate.cc:18
float eta() const
returns the pseudorapidity
Definition: Candidate.cc:134
float mass() const
returns the mass
Definition: Candidate.cc:138
std::vector< Candidate > Candidates
Definition: Candidate.h:38
float m() const
returns the mass
Definition: Candidate.cc:137
float deltaPhi(const Candidate &) const
returns the deltaPhi between this and another candidate
Definition: Candidate.cc:141
float e() const
returns the energy
Definition: Candidate.cc:136
std::map< std::string, const Candidate * > matched_
map of matched candidates
Definition: Candidate.h:116
float py() const
returns the y component of the momentum
Definition: Candidate.cc:131
float px() const
returns the x component of the momentum
Definition: Candidate.cc:130
float phi() const
returns the azimuthal angle
Definition: Candidate.cc:135
float pz() const
returns the z component of the momentum
Definition: Candidate.cc:132
const Candidate * matched(const std::string &name)
returns the pointer to the matched candidate object
Definition: Candidate.cc:147
float q_
the charge
Definition: Candidate.h:112
void unmatch(const std::string &)
unmatch a matched candidate object, i.e. set it to nullptr, useful to remove possible duplicated matc...
Definition: Candidate.cc:150
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
TLorentzVector p4_
the 4-momentum
Definition: Candidate.h:114
TVector3 p3() const
returns the 4-momentum (TVector3)
Definition: Candidate.cc:144
float deltaR(const Candidate &) const
returns the deltaR between this and another candidate
Definition: Candidate.cc:140
int q() const
returns the charge
Definition: Candidate.cc:139
virtual ~Candidate()
destructor
Definition: Candidate.cc:43
virtual bool matchTo(const std::vector< Candidate > *cands, const std::string &name, const float &deltaR=0.5)
function to match this candidate to another object from a list of pointers with a name ...
Definition: Candidate.cc:51