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 
21 
24 
25 namespace egHLT {
26  class OffPho {
27  public:
28  //helper struct to store the isolations
29  struct IsolData {
30  int nrTrks;
31  float ptTrks;
32  float em;
33  float had;
34  float hltHad;
35  float hltTrks;
36  float hltEm;
37  };
38 
39  public:
40  //helper struct to store the cluster shapes
41  struct ClusShapeData {
42  float sigmaEtaEta;
45  float e1x5Over5x5;
46  float sigmaPhiPhi;
48  float r9;
49  };
50 
51  public:
52  //helper struct to store reco approximations of variables made by HLT
53  struct HLTData {
54  //const math::XYZTLorentzVector p4() const;
55  float HLTeta;
56  float HLTphi;
57  float HLTenergy;
58  };
59 
60  private:
61  const reco::Photon* pho_; //pointers to the underlying phoctron (we do not own this)
62 
66 
67  //these are bit-packed words telling me which cuts the photon fail (ie 0x0 is passed all cuts)
68  int cutCode_;
70 
71  //the idea is that these are user definable cuts mean to be idenital to the specified trigger
72  //it is probably clear to the reader that I havent decided on the most efficient way to do this
73  std::vector<std::pair<TrigCodes::TrigBitSet, int> >
74  trigCutsCutCodes_; //unsorted vector (may sort if have performance issues)
75 
76  //and these are the trigger bits stored
77  //note that the trigger bits are defined at the begining of each job
78  //and do not necessaryly map between jobs
80 
81  public:
82  OffPho(const reco::Photon& pho, const ClusShapeData& shapeData, const IsolData& isolData, const HLTData& hltData)
83  : pho_(&pho),
84  clusShapeData_(shapeData),
85  isolData_(isolData),
86  hltData_(hltData),
89  ~OffPho() = default;
90 
91  //modifiers
92  void setCutCode(int code) { cutCode_ = code; }
93  void setLooseCutCode(int code) { looseCutCode_ = code; }
94 
95  //slightly inefficient way, think I can afford it and its a lot easier to just make the sorted vector outside the class
96  void setTrigCutsCutCodes(const std::vector<std::pair<TrigCodes::TrigBitSet, int> >& trigCutsCutCodes) {
97  trigCutsCutCodes_ = trigCutsCutCodes;
98  }
100 
101  const reco::Photon* recoPho() const { return pho_; }
102 
103  //kinematic and geometric methods
104  float et() const { return pho_->et(); }
105  float pt() const { return pho_->pt(); }
106  float energy() const { return pho_->energy(); }
107  float eta() const { return pho_->eta(); }
108  float phi() const { return pho_->phi(); }
109  float etSC() const {
110  return pho_->superCluster()->position().rho() / pho_->superCluster()->position().r() * energy();
111  }
112  float etaSC() const { return pho_->superCluster()->eta(); }
113  float detEta() const { return etaSC(); }
114  float phiSC() const { return pho_->superCluster()->phi(); }
115  float zVtx() const { return pho_->vz(); }
116  const math::XYZTLorentzVector& p4() const { return pho_->p4(); }
117 
118  bool isGap() const { return pho_->isEBGap() || pho_->isEEGap() || pho_->isEBEEGap(); }
119 
120  //abreviations of overly long Photon methods, I'm sorry but if you cant figure out what hOverE() means, you shouldnt be using this class
121  float hOverE() const { return pho_->hadronicOverEm(); }
122 
123  float sigmaEtaEta() const;
124  float sigmaEtaEtaUnCorr() const { return clusShapeData_.sigmaEtaEta; }
125  float sigmaIEtaIEta() const { return clusShapeData_.sigmaIEtaIEta; }
126  float sigmaPhiPhi() const { return clusShapeData_.sigmaPhiPhi; }
127  float sigmaIPhiIPhi() const { return clusShapeData_.sigmaIPhiIPhi; }
128  float e2x5MaxOver5x5() const { return clusShapeData_.e2x5MaxOver5x5; }
129  float e1x5Over5x5() const { return clusShapeData_.e1x5Over5x5; }
130  float r9() const { return clusShapeData_.r9; }
131 
132  //isolation
133  float isolEm() const { return isolData_.em; }
134  float isolHad() const { return isolData_.had; }
135  int isolNrTrks() const { return isolData_.nrTrks; }
136  float isolPtTrks() const { return isolData_.ptTrks; }
137  float hltIsolHad() const { return isolData_.hltHad; }
138  float hltIsolTrks() const { return isolData_.hltTrks; }
139  float hltIsolEm() const { return isolData_.hltEm; }
140 
141  //hlt position - not a reco approximation, taken from triggerobject
142  //const math::XYZTLorentzVector& HLTp4()const{return hltDataPho_.p4();}
143  float hltPhi() const { return hltData_.HLTphi; }
144  float hltEta() const { return hltData_.HLTeta; }
145  float hltEnergy() const { return hltData_.HLTenergy; }
146  //Diference between HLT Et and reco SC Et
147  float DeltaE() const { return (hltEnergy() - energy()); }
148 
149  //selection cuts
150  int cutCode() const { return cutCode_; }
151  int looseCutCode() const { return looseCutCode_; }
152 
153  //trigger codes are just used as a unique identifier of the trigger, it is an error to specify more than a single bit
154  //the idea here is to allow an arbitary number of photon triggers
156 
157  //trigger
159  };
160 } // namespace egHLT
161 
162 #endif
float hltEta() const
Definition: EgHLTOffPho.h:144
float eta() const
Definition: EgHLTOffPho.h:107
void setTrigCutsCutCodes(const std::vector< std::pair< TrigCodes::TrigBitSet, int > > &trigCutsCutCodes)
Definition: EgHLTOffPho.h:96
float energy() const
Definition: EgHLTOffPho.h:106
int cutCode() const
Definition: EgHLTOffPho.h:150
float sigmaIPhiIPhi() const
Definition: EgHLTOffPho.h:127
double pt() const final
transverse momentum
double vz() const override
z coordinate of vertex position
float sigmaIEtaIEta() const
Definition: EgHLTOffPho.h:125
const math::XYZTLorentzVector & p4() const
Definition: EgHLTOffPho.h:116
ClusShapeData clusShapeData_
Definition: EgHLTOffPho.h:63
OffPho(const reco::Photon &pho, const ClusShapeData &shapeData, const IsolData &isolData, const HLTData &hltData)
Definition: EgHLTOffPho.h:82
constexpr uint32_t bits
Definition: gpuClustering.h:23
int trigCutsCutCode(const TrigCodes::TrigBitSet &trigger) const
Definition: EgHLTOffPho.cc:15
float hOverE() const
Definition: EgHLTOffPho.h:121
const reco::Photon * pho_
Definition: EgHLTOffPho.h:61
float phiSC() const
Definition: EgHLTOffPho.h:114
IsolData isolData_
Definition: EgHLTOffPho.h:64
float etaSC() const
Definition: EgHLTOffPho.h:112
TrigCodes::TrigBitSet trigBits_
Definition: EgHLTOffPho.h:79
float sigmaEtaEtaUnCorr() const
Definition: EgHLTOffPho.h:124
float phi() const
Definition: EgHLTOffPho.h:108
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
float e2x5MaxOver5x5() const
Definition: EgHLTOffPho.h:128
float sigmaEtaEta() const
Definition: EgHLTOffPho.cc:7
TrigCodes::TrigBitSet trigBits() const
Definition: EgHLTOffPho.h:158
float etSC() const
Definition: EgHLTOffPho.h:109
float e1x5Over5x5() const
Definition: EgHLTOffPho.h:129
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
int looseCutCode() const
Definition: EgHLTOffPho.h:151
int isolNrTrks() const
Definition: EgHLTOffPho.h:135
HLTData hltData_
Definition: EgHLTOffPho.h:65
float sigmaPhiPhi() const
Definition: EgHLTOffPho.h:126
float hltEnergy() const
Definition: EgHLTOffPho.h:145
float isolHad() const
Definition: EgHLTOffPho.h:134
void setTrigBits(TrigCodes::TrigBitSet bits)
Definition: EgHLTOffPho.h:99
float r9() const
Definition: EgHLTOffPho.h:130
void setLooseCutCode(int code)
Definition: EgHLTOffPho.h:93
bool isEEGap() const
true if photon is in EE, and inside the boundaries in supercrystal/D
Definition: Photon.h:131
float hltIsolEm() const
Definition: EgHLTOffPho.h:139
float hadronicOverEm(int depth=0) const
Definition: Photon.h:236
float hltPhi() const
Definition: EgHLTOffPho.h:143
void setCutCode(int code)
Definition: EgHLTOffPho.h:92
float isolPtTrks() const
Definition: EgHLTOffPho.h:136
float zVtx() const
Definition: EgHLTOffPho.h:115
const reco::Photon * recoPho() const
Definition: EgHLTOffPho.h:101
float pt() const
Definition: EgHLTOffPho.h:105
bool isEBGap() const
true if photon is in EB, and inside the boundaries in super crystals/modules
Definition: Photon.h:127
float isolEm() const
Definition: EgHLTOffPho.h:133
bool isGap() const
Definition: EgHLTOffPho.h:118
double et() const final
transverse energy
float et() const
Definition: EgHLTOffPho.h:104
const LorentzVector & p4(P4type type) const
std::vector< std::pair< TrigCodes::TrigBitSet, int > > trigCutsCutCodes_
Definition: EgHLTOffPho.h:74
float hltIsolHad() const
Definition: EgHLTOffPho.h:137
~OffPho()=default
float hltIsolTrks() const
Definition: EgHLTOffPho.h:138
double phi() const final
momentum azimuthal angle
std::bitset< maxNrBits_ > TrigBitSet
bool isEBEEGap() const
true if photon is in boundary between EB and EE
Definition: Photon.h:135
float detEta() const
Definition: EgHLTOffPho.h:113
double energy() const final
energy
double eta() const final
momentum pseudorapidity
float DeltaE() const
Definition: EgHLTOffPho.h:147