Go to the documentation of this file.00001 #ifndef HLTReco_TriggerObject_h
00002 #define HLTReco_TriggerObject_h
00003
00016 #include "DataFormats/Candidate/interface/Particle.h"
00017 #include <cmath>
00018 #include <vector>
00019
00020 namespace trigger
00021 {
00022
00024 class TriggerObject {
00025
00027 private:
00029 int id_;
00031 float pt_, eta_, phi_, mass_;
00032
00034 public:
00036 TriggerObject(): id_(), pt_(), eta_(), phi_(), mass_() { }
00037 TriggerObject(int id, float pt, float eta, float phi, float mass):
00038 id_(id), pt_(pt), eta_(eta), phi_(phi), mass_(mass) { }
00039
00041 template <typename T>
00042 TriggerObject(int id, const T& o):
00043 id_(id), pt_(o.pt()), eta_(o.eta()), phi_(o.phi()), mass_(o.mass()) { }
00045 template <typename T>
00046 TriggerObject(const T& o):
00047 id_(o.pdgId()), pt_(o.pt()), eta_(o.eta()), phi_(o.phi()), mass_(o.mass()) { }
00048
00050 void setId (int id) {id_ =id;}
00051 void setPt (float pt) {pt_ =pt;}
00052 void setEta (float eta) {eta_ =eta;}
00053 void setPhi (float phi) {phi_ =phi;}
00054 void setMass(float mass) {mass_=mass;}
00055
00057 int id() const {return id_;}
00058 float pt() const {return pt_;}
00059 float eta() const {return eta_;}
00060 float phi() const {return phi_;}
00061 float mass() const {return mass_;}
00062
00063 float px() const {return pt_*std::cos(phi_);}
00064 float py() const {return pt_*std::sin(phi_);}
00065 float pz() const {return pt_*std::sinh(eta_);}
00066 float p () const {return pt_*std::cosh(eta_);}
00067 float energy() const {return std::sqrt(std::pow(mass_,2)+std::pow(p(),2));}
00068
00069 float et() const {return std::sqrt(std::pow(mass_/std::cosh(eta_),2)+std::pow(pt_,2));}
00070
00071 reco::Particle particle(reco::Particle::Charge q=0,
00072 const reco::Particle::Point & vertex = reco::Particle::Point(0,0,0),
00073 int status=0, bool integerCharge=true) const {
00074 return reco::Particle(q,
00075 reco::Particle::LorentzVector(px(),py(),pz(),energy()),
00076 vertex,id(),status,integerCharge);
00077 }
00078
00079 };
00080
00081
00083 typedef std::vector<TriggerObject> TriggerObjectCollection;
00084
00085 }
00086
00087 #endif