CMS 3D CMS Logo

EgHLTOffEgSel.cc
Go to the documentation of this file.
1 #include <cmath>
2 
4 
8 
10 
11 using namespace egHLT;
12 
13 void OffEgSel::setup(const edm::ParameterSet& iConfig) {
16 }
17 
18 int OffEgSel::getCutCode(const OffEle& ele, int cutMask) const {
19  if (std::fabs(ele.detEta()) < 1.5)
20  return getCutCode(ele, ebCutValues_, cutMask);
21  else
22  return getCutCode(ele, eeCutValues_, cutMask);
23 }
24 
25 int OffEgSel::getCutCode(const OffEle& ele, const EgCutValues& cuts, int cutMask) {
26  int cutCode = 0x0;
27  //kinematic cuts
28  if (ele.et() < cuts.minEt)
29  cutCode |= EgCutCodes::ET;
30  if (std::fabs(ele.etaSC()) < cuts.minEta || std::fabs(ele.etaSC()) > cuts.maxEta)
31  cutCode |= EgCutCodes::DETETA;
32  if (ele.isGap())
33  cutCode |= EgCutCodes::CRACK;
34  //track cuts
35  if (std::fabs(ele.dEtaIn()) > cuts.maxDEtaIn)
36  cutCode |= EgCutCodes::DETAIN;
37  if (std::fabs(ele.dPhiIn()) > cuts.maxDPhiIn)
38  cutCode |= EgCutCodes::DPHIIN;
39  if (ele.invEInvP() > cuts.maxInvEInvP)
40  cutCode |= EgCutCodes::INVEINVP;
41  //supercluster cuts
42  if (ele.hOverE() > cuts.maxHadem && ele.hOverE() * ele.caloEnergy() > cuts.maxHadEnergy)
43  cutCode |= EgCutCodes::HADEM;
44  if (ele.sigmaIEtaIEta() > cuts.maxSigmaIEtaIEta)
45  cutCode |= EgCutCodes::SIGMAIETAIETA;
46  if (ele.sigmaEtaEta() > cuts.maxSigmaEtaEta)
47  cutCode |= EgCutCodes::SIGMAETAETA;
48  //---Morse-------
49  //if(ele.r9()<cuts.minR9) cutCode |= EgCutCodes::R9;
50  if (ele.r9() < cuts.minR9)
51  cutCode |= EgCutCodes::MINR9;
52  if (ele.r9() > cuts.maxR9)
53  cutCode |= EgCutCodes::MAXR9;
54  //----------------
55 
56  //std isolation cuts
57  if (ele.isolEm() > (cuts.isolEmConstTerm +
58  cuts.isolEmGradTerm * (ele.et() < cuts.isolEmGradStart ? 0. : (ele.et() - cuts.isolEmGradStart))))
59  cutCode |= EgCutCodes::ISOLEM;
60  if (ele.isolHad() >
61  (cuts.isolHadConstTerm +
62  cuts.isolHadGradTerm * (ele.et() < cuts.isolHadGradStart ? 0. : (ele.et() - cuts.isolHadGradStart))))
63  cutCode |= EgCutCodes::ISOLHAD;
64  if (ele.isolPtTrks() >
65  (cuts.isolPtTrksConstTerm +
66  cuts.isolPtTrksGradTerm * (ele.et() < cuts.isolPtTrksGradStart ? 0. : (ele.et() - cuts.isolPtTrksGradStart))))
67  cutCode |= EgCutCodes::ISOLPTTRKS;
68  //ele Nr trks not defined, assume it passes
69  //hlt isolation cuts
70  if (ele.et() <=
71  0.) { //even it if et<=0, we give it a shot at passing isolation. Note this should be an impossible case
72  if (ele.hltIsolTrksEle() > cuts.maxHLTIsolTrksEle)
73  cutCode |= EgCutCodes::HLTISOLTRKSELE;
74  if (ele.hltIsolTrksPho() > cuts.maxHLTIsolTrksPho)
75  cutCode |= EgCutCodes::HLTISOLTRKSPHO;
76  if (ele.hltIsolHad() > cuts.maxHLTIsolHad)
77  cutCode |= EgCutCodes::HLTISOLHAD;
78  if (ele.hltIsolEm() > cuts.maxHLTIsolEm)
79  cutCode |= EgCutCodes::HLTISOLEM;
80  } else {
81  if (ele.hltIsolTrksEle() > cuts.maxHLTIsolTrksEle &&
82  ele.hltIsolTrksEle() / ele.et() > cuts.maxHLTIsolTrksEleOverPt &&
83  ele.hltIsolTrksEle() / ele.et() / ele.et() > cuts.maxHLTIsolTrksEleOverPt2)
84  cutCode |= EgCutCodes::HLTISOLTRKSELE;
85  if (ele.hltIsolTrksPho() > cuts.maxHLTIsolTrksPho &&
86  ele.hltIsolTrksPho() / ele.et() > cuts.maxHLTIsolTrksPhoOverPt &&
87  ele.hltIsolTrksPho() / ele.et() / ele.et() > cuts.maxHLTIsolTrksPhoOverPt2)
88  cutCode |= EgCutCodes::HLTISOLTRKSPHO;
89  if (ele.hltIsolHad() > cuts.maxHLTIsolHad && ele.hltIsolHad() / ele.et() > cuts.maxHLTIsolHadOverEt &&
90  ele.hltIsolHad() / ele.et() / ele.et() > cuts.maxHLTIsolHadOverEt2)
91  cutCode |= EgCutCodes::HLTISOLHAD;
92  if (ele.hltIsolEm() > cuts.maxHLTIsolEm && ele.hltIsolEm() / ele.et() > cuts.maxHLTIsolEmOverEt &&
93  ele.hltIsolEm() / ele.et() / ele.et() > cuts.maxHLTIsolEmOverEt2)
94  cutCode |= EgCutCodes::HLTISOLEM;
95  }
96 
97  //cuts on CTF track, HLT tracking doesnt handle poor quaility tracks
98  if (ele.validCTFTrack()) {
99  if (!(ele.ctfTrkOuterRadius() >= cuts.minCTFTrkOuterRadius && //note I'm NOTing the result of the AND
100  ele.ctfTrkInnerRadius() <= cuts.maxCTFTrkInnerRadius &&
101 
102  ele.ctfTrkHitsFound() >= cuts.minNrCTFTrkHits && ele.ctfTrkHitsLost() <= cuts.maxNrCTFTrkHitsLost))
103  cutCode |= EgCutCodes::CTFTRACK; //the next line can also set this bit
104  if (cuts.requirePixelHitsIfOuterInOuter) {
105  DetId innerDetId(ele.ctfTrack()->extra()->innerDetId());
106  DetId outerDetId(ele.ctfTrack()->extra()->outerDetId());
107 
108  if (outerDetId.subdetId() >= 5 && innerDetId.subdetId() >= 3)
109  cutCode |= EgCutCodes::CTFTRACK; //1,2 = pixel, 3,4,5,6 sistrip
110  }
111  // std::cout <<"eta "<<ele.detEta()<<" max inner "<<cuts.maxCTFTrkInnerRadius<<" inner "<<ele.ctfTrkInnerRadius()<<std::endl;
112  } else
113  cutCode |= EgCutCodes::CTFTRACK;
114 
115  if (std::fabs(ele.hltDEtaIn()) > cuts.maxHLTDEtaIn)
116  cutCode |= EgCutCodes::HLTDETAIN;
117  if (std::fabs(ele.hltDPhiIn()) > cuts.maxHLTDPhiIn)
118  cutCode |= EgCutCodes::HLTDPHIIN;
119  if (std::fabs(ele.hltInvEInvP()) > cuts.maxHLTInvEInvP)
120  cutCode |= EgCutCodes::HLTINVEINVP;
121 
122  return (cutCode & cuts.cutMask & cutMask);
123 }
124 
125 int OffEgSel::getCutCode(const OffPho& pho, int cutMask) const {
126  if (std::fabs(pho.detEta()) < 1.5)
127  return getCutCode(pho, ebCutValues_, cutMask);
128  else
129  return getCutCode(pho, eeCutValues_, cutMask);
130 }
131 
132 //photons automatically fail any track cut
133 int OffEgSel::getCutCode(const OffPho& pho, const EgCutValues& cuts, int cutMask) {
134  int cutCode = 0x0;
135  //kinematic cuts
136  if (pho.et() < cuts.minEt)
137  cutCode |= EgCutCodes::ET;
138  if (std::fabs(pho.etaSC()) < cuts.minEta || std::fabs(pho.etaSC()) > cuts.maxEta)
139  cutCode |= EgCutCodes::DETETA;
140  if (pho.isGap())
141  cutCode |= EgCutCodes::CRACK;
142  //track cuts (all fail)
143  cutCode |= EgCutCodes::DETAIN;
144  cutCode |= EgCutCodes::DPHIIN;
145  cutCode |= EgCutCodes::INVEINVP;
146  //supercluster cuts
147  if (pho.hOverE() > cuts.maxHadem && pho.hOverE() * pho.energy() > cuts.maxHadEnergy)
148  cutCode |= EgCutCodes::HADEM;
149  if (pho.sigmaIEtaIEta() > cuts.maxSigmaIEtaIEta)
150  cutCode |= EgCutCodes::SIGMAIETAIETA;
151  if (pho.sigmaEtaEta() > cuts.maxSigmaEtaEta)
152  cutCode |= EgCutCodes::SIGMAETAETA;
153  //----Morse--------
154  //if(pho.r9()<cuts.minR9) cutCode |= EgCutCodes::R9;
155  if (pho.r9() < cuts.minR9)
156  cutCode |= EgCutCodes::MINR9;
157  if (pho.r9() > cuts.maxR9)
158  cutCode |= EgCutCodes::MAXR9;
159  //----------------
160  //std isolation cuts
161  if (pho.isolEm() > (cuts.isolEmConstTerm +
162  cuts.isolEmGradTerm * (pho.et() < cuts.isolEmGradStart ? 0. : (pho.et() - cuts.isolEmGradStart))))
163  cutCode |= EgCutCodes::ISOLEM;
164  if (pho.isolHad() >
165  (cuts.isolHadConstTerm +
166  cuts.isolHadGradTerm * (pho.et() < cuts.isolHadGradStart ? 0. : (pho.et() - cuts.isolHadGradStart))))
167  cutCode |= EgCutCodes::ISOLHAD;
168  if (pho.isolPtTrks() >
169  (cuts.isolPtTrksConstTerm +
170  cuts.isolPtTrksGradTerm * (pho.et() < cuts.isolPtTrksGradStart ? 0. : (pho.et() - cuts.isolPtTrksGradStart))))
171  cutCode |= EgCutCodes::ISOLPTTRKS;
172  if (pho.isolNrTrks() > cuts.isolNrTrksConstTerm)
173  cutCode |= EgCutCodes::ISOLNRTRKS;
174 
175  //hlt isolation cuts
176  cutCode |= EgCutCodes::HLTISOLTRKSELE; //automatically fails ele track isolation
177  if (pho.et() <=
178  0.) { //even it if et<=0, we give it a shot at passing isolation. Note this should be an impossible case
179  if (pho.hltIsolTrks() > cuts.maxHLTIsolTrksPho)
180  cutCode |= EgCutCodes::HLTISOLTRKSPHO;
181  if (pho.hltIsolHad() > cuts.maxHLTIsolHad)
182  cutCode |= EgCutCodes::HLTISOLHAD;
183  if (pho.hltIsolEm() > cuts.maxHLTIsolEm)
184  cutCode |= EgCutCodes::HLTISOLEM;
185  } else {
186  if (pho.hltIsolTrks() > cuts.maxHLTIsolTrksPho && pho.hltIsolTrks() / pho.et() > cuts.maxHLTIsolTrksPhoOverPt &&
187  pho.hltIsolTrks() / pho.et() / pho.et() > cuts.maxHLTIsolTrksPhoOverPt2)
188  cutCode |= EgCutCodes::HLTISOLTRKSPHO;
189  if (pho.hltIsolHad() > cuts.maxHLTIsolHad && pho.hltIsolHad() / pho.et() > cuts.maxHLTIsolHadOverEt &&
190  pho.hltIsolHad() / pho.et() / pho.et() > cuts.maxHLTIsolHadOverEt2)
191  cutCode |= EgCutCodes::HLTISOLHAD;
192  if (pho.hltIsolEm() > cuts.maxHLTIsolEm && pho.hltIsolEm() / pho.et() > cuts.maxHLTIsolEmOverEt &&
193  pho.hltIsolEm() / pho.et() / pho.et() > cuts.maxHLTIsolEmOverEt2)
194  cutCode |= EgCutCodes::HLTISOLEM;
195  }
196 
197  //track cuts, photon will automatically fail them (for now)
198  cutCode |= EgCutCodes::CTFTRACK;
199  cutCode |= EgCutCodes::HLTDETAIN;
200  cutCode |= EgCutCodes::HLTDPHIIN;
201  cutCode |= EgCutCodes::HLTINVEINVP;
202 
203  return (cutCode & cuts.cutMask & cutMask);
204 }
egHLT::EgCutCodes::HLTDETAIN
Definition: EgHLTEgCutCodes.h:49
egHLT::OffPho::sigmaEtaEta
float sigmaEtaEta() const
Definition: EgHLTOffPho.cc:7
egHLT::OffEle::ctfTrkHitsFound
int ctfTrkHitsFound() const
Definition: EgHLTOffEle.h:223
egHLT::OffEle::hltIsolEm
float hltIsolEm() const
Definition: EgHLTOffEle.h:188
egHLT::OffPho::isGap
bool isGap() const
Definition: EgHLTOffPho.h:118
egHLT::EgCutCodes::SIGMAIETAIETA
Definition: EgHLTEgCutCodes.h:29
egHLT::OffEle::caloEnergy
float caloEnergy() const
Definition: EgHLTOffEle.h:132
egHLT::OffPho::energy
float energy() const
Definition: EgHLTOffPho.h:106
egHLT::OffEle::invEInvP
float invEInvP() const
Definition: EgHLTOffEle.h:171
egHLT::OffEle::dEtaIn
float dEtaIn() const
Definition: EgHLTOffEle.h:152
egHLT::OffPho::hltIsolEm
float hltIsolEm() const
Definition: EgHLTOffPho.h:139
egHLT::OffEle::ctfTrkOuterRadius
float ctfTrkOuterRadius() const
Definition: EgHLTOffEle.h:222
egHLT::OffPho::r9
float r9() const
Definition: EgHLTOffPho.h:130
EgHLTOffPho.h
egHLT::OffEle::dPhiIn
float dPhiIn() const
Definition: EgHLTOffEle.h:153
egHLT::EgCutCodes::HLTISOLTRKSPHO
Definition: EgHLTEgCutCodes.h:43
egHLT::OffEle::detEta
float detEta() const
Definition: EgHLTOffEle.h:134
egHLT::EgCutCodes::ISOLNRTRKS
Definition: EgHLTEgCutCodes.h:40
egHLT::OffEle::hltInvEInvP
float hltInvEInvP() const
Definition: EgHLTOffEle.h:193
egHLT::EgCutCodes::HLTISOLHAD
Definition: EgHLTEgCutCodes.h:44
egHLT::OffEle::isGap
bool isGap() const
Definition: EgHLTOffEle.h:141
egHLT::EgCutCodes::ET
Definition: EgHLTEgCutCodes.h:17
egHLT::OffPho::etaSC
float etaSC() const
Definition: EgHLTOffPho.h:112
egHLT::EgCutCodes::CTFTRACK
Definition: EgHLTEgCutCodes.h:47
egHLT::OffEle
Definition: EgHLTOffEle.h:29
egHLT::OffPho::isolHad
float isolHad() const
Definition: EgHLTOffPho.h:134
DetId
Definition: DetId.h:17
egHLT::EgCutCodes::MAXR9
Definition: EgHLTEgCutCodes.h:34
egHLT::OffEle::etaSC
float etaSC() const
Definition: EgHLTOffEle.h:133
egHLT::EgCutCodes::MINR9
Definition: EgHLTEgCutCodes.h:33
egHLT::OffEgSel::eeCutValues_
EgCutValues eeCutValues_
Definition: EgHLTOffEgSel.h:27
egHLT::EgCutCodes::DPHIIN
Definition: EgHLTEgCutCodes.h:23
egHLT::OffPho
Definition: EgHLTOffPho.h:26
egHLT::OffEle::ctfTrkInnerRadius
float ctfTrkInnerRadius() const
Definition: EgHLTOffEle.h:221
egHLT::EgCutCodes::HLTDPHIIN
Definition: EgHLTEgCutCodes.h:50
egHLT::OffPho::isolNrTrks
int isolNrTrks() const
Definition: EgHLTOffPho.h:135
EgHLTOffEgSel.h
egHLT::EgCutCodes::CRACK
Definition: EgHLTEgCutCodes.h:20
egHLT::EgCutValues
Definition: EgHLTEgCutValues.h:13
egHLT::OffEle::et
float et() const
Definition: EgHLTOffEle.h:124
egHLT::OffPho::hOverE
float hOverE() const
Definition: EgHLTOffPho.h:121
egHLT::OffEle::ctfTrack
reco::TrackRef ctfTrack() const
Definition: EgHLTOffEle.h:203
egHLT::OffEle::ctfTrkHitsLost
int ctfTrkHitsLost() const
Definition: EgHLTOffEle.h:224
EgHLTOffEle.h
egHLT::OffEgSel::setup
void setup(const edm::ParameterSet &)
Definition: EgHLTOffEgSel.cc:13
egHLT::OffEle::hltDPhiIn
float hltDPhiIn() const
Definition: EgHLTOffEle.h:192
egHLT::OffPho::hltIsolHad
float hltIsolHad() const
Definition: EgHLTOffPho.h:137
edm::ParameterSet
Definition: ParameterSet.h:36
egHLT::OffEle::isolHad
float isolHad() const
Definition: EgHLTOffEle.h:180
egHLT::OffEle::r9
float r9() const
Definition: EgHLTOffEle.h:168
egHLT::OffEle::hltDEtaIn
float hltDEtaIn() const
Definition: EgHLTOffEle.h:191
egHLT::EgCutCodes::ISOLHAD
Definition: EgHLTEgCutCodes.h:38
egHLT::EgCutCodes::SIGMAETAETA
Definition: EgHLTEgCutCodes.h:27
egHLT::OffEle::hltIsolHad
float hltIsolHad() const
Definition: EgHLTOffEle.h:187
egHLT::EgCutCodes::DETAIN
Definition: EgHLTEgCutCodes.h:22
egHLT::OffEle::hOverE
float hOverE() const
Definition: EgHLTOffEle.h:151
egHLT::OffPho::isolEm
float isolEm() const
Definition: EgHLTOffPho.h:133
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
egHLT::EgCutCodes::INVEINVP
Definition: EgHLTEgCutCodes.h:24
egHLT::OffEgSel::getCutCode
int getCutCode(const OffEle &ele, int cutMask=~0x0) const
Definition: EgHLTOffEgSel.cc:18
egHLT::EgCutValues::setup
void setup(const edm::ParameterSet &iConfig)
Definition: EgHLTEgCutValues.cc:8
egHLT::OffEle::hltIsolTrksEle
float hltIsolTrksEle() const
Definition: EgHLTOffEle.h:185
egHLT::OffEle::sigmaIEtaIEta
float sigmaIEtaIEta() const
Definition: EgHLTOffEle.h:162
egHLT::OffEle::sigmaEtaEta
float sigmaEtaEta() const
Definition: EgHLTOffEle.cc:7
egHLT::OffPho::detEta
float detEta() const
Definition: EgHLTOffPho.h:113
egHLT::OffPho::isolPtTrks
float isolPtTrks() const
Definition: EgHLTOffPho.h:136
egHLT::EgCutCodes::HADEM
Definition: EgHLTEgCutCodes.h:28
egHLT::OffPho::et
float et() const
Definition: EgHLTOffPho.h:104
egHLT::OffEle::isolPtTrks
float isolPtTrks() const
Definition: EgHLTOffEle.h:183
egHLT::EgCutCodes::DETETA
Definition: EgHLTEgCutCodes.h:19
EgHLTEgCutCodes.h
egHLT::OffPho::sigmaIEtaIEta
float sigmaIEtaIEta() const
Definition: EgHLTOffPho.h:125
L1TMuonDQMOffline_cfi.cuts
cuts
Definition: L1TMuonDQMOffline_cfi.py:41
egHLT::EgCutCodes::ISOLEM
Definition: EgHLTEgCutCodes.h:37
egHLT::OffEgSel::ebCutValues_
EgCutValues ebCutValues_
Definition: EgHLTOffEgSel.h:26
ParameterSet.h
egHLT::OffEle::validCTFTrack
bool validCTFTrack() const
Definition: EgHLTOffEle.h:207
egHLT::EgCutCodes::HLTISOLEM
Definition: EgHLTEgCutCodes.h:45
egHLT::EgCutCodes::ISOLPTTRKS
Definition: EgHLTEgCutCodes.h:39
egHLT::EgCutCodes::HLTINVEINVP
Definition: EgHLTEgCutCodes.h:51
egHLT::OffEle::hltIsolTrksPho
float hltIsolTrksPho() const
Definition: EgHLTOffEle.h:186
egHLT
Definition: EgHLTBinData.h:10
egHLT::OffPho::hltIsolTrks
float hltIsolTrks() const
Definition: EgHLTOffPho.h:138
egHLT::EgCutCodes::HLTISOLTRKSELE
Definition: EgHLTEgCutCodes.h:42
egHLT::OffEle::isolEm
float isolEm() const
Definition: EgHLTOffEle.h:179