CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TriggerObject.h
Go to the documentation of this file.
1 #ifndef HLTReco_TriggerObject_h
2 #define HLTReco_TriggerObject_h
3 
17 #include <cmath>
18 #include <vector>
19 
20 namespace trigger
21 {
22 
24  class TriggerObject {
25 
27  private:
29  int id_;
31  float pt_, eta_, phi_, mass_;
32 
34  public:
36  TriggerObject(): id_(), pt_(), eta_(), phi_(), mass_() { }
37  TriggerObject(int id, float pt, float eta, float phi, float mass):
38  id_(id), pt_(pt), eta_(eta), phi_(phi), mass_(mass) { }
39 
41  template <typename T>
42  TriggerObject(int id, const T& o):
43  id_(id), pt_(o.pt()), eta_(o.eta()), phi_(o.phi()), mass_(o.mass()) { }
45  template <typename T>
46  TriggerObject(const T& o):
47  id_(o.pdgId()), pt_(o.pt()), eta_(o.eta()), phi_(o.phi()), mass_(o.mass()) { }
48 
50  void setId (int id) {id_ =id;}
51  void setPt (float pt) {pt_ =pt;}
52  void setEta (float eta) {eta_ =eta;}
53  void setPhi (float phi) {phi_ =phi;}
54  void setMass(float mass) {mass_=mass;}
55 
57  int id() const {return id_;}
58  float pt() const {return pt_;}
59  float eta() const {return eta_;}
60  float phi() const {return phi_;}
61  float mass() const {return mass_;}
62 
63  float px() const {return pt_*std::cos(phi_);}
64  float py() const {return pt_*std::sin(phi_);}
65  float pz() const {return pt_*std::sinh(eta_);}
66  float p () const {return pt_*std::cosh(eta_);}
67  float energy() const {return std::sqrt(std::pow(mass_,2)+std::pow(p(),2));}
68  // et = energy/cosh(eta)
69  float et() const {return std::sqrt(std::pow(mass_/std::cosh(eta_),2)+std::pow(pt_,2));}
70 
72  const reco::Particle::Point & vertex = reco::Particle::Point(0,0,0),
73  int status=0, bool integerCharge=true) const {
74  return reco::Particle(q,
76  vertex,id(),status,integerCharge);
77  }
78 
79  };
80 
81 
83  typedef std::vector<TriggerObject> TriggerObjectCollection;
84 
85 }
86 
87 #endif
int id() const
getters
Definition: TriggerObject.h:57
float phi() const
Definition: TriggerObject.h:60
void setPt(float pt)
Definition: TriggerObject.h:51
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::Particle particle(reco::Particle::Charge q=0, const reco::Particle::Point &vertex=reco::Particle::Point(0, 0, 0), int status=0, bool integerCharge=true) const
Definition: TriggerObject.h:71
float energy() const
Definition: TriggerObject.h:67
int Charge
electric charge type
Definition: Particle.h:23
float eta() const
Definition: TriggerObject.h:59
void setEta(float eta)
Definition: TriggerObject.h:52
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:24
void setId(int id)
setters
Definition: TriggerObject.h:50
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
math::XYZPoint Point
point in the space
Definition: Particle.h:29
void setPhi(float phi)
Definition: TriggerObject.h:53
void setMass(float mass)
Definition: TriggerObject.h:54
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:83
TriggerObject(int id, float pt, float eta, float phi, float mass)
Definition: TriggerObject.h:37
TriggerObject(const T &o)
... and pdgId()
Definition: TriggerObject.h:46
int id_
data members - similar to DataFormats/Candidate/interface/Particle.h
Definition: TriggerObject.h:29
float mass() const
Definition: TriggerObject.h:61
tuple status
Definition: ntuplemaker.py:245
long double T
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25
TriggerObject(int id, const T &o)
any type T object implementing the methods pt(), eta(), phi(), mass()
Definition: TriggerObject.h:42
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
float pt_
4-momentum of physics object
Definition: TriggerObject.h:31