test
CMS 3D CMS Logo

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