ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/HZZCiCElectronSelection.cc
Revision: 1.7
Committed: Mon Feb 13 09:41:50 2012 UTC (13 years, 3 months ago) by khahn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +0 -0 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
*** empty log message ***

File Contents

# Content
1 #include <iostream>
2 #include <math.h>
3 #include "HZZCiCElectronSelection.h"
4
5 using namespace std;
6
7 CICStruct eidVeryLoose;
8 CICStruct eidLoose;
9 CICStruct eidMedium;
10 CICStruct eidTight;
11 CICStruct eidSuperTight;
12 CICStruct eidHyperTight1;
13
14 CICStruct getCiCCuts(TString eleSeleAnality) {
15 if(eleSeleAnality=="loose") return eidLoose;
16 else if(eleSeleAnality=="medium") return eidMedium;
17 else if(eleSeleAnality=="tight") return eidTight;
18 else {cout << "error! bad taughtness." << endl; assert(0); return eidLoose;}
19 }
20
21 void initCiCSelection() {
22 #include "CiCElectronSelectionDataTuning.i"
23 };
24
25 //
26 //https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideCategoryBasedElectronID
27 //
28 unsigned cicCategory(const mithep::TElectron *ele) {
29 unsigned categories=0;
30 float eta = fabs(ele->scEta);
31 float eop = fabs(ele->EoverP); // this is what it should be ...
32 float fbrem = ele->fBrem;
33
34 if( ele->isEB ) {
35 if( eop>0.9 && eop<1.2 && fbrem>=0.12 ) {
36 return ELECTRON_BREM_EB;
37 }
38 else if( (eta > .445 && eta < .45 ) ||
39 (eta > .79 && eta < .81 ) ||
40 (eta > 1.137 && eta < 1.157 ) ||
41 (eta > 1.47285 && eta < 1.4744) ) {
42 return ELECTRON_CRACK_EB;
43 }
44 else if ( !ele->isEcalDriven ) { // ele->trackerDrivenSeed &&
45 return ELECTRON_PURETRACKER;
46 }
47 else if( fbrem<0.12 ) {
48 return ELECTRON_LOWBREM_EB;
49 }
50 else return ELECTRON_BADTRACK_EB;
51
52 } else { // isEE
53
54 if( eop>0.82 && eop<1.22 && fbrem>=0.2 ) {
55 return ELECTRON_BREM_EE;
56 }
57 else if ( eta>1.5 && eta<1.58 ) {
58 return ELECTRON_CRACK_EE;
59 }
60 else if ( !ele->isEcalDriven ) { //ele->trackerDrivenSeed &&
61 return ELECTRON_PURETRACKER;
62 }
63 else if( fbrem<0.2 ) {
64 return ELECTRON_LOWBREM_EE;
65 }
66 else return ELECTRON_BADTRACK_EE;
67 }
68 return 0xDEADDEAD;
69 };
70
71
72 unsigned failsCicSelection( ControlFlags &ctrl, const mithep::TElectron * ele, CICStruct &cuts,
73 string kinematics) {
74 int level=0;
75 unsigned failmask=0x0;
76 unsigned category = cicCategory(ele);
77
78 float scEt = ele->scEt;
79 float scEta = ele->scEta;
80
81 float deta = fabs(ele->deltaEtaIn);
82 float dphi = fabs(ele->deltaPhiIn);
83 float sigieie = ele->sigiEtaiEta;
84 float EsoPin = ele->ESeedClusterOverPIn;
85 float fBrem = ele->fBrem;
86 float HoE = ele->HoverE;
87 float EsoPinCor = EsoPin + fBrem;
88 // weird, see http://cmslxr.fnal.gov/lxr/source/RecoEgamma/ElectronIdentification/src/CutBasedElectronID.cc
89 if( fBrem < 0 ) {
90 EsoPinCor = EsoPin;
91 }
92
93 float dist = (ele->partnerDist == -9999.? 9999:ele->partnerDist);
94 float dcot = (ele->partnerDeltaCot == -9999.? 9999:ele->partnerDeltaCot);
95 float dcotdistcomb = ((0.04 - std::max(dist, dcot)) > 0?(0.04 - std::max(dist, dcot)):0);
96 // cout << "debug is now set to : " << ctrl.debug << endl;
97
98 if( ctrl.debug ) cout << "--> scEt : " << scEt << endl;
99
100 double etcut=0;
101 if ( kinematics == "loose" ) etcut = 5;
102 else if ( kinematics == "tight" ) etcut = 7;
103 else { cout << "kinematics not defined!" << endl; assert(0); }
104 if ( scEt < etcut ) {
105 failmask |= (1<<level);
106 // cout << "failing scET ... " << endl;
107 return failmask;
108 }
109
110 level++;
111 if ( fabs(scEta) > 2.5 ) {
112 failmask |= (1<<level);
113 // cout << "failing scEta ... " << endl;
114 return failmask;
115 }
116
117 float max_deta, max_dphi, max_HoE, max_sigieie, max_missHits, max_conv;
118 float max_IP;
119 float min_EoP; // this is a min cut ... maxn_EoP
120
121
122 float etmin=10.;
123 float etmax=40.;
124
125 if( scEt < etmin ) {
126 max_deta = cuts.cutdetainl[category];
127 max_dphi = cuts.cutdphiinl[category];
128 max_HoE = cuts.cuthoel[category];
129 max_sigieie = cuts.cutseel[category];
130 min_EoP = cuts.cuteseedopcor[category];
131 max_missHits = cuts.cutfmishits[category];
132 max_conv = cuts.cutdcotdist[category];
133 }
134 else if( scEt > etmin && scEt < etmax ) {
135 // float dET = scEt-10;
136 max_deta = cuts.cutdetainl[category] + (1/etmin - 1/scEt)*(cuts.cutdetain[category]-cuts.cutdetainl[category])/(1/etmin - 1/etmax);
137 max_dphi = cuts.cutdphiinl[category] + (1/etmin - 1/scEt)*(cuts.cutdphiin[category]-cuts.cutdphiinl[category])/(1/etmin - 1/etmax);
138 max_HoE = cuts.cuthoel[category] + (1/etmin - 1/scEt)*(cuts.cuthoe[category]-cuts.cuthoel[category])/(1/etmin - 1/etmax);
139 max_sigieie = cuts.cutseel[category] + (1/etmin - 1/scEt)*(cuts.cutsee[category]-cuts.cutseel[category])/(1/etmin - 1/etmax);
140 min_EoP = cuts.cuteseedopcor[category];
141 max_missHits = cuts.cutfmishits[category];
142 max_conv = cuts.cutdcotdist[category];
143 } else {
144 max_deta = cuts.cutdetain[category];
145 max_dphi = cuts.cutdphiin[category];
146 max_HoE = cuts.cuthoe[category];
147 max_sigieie = cuts.cutsee[category];
148 min_EoP = cuts.cuteseedopcor[category];
149 max_missHits = cuts.cutfmishits[category];
150 max_conv = cuts.cutdcotdist[category];
151 }
152
153 if( ctrl.debug ) cout << "max_deta: " << max_deta
154 << "\tmax_dphi : " << max_dphi
155 << "\tmax_HoE : "<< max_HoE
156 << "\tmax_sigieie : " << max_sigieie
157 << "\tmin_EoP : " << min_EoP
158 << endl;
159
160 level++;
161 if( deta > max_deta ) {
162 failmask |= (1<<level);
163 if( ctrl.debug ) cout << "failing deta ... " << deta << ">" << max_deta << endl;
164 }
165 level++;
166 if( dphi > max_dphi ) {
167 failmask |= (1<<level);
168 if(ctrl.debug) cout << "failing dphi ... " << endl;
169 }
170 level++;
171 if( EsoPinCor < min_EoP ) {
172 failmask |= (1<<level);
173 if(ctrl.debug) cout << "failing eop ... " << endl;
174 }
175 level++;
176 if( sigieie > max_sigieie ) {
177 failmask |= (1<<level);
178 if(ctrl.debug) cout << "failing sigieie: " << "sigieie: " << sigieie << " max_sigieie: " << max_sigieie << endl;
179 }
180 level++;
181 if( HoE > max_HoE ) {
182 failmask |= (1<<level);
183 if( ctrl.debug ) cout << "failing hoe ... " << HoE << ">" << max_HoE << endl;
184 }
185 level++;
186 if( ele->nExpHitsInner > max_missHits ) {
187 // || dcotdistcomb > max_conv
188 failmask |= (1<<level);
189 if(ctrl.debug) cout << "failing misshits ... " << endl;
190 }
191
192 // loose trkIso
193 level++;
194 if( (ele->trkIso03/ele->pt) > 0.7 ) {
195 failmask |= (1<<level);
196 if(ctrl.debug) cout << "failing loose iso ... " << endl;
197 }
198
199 // level++;
200 // if( fabs(ele->ip) > max_IP ) {
201 // failmask |= (1<<level);
202 // }
203
204 return failmask;
205 };
206