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:125
T getParameter(std::string const &) const
int ctfTrkHitsFound() const
Definition: EgHLTOffEle.h:195
reco::TrackRef ctfTrack() const
Definition: EgHLTOffEle.h:180
float detEta() const
Definition: EgHLTOffEle.h:121
float caloEnergy() const
Definition: EgHLTOffEle.h:119
int getCutCode(const OffEle &ele, int cutMask=~0x0) const
float et() const
Definition: EgHLTOffPho.h:91
float isolHad() const
Definition: EgHLTOffPho.h:121
float r9() const
Definition: EgHLTOffEle.h:156
EgCutValues eeCutValues_
Definition: EgHLTOffEgSel.h:29
float isolPtTrks() const
Definition: EgHLTOffPho.h:123
float invEInvP() const
Definition: EgHLTOffEle.h:159
float et() const
Definition: EgHLTOffEle.h:113
float ctfTrkInnerRadius() const
Definition: EgHLTOffEle.h:193
bool validCTFTrack() const
Definition: EgHLTOffEle.h:182
float dPhiIn() const
Definition: EgHLTOffEle.h:141
float energy() const
Definition: EgHLTOffPho.h:93
float etaSC() const
Definition: EgHLTOffPho.h:97
float detEta() const
Definition: EgHLTOffPho.h:98
float hltDPhiIn() const
Definition: EgHLTOffEle.h:176
float isolEm() const
Definition: EgHLTOffEle.h:163
float hltInvEInvP() const
Definition: EgHLTOffEle.h:177
float hOverE() const
Definition: EgHLTOffPho.h:106
float dEtaIn() const
Definition: EgHLTOffEle.h:140
void setup(const edm::ParameterSet &)
float etaSC() const
Definition: EgHLTOffEle.h:120
float sigmaEtaEta() const
Definition: EgHLTOffPho.cc:5
void setup(const edm::ParameterSet &iConfig)
float r9() const
Definition: EgHLTOffPho.h:117
bool isGap() const
Definition: EgHLTOffEle.h:128
float sigmaIEtaIEta() const
Definition: EgHLTOffEle.h:150
float sigmaEtaEta() const
Definition: EgHLTOffEle.cc:5
float hltIsolHad() const
Definition: EgHLTOffPho.h:124
bool isGap() const
Definition: EgHLTOffPho.h:103
float hltIsolHad() const
Definition: EgHLTOffEle.h:171
Definition: DetId.h:20
int ctfTrkHitsLost() const
Definition: EgHLTOffEle.h:196
float sigmaIEtaIEta() const
Definition: EgHLTOffPho.h:112
float hltIsolTrksPho() const
Definition: EgHLTOffEle.h:170
float isolPtTrks() const
Definition: EgHLTOffEle.h:167
float ctfTrkOuterRadius() const
Definition: EgHLTOffEle.h:194
float hltIsolTrksEle() const
Definition: EgHLTOffEle.h:169
float hltDEtaIn() const
Definition: EgHLTOffEle.h:175
int isolNrTrks() const
Definition: EgHLTOffPho.h:122
float hOverE() const
Definition: EgHLTOffEle.h:139
float isolHad() const
Definition: EgHLTOffEle.h:164
EgCutValues ebCutValues_
Definition: EgHLTOffEgSel.h:28
float hltIsolEm() const
Definition: EgHLTOffPho.h:126
float isolEm() const
Definition: EgHLTOffPho.h:120
float hltIsolEm() const
Definition: EgHLTOffEle.h:172