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
egHLT::OffPho::e2x5MaxOver5x5
float e2x5MaxOver5x5() const
Definition: EgHLTOffPho.h:128
reco::Photon::hadronicOverEm
float hadronicOverEm(int depth=0) const
Definition: Photon.h:233
egHLT::OffPho::sigmaEtaEta
float sigmaEtaEta() const
Definition: EgHLTOffPho.cc:7
egHLT::OffPho::cutCode
int cutCode() const
Definition: EgHLTOffPho.h:150
egHLT::OffPho::isGap
bool isGap() const
Definition: EgHLTOffPho.h:118
egHLT::OffPho::IsolData::nrTrks
int nrTrks
Definition: EgHLTOffPho.h:30
egHLT::OffPho::IsolData
Definition: EgHLTOffPho.h:29
reco::Photon::superCluster
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
egHLT::OffPho::energy
float energy() const
Definition: EgHLTOffPho.h:106
egHLT::OffPho::sigmaEtaEtaUnCorr
float sigmaEtaEtaUnCorr() const
Definition: EgHLTOffPho.h:124
egHLT::EgCutCodes
Definition: EgHLTEgCutCodes.h:12
egHLT::OffPho::hltIsolEm
float hltIsolEm() const
Definition: EgHLTOffPho.h:139
egHLT::OffPho::r9
float r9() const
Definition: EgHLTOffPho.h:130
egHLT::OffPho::ClusShapeData::sigmaPhiPhi
float sigmaPhiPhi
Definition: EgHLTOffPho.h:46
egHLT::OffPho::DeltaE
float DeltaE() const
Definition: EgHLTOffPho.h:147
reco::Photon::p4
const LorentzVector & p4(P4type type) const
egHLT::OffPho::IsolData::hltHad
float hltHad
Definition: EgHLTOffPho.h:34
reco::LeafCandidate::vz
double vz() const override
z coordinate of vertex position
Definition: LeafCandidate.h:171
egHLT::OffPho::trigCutsCutCode
int trigCutsCutCode(const TrigCodes::TrigBitSet &trigger) const
Definition: EgHLTOffPho.cc:15
egHLT::OffPho::ClusShapeData
Definition: EgHLTOffPho.h:41
PhotonFwd.h
egHLT::OffPho::trigCutsCutCodes_
std::vector< std::pair< TrigCodes::TrigBitSet, int > > trigCutsCutCodes_
Definition: EgHLTOffPho.h:74
egHLT::OffPho::zVtx
float zVtx() const
Definition: EgHLTOffPho.h:115
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
egHLT::OffPho::etaSC
float etaSC() const
Definition: EgHLTOffPho.h:112
egHLT::OffPho::ClusShapeData::sigmaIEtaIEta
float sigmaIEtaIEta
Definition: EgHLTOffPho.h:43
egHLT::OffPho::sigmaIPhiIPhi
float sigmaIPhiIPhi() const
Definition: EgHLTOffPho.h:127
egHLT::OffPho::isolData_
IsolData isolData_
Definition: EgHLTOffPho.h:64
egHLT::OffPho::trigBits
TrigCodes::TrigBitSet trigBits() const
Definition: EgHLTOffPho.h:158
egHLT::OffPho::p4
const math::XYZTLorentzVector & p4() const
Definition: EgHLTOffPho.h:116
egHLT::OffPho::isolHad
float isolHad() const
Definition: EgHLTOffPho.h:134
egHLT::OffPho::HLTData::HLTeta
float HLTeta
Definition: EgHLTOffPho.h:55
egHLT::OffPho::trigBits_
TrigCodes::TrigBitSet trigBits_
Definition: EgHLTOffPho.h:79
egHLT::OffPho::ClusShapeData::e1x5Over5x5
float e1x5Over5x5
Definition: EgHLTOffPho.h:45
Photon.h
egHLT::OffPho
Definition: EgHLTOffPho.h:26
egHLT::OffPho::isolNrTrks
int isolNrTrks() const
Definition: EgHLTOffPho.h:135
egHLT::TrigCodes::TrigBitSet
std::bitset< maxNrBits_ > TrigBitSet
Definition: EgHLTTrigCodes.h:23
egHLT::OffPho::setCutCode
void setCutCode(int code)
Definition: EgHLTOffPho.h:92
egHLT::OffPho::cutCode_
int cutCode_
Definition: EgHLTOffPho.h:68
cond::time::INVALID
static constexpr TimeType INVALID
Definition: Time.h:33
egHLT::OffPho::IsolData::hltEm
float hltEm
Definition: EgHLTOffPho.h:36
egHLT::OffPho::setTrigBits
void setTrigBits(TrigCodes::TrigBitSet bits)
Definition: EgHLTOffPho.h:99
egHLT::OffPho::hltPhi
float hltPhi() const
Definition: EgHLTOffPho.h:143
egHLT::OffPho::hOverE
float hOverE() const
Definition: EgHLTOffPho.h:121
egHLT::OffPho::setTrigCutsCutCodes
void setTrigCutsCutCodes(const std::vector< std::pair< TrigCodes::TrigBitSet, int > > &trigCutsCutCodes)
Definition: EgHLTOffPho.h:96
egHLT::OffPho::sigmaPhiPhi
float sigmaPhiPhi() const
Definition: EgHLTOffPho.h:126
egHLT::OffPho::pt
float pt() const
Definition: EgHLTOffPho.h:105
egHLT::OffPho::recoPho
const reco::Photon * recoPho() const
Definition: EgHLTOffPho.h:101
egHLT::OffPho::IsolData::had
float had
Definition: EgHLTOffPho.h:33
egHLT::OffPho::clusShapeData_
ClusShapeData clusShapeData_
Definition: EgHLTOffPho.h:63
egHLT::OffPho::hltEnergy
float hltEnergy() const
Definition: EgHLTOffPho.h:145
egHLT::OffPho::hltIsolHad
float hltIsolHad() const
Definition: EgHLTOffPho.h:137
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
egHLT::OffPho::phiSC
float phiSC() const
Definition: EgHLTOffPho.h:114
egHLT::OffPho::etSC
float etSC() const
Definition: EgHLTOffPho.h:109
createfilelist.int
int
Definition: createfilelist.py:10
reco::Photon::isEEGap
bool isEEGap() const
true if photon is in EE, and inside the boundaries in supercrystal/D
Definition: Photon.h:128
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
egHLT::OffPho::ClusShapeData::sigmaIPhiIPhi
float sigmaIPhiIPhi
Definition: EgHLTOffPho.h:47
egHLT::OffPho::HLTData
Definition: EgHLTOffPho.h:53
egHLT::OffPho::looseCutCode
int looseCutCode() const
Definition: EgHLTOffPho.h:151
egHLT::OffPho::isolEm
float isolEm() const
Definition: EgHLTOffPho.h:133
egHLT::OffPho::HLTData::HLTenergy
float HLTenergy
Definition: EgHLTOffPho.h:57
reco::Photon
Definition: Photon.h:22
egHLT::OffPho::IsolData::em
float em
Definition: EgHLTOffPho.h:32
reco::LeafCandidate::et
double et() const final
transverse energy
Definition: LeafCandidate.h:127
egHLT::OffPho::phi
float phi() const
Definition: EgHLTOffPho.h:108
egHLT::OffPho::pho_
const reco::Photon * pho_
Definition: EgHLTOffPho.h:61
egHLT::OffPho::hltEta
float hltEta() const
Definition: EgHLTOffPho.h:144
egHLT::OffPho::eta
float eta() const
Definition: EgHLTOffPho.h:107
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
egHLT::OffPho::e1x5Over5x5
float e1x5Over5x5() const
Definition: EgHLTOffPho.h:129
egHLT::OffPho::ClusShapeData::sigmaEtaEta
float sigmaEtaEta
Definition: EgHLTOffPho.h:42
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
egHLT::OffPho::IsolData::hltTrks
float hltTrks
Definition: EgHLTOffPho.h:35
egHLT::OffPho::detEta
float detEta() const
Definition: EgHLTOffPho.h:113
egHLT::OffPho::OffPho
OffPho(const reco::Photon &pho, const ClusShapeData &shapeData, const IsolData &isolData, const HLTData &hltData)
Definition: EgHLTOffPho.h:82
egHLT::OffPho::hltData_
HLTData hltData_
Definition: EgHLTOffPho.h:65
egHLT::OffPho::isolPtTrks
float isolPtTrks() const
Definition: EgHLTOffPho.h:136
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
egHLT::OffPho::et
float et() const
Definition: EgHLTOffPho.h:104
trigger
Definition: HLTPrescaleTableCond.h:8
EgHLTEgCutCodes.h
egHLT::OffPho::sigmaIEtaIEta
float sigmaIEtaIEta() const
Definition: EgHLTOffPho.h:125
EgHLTTrigCodes.h
egHLT::OffPho::IsolData::ptTrks
float ptTrks
Definition: EgHLTOffPho.h:31
egHLT::OffPho::HLTData::HLTphi
float HLTphi
Definition: EgHLTOffPho.h:56
egHLT::OffPho::~OffPho
~OffPho()=default
egHLT::OffPho::looseCutCode_
int looseCutCode_
Definition: EgHLTOffPho.h:69
reco::Photon::isEBEEGap
bool isEBEEGap() const
true if photon is in boundary between EB and EE
Definition: Photon.h:132
egHLT
Definition: EgHLTBinData.h:10
egHLT::OffPho::hltIsolTrks
float hltIsolTrks() const
Definition: EgHLTOffPho.h:138
egHLT::OffPho::ClusShapeData::e2x5MaxOver5x5
float e2x5MaxOver5x5
Definition: EgHLTOffPho.h:44
egHLT::OffPho::setLooseCutCode
void setLooseCutCode(int code)
Definition: EgHLTOffPho.h:93
egHLT::OffPho::ClusShapeData::r9
float r9
Definition: EgHLTOffPho.h:48
reco::Photon::isEBGap
bool isEBGap() const
true if photon is in EB, and inside the boundaries in super crystals/modules
Definition: Photon.h:124