CMS 3D CMS Logo

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