9 |
|
#include <TMath.h> |
10 |
|
#include <TFile.h> |
11 |
|
#include <TRandom3.h> |
12 |
+ |
#include <TSystem.h> |
13 |
|
#include "TMVA/Tools.h"//MVA |
14 |
|
#include "TMVA/Reader.h"//MVA |
15 |
|
|
24 |
|
fReaderEndcap(0), |
25 |
|
fReaderBarrel(0), |
26 |
|
|
27 |
+ |
fMVAType (MVATools::kNone) |
28 |
+ |
|
29 |
+ |
// ------------------------------------------------------------------------------ |
30 |
+ |
// fab: These guys should all go away.... |
31 |
|
//MVA Variables v4 |
32 |
< |
HoE(0), |
33 |
< |
covIEtaIEta(0), |
34 |
< |
tIso1abs(0), |
35 |
< |
tIso3abs(0), |
36 |
< |
tIso2abs(0), |
37 |
< |
R9(0), |
38 |
< |
|
39 |
< |
absIsoEcal(0), |
40 |
< |
absIsoHcal(0), |
41 |
< |
RelEMax(0), |
42 |
< |
RelETop(0), |
43 |
< |
RelEBottom(0), |
44 |
< |
RelELeft(0), |
45 |
< |
RelERight(0), |
46 |
< |
RelE2x5Max(0), |
47 |
< |
RelE2x5Top(0), |
48 |
< |
RelE2x5Bottom(0), |
49 |
< |
RelE2x5Left(0), |
50 |
< |
RelE2x5Right(0), |
51 |
< |
RelE5x5(0), |
52 |
< |
|
53 |
< |
EtaWidth(0), |
54 |
< |
PhiWidth(0), |
55 |
< |
CoviEtaiPhi(0), |
56 |
< |
CoviPhiiPhi(0), |
57 |
< |
|
58 |
< |
NVertexes(0), |
59 |
< |
RelPreshowerEnergy(0), |
60 |
< |
|
61 |
< |
//MVA v2 and v1 |
62 |
< |
RelIsoEcal(0), |
63 |
< |
RelIsoHcal(0), |
64 |
< |
tIso1(0), |
65 |
< |
tIso3(0), |
66 |
< |
tIso2(0), |
67 |
< |
ScEta(0.) |
32 |
> |
// HoE(0), |
33 |
> |
// covIEtaIEta(0), |
34 |
> |
// tIso1abs(0), |
35 |
> |
// tIso3abs(0), |
36 |
> |
// tIso2abs(0), |
37 |
> |
// R9(0), |
38 |
> |
|
39 |
> |
// absIsoEcal(0), |
40 |
> |
// absIsoHcal(0), |
41 |
> |
// RelEMax(0), |
42 |
> |
// RelETop(0), |
43 |
> |
// RelEBottom(0), |
44 |
> |
// RelELeft(0), |
45 |
> |
// RelERight(0), |
46 |
> |
// RelE2x5Max(0), |
47 |
> |
// RelE2x5Top(0), |
48 |
> |
// RelE2x5Bottom(0), |
49 |
> |
// RelE2x5Left(0), |
50 |
> |
// RelE2x5Right(0), |
51 |
> |
// RelE5x5(0), |
52 |
> |
|
53 |
> |
// EtaWidth(0), |
54 |
> |
// PhiWidth(0), |
55 |
> |
// CoviEtaiPhi(0), |
56 |
> |
// CoviPhiiPhi(0), |
57 |
> |
|
58 |
> |
// NVertexes(0), |
59 |
> |
// RelPreshowerEnergy(0), |
60 |
> |
|
61 |
> |
// //MVA v2 and v1 |
62 |
> |
// RelIsoEcal(0), |
63 |
> |
// RelIsoHcal(0), |
64 |
> |
// tIso1(0), |
65 |
> |
// tIso3(0), |
66 |
> |
// tIso2(0), |
67 |
> |
// ScEta(0.) |
68 |
> |
|
69 |
|
{ |
70 |
|
// Constructor. |
71 |
|
} |
72 |
|
|
73 |
|
//-------------------------------------------------------------------------------------------------- |
74 |
< |
void MVATools::InitializeMVA(int VariableType, TString EndcapWeights,TString BarrelWeights) { |
74 |
> |
void MVATools::InitializeMVA(MVATools::IdMVAType type) { |
75 |
|
|
76 |
+ |
fMVAType = type; |
77 |
+ |
|
78 |
|
if (fReaderEndcap) delete fReaderEndcap; |
79 |
|
if (fReaderBarrel) delete fReaderBarrel; |
80 |
+ |
|
81 |
+ |
// no MVA needed if none requested |
82 |
+ |
if( type == kNone ) { |
83 |
+ |
return; |
84 |
+ |
} |
85 |
|
|
86 |
|
fReaderEndcap = new TMVA::Reader( "!Color:!Silent:Error" ); |
87 |
|
fReaderBarrel = new TMVA::Reader( "!Color:!Silent:Error" ); |
88 |
+ |
|
89 |
+ |
TString BarrelWeights; |
90 |
+ |
TString EndcapWeights; |
91 |
+ |
|
92 |
+ |
varNames.resize(0); |
93 |
|
|
94 |
< |
TMVA::Reader *readers[2]; |
77 |
< |
readers[0] = fReaderEndcap; |
78 |
< |
readers[1] = fReaderBarrel; |
79 |
< |
|
80 |
< |
for (UInt_t i=0; i<2; ++i) { |
81 |
< |
|
82 |
< |
if(VariableType==0||VariableType==1||VariableType==2){ |
83 |
< |
readers[i]->AddVariable( "HoE", &HoE ); |
84 |
< |
readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
85 |
< |
readers[i]->AddVariable( "tIso1", &tIso1 ); |
86 |
< |
readers[i]->AddVariable( "tIso3", &tIso3 ); |
87 |
< |
readers[i]->AddVariable( "tIso2", &tIso2 ); |
88 |
< |
readers[i]->AddVariable( "R9", &R9 ); |
89 |
< |
} |
94 |
> |
switch (type) { |
95 |
|
|
96 |
< |
if(VariableType==3||VariableType==4){ |
97 |
< |
readers[i]->AddVariable( "HoE", &HoE ); |
98 |
< |
readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
99 |
< |
readers[i]->AddVariable( "tIso1abs", &tIso1abs ); |
100 |
< |
readers[i]->AddVariable( "tIso3abs", &tIso3abs ); |
101 |
< |
readers[i]->AddVariable( "tIso2abs", &tIso2abs ); |
102 |
< |
readers[i]->AddVariable( "R9", &R9 ); |
103 |
< |
} |
104 |
< |
|
105 |
< |
if(VariableType==1||VariableType==2){ |
106 |
< |
readers[i]->AddVariable( "RelIsoEcal", &RelIsoEcal ); |
107 |
< |
readers[i]->AddVariable( "RelIsoHcal", &RelIsoHcal ); |
108 |
< |
readers[i]->AddVariable( "RelEMax", &RelEMax ); |
109 |
< |
readers[i]->AddVariable( "RelETop", &RelETop ); |
110 |
< |
readers[i]->AddVariable( "RelEBottom", &RelEBottom ); |
111 |
< |
readers[i]->AddVariable( "RelELeft", &RelELeft ); |
112 |
< |
readers[i]->AddVariable( "RelERight", &RelERight ); |
113 |
< |
readers[i]->AddVariable( "RelE2x5Max", &RelE2x5Max ); |
114 |
< |
readers[i]->AddVariable( "RelE2x5Top", &RelE2x5Top ); |
115 |
< |
readers[i]->AddVariable( "RelE2x5Bottom", &RelE2x5Bottom ); |
116 |
< |
readers[i]->AddVariable( "RelE2x5Left", &RelE2x5Left ); |
117 |
< |
readers[i]->AddVariable( "RelE2x5Right", &RelE2x5Right ); |
118 |
< |
readers[i]->AddVariable( "RelE5x5", &RelE5x5 ); |
96 |
> |
case k2011IdMVA_HZg: |
97 |
> |
|
98 |
> |
EndcapWeights = (gSystem->Getenv("CMSSW_BASE")+ |
99 |
> |
TString("/src/MitPhysics/data/")+ |
100 |
> |
TString("PhotonId_lowPt_EE_BDTG.")+ |
101 |
> |
TString("weights.xml")); |
102 |
> |
BarrelWeights = (gSystem->Getenv("CMSSW_BASE")+ |
103 |
> |
TString("/src/MitPhysics/data/")+ |
104 |
> |
TString("PhotonId_lowPt_EB_BDTG.")+ |
105 |
> |
TString("weights.xml")); |
106 |
> |
|
107 |
> |
|
108 |
> |
varNames.push_back("sigieie"); |
109 |
> |
varNames.push_back("covieip"); |
110 |
> |
varNames.push_back("s4r" ); |
111 |
> |
varNames.push_back("r9" ); |
112 |
> |
varNames.push_back("sigeta" ); |
113 |
> |
varNames.push_back("sigphi" ); |
114 |
> |
varNames.push_back("pfgios" ); |
115 |
> |
varNames.push_back("pfciso" ); |
116 |
> |
varNames.push_back("rho" ); |
117 |
> |
varNames.push_back("sceta" ); |
118 |
> |
varNames.push_back("rawe" ); |
119 |
> |
|
120 |
> |
mvaVars.resize(varNames.size()); |
121 |
> |
|
122 |
> |
std::cout<<" Adding stuff here.... "<<std::endl; |
123 |
> |
|
124 |
> |
for( unsigned int iV = 0; iV < mvaVars.size(); ++iV) { |
125 |
> |
mvaVarMapEB.insert( std::pair<std::string,unsigned int>(varNames[iV], iV) ); |
126 |
> |
mvaVarMapEE.insert( std::pair<std::string,unsigned int>(varNames[iV], iV) ); |
127 |
|
} |
128 |
|
|
129 |
< |
if(VariableType==3||VariableType==4){ |
130 |
< |
readers[i]->AddVariable( "absIsoEcal", &absIsoEcal ); |
131 |
< |
readers[i]->AddVariable( "absIsoHcal", &absIsoHcal ); |
132 |
< |
readers[i]->AddVariable( "RelEMax", &RelEMax ); |
133 |
< |
readers[i]->AddVariable( "RelETop", &RelEBottom); |
134 |
< |
readers[i]->AddVariable( "RelEBottom", &RelEBottom ); |
135 |
< |
readers[i]->AddVariable( "RelELeft", &RelELeft ); |
136 |
< |
readers[i]->AddVariable( "RelERight", &RelERight ); |
137 |
< |
readers[i]->AddVariable( "RelE2x5Max", &RelE2x5Max ); |
138 |
< |
readers[i]->AddVariable( "RelE2x5Top", &RelE2x5Top ); |
139 |
< |
readers[i]->AddVariable( "RelE2x5Bottom", &RelE2x5Bottom ); |
140 |
< |
readers[i]->AddVariable( "RelE2x5Left", &RelE2x5Left ); |
141 |
< |
readers[i]->AddVariable( "RelE2x5Right", &RelE2x5Right ); |
142 |
< |
readers[i]->AddVariable( "RelE5x5", &RelE5x5 ); |
129 |
> |
std::cout<<" ... done "<<std::endl; |
130 |
> |
|
131 |
> |
break; |
132 |
> |
|
133 |
> |
case k2011IdMVA: |
134 |
> |
|
135 |
> |
EndcapWeights = (gSystem->Getenv("CMSSW_BASE")+ |
136 |
> |
TString("/src/MitPhysics/data/TMVAClassificationPhotonID_")+ |
137 |
> |
TString("Endcap_PassPreSel_Variable_10_BDTnCuts2000_BDT.")+ |
138 |
> |
TString("weights.xml")); |
139 |
> |
BarrelWeights = (gSystem->Getenv("CMSSW_BASE")+ |
140 |
> |
TString("/src/MitPhysics/data/TMVAClassificationPhotonID_")+ |
141 |
> |
TString("Barrel_PassPreSel_Variable_10_BDTnCuts2000_BDT.")+ |
142 |
> |
TString("weights.xml")); |
143 |
> |
|
144 |
> |
// set up the variable names |
145 |
> |
mvaVars.resize(12); |
146 |
> |
varNames.push_back("HoE" ); |
147 |
> |
varNames.push_back("covIEtaIEta"); |
148 |
> |
varNames.push_back("tIso1abs" ); |
149 |
> |
varNames.push_back("tIso3abs" ); |
150 |
> |
varNames.push_back("tIso2abs" ); |
151 |
> |
varNames.push_back("R9" ); |
152 |
> |
varNames.push_back("absIsoEcal" ); |
153 |
> |
varNames.push_back("absIsoHcal" ); |
154 |
> |
varNames.push_back("NVertexes" ); |
155 |
> |
varNames.push_back("ScEta" ); |
156 |
> |
varNames.push_back("EtaWidth" ); |
157 |
> |
varNames.push_back("PhiWidth" ); |
158 |
> |
|
159 |
> |
for( unsigned int iV = 0; iV < mvaVars.size(); ++iV) { |
160 |
> |
mvaVarMapEB.insert( std::pair<std::string,unsigned int>(varNames[iV], iV) ); |
161 |
> |
mvaVarMapEE.insert( std::pair<std::string,unsigned int>(varNames[iV], iV) ); |
162 |
|
} |
163 |
|
|
164 |
< |
if(VariableType==2||VariableType==3||VariableType==4){ |
133 |
< |
readers[i]->AddVariable( "EtaWidth", &EtaWidth ); |
134 |
< |
readers[i]->AddVariable( "PhiWidth", &PhiWidth ); |
135 |
< |
readers[i]->AddVariable( "CoviEtaiPhi", &CoviEtaiPhi ); |
136 |
< |
readers[i]->AddVariable( "CoviPhiiPhi", &CoviPhiiPhi ); |
137 |
< |
if(VariableType==4){ |
138 |
< |
readers[i]->AddVariable( "NVertexes", &NVertexes ); |
139 |
< |
} |
140 |
< |
if(i==0){ |
141 |
< |
readers[i]->AddVariable( "RelPreshowerEnergy", &RelPreshowerEnergy ); |
142 |
< |
} |
143 |
< |
} |
164 |
> |
break; |
165 |
|
|
166 |
< |
if(VariableType==6){ |
167 |
< |
readers[i]->AddVariable( "HoE", &HoE ); |
147 |
< |
readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
148 |
< |
readers[i]->AddVariable( "tIso1abs", &tIso1abs ); |
149 |
< |
readers[i]->AddVariable( "tIso3abs", &tIso3abs ); |
150 |
< |
readers[i]->AddVariable( "tIso2abs", &tIso2abs ); |
151 |
< |
readers[i]->AddVariable( "R9", &R9 ); |
152 |
< |
readers[i]->AddVariable( "absIsoEcal", &absIsoEcal ); |
153 |
< |
readers[i]->AddVariable( "absIsoHcal", &absIsoHcal ); |
154 |
< |
readers[i]->AddVariable( "RelE5x5", &RelE5x5 ); |
155 |
< |
readers[i]->AddVariable( "EtaWidth", &EtaWidth ); |
156 |
< |
readers[i]->AddVariable( "PhiWidth", &PhiWidth ); |
157 |
< |
readers[i]->AddVariable( "CoviEtaiPhi", &CoviEtaiPhi ); |
158 |
< |
readers[i]->AddVariable( "CoviPhiiPhi", &CoviPhiiPhi ); |
159 |
< |
readers[i]->AddVariable( "NVertexes", &NVertexes ); |
160 |
< |
if(i==0){ |
161 |
< |
readers[i]->AddVariable( "RelPreshowerEnergy", &RelPreshowerEnergy ); |
162 |
< |
} |
163 |
< |
} |
166 |
> |
case k2012IdMVA: |
167 |
> |
case k2012IdMVA_globe: |
168 |
|
|
169 |
< |
if(VariableType==7){ |
170 |
< |
readers[i]->AddVariable( "HoE", &HoE ); |
171 |
< |
readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
172 |
< |
readers[i]->AddVariable( "tIso1abs", &tIso1abs ); |
173 |
< |
readers[i]->AddVariable( "tIso3abs", &tIso3abs ); |
174 |
< |
readers[i]->AddVariable( "tIso2abs", &tIso2abs ); |
175 |
< |
readers[i]->AddVariable( "R9", &R9 ); |
176 |
< |
readers[i]->AddVariable( "absIsoEcal", &absIsoEcal ); |
177 |
< |
readers[i]->AddVariable( "absIsoHcal", &absIsoHcal ); |
178 |
< |
readers[i]->AddVariable( "NVertexes", &NVertexes ); |
179 |
< |
readers[i]->AddVariable( "ScEta", &ScEta ); |
180 |
< |
} |
181 |
< |
|
182 |
< |
if(VariableType==10){ |
183 |
< |
readers[i]->AddVariable( "HoE", &HoE ); |
184 |
< |
readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
185 |
< |
readers[i]->AddVariable( "tIso1abs", &tIso1abs ); |
186 |
< |
readers[i]->AddVariable( "tIso3abs", &tIso3abs ); |
187 |
< |
readers[i]->AddVariable( "tIso2abs", &tIso2abs ); |
188 |
< |
readers[i]->AddVariable( "R9", &R9 ); |
189 |
< |
readers[i]->AddVariable( "absIsoEcal", &absIsoEcal ); |
190 |
< |
readers[i]->AddVariable( "absIsoHcal", &absIsoHcal ); |
191 |
< |
readers[i]->AddVariable( "NVertexes", &NVertexes ); |
192 |
< |
readers[i]->AddVariable( "ScEta", &ScEta ); |
193 |
< |
readers[i]->AddVariable( "EtaWidth", &EtaWidth ); |
194 |
< |
readers[i]->AddVariable( "PhiWidth", &PhiWidth ); |
191 |
< |
} |
192 |
< |
|
193 |
< |
if(VariableType==1201){ |
194 |
< |
readers[i]->AddVariable( "myphoton_pfchargedisogood03", &myphoton_pfchargedisogood03); |
195 |
< |
readers[i]->AddVariable( "myphoton_pfchargedisobad03", &myphoton_pfchargedisobad03); |
196 |
< |
readers[i]->AddVariable( "myphoton_pfphotoniso03", &myphoton_pfphotoniso03 ); |
197 |
< |
readers[i]->AddVariable( "myphoton_sieie", &myphoton_sieie ); |
198 |
< |
readers[i]->AddVariable( "myphoton_sieip", &myphoton_sieip ); |
199 |
< |
readers[i]->AddVariable( "myphoton_etawidth", &myphoton_etawidth ); |
200 |
< |
readers[i]->AddVariable( "myphoton_phiwidth", &myphoton_phiwidth ); |
201 |
< |
readers[i]->AddVariable( "myphoton_r9", &myphoton_r9 ); |
202 |
< |
readers[i]->AddVariable( "myphoton_s4ratio", &myphoton_s4ratio ); |
203 |
< |
readers[i]->AddVariable( "myphoton_SCeta", &myphoton_SCeta ); |
204 |
< |
readers[i]->AddVariable( "event_rho", &event_rho ); |
205 |
< |
if(i==0){ |
206 |
< |
readers[i]->AddVariable( "myphoton_ESEffSigmaRR", &myphoton_ESEffSigmaRR); |
207 |
< |
} |
169 |
> |
EndcapWeights = (gSystem->Getenv("CMSSW_BASE")+ |
170 |
> |
TString("/src/MitPhysics/data/")+ |
171 |
> |
TString("2012ICHEP_PhotonID_Endcap_BDT.")+ |
172 |
> |
TString("weights_PSCorr.xml")); |
173 |
> |
BarrelWeights = (gSystem->Getenv("CMSSW_BASE")+ |
174 |
> |
TString("/src/MitPhysics/data/")+ |
175 |
> |
TString("2012ICHEP_PhotonID_Barrel_BDT.")+ |
176 |
> |
TString("weights.xml")); |
177 |
> |
|
178 |
> |
mvaVars.resize(12); |
179 |
> |
varNames.push_back("ph.r9" ); |
180 |
> |
varNames.push_back("ph.sigietaieta" ); |
181 |
> |
varNames.push_back("ph.scetawidth" ); |
182 |
> |
varNames.push_back("ph.scphiwidth" ); |
183 |
> |
varNames.push_back("ph.idmva_CoviEtaiPhi" ); |
184 |
> |
varNames.push_back("ph.idmva_s4ratio" ); |
185 |
> |
varNames.push_back("ph.idmva_GammaIso" ); |
186 |
> |
varNames.push_back("ph.idmva_ChargedIso_selvtx" ); |
187 |
> |
varNames.push_back("ph.idmva_ChargedIso_worstvtx" ); |
188 |
> |
varNames.push_back("ph.sceta" ); |
189 |
> |
varNames.push_back("rho" ); |
190 |
> |
varNames.push_back("ph.idmva_PsEffWidthSigmaRR" ); |
191 |
> |
|
192 |
> |
for( unsigned int iV = 0; iV < mvaVars.size() - 1; ++iV) { |
193 |
> |
mvaVarMapEB.insert( std::pair<std::string,unsigned int>(varNames[iV], iV) ); |
194 |
> |
mvaVarMapEE.insert( std::pair<std::string,unsigned int>(varNames[iV], iV) ); |
195 |
|
} |
196 |
|
|
197 |
+ |
// pre-shower only used for Endcaps |
198 |
+ |
mvaVarMapEE.insert( std::pair<std::string,unsigned int> ( varNames[mvaVars.size() - 1], mvaVars.size() - 1) ); |
199 |
+ |
|
200 |
+ |
break; |
201 |
+ |
|
202 |
+ |
default: |
203 |
+ |
// no variables... better never called.. |
204 |
+ |
std::cerr<<" MVATools: Trying to initialize with unknown type."<<std::endl; |
205 |
+ |
break; |
206 |
|
} |
207 |
< |
|
207 |
> |
|
208 |
> |
|
209 |
> |
// looping over both maps and adding Vars to BDT readers |
210 |
> |
for( unsigned int iV = 0; iV < varNames.size(); ++iV ){ |
211 |
> |
std::map<std::string,unsigned int>::const_iterator it = mvaVarMapEB.find(varNames[iV]); |
212 |
> |
if ( it != mvaVarMapEB.end() ) |
213 |
> |
fReaderBarrel -> AddVariable( (it->first).c_str(), &(mvaVars[it->second])); |
214 |
> |
it = mvaVarMapEE.find(varNames[iV]); |
215 |
> |
if ( it != mvaVarMapEE.end() ) |
216 |
> |
fReaderEndcap -> AddVariable( (it->first).c_str(), &(mvaVars[it->second])); |
217 |
> |
} |
218 |
> |
|
219 |
|
fReaderEndcap->BookMVA("BDT method",EndcapWeights); |
220 |
|
fReaderBarrel->BookMVA("BDT method",BarrelWeights); |
221 |
|
|
224 |
|
|
225 |
|
} |
226 |
|
|
227 |
< |
Bool_t MVATools::PassMVASelection(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho,Float_t bdtCutBarrel, Float_t bdtCutEndcap, const ElectronCol* els, Bool_t applyElectronVeto) { |
227 |
> |
// //-------------------------------------------------------------------------------------------------- |
228 |
> |
// void MVATools::InitializeMVA(int VariableType, TString EndcapWeights,TString BarrelWeights) { |
229 |
|
|
230 |
< |
//initilize the bool value |
231 |
< |
PassMVA=kFALSE; |
230 |
> |
// if (fReaderEndcap) delete fReaderEndcap; |
231 |
> |
// if (fReaderBarrel) delete fReaderBarrel; |
232 |
|
|
233 |
< |
Float_t photon_bdt = MVATools::GetMVAbdtValueOld(p,vtx,trackCol,vtxCol, _tRho, els, applyElectronVeto); |
233 |
> |
// fReaderEndcap = new TMVA::Reader( "!Color:!Silent:Error" ); |
234 |
> |
// fReaderBarrel = new TMVA::Reader( "!Color:!Silent:Error" ); |
235 |
|
|
236 |
< |
if (isbarrel) { |
237 |
< |
if(bdt>bdtCutBarrel){ |
238 |
< |
PassMVA=kTRUE; |
239 |
< |
} |
240 |
< |
} |
241 |
< |
else { |
242 |
< |
if(bdt>bdtCutEndcap){ |
243 |
< |
PassMVA=kTRUE; |
244 |
< |
} |
245 |
< |
} |
246 |
< |
return PassMVA; |
247 |
< |
} |
248 |
< |
|
249 |
< |
//--------------------------------------------------------------------------------- |
250 |
< |
Int_t MVATools::PassElectronVetoInt(const Photon* p, const ElectronCol* els) { |
236 |
> |
// TMVA::Reader *readers[2]; |
237 |
> |
// readers[0] = fReaderEndcap; |
238 |
> |
// readers[1] = fReaderBarrel; |
239 |
> |
|
240 |
> |
// for (UInt_t i=0; i<2; ++i) { |
241 |
> |
|
242 |
> |
// if(VariableType==0||VariableType==1||VariableType==2){ |
243 |
> |
// readers[i]->AddVariable( "HoE", &HoE ); |
244 |
> |
// readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
245 |
> |
// readers[i]->AddVariable( "tIso1", &tIso1 ); |
246 |
> |
// readers[i]->AddVariable( "tIso3", &tIso3 ); |
247 |
> |
// readers[i]->AddVariable( "tIso2", &tIso2 ); |
248 |
> |
// readers[i]->AddVariable( "R9", &R9 ); |
249 |
> |
// } |
250 |
> |
|
251 |
> |
// if(VariableType==3||VariableType==4){ |
252 |
> |
// readers[i]->AddVariable( "HoE", &HoE ); |
253 |
> |
// readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
254 |
> |
// readers[i]->AddVariable( "tIso1abs", &tIso1abs ); |
255 |
> |
// readers[i]->AddVariable( "tIso3abs", &tIso3abs ); |
256 |
> |
// readers[i]->AddVariable( "tIso2abs", &tIso2abs ); |
257 |
> |
// readers[i]->AddVariable( "R9", &R9 ); |
258 |
> |
// } |
259 |
> |
|
260 |
> |
// if(VariableType==1||VariableType==2){ |
261 |
> |
// readers[i]->AddVariable( "RelIsoEcal", &RelIsoEcal ); |
262 |
> |
// readers[i]->AddVariable( "RelIsoHcal", &RelIsoHcal ); |
263 |
> |
// readers[i]->AddVariable( "RelEMax", &RelEMax ); |
264 |
> |
// readers[i]->AddVariable( "RelETop", &RelETop ); |
265 |
> |
// readers[i]->AddVariable( "RelEBottom", &RelEBottom ); |
266 |
> |
// readers[i]->AddVariable( "RelELeft", &RelELeft ); |
267 |
> |
// readers[i]->AddVariable( "RelERight", &RelERight ); |
268 |
> |
// readers[i]->AddVariable( "RelE2x5Max", &RelE2x5Max ); |
269 |
> |
// readers[i]->AddVariable( "RelE2x5Top", &RelE2x5Top ); |
270 |
> |
// readers[i]->AddVariable( "RelE2x5Bottom", &RelE2x5Bottom ); |
271 |
> |
// readers[i]->AddVariable( "RelE2x5Left", &RelE2x5Left ); |
272 |
> |
// readers[i]->AddVariable( "RelE2x5Right", &RelE2x5Right ); |
273 |
> |
// readers[i]->AddVariable( "RelE5x5", &RelE5x5 ); |
274 |
> |
// } |
275 |
> |
|
276 |
> |
// if(VariableType==3||VariableType==4){ |
277 |
> |
// readers[i]->AddVariable( "absIsoEcal", &absIsoEcal ); |
278 |
> |
// readers[i]->AddVariable( "absIsoHcal", &absIsoHcal ); |
279 |
> |
// readers[i]->AddVariable( "RelEMax", &RelEMax ); |
280 |
> |
// readers[i]->AddVariable( "RelETop", &RelEBottom); |
281 |
> |
// readers[i]->AddVariable( "RelEBottom", &RelEBottom ); |
282 |
> |
// readers[i]->AddVariable( "RelELeft", &RelELeft ); |
283 |
> |
// readers[i]->AddVariable( "RelERight", &RelERight ); |
284 |
> |
// readers[i]->AddVariable( "RelE2x5Max", &RelE2x5Max ); |
285 |
> |
// readers[i]->AddVariable( "RelE2x5Top", &RelE2x5Top ); |
286 |
> |
// readers[i]->AddVariable( "RelE2x5Bottom", &RelE2x5Bottom ); |
287 |
> |
// readers[i]->AddVariable( "RelE2x5Left", &RelE2x5Left ); |
288 |
> |
// readers[i]->AddVariable( "RelE2x5Right", &RelE2x5Right ); |
289 |
> |
// readers[i]->AddVariable( "RelE5x5", &RelE5x5 ); |
290 |
> |
// } |
291 |
> |
|
292 |
> |
// if(VariableType==2||VariableType==3||VariableType==4){ |
293 |
> |
// readers[i]->AddVariable( "EtaWidth", &EtaWidth ); |
294 |
> |
// readers[i]->AddVariable( "PhiWidth", &PhiWidth ); |
295 |
> |
// readers[i]->AddVariable( "CoviEtaiPhi", &CoviEtaiPhi ); |
296 |
> |
// readers[i]->AddVariable( "CoviPhiiPhi", &CoviPhiiPhi ); |
297 |
> |
// if(VariableType==4){ |
298 |
> |
// readers[i]->AddVariable( "NVertexes", &NVertexes ); |
299 |
> |
// } |
300 |
> |
// if(i==0){ |
301 |
> |
// readers[i]->AddVariable( "RelPreshowerEnergy", &RelPreshowerEnergy ); |
302 |
> |
// } |
303 |
> |
// } |
304 |
> |
|
305 |
> |
// if(VariableType==6){ |
306 |
> |
// readers[i]->AddVariable( "HoE", &HoE ); |
307 |
> |
// readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
308 |
> |
// readers[i]->AddVariable( "tIso1abs", &tIso1abs ); |
309 |
> |
// readers[i]->AddVariable( "tIso3abs", &tIso3abs ); |
310 |
> |
// readers[i]->AddVariable( "tIso2abs", &tIso2abs ); |
311 |
> |
// readers[i]->AddVariable( "R9", &R9 ); |
312 |
> |
// readers[i]->AddVariable( "absIsoEcal", &absIsoEcal ); |
313 |
> |
// readers[i]->AddVariable( "absIsoHcal", &absIsoHcal ); |
314 |
> |
// readers[i]->AddVariable( "RelE5x5", &RelE5x5 ); |
315 |
> |
// readers[i]->AddVariable( "EtaWidth", &EtaWidth ); |
316 |
> |
// readers[i]->AddVariable( "PhiWidth", &PhiWidth ); |
317 |
> |
// readers[i]->AddVariable( "CoviEtaiPhi", &CoviEtaiPhi ); |
318 |
> |
// readers[i]->AddVariable( "CoviPhiiPhi", &CoviPhiiPhi ); |
319 |
> |
// readers[i]->AddVariable( "NVertexes", &NVertexes ); |
320 |
> |
// if(i==0){ |
321 |
> |
// readers[i]->AddVariable( "RelPreshowerEnergy", &RelPreshowerEnergy ); |
322 |
> |
// } |
323 |
> |
// } |
324 |
> |
|
325 |
> |
// if(VariableType==7){ |
326 |
> |
// readers[i]->AddVariable( "HoE", &HoE ); |
327 |
> |
// readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
328 |
> |
// readers[i]->AddVariable( "tIso1abs", &tIso1abs ); |
329 |
> |
// readers[i]->AddVariable( "tIso3abs", &tIso3abs ); |
330 |
> |
// readers[i]->AddVariable( "tIso2abs", &tIso2abs ); |
331 |
> |
// readers[i]->AddVariable( "R9", &R9 ); |
332 |
> |
// readers[i]->AddVariable( "absIsoEcal", &absIsoEcal ); |
333 |
> |
// readers[i]->AddVariable( "absIsoHcal", &absIsoHcal ); |
334 |
> |
// readers[i]->AddVariable( "NVertexes", &NVertexes ); |
335 |
> |
// readers[i]->AddVariable( "ScEta", &ScEta ); |
336 |
> |
// } |
337 |
> |
|
338 |
> |
// if(VariableType==10){ |
339 |
> |
// readers[i]->AddVariable( "HoE", &HoE ); |
340 |
> |
// readers[i]->AddVariable( "covIEtaIEta", &covIEtaIEta ); |
341 |
> |
// readers[i]->AddVariable( "tIso1abs", &tIso1abs ); |
342 |
> |
// readers[i]->AddVariable( "tIso3abs", &tIso3abs ); |
343 |
> |
// readers[i]->AddVariable( "tIso2abs", &tIso2abs ); |
344 |
> |
// readers[i]->AddVariable( "R9", &R9 ); |
345 |
> |
// readers[i]->AddVariable( "absIsoEcal", &absIsoEcal ); |
346 |
> |
// readers[i]->AddVariable( "absIsoHcal", &absIsoHcal ); |
347 |
> |
// readers[i]->AddVariable( "NVertexes", &NVertexes ); |
348 |
> |
// readers[i]->AddVariable( "ScEta", &ScEta ); |
349 |
> |
// readers[i]->AddVariable( "EtaWidth", &EtaWidth ); |
350 |
> |
// readers[i]->AddVariable( "PhiWidth", &PhiWidth ); |
351 |
> |
// } |
352 |
> |
|
353 |
> |
// if(VariableType==1201){ |
354 |
> |
// /*readers[i]->AddVariable( "myphoton_pfchargedisogood03", &myphoton_pfchargedisogood03); |
355 |
> |
// readers[i]->AddVariable( "myphoton_pfchargedisobad03", &myphoton_pfchargedisobad03); |
356 |
> |
// readers[i]->AddVariable( "myphoton_pfphotoniso03", &myphoton_pfphotoniso03 ); |
357 |
> |
// readers[i]->AddVariable( "myphoton_sieie", &myphoton_sieie ); |
358 |
> |
// readers[i]->AddVariable( "myphoton_sieip", &myphoton_sieip ); |
359 |
> |
// readers[i]->AddVariable( "myphoton_etawidth", &myphoton_etawidth ); |
360 |
> |
// readers[i]->AddVariable( "myphoton_phiwidth", &myphoton_phiwidth ); |
361 |
> |
// readers[i]->AddVariable( "myphoton_r9", &myphoton_r9 ); |
362 |
> |
// readers[i]->AddVariable( "myphoton_s4ratio", &myphoton_s4ratio ); |
363 |
> |
// readers[i]->AddVariable( "myphoton_SCeta", &myphoton_SCeta ); |
364 |
> |
// readers[i]->AddVariable( "event_rho", &event_rho ); |
365 |
> |
// if(i==0){ |
366 |
> |
// readers[i]->AddVariable( "myphoton_ESEffSigmaRR", &myphoton_ESEffSigmaRR); |
367 |
> |
// }*/ |
368 |
> |
// readers[i]->AddVariable( "ph.r9", &myphoton_r9 ); |
369 |
> |
// readers[i]->AddVariable( "ph.sigietaieta", &myphoton_sieie ); |
370 |
> |
// readers[i]->AddVariable( "ph.scetawidth", &myphoton_etawidth ); |
371 |
> |
// readers[i]->AddVariable( "ph.scphiwidth", &myphoton_phiwidth ); |
372 |
> |
// readers[i]->AddVariable( "ph.idmva_CoviEtaiPhi", &myphoton_sieip ); |
373 |
> |
// readers[i]->AddVariable( "ph.idmva_s4ratio", &myphoton_s4ratio ); |
374 |
> |
// readers[i]->AddVariable( "ph.idmva_GammaIso", &myphoton_pfphotoniso03 ); |
375 |
> |
// readers[i]->AddVariable( "ph.idmva_ChargedIso_selvtx", &myphoton_pfchargedisogood03); |
376 |
> |
// readers[i]->AddVariable( "ph.idmva_ChargedIso_worstvtx", &myphoton_pfchargedisobad03); |
377 |
> |
// readers[i]->AddVariable( "ph.sceta", &myphoton_SCeta ); |
378 |
> |
// readers[i]->AddVariable( "rho", &event_rho ); |
379 |
> |
// if(i==0){ |
380 |
> |
// //readers[i]->AddVariable( "1.00023*ph.idmva_PsEffWidthSigmaRR + 0.0913", &myphoton_ESEffSigmaRR); |
381 |
> |
// readers[i]->AddVariable( "ph.idmva_PsEffWidthSigmaRR", &myphoton_ESEffSigmaRR); |
382 |
> |
// } |
383 |
> |
// } |
384 |
> |
|
385 |
> |
// } |
386 |
|
|
387 |
< |
// these values are taken from the H2GGlobe code... (actually from Marco/s mail) |
388 |
< |
float cic4_allcuts_temp_sublead[] = { |
245 |
< |
3.8, 2.2, 1.77, 1.29, |
246 |
< |
11.7, 3.4, 3.9, 1.84, |
247 |
< |
3.5, 2.2, 2.3, 1.45, |
248 |
< |
0.0106, 0.0097, 0.028, 0.027, |
249 |
< |
0.082, 0.062, 0.065, 0.048, |
250 |
< |
0.94, 0.36, 0.94, 0.32, |
251 |
< |
1., 0.062, 0.97, 0.97, |
252 |
< |
1.5, 1.5, 1.5, 1.5 }; // the last line is PixelmatchVeto and un-used |
253 |
< |
|
254 |
< |
//initilize the bool value |
255 |
< |
PassElecVetoInt=0; |
256 |
< |
|
257 |
< |
dRTrack = PhotonTools::ElectronVetoCiC(p, els); |
258 |
< |
|
259 |
< |
ScEta_MVA=p->SCluster()->Eta(); |
260 |
< |
|
261 |
< |
isbarrel = (fabs(ScEta_MVA)<1.4442); |
262 |
< |
|
263 |
< |
R9 = p->R9(); |
264 |
< |
//R9 = p->E33()/p->SCluster()->RawEnergy(); |
265 |
< |
|
266 |
< |
// check which category it is ... |
267 |
< |
_tCat = 1; |
268 |
< |
if ( !isbarrel ) _tCat = 3; |
269 |
< |
if ( R9 < 0.94 ) _tCat++; |
270 |
< |
|
271 |
< |
//Electron Veto |
272 |
< |
if(dRTrack > cic4_allcuts_temp_sublead[_tCat-1+6*4]){ |
273 |
< |
PassElecVetoInt=1; |
274 |
< |
} |
387 |
> |
// fReaderEndcap->BookMVA("BDT method",EndcapWeights); |
388 |
> |
// fReaderBarrel->BookMVA("BDT method",BarrelWeights); |
389 |
|
|
390 |
< |
return PassElecVetoInt; |
390 |
> |
// assert(fReaderEndcap); |
391 |
> |
// assert(fReaderBarrel); |
392 |
|
|
393 |
< |
} |
393 |
> |
// } |
394 |
|
|
395 |
< |
//-------------------------------------------------------------------------------------------------- |
395 |
> |
// *** REMOVED THIS COMPLETELY. If a module wants to cut on BDT, it should 1,) compute the BDT value (using GetMVAbdtValue(...) ) and then make the cut itself... |
396 |
|
|
397 |
< |
Float_t MVATools::GetMVAbdtValue(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho, const PFCandidateCol *fPFCands,const ElectronCol* els,Bool_t applyElectronVeto) { |
397 |
> |
// Bool_t MVATools::PassMVASelection(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho,Float_t bdtCutBarrel, Float_t bdtCutEndcap, const ElectronCol* els, Bool_t applyElectronVeto) { |
398 |
|
|
399 |
< |
//get the variables used to compute MVA variables |
400 |
< |
ecalIso3 = p->EcalRecHitIsoDr03(); |
401 |
< |
ecalIso4 = p->EcalRecHitIsoDr04(); |
402 |
< |
hcalIso4 = p->HcalTowerSumEtDr04(); |
403 |
< |
|
404 |
< |
wVtxInd = 0; |
405 |
< |
|
406 |
< |
trackIso1 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) );//Question Ming:whyfPV->At(0) instead of selected vertex using ranking method? |
407 |
< |
|
408 |
< |
// track iso worst vtx |
409 |
< |
trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol, (!applyElectronVeto ? els : NULL) ); |
410 |
< |
|
411 |
< |
combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*_tRho; |
412 |
< |
combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*_tRho; |
413 |
< |
|
414 |
< |
RawEnergy = p->SCluster()->RawEnergy(); |
415 |
< |
|
301 |
< |
ScEta = p->SCluster()->Eta(); |
302 |
< |
|
303 |
< |
//mva varialbes v1 and v2 |
304 |
< |
tIso1 = (combIso1) *50./p->Et(); |
305 |
< |
tIso3 = (trackIso1)*50./p->Et(); |
306 |
< |
tIso2 = (combIso2) *50./(p->MomVtx(vtxCol->At(wVtxInd)->Position()).Pt()); |
307 |
< |
RelIsoEcal=(ecalIso3-0.17*_tRho)/p->Et(); |
308 |
< |
RelIsoHcal=(hcalIso4-0.17*_tRho)/p->Et(); |
309 |
< |
|
310 |
< |
//compute mva variables for v3 |
311 |
< |
HoE = p->HadOverEm(); |
312 |
< |
covIEtaIEta = p->CoviEtaiEta(); |
313 |
< |
tIso1abs = combIso1; |
314 |
< |
tIso3abs = trackIso1; |
315 |
< |
tIso2abs = combIso2; |
316 |
< |
R9 = p->R9(); |
317 |
< |
|
318 |
< |
absIsoEcal=(ecalIso3-0.17*_tRho); |
319 |
< |
absIsoHcal=(hcalIso4-0.17*_tRho); |
320 |
< |
RelEMax=p->SCluster()->Seed()->EMax()/RawEnergy; |
321 |
< |
RelETop=p->SCluster()->Seed()->ETop()/RawEnergy; |
322 |
< |
RelEBottom=p->SCluster()->Seed()->EBottom()/RawEnergy; |
323 |
< |
RelELeft=p->SCluster()->Seed()->ELeft()/RawEnergy; |
324 |
< |
RelERight=p->SCluster()->Seed()->ERight()/RawEnergy; |
325 |
< |
RelE2x5Max=p->SCluster()->Seed()->E2x5Max()/RawEnergy; |
326 |
< |
RelE2x5Top=p->SCluster()->Seed()->E2x5Top()/RawEnergy; |
327 |
< |
RelE2x5Bottom=p->SCluster()->Seed()->E2x5Bottom()/RawEnergy; |
328 |
< |
RelE2x5Left=p->SCluster()->Seed()->E2x5Left()/RawEnergy; |
329 |
< |
RelE2x5Right=p->SCluster()->Seed()->E2x5Right()/RawEnergy; |
330 |
< |
RelE5x5=p->SCluster()->Seed()->E5x5()/RawEnergy; |
331 |
< |
|
332 |
< |
EtaWidth=p->EtaWidth(); |
333 |
< |
PhiWidth=p->PhiWidth(); |
334 |
< |
CoviEtaiPhi=p->SCluster()->Seed()->CoviEtaiPhi(); |
335 |
< |
CoviPhiiPhi=p->SCluster()->Seed()->CoviPhiiPhi(); |
336 |
< |
|
337 |
< |
RelPreshowerEnergy=p->SCluster()->PreshowerEnergy()/RawEnergy; |
338 |
< |
NVertexes=vtxCol->GetEntries(); |
339 |
< |
|
340 |
< |
//spectator variables |
341 |
< |
Pt_MVA=p->Pt(); |
342 |
< |
ScEta_MVA=p->SCluster()->Eta(); |
343 |
< |
|
344 |
< |
// |
345 |
< |
|
346 |
< |
isbarrel = (fabs(ScEta_MVA)<1.4442); |
347 |
< |
|
348 |
< |
//variable 1201 |
349 |
< |
myphoton_pfchargedisogood03=IsolationTools::PFChargedIsolation(p,vtx,0.3,0,fPFCands); |
350 |
< |
myphoton_pfchargedisobad03=IsolationTools::PFChargedIsolation(p,vtx,0.3,0,fPFCands,&wVtxInd,vtxCol); |
351 |
< |
myphoton_pfphotoniso03=IsolationTools::PFGammaIsolation(p,0.3,0,fPFCands); |
352 |
< |
myphoton_sieie=covIEtaIEta; |
353 |
< |
myphoton_sieip=CoviEtaiPhi; |
354 |
< |
myphoton_etawidth=EtaWidth; |
355 |
< |
myphoton_phiwidth=PhiWidth; |
356 |
< |
myphoton_r9=R9; |
357 |
< |
myphoton_s4ratio=p->SCluster()->Seed()->E2x2()/p->SCluster()->Seed()->E5x5(); |
358 |
< |
myphoton_SCeta=ScEta_MVA; |
359 |
< |
event_rho= _tRho; |
399 |
> |
// //initilize the bool value |
400 |
> |
// PassMVA=kFALSE; |
401 |
> |
|
402 |
> |
// Float_t photon_bdt = MVATools::GetMVAbdtValue_2011(p,vtx,trackCol,vtxCol, _tRho, els, applyElectronVeto); |
403 |
> |
|
404 |
> |
// if (isbarrel) { |
405 |
> |
// if(photon_bdt>bdtCutBarrel){ |
406 |
> |
// PassMVA=kTRUE; |
407 |
> |
// } |
408 |
> |
// } |
409 |
> |
// else { |
410 |
> |
// if(photon_bdt>bdtCutEndcap){ |
411 |
> |
// PassMVA=kTRUE; |
412 |
> |
// } |
413 |
> |
// } |
414 |
> |
// return PassMVA; |
415 |
> |
// } |
416 |
|
|
417 |
< |
myphoton_ESEffSigmaRR=-99; |
417 |
> |
// //--------------------------------------------------------------------------------- |
418 |
> |
// Int_t MVATools::PassElectronVetoInt(const Photon* p, const ElectronCol* els) { |
419 |
> |
|
420 |
> |
// // these values are taken from the H2GGlobe code... (actually from Marco/s mail) |
421 |
> |
// float cic4_allcuts_temp_sublead[] = { |
422 |
> |
// 3.8, 2.2, 1.77, 1.29, |
423 |
> |
// 11.7, 3.4, 3.9, 1.84, |
424 |
> |
// 3.5, 2.2, 2.3, 1.45, |
425 |
> |
// 0.0106, 0.0097, 0.028, 0.027, |
426 |
> |
// 0.082, 0.062, 0.065, 0.048, |
427 |
> |
// 0.94, 0.36, 0.94, 0.32, |
428 |
> |
// 1., 0.062, 0.97, 0.97, |
429 |
> |
// 1.5, 1.5, 1.5, 1.5 }; // the last line is PixelmatchVeto and un-used |
430 |
> |
|
431 |
> |
// //initilize the bool value |
432 |
> |
// PassElecVetoInt=0; |
433 |
> |
|
434 |
> |
// dRTrack = PhotonTools::ElectronVetoCiC(p, els); |
435 |
> |
|
436 |
> |
// ScEta_MVA=p->SCluster()->Eta(); |
437 |
> |
|
438 |
> |
// isbarrel = (fabs(ScEta_MVA)<1.4442); |
439 |
|
|
440 |
< |
if(!isbarrel){ |
441 |
< |
myphoton_ESEffSigmaRR=float(sqrt((p->SCluster()->PsEffWidthSigmaXX())*(p->SCluster()->PsEffWidthSigmaXX())+(p->SCluster()->PsEffWidthSigmaYY())*(p->SCluster()->PsEffWidthSigmaYY()))); |
365 |
< |
} |
366 |
< |
|
367 |
< |
if (isbarrel) { |
368 |
< |
reader = fReaderBarrel; |
369 |
< |
} |
370 |
< |
else { |
371 |
< |
reader = fReaderEndcap; |
372 |
< |
} |
440 |
> |
// R9 = p->R9(); |
441 |
> |
// //R9 = p->E33()/p->SCluster()->RawEnergy(); |
442 |
|
|
443 |
< |
assert(reader); |
443 |
> |
// // check which category it is ... |
444 |
> |
// _tCat = 1; |
445 |
> |
// if ( !isbarrel ) _tCat = 3; |
446 |
> |
// if ( R9 < 0.94 ) _tCat++; |
447 |
> |
|
448 |
> |
// //Electron Veto |
449 |
> |
// if(dRTrack > cic4_allcuts_temp_sublead[_tCat-1+6*4]){ |
450 |
> |
// PassElecVetoInt=1; |
451 |
> |
// } |
452 |
> |
|
453 |
> |
// return PassElecVetoInt; |
454 |
> |
|
455 |
> |
// } |
456 |
|
|
457 |
< |
bdt = reader->EvaluateMVA("BDT method"); |
457 |
> |
//-------------------------------------------------------------------------------------------------- |
458 |
|
|
378 |
– |
/* printf("HoE: %f\n",HoE); |
379 |
– |
printf("covIEtaIEta: %f\n",covIEtaIEta); |
380 |
– |
printf("tIso1abs: %f\n",tIso1abs); |
381 |
– |
printf("tIso3abs: %f\n",tIso3abs); |
382 |
– |
printf("tIso2abs: %f\n",tIso2abs); |
383 |
– |
|
384 |
– |
printf("absIsoEcal: %f\n",absIsoEcal); |
385 |
– |
printf("absIsoHcal: %f\n",absIsoHcal); |
386 |
– |
printf("RelEMax: %f\n",RelEMax); |
387 |
– |
printf("RelETop: %f\n",RelETop); |
388 |
– |
printf("RelEBottom: %f\n",RelEBottom); |
389 |
– |
printf("RelELeft: %f\n",RelELeft); |
390 |
– |
printf("RelERight: %f\n",RelERight); |
391 |
– |
printf("RelE2x5Max: %f\n",RelE2x5Max); |
392 |
– |
printf("RelE2x5Top: %f\n",RelE2x5Top); |
393 |
– |
printf("RelE2x5Bottom: %f\n",RelE2x5Bottom); |
394 |
– |
printf("RelE2x5Left: %f\n",RelE2x5Left); |
395 |
– |
printf("RelE2x5Right;: %f\n",RelE2x5Right); |
396 |
– |
printf("RelE5x5: %f\n",RelE5x5); |
397 |
– |
|
398 |
– |
printf("EtaWidth: %f\n",EtaWidth); |
399 |
– |
printf("PhiWidth: %f\n",PhiWidth); |
400 |
– |
printf("CoviEtaiPhi: %f\n",CoviEtaiPhi); |
401 |
– |
printf("CoviPhiiPhi: %f\n",CoviPhiiPhi); |
402 |
– |
|
403 |
– |
if (!isbarrel) { |
404 |
– |
printf("RelPreshowerEnergy: %f\n",RelPreshowerEnergy); |
405 |
– |
}*/ |
406 |
– |
|
407 |
– |
return bdt; |
408 |
– |
} |
459 |
|
|
460 |
< |
Float_t MVATools::GetMVAbdtValueOld(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho,const ElectronCol* els,Bool_t applyElectronVeto) { |
411 |
< |
|
412 |
< |
//get the variables used to compute MVA variables |
413 |
< |
ecalIso3 = p->EcalRecHitIsoDr03(); |
414 |
< |
ecalIso4 = p->EcalRecHitIsoDr04(); |
415 |
< |
hcalIso4 = p->HcalTowerSumEtDr04(); |
416 |
< |
|
417 |
< |
wVtxInd = 0; |
418 |
< |
|
419 |
< |
trackIso1 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) );//Question Ming:whyfPV->At(0) instead of selected vertex using ranking method? |
420 |
< |
|
421 |
< |
// track iso worst vtx |
422 |
< |
trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol, (!applyElectronVeto ? els : NULL) ); |
423 |
< |
|
424 |
< |
combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*_tRho; |
425 |
< |
combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*_tRho; |
426 |
< |
|
427 |
< |
RawEnergy = p->SCluster()->RawEnergy(); |
428 |
< |
|
429 |
< |
ScEta = p->SCluster()->Eta(); |
430 |
< |
|
431 |
< |
//mva varialbes v1 and v2 |
432 |
< |
tIso1 = (combIso1) *50./p->Et(); |
433 |
< |
tIso3 = (trackIso1)*50./p->Et(); |
434 |
< |
tIso2 = (combIso2) *50./(p->MomVtx(vtxCol->At(wVtxInd)->Position()).Pt()); |
435 |
< |
RelIsoEcal=(ecalIso3-0.17*_tRho)/p->Et(); |
436 |
< |
RelIsoHcal=(hcalIso4-0.17*_tRho)/p->Et(); |
437 |
< |
|
438 |
< |
//compute mva variables for v3 |
439 |
< |
HoE = p->HadOverEm(); |
440 |
< |
covIEtaIEta = p->CoviEtaiEta(); |
441 |
< |
tIso1abs = combIso1; |
442 |
< |
tIso3abs = trackIso1; |
443 |
< |
tIso2abs = combIso2; |
444 |
< |
R9 = p->R9(); |
445 |
< |
|
446 |
< |
absIsoEcal=(ecalIso3-0.17*_tRho); |
447 |
< |
absIsoHcal=(hcalIso4-0.17*_tRho); |
448 |
< |
RelEMax=p->SCluster()->Seed()->EMax()/RawEnergy; |
449 |
< |
RelETop=p->SCluster()->Seed()->ETop()/RawEnergy; |
450 |
< |
RelEBottom=p->SCluster()->Seed()->EBottom()/RawEnergy; |
451 |
< |
RelELeft=p->SCluster()->Seed()->ELeft()/RawEnergy; |
452 |
< |
RelERight=p->SCluster()->Seed()->ERight()/RawEnergy; |
453 |
< |
RelE2x5Max=p->SCluster()->Seed()->E2x5Max()/RawEnergy; |
454 |
< |
RelE2x5Top=p->SCluster()->Seed()->E2x5Top()/RawEnergy; |
455 |
< |
RelE2x5Bottom=p->SCluster()->Seed()->E2x5Bottom()/RawEnergy; |
456 |
< |
RelE2x5Left=p->SCluster()->Seed()->E2x5Left()/RawEnergy; |
457 |
< |
RelE2x5Right=p->SCluster()->Seed()->E2x5Right()/RawEnergy; |
458 |
< |
RelE5x5=p->SCluster()->Seed()->E5x5()/RawEnergy; |
459 |
< |
|
460 |
< |
EtaWidth=p->EtaWidth(); |
461 |
< |
PhiWidth=p->PhiWidth(); |
462 |
< |
CoviEtaiPhi=p->SCluster()->Seed()->CoviEtaiPhi(); |
463 |
< |
CoviPhiiPhi=p->SCluster()->Seed()->CoviPhiiPhi(); |
464 |
< |
|
465 |
< |
RelPreshowerEnergy=p->SCluster()->PreshowerEnergy()/RawEnergy; |
466 |
< |
NVertexes=vtxCol->GetEntries(); |
467 |
< |
|
468 |
< |
//spectator variables |
469 |
< |
Pt_MVA=p->Pt(); |
470 |
< |
ScEta_MVA=p->SCluster()->Eta(); |
460 |
> |
Double_t MVATools::GetMVAbdtValue(const Photon* p, const Vertex* vtx, const TrackCol* trackCol, const VertexCol* vtxCol, Double_t _tRho, const PFCandidateCol *fPFCands, const ElectronCol* els, Bool_t applyElectronVeto) { |
461 |
|
|
462 |
< |
// |
462 |
> |
// if there's no reader, or the type is kNone, return the default values of -99. |
463 |
> |
if( ( !fReaderBarrel || !fReaderEndcap ) || fMVAType == kNone ) return -99.; |
464 |
|
|
465 |
< |
isbarrel = (fabs(ScEta_MVA)<1.4442); |
465 |
> |
// we compute the variable names... make sure no confilcts when adding new variables... |
466 |
|
|
467 |
< |
if (isbarrel) { |
468 |
< |
reader = fReaderBarrel; |
467 |
> |
// check if it's a Barrel or EE photon |
468 |
> |
bool isBarrel = ( p->SCluster()->AbsEta() < 1.5 ); |
469 |
> |
|
470 |
> |
std::map<std::string,unsigned int>* theVars = ( isBarrel ? &mvaVarMapEB : &mvaVarMapEB ); |
471 |
> |
|
472 |
> |
// loop over all the variables in the map... and keep count (to make sure we have filled all variables) |
473 |
> |
unsigned int varCounter = 0; |
474 |
> |
for( std::map<std::string,unsigned int>::const_iterator iV = theVars->begin(); iV != theVars->end(); ++iV ) { |
475 |
> |
|
476 |
> |
TString theVarName = TString(iV->first); |
477 |
> |
float* theVarValue = &(mvaVars[iV->second]); // pointer to the variable... |
478 |
> |
|
479 |
> |
if( |
480 |
> |
!theVarName.CompareTo("HoE") |
481 |
> |
) { |
482 |
> |
(*theVarValue) = p->HadOverEm(); |
483 |
> |
varCounter++; |
484 |
> |
} else if ( |
485 |
> |
!theVarName.CompareTo("covIEtaIEta") || !theVarName.CompareTo("ph.sigietaieta") || !theVarName.CompareTo("sigieie") |
486 |
> |
) { |
487 |
> |
(*theVarValue) = p->CoviEtaiEta(); |
488 |
> |
varCounter++; |
489 |
> |
} else if ( |
490 |
> |
!theVarName.CompareTo("R9") || !theVarName.CompareTo("ph.r9") || !theVarName.CompareTo("r9") |
491 |
> |
) { |
492 |
> |
(*theVarValue) = p->R9(); |
493 |
> |
varCounter++; |
494 |
> |
} else if ( |
495 |
> |
!theVarName.CompareTo("ScEta") || !theVarName.CompareTo("ph.sceta") || !theVarName.CompareTo("sceta") |
496 |
> |
) { |
497 |
> |
(*theVarValue) = p->SCluster()->Eta(); |
498 |
> |
varCounter++; |
499 |
> |
} else if ( |
500 |
> |
!theVarName.CompareTo("rho") |
501 |
> |
) { |
502 |
> |
(*theVarValue) = _tRho; |
503 |
> |
varCounter++; |
504 |
> |
} else if ( |
505 |
> |
!theVarName.CompareTo("tIso1abs") |
506 |
> |
) { |
507 |
> |
double _ecalIso3 = p->EcalRecHitIsoDr03(); |
508 |
> |
double _hcalIso4 = p->HcalTowerSumEtDr04(); |
509 |
> |
double _trackIso1 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) );//Question Ming:whyfPV->At(0) instead of selected vertex using ranking method? |
510 |
> |
(*theVarValue) = _ecalIso3+_hcalIso4+_trackIso1 - 0.17*_tRho; |
511 |
> |
varCounter++; |
512 |
> |
} else if ( |
513 |
> |
!theVarName.CompareTo("tIso2abs") |
514 |
> |
) { |
515 |
> |
double _ecalIso4 = p->EcalRecHitIsoDr04(); |
516 |
> |
double _hcalIso4 = p->HcalTowerSumEtDr04(); |
517 |
> |
unsigned int wVtxInd = 0; |
518 |
> |
double _trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol, (!applyElectronVeto ? els : NULL) ); |
519 |
> |
(*theVarValue) = _ecalIso4+_hcalIso4+_trackIso2 - 0.52*_tRho; |
520 |
> |
varCounter++; |
521 |
> |
} else if ( |
522 |
> |
!theVarName.CompareTo("tIso3abs") |
523 |
> |
) { |
524 |
> |
(*theVarValue) = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) ); |
525 |
> |
varCounter++; |
526 |
> |
} else if ( |
527 |
> |
!theVarName.CompareTo("absIsoEcal") |
528 |
> |
) { |
529 |
> |
double _ecalIso3 = p->EcalRecHitIsoDr03(); |
530 |
> |
(*theVarValue) = (_ecalIso3-0.17*_tRho); |
531 |
> |
varCounter++; |
532 |
> |
} else if ( |
533 |
> |
!theVarName.CompareTo("absIsoHcal") |
534 |
> |
) { |
535 |
> |
double _hcalIso4 = p->HcalTowerSumEtDr04(); |
536 |
> |
(*theVarValue) = (_hcalIso4-0.17*_tRho); |
537 |
> |
varCounter++; |
538 |
> |
} else if ( |
539 |
> |
!theVarName.CompareTo("NVertexes") |
540 |
> |
) { |
541 |
> |
|
542 |
> |
(*theVarValue) = vtxCol->GetEntries(); |
543 |
> |
varCounter++; |
544 |
> |
} else if ( |
545 |
> |
!theVarName.CompareTo("EtaWidth") || !theVarName.CompareTo("ph.scetawidth") || !theVarName.CompareTo("sigeta") |
546 |
> |
) { |
547 |
> |
(*theVarValue) = p->EtaWidth(); |
548 |
> |
varCounter++; |
549 |
> |
} else if ( |
550 |
> |
!theVarName.CompareTo("PhiWidth") || !theVarName.CompareTo("ph.scphiwidth") || !theVarName.CompareTo("sigphi") |
551 |
> |
) { |
552 |
> |
(*theVarValue) = p->PhiWidth(); |
553 |
> |
varCounter++; |
554 |
> |
|
555 |
> |
} else if ( |
556 |
> |
!theVarName.CompareTo("ph.idmva_CoviEtaiPhi") || !theVarName.CompareTo("covieip") |
557 |
> |
) { |
558 |
> |
(*theVarValue) = p->SCluster()->Seed()->CoviEtaiPhi(); |
559 |
> |
varCounter++; |
560 |
> |
} else if ( |
561 |
> |
!theVarName.CompareTo("ph.idmva_s4ratio") || !theVarName.CompareTo("s4r") |
562 |
> |
) { |
563 |
> |
(*theVarValue) = p->S4Ratio(); |
564 |
> |
varCounter++; |
565 |
> |
} else if ( |
566 |
> |
!theVarName.CompareTo("ph.idmva_GammaIso") || !theVarName.CompareTo("pfgiso") |
567 |
> |
) { |
568 |
> |
(*theVarValue) = IsolationTools::PFGammaIsolation(p,0.3,0,fPFCands); |
569 |
> |
varCounter++; |
570 |
> |
} else if ( |
571 |
> |
!theVarName.CompareTo("ph.idmva_ChargedIso_selvtx") || !theVarName.CompareTo("pfciso") |
572 |
> |
) { |
573 |
> |
(*theVarValue) = IsolationTools::PFChargedIsolation(p,vtx,0.3,0,fPFCands); |
574 |
> |
varCounter++; |
575 |
> |
} else if ( |
576 |
> |
!theVarName.CompareTo("ph.idmva_ChargedIso_worstvtx") |
577 |
> |
) { |
578 |
> |
unsigned int wVtxInd = 0; |
579 |
> |
(*theVarValue) = IsolationTools::PFChargedIsolation(p,vtx,0.3,0,fPFCands,&wVtxInd,vtxCol); |
580 |
> |
varCounter++; |
581 |
> |
} else if ( |
582 |
> |
!theVarName.CompareTo("ph.idmva_PsEffWidthSigmaRR") |
583 |
> |
) { |
584 |
> |
(*theVarValue) = p->EffSigmaRR(); |
585 |
> |
varCounter++; |
586 |
> |
} else if ( |
587 |
> |
!theVarName.CompareTo("rawe") |
588 |
> |
) { |
589 |
> |
(*theVarValue) = p->SCluster()->RawEnergy(); |
590 |
> |
varCounter++; |
591 |
> |
} else { |
592 |
> |
// a variable is not know... copmplain! |
593 |
> |
std::cerr<<" ERROR: MVA Evaluation called with unknown variable name >"<<theVarName<<">."<<std::endl; |
594 |
> |
} |
595 |
|
} |
596 |
< |
else { |
596 |
> |
|
597 |
> |
// now all the variables should be filled... check! |
598 |
> |
if( varCounter != theVars->size() ) |
599 |
> |
std::cerr<<" ERROR: MVA Evaludation called and not all variables are filled."<<std::endl; |
600 |
> |
|
601 |
> |
// we're ready to compute the MVA value |
602 |
> |
TMVA::Reader* reader = NULL; |
603 |
> |
if (isBarrel) |
604 |
> |
reader = fReaderBarrel; |
605 |
> |
else |
606 |
|
reader = fReaderEndcap; |
481 |
– |
} |
607 |
|
|
608 |
|
assert(reader); |
484 |
– |
|
485 |
– |
bdt = reader->EvaluateMVA("BDT method"); |
486 |
– |
|
487 |
– |
/* printf("HoE: %f\n",HoE); |
488 |
– |
printf("covIEtaIEta: %f\n",covIEtaIEta); |
489 |
– |
printf("tIso1abs: %f\n",tIso1abs); |
490 |
– |
printf("tIso3abs: %f\n",tIso3abs); |
491 |
– |
printf("tIso2abs: %f\n",tIso2abs); |
492 |
– |
|
493 |
– |
printf("absIsoEcal: %f\n",absIsoEcal); |
494 |
– |
printf("absIsoHcal: %f\n",absIsoHcal); |
495 |
– |
printf("RelEMax: %f\n",RelEMax); |
496 |
– |
printf("RelETop: %f\n",RelETop); |
497 |
– |
printf("RelEBottom: %f\n",RelEBottom); |
498 |
– |
printf("RelELeft: %f\n",RelELeft); |
499 |
– |
printf("RelERight: %f\n",RelERight); |
500 |
– |
printf("RelE2x5Max: %f\n",RelE2x5Max); |
501 |
– |
printf("RelE2x5Top: %f\n",RelE2x5Top); |
502 |
– |
printf("RelE2x5Bottom: %f\n",RelE2x5Bottom); |
503 |
– |
printf("RelE2x5Left: %f\n",RelE2x5Left); |
504 |
– |
printf("RelE2x5Right;: %f\n",RelE2x5Right); |
505 |
– |
printf("RelE5x5: %f\n",RelE5x5); |
506 |
– |
|
507 |
– |
printf("EtaWidth: %f\n",EtaWidth); |
508 |
– |
printf("PhiWidth: %f\n",PhiWidth); |
509 |
– |
printf("CoviEtaiPhi: %f\n",CoviEtaiPhi); |
510 |
– |
printf("CoviPhiiPhi: %f\n",CoviPhiiPhi); |
511 |
– |
|
512 |
– |
if (!isbarrel) { |
513 |
– |
printf("RelPreshowerEnergy: %f\n",RelPreshowerEnergy); |
514 |
– |
}*/ |
609 |
|
|
610 |
< |
return bdt; |
610 |
> |
return (reader->EvaluateMVA("BDT method")); |
611 |
|
} |
612 |
+ |
|
613 |
+ |
// Float_t MVATools::GetMVAbdtValue_2012_globe(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho, const PFCandidateCol *fPFCands,const ElectronCol* els,Bool_t applyElectronVeto) { |
614 |
+ |
|
615 |
+ |
// //get the variables used to compute MVA variables |
616 |
+ |
// ecalIso3 = p->EcalRecHitIsoDr03(); |
617 |
+ |
// ecalIso4 = p->EcalRecHitIsoDr04(); |
618 |
+ |
// hcalIso4 = p->HcalTowerSumEtDr04(); |
619 |
+ |
|
620 |
+ |
// wVtxInd = 0; |
621 |
+ |
|
622 |
+ |
// trackIso1 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) );//Question Ming:whyfPV->At(0) instead of selected vertex using ranking method? |
623 |
+ |
|
624 |
+ |
// // track iso worst vtx |
625 |
+ |
// trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol, (!applyElectronVeto ? els : NULL) ); |
626 |
+ |
|
627 |
+ |
// combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*_tRho; |
628 |
+ |
// combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*_tRho; |
629 |
+ |
|
630 |
+ |
// RawEnergy = p->SCluster()->RawEnergy(); |
631 |
+ |
|
632 |
+ |
// ScEta = p->SCluster()->Eta(); |
633 |
+ |
|
634 |
+ |
// //mva varialbes v1 and v2 |
635 |
+ |
// tIso1 = (combIso1) *50./p->Et(); |
636 |
+ |
// tIso3 = (trackIso1)*50./p->Et(); |
637 |
+ |
// tIso2 = (combIso2) *50./(p->MomVtx(vtxCol->At(wVtxInd)->Position()).Pt()); |
638 |
+ |
// RelIsoEcal=(ecalIso3-0.17*_tRho)/p->Et(); |
639 |
+ |
// RelIsoHcal=(hcalIso4-0.17*_tRho)/p->Et(); |
640 |
+ |
|
641 |
+ |
// //compute mva variables for v3 |
642 |
+ |
// HoE = p->HadOverEm(); |
643 |
+ |
// covIEtaIEta = p->CoviEtaiEta(); |
644 |
+ |
// tIso1abs = combIso1; |
645 |
+ |
// tIso3abs = trackIso1; |
646 |
+ |
// tIso2abs = combIso2; |
647 |
+ |
// R9 = p->R9(); |
648 |
+ |
|
649 |
+ |
// absIsoEcal=(ecalIso3-0.17*_tRho); |
650 |
+ |
// absIsoHcal=(hcalIso4-0.17*_tRho); |
651 |
+ |
// RelEMax=p->SCluster()->Seed()->EMax()/RawEnergy; |
652 |
+ |
// RelETop=p->SCluster()->Seed()->ETop()/RawEnergy; |
653 |
+ |
// RelEBottom=p->SCluster()->Seed()->EBottom()/RawEnergy; |
654 |
+ |
// RelELeft=p->SCluster()->Seed()->ELeft()/RawEnergy; |
655 |
+ |
// RelERight=p->SCluster()->Seed()->ERight()/RawEnergy; |
656 |
+ |
// RelE2x5Max=p->SCluster()->Seed()->E2x5Max()/RawEnergy; |
657 |
+ |
// RelE2x5Top=p->SCluster()->Seed()->E2x5Top()/RawEnergy; |
658 |
+ |
// RelE2x5Bottom=p->SCluster()->Seed()->E2x5Bottom()/RawEnergy; |
659 |
+ |
// RelE2x5Left=p->SCluster()->Seed()->E2x5Left()/RawEnergy; |
660 |
+ |
// RelE2x5Right=p->SCluster()->Seed()->E2x5Right()/RawEnergy; |
661 |
+ |
// RelE5x5=p->SCluster()->Seed()->E5x5()/RawEnergy; |
662 |
+ |
|
663 |
+ |
// EtaWidth=p->EtaWidth(); |
664 |
+ |
// PhiWidth=p->PhiWidth(); |
665 |
+ |
// CoviEtaiPhi=p->SCluster()->Seed()->CoviEtaiPhi(); |
666 |
+ |
// CoviPhiiPhi=p->SCluster()->Seed()->CoviPhiiPhi(); |
667 |
+ |
|
668 |
+ |
// RelPreshowerEnergy=p->SCluster()->PreshowerEnergy()/RawEnergy; |
669 |
+ |
// NVertexes=vtxCol->GetEntries(); |
670 |
+ |
|
671 |
+ |
// //spectator variables |
672 |
+ |
// Pt_MVA=p->Pt(); |
673 |
+ |
// ScEta_MVA=p->SCluster()->Eta(); |
674 |
+ |
|
675 |
+ |
// // |
676 |
+ |
|
677 |
+ |
// isbarrel = (fabs(ScEta_MVA)<1.4442); |
678 |
+ |
|
679 |
+ |
// //variable 1201 |
680 |
+ |
// myphoton_pfchargedisogood03=IsolationTools::PFChargedIsolation(p,vtx,0.3,0,fPFCands); |
681 |
+ |
// myphoton_pfchargedisobad03=IsolationTools::PFChargedIsolation(p,vtx,0.3,0,fPFCands,&wVtxInd,vtxCol); |
682 |
+ |
// myphoton_pfphotoniso03=IsolationTools::PFGammaIsolation(p,0.3,0,fPFCands); |
683 |
+ |
// myphoton_sieie=covIEtaIEta; |
684 |
+ |
// myphoton_sieip=CoviEtaiPhi; |
685 |
+ |
// myphoton_etawidth=EtaWidth; |
686 |
+ |
// myphoton_phiwidth=PhiWidth; |
687 |
+ |
// myphoton_r9=R9; |
688 |
+ |
// myphoton_s4ratio=p->S4Ratio(); |
689 |
+ |
// myphoton_SCeta=ScEta_MVA; |
690 |
+ |
// event_rho= _tRho; |
691 |
+ |
|
692 |
+ |
// myphoton_ESEffSigmaRR=-99; |
693 |
+ |
|
694 |
+ |
// if(!isbarrel){ |
695 |
+ |
// myphoton_ESEffSigmaRR=p->EffSigmaRR(); |
696 |
+ |
// } |
697 |
+ |
|
698 |
+ |
// if (isbarrel) { |
699 |
+ |
// reader = fReaderBarrel; |
700 |
+ |
// } |
701 |
+ |
// else { |
702 |
+ |
// reader = fReaderEndcap; |
703 |
+ |
// } |
704 |
+ |
|
705 |
+ |
// assert(reader); |
706 |
+ |
|
707 |
+ |
// double bdt = reader->EvaluateMVA("BDT method"); |
708 |
+ |
|
709 |
+ |
// /* printf("HoE: %f\n",HoE); |
710 |
+ |
// printf("covIEtaIEta: %f\n",covIEtaIEta); |
711 |
+ |
// printf("tIso1abs: %f\n",tIso1abs); |
712 |
+ |
// printf("tIso3abs: %f\n",tIso3abs); |
713 |
+ |
// printf("tIso2abs: %f\n",tIso2abs); |
714 |
+ |
|
715 |
+ |
// printf("absIsoEcal: %f\n",absIsoEcal); |
716 |
+ |
// printf("absIsoHcal: %f\n",absIsoHcal); |
717 |
+ |
// printf("RelEMax: %f\n",RelEMax); |
718 |
+ |
// printf("RelETop: %f\n",RelETop); |
719 |
+ |
// printf("RelEBottom: %f\n",RelEBottom); |
720 |
+ |
// printf("RelELeft: %f\n",RelELeft); |
721 |
+ |
// printf("RelERight: %f\n",RelERight); |
722 |
+ |
// printf("RelE2x5Max: %f\n",RelE2x5Max); |
723 |
+ |
// printf("RelE2x5Top: %f\n",RelE2x5Top); |
724 |
+ |
// printf("RelE2x5Bottom: %f\n",RelE2x5Bottom); |
725 |
+ |
// printf("RelE2x5Left: %f\n",RelE2x5Left); |
726 |
+ |
// printf("RelE2x5Right;: %f\n",RelE2x5Right); |
727 |
+ |
// printf("RelE5x5: %f\n",RelE5x5); |
728 |
+ |
|
729 |
+ |
// printf("EtaWidth: %f\n",EtaWidth); |
730 |
+ |
// printf("PhiWidth: %f\n",PhiWidth); |
731 |
+ |
// printf("CoviEtaiPhi: %f\n",CoviEtaiPhi); |
732 |
+ |
// printf("CoviPhiiPhi: %f\n",CoviPhiiPhi); |
733 |
+ |
|
734 |
+ |
// if (!isbarrel) { |
735 |
+ |
// printf("RelPreshowerEnergy: %f\n",RelPreshowerEnergy); |
736 |
+ |
// }*/ |
737 |
+ |
|
738 |
+ |
// return bdt; |
739 |
+ |
// } |
740 |
+ |
|
741 |
+ |
// Float_t MVATools::GetMVAbdtValue_2011(const Photon* p,const Vertex* vtx,const TrackCol* trackCol,const VertexCol* vtxCol,Double_t _tRho,const ElectronCol* els,Bool_t applyElectronVeto) { |
742 |
+ |
|
743 |
+ |
// //get the variables used to compute MVA variables |
744 |
+ |
// ecalIso3 = p->EcalRecHitIsoDr03(); |
745 |
+ |
// ecalIso4 = p->EcalRecHitIsoDr04(); |
746 |
+ |
// hcalIso4 = p->HcalTowerSumEtDr04(); |
747 |
+ |
|
748 |
+ |
// wVtxInd = 0; |
749 |
+ |
|
750 |
+ |
// trackIso1 = IsolationTools::CiCTrackIsolation(p,vtx, 0.3, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, NULL, NULL, (!applyElectronVeto ? els : NULL) );//Question Ming:whyfPV->At(0) instead of selected vertex using ranking method? |
751 |
+ |
|
752 |
+ |
// // track iso worst vtx |
753 |
+ |
// trackIso2 = IsolationTools::CiCTrackIsolation(p,vtx, 0.4, 0.02, 0.0, 0.0, 0.1, 1.0, trackCol, &wVtxInd,vtxCol, (!applyElectronVeto ? els : NULL) ); |
754 |
+ |
|
755 |
+ |
// combIso1 = ecalIso3+hcalIso4+trackIso1 - 0.17*_tRho; |
756 |
+ |
// combIso2 = ecalIso4+hcalIso4+trackIso2 - 0.52*_tRho; |
757 |
+ |
|
758 |
+ |
// RawEnergy = p->SCluster()->RawEnergy(); |
759 |
+ |
|
760 |
+ |
// ScEta = p->SCluster()->Eta(); |
761 |
+ |
|
762 |
+ |
// //mva varialbes v1 and v2 |
763 |
+ |
// tIso1 = (combIso1) *50./p->Et(); |
764 |
+ |
// tIso3 = (trackIso1)*50./p->Et(); |
765 |
+ |
// tIso2 = (combIso2) *50./(p->MomVtx(vtxCol->At(wVtxInd)->Position()).Pt()); |
766 |
+ |
// RelIsoEcal=(ecalIso3-0.17*_tRho)/p->Et(); |
767 |
+ |
// RelIsoHcal=(hcalIso4-0.17*_tRho)/p->Et(); |
768 |
+ |
|
769 |
+ |
// //compute mva variables for v3 |
770 |
+ |
// HoE = p->HadOverEm(); |
771 |
+ |
// covIEtaIEta = p->CoviEtaiEta(); |
772 |
+ |
// tIso1abs = combIso1; |
773 |
+ |
// tIso3abs = trackIso1; |
774 |
+ |
// tIso2abs = combIso2; |
775 |
+ |
// R9 = p->R9(); |
776 |
+ |
|
777 |
+ |
// absIsoEcal=(ecalIso3-0.17*_tRho); |
778 |
+ |
// absIsoHcal=(hcalIso4-0.17*_tRho); |
779 |
+ |
// RelEMax=p->SCluster()->Seed()->EMax()/RawEnergy; |
780 |
+ |
// RelETop=p->SCluster()->Seed()->ETop()/RawEnergy; |
781 |
+ |
// RelEBottom=p->SCluster()->Seed()->EBottom()/RawEnergy; |
782 |
+ |
// RelELeft=p->SCluster()->Seed()->ELeft()/RawEnergy; |
783 |
+ |
// RelERight=p->SCluster()->Seed()->ERight()/RawEnergy; |
784 |
+ |
// RelE2x5Max=p->SCluster()->Seed()->E2x5Max()/RawEnergy; |
785 |
+ |
// RelE2x5Top=p->SCluster()->Seed()->E2x5Top()/RawEnergy; |
786 |
+ |
// RelE2x5Bottom=p->SCluster()->Seed()->E2x5Bottom()/RawEnergy; |
787 |
+ |
// RelE2x5Left=p->SCluster()->Seed()->E2x5Left()/RawEnergy; |
788 |
+ |
// RelE2x5Right=p->SCluster()->Seed()->E2x5Right()/RawEnergy; |
789 |
+ |
// RelE5x5=p->SCluster()->Seed()->E5x5()/RawEnergy; |
790 |
+ |
|
791 |
+ |
// EtaWidth=p->EtaWidth(); |
792 |
+ |
// PhiWidth=p->PhiWidth(); |
793 |
+ |
// CoviEtaiPhi=p->SCluster()->Seed()->CoviEtaiPhi(); |
794 |
+ |
// CoviPhiiPhi=p->SCluster()->Seed()->CoviPhiiPhi(); |
795 |
+ |
|
796 |
+ |
// RelPreshowerEnergy=p->SCluster()->PreshowerEnergy()/RawEnergy; |
797 |
+ |
// NVertexes=vtxCol->GetEntries(); |
798 |
+ |
|
799 |
+ |
// //spectator variables |
800 |
+ |
// Pt_MVA=p->Pt(); |
801 |
+ |
// ScEta_MVA=p->SCluster()->Eta(); |
802 |
+ |
|
803 |
+ |
// // |
804 |
+ |
|
805 |
+ |
// isbarrel = (fabs(ScEta_MVA)<1.4442); |
806 |
+ |
|
807 |
+ |
// if (isbarrel) { |
808 |
+ |
// reader = fReaderBarrel; |
809 |
+ |
// } |
810 |
+ |
// else { |
811 |
+ |
// reader = fReaderEndcap; |
812 |
+ |
// } |
813 |
+ |
|
814 |
+ |
// assert(reader); |
815 |
+ |
|
816 |
+ |
// double bdt = reader->EvaluateMVA("BDT method"); |
817 |
+ |
|
818 |
+ |
// /* printf("HoE: %f\n",HoE); |
819 |
+ |
// printf("covIEtaIEta: %f\n",covIEtaIEta); |
820 |
+ |
// printf("tIso1abs: %f\n",tIso1abs); |
821 |
+ |
// printf("tIso3abs: %f\n",tIso3abs); |
822 |
+ |
// printf("tIso2abs: %f\n",tIso2abs); |
823 |
+ |
|
824 |
+ |
// printf("absIsoEcal: %f\n",absIsoEcal); |
825 |
+ |
// printf("absIsoHcal: %f\n",absIsoHcal); |
826 |
+ |
// printf("RelEMax: %f\n",RelEMax); |
827 |
+ |
// printf("RelETop: %f\n",RelETop); |
828 |
+ |
// printf("RelEBottom: %f\n",RelEBottom); |
829 |
+ |
// printf("RelELeft: %f\n",RelELeft); |
830 |
+ |
// printf("RelERight: %f\n",RelERight); |
831 |
+ |
// printf("RelE2x5Max: %f\n",RelE2x5Max); |
832 |
+ |
// printf("RelE2x5Top: %f\n",RelE2x5Top); |
833 |
+ |
// printf("RelE2x5Bottom: %f\n",RelE2x5Bottom); |
834 |
+ |
// printf("RelE2x5Left: %f\n",RelE2x5Left); |
835 |
+ |
// printf("RelE2x5Right;: %f\n",RelE2x5Right); |
836 |
+ |
// printf("RelE5x5: %f\n",RelE5x5); |
837 |
+ |
|
838 |
+ |
// printf("EtaWidth: %f\n",EtaWidth); |
839 |
+ |
// printf("PhiWidth: %f\n",PhiWidth); |
840 |
+ |
// printf("CoviEtaiPhi: %f\n",CoviEtaiPhi); |
841 |
+ |
// printf("CoviPhiiPhi: %f\n",CoviPhiiPhi); |
842 |
+ |
|
843 |
+ |
// if (!isbarrel) { |
844 |
+ |
// printf("RelPreshowerEnergy: %f\n",RelPreshowerEnergy); |
845 |
+ |
// }*/ |
846 |
+ |
|
847 |
+ |
// return bdt; |
848 |
+ |
// } |