CMS 3D CMS Logo

EgHLTOffPho.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_EGHLTOFFPHO
2 #define DQMOFFLINE_TRIGGER_EGHLTOFFPHO
3 
4 //class: EgHLTOffPho
5 //
6 //author: Sam Harper (July 2008)
7 //
8 //
9 //aim: to allow easy access to phoctron ID variables
10 // currently the CMSSW photon classes are a mess with key photon variables not being accessable from Photon
11 // this a stop gap to produce a simple photon class with all variables easily accessable via methods
12 // note as this is meant for HLT Offline DQM, I do not want the overhead of converting to pat
13 //
14 //implimentation: aims to be a wrapper for Photon methods, it is hoped that in time these methods will be directly added to Photon and so
15 // make this class obsolute
16 // unfortunately can not be a pure wrapper as needs to store isol and cluster shape
17 //
18 
19 
22 
25 
26 namespace egHLT {
27  class OffPho {
28 
29  public:
30  //helper struct to store the isolations
31  struct IsolData {
32  int nrTrks;
33  float ptTrks;
34  float em;
35  float had;
36  float hltHad;
37  float hltTrks;
38  float hltEm;
39  };
40 
41  public:
42  //helper struct to store the cluster shapes
43  struct ClusShapeData {
44  float sigmaEtaEta;
47  float e1x5Over5x5;
48  float sigmaPhiPhi;
50  float r9;
51  };
52 
53 public:
54  //helper struct to store reco approximations of variables made by HLT
55  struct HLTData {
56  //const math::XYZTLorentzVector p4() const;
57  float HLTeta;
58  float HLTphi;
59  float HLTenergy;
60  };
61 
62 
63  private:
64  const reco::Photon* pho_; //pointers to the underlying phoctron (we do not own this)
65 
69 
70  //these are bit-packed words telling me which cuts the photon fail (ie 0x0 is passed all cuts)
71  int cutCode_;
73 
74  //the idea is that these are user definable cuts mean to be idenital to the specified trigger
75  //it is probably clear to the reader that I havent decided on the most efficient way to do this
76  std::vector<std::pair<TrigCodes::TrigBitSet,int> > trigCutsCutCodes_; //unsorted vector (may sort if have performance issues)
77 
78  //and these are the trigger bits stored
79  //note that the trigger bits are defined at the begining of each job
80  //and do not necessaryly map between jobs
82 
83  public:
84 
85  OffPho(const reco::Photon& pho,const ClusShapeData& shapeData,const IsolData& isolData,const HLTData& hltData):
86  pho_(&pho),clusShapeData_(shapeData),isolData_(isolData),hltData_(hltData),
87  cutCode_(int(EgCutCodes::INVALID)),looseCutCode_(int(EgCutCodes::INVALID)){}
88  ~OffPho()= default;
89 
90  //modifiers
91  void setCutCode(int code){cutCode_=code;}
92  void setLooseCutCode(int code){looseCutCode_=code;}
93 
94  //slightly inefficient way, think I can afford it and its a lot easier to just make the sorted vector outside the class
95  void setTrigCutsCutCodes(const std::vector<std::pair<TrigCodes::TrigBitSet,int> >& trigCutsCutCodes){trigCutsCutCodes_=trigCutsCutCodes;}
97 
98  const reco::Photon* recoPho()const{return pho_;}
99 
100  //kinematic and geometric methods
101  float et()const{return pho_->et();}
102  float pt()const{return pho_->pt();}
103  float energy()const{return pho_->energy();}
104  float eta()const{return pho_->eta();}
105  float phi()const{return pho_->phi();}
106  float etSC()const{return pho_->superCluster()->position().rho()/pho_->superCluster()->position().r()*energy();}
107  float etaSC()const{return pho_->superCluster()->eta();}
108  float detEta()const{return etaSC();}
109  float phiSC()const{return pho_->superCluster()->phi();}
110  float zVtx()const{return pho_->vz();}
111  const math::XYZTLorentzVector& p4()const{return pho_->p4();}
112 
113  bool isGap()const{return pho_->isEBGap() || pho_->isEEGap() || pho_->isEBEEGap();}
114 
115  //abreviations of overly long Photon methods, I'm sorry but if you cant figure out what hOverE() means, you shouldnt be using this class
116  float hOverE()const{return pho_->hadronicOverEm();}
117 
118 
119 
120  float sigmaEtaEta()const;
121  float sigmaEtaEtaUnCorr()const{return clusShapeData_.sigmaEtaEta;}
122  float sigmaIEtaIEta()const{return clusShapeData_.sigmaIEtaIEta;}
123  float sigmaPhiPhi()const{return clusShapeData_.sigmaPhiPhi;}
124  float sigmaIPhiIPhi()const{return clusShapeData_.sigmaIPhiIPhi;}
125  float e2x5MaxOver5x5()const{return clusShapeData_.e2x5MaxOver5x5;}
126  float e1x5Over5x5()const{return clusShapeData_.e1x5Over5x5;}
127  float r9()const{return clusShapeData_.r9;}
128 
129  //isolation
130  float isolEm()const{return isolData_.em;}
131  float isolHad()const{return isolData_.had;}
132  int isolNrTrks()const{return isolData_.nrTrks;}
133  float isolPtTrks()const{return isolData_.ptTrks;}
134  float hltIsolHad()const{return isolData_.hltHad;}
135  float hltIsolTrks()const{return isolData_.hltTrks;}
136  float hltIsolEm()const{return isolData_.hltEm;}
137 
138  //hlt position - not a reco approximation, taken from triggerobject
139  //const math::XYZTLorentzVector& HLTp4()const{return hltDataPho_.p4();}
140  float hltPhi()const{return hltData_.HLTphi;}
141  float hltEta()const{return hltData_.HLTeta;}
142  float hltEnergy()const{return hltData_.HLTenergy;}
143  //Diference between HLT Et and reco SC Et
144  float DeltaE()const{return (hltEnergy() - energy());}
145 
146  //selection cuts
147  int cutCode()const{return cutCode_;}
148  int looseCutCode()const{return looseCutCode_;}
149 
150  //trigger codes are just used as a unique identifier of the trigger, it is an error to specify more than a single bit
151  //the idea here is to allow an arbitary number of photon triggers
153 
154  //trigger
156 
157  };
158 }
159 
160 #endif
float hltIsolTrks() const
Definition: EgHLTOffPho.h:135
float e1x5Over5x5() const
Definition: EgHLTOffPho.h:126
void setTrigCutsCutCodes(const std::vector< std::pair< TrigCodes::TrigBitSet, int > > &trigCutsCutCodes)
Definition: EgHLTOffPho.h:95
float sigmaIPhiIPhi() const
Definition: EgHLTOffPho.h:124
double eta() const final
momentum pseudorapidity
bool isEBGap() const
true if photon is in EB, and inside the boundaries in super crystals/modules
Definition: Photon.h:125
std::vector< std::pair< TrigCodes::TrigBitSet, int > > trigCutsCutCodes_
Definition: EgHLTOffPho.h:76
ClusShapeData clusShapeData_
Definition: EgHLTOffPho.h:66
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
float et() const
Definition: EgHLTOffPho.h:101
float isolHad() const
Definition: EgHLTOffPho.h:131
OffPho(const reco::Photon &pho, const ClusShapeData &shapeData, const IsolData &isolData, const HLTData &hltData)
Definition: EgHLTOffPho.h:85
float isolPtTrks() const
Definition: EgHLTOffPho.h:133
float sigmaEtaEtaUnCorr() const
Definition: EgHLTOffPho.h:121
bool isEBEEGap() const
true if photon is in boundary between EB and EE
Definition: Photon.h:133
float DeltaE() const
Definition: EgHLTOffPho.h:144
double pt() const final
transverse momentum
float hltEta() const
Definition: EgHLTOffPho.h:141
int trigCutsCutCode(const TrigCodes::TrigBitSet &trigger) const
Definition: EgHLTOffPho.cc:16
static constexpr TimeType INVALID
Definition: Time.h:33
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
const reco::Photon * pho_
Definition: EgHLTOffPho.h:64
float phiSC() const
Definition: EgHLTOffPho.h:109
IsolData isolData_
Definition: EgHLTOffPho.h:67
float energy() const
Definition: EgHLTOffPho.h:103
float eta() const
Definition: EgHLTOffPho.h:104
TrigCodes::TrigBitSet trigBits_
Definition: EgHLTOffPho.h:81
int looseCutCode() const
Definition: EgHLTOffPho.h:148
float etaSC() const
Definition: EgHLTOffPho.h:107
TrigCodes::TrigBitSet trigBits() const
Definition: EgHLTOffPho.h:155
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
float detEta() const
Definition: EgHLTOffPho.h:108
const reco::Photon * recoPho() const
Definition: EgHLTOffPho.h:98
float hOverE() const
Definition: EgHLTOffPho.h:116
double et() const final
transverse energy
HLTData hltData_
Definition: EgHLTOffPho.h:68
float sigmaEtaEta() const
Definition: EgHLTOffPho.cc:7
float pt() const
Definition: EgHLTOffPho.h:102
void setTrigBits(TrigCodes::TrigBitSet bits)
Definition: EgHLTOffPho.h:96
float r9() const
Definition: EgHLTOffPho.h:127
double energy() const final
energy
void setLooseCutCode(int code)
Definition: EgHLTOffPho.h:92
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
Definition: Photon.h:212
float e2x5MaxOver5x5() const
Definition: EgHLTOffPho.h:125
float hltIsolHad() const
Definition: EgHLTOffPho.h:134
bool isGap() const
Definition: EgHLTOffPho.h:113
float hltPhi() const
Definition: EgHLTOffPho.h:140
float zVtx() const
Definition: EgHLTOffPho.h:110
double vz() const override
z coordinate of vertex position
bool isEEGap() const
true if photon is in EE, and inside the boundaries in supercrystal/D
Definition: Photon.h:129
void setCutCode(int code)
Definition: EgHLTOffPho.h:91
float etSC() const
Definition: EgHLTOffPho.h:106
float sigmaIEtaIEta() const
Definition: EgHLTOffPho.h:122
const LorentzVector & p4(P4type type) const
float phi() const
Definition: EgHLTOffPho.h:105
float sigmaPhiPhi() const
Definition: EgHLTOffPho.h:123
int isolNrTrks() const
Definition: EgHLTOffPho.h:132
int cutCode() const
Definition: EgHLTOffPho.h:147
~OffPho()=default
const math::XYZTLorentzVector & p4() const
Definition: EgHLTOffPho.h:111
double phi() const final
momentum azimuthal angle
std::bitset< maxNrBits_ > TrigBitSet
float hltIsolEm() const
Definition: EgHLTOffPho.h:136
float isolEm() const
Definition: EgHLTOffPho.h:130
float hltEnergy() const
Definition: EgHLTOffPho.h:142