CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AntiElectronIDMVA3.cc
Go to the documentation of this file.
1 #include <TFile.h>
2 #include <TMath.h>
5 
7  : isInitialized_(kFALSE),
8  methodName_("BDTG")
9 {
10  for ( unsigned i = 0; i < 16; ++i ) {
11  fTMVAReader_[i] = 0;
12  }
13 
14  verbosity_ = 1;
15 }
16 
18 {
19  for ( unsigned i = 0; i < 16; ++i ) {
20  if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
21  }
22 }
23 
40 
41 
42 void AntiElectronIDMVA3::Initialize_from_file(const std::string& methodName,
43  const std::string& oneProngNoEleMatch0Pi0woGSF_BL,
44  const std::string& oneProngNoEleMatch0Pi0wGSF_BL,
45  const std::string& oneProngNoEleMatch1Pi0woGSF_BL,
46  const std::string& oneProngNoEleMatch1Pi0wGSF_BL,
47  const std::string& oneProng0Pi0woGSF_BL,
48  const std::string& oneProng0Pi0wGSF_BL,
49  const std::string& oneProng1Pi0woGSF_BL,
50  const std::string& oneProng1Pi0wGSF_BL,
51  const std::string& oneProngNoEleMatch0Pi0woGSF_EC,
52  const std::string& oneProngNoEleMatch0Pi0wGSF_EC,
53  const std::string& oneProngNoEleMatch1Pi0woGSF_EC,
54  const std::string& oneProngNoEleMatch1Pi0wGSF_EC,
55  const std::string& oneProng0Pi0woGSF_EC,
56  const std::string& oneProng0Pi0wGSF_EC,
57  const std::string& oneProng1Pi0woGSF_EC,
58  const std::string& oneProng1Pi0wGSF_EC)
59 {
60  for ( unsigned i = 0; i < 16; ++i ) {
61  if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
62  }
63 
64  isInitialized_ = kTRUE;
65  methodName_ = methodName;
66 
67  bookMVAs();
68 
69  reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwoGwoGSF_BL], "BDTG", oneProngNoEleMatch0Pi0woGSF_BL);
70  reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwoGwGSF_BL], "BDTG", oneProngNoEleMatch0Pi0wGSF_BL);
71  reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwGwoGSF_BL], "BDTG", oneProngNoEleMatch1Pi0woGSF_BL);
72  reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwGwGSF_BL], "BDTG", oneProngNoEleMatch1Pi0wGSF_BL);
73  reco::details::loadTMVAWeights(fTMVAReader_[k_woGwoGSF_BL], "BDTG", oneProng0Pi0woGSF_BL);
74  reco::details::loadTMVAWeights(fTMVAReader_[k_woGwGSF_BL], "BDTG", oneProng0Pi0wGSF_BL);
75  reco::details::loadTMVAWeights(fTMVAReader_[k_wGwoGSF_BL], "BDTG", oneProng1Pi0woGSF_BL);
76  reco::details::loadTMVAWeights(fTMVAReader_[k_wGwGSF_BL], "BDTG", oneProng1Pi0wGSF_BL);
77  reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwoGwoGSF_EC], "BDTG", oneProngNoEleMatch0Pi0woGSF_EC);
78  reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwoGwGSF_EC], "BDTG", oneProngNoEleMatch0Pi0wGSF_EC);
79  reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwGwoGSF_EC], "BDTG", oneProngNoEleMatch1Pi0woGSF_EC);
80  reco::details::loadTMVAWeights(fTMVAReader_[k_NoEleMatchwGwGSF_EC], "BDTG", oneProngNoEleMatch1Pi0wGSF_EC);
81  reco::details::loadTMVAWeights(fTMVAReader_[k_woGwoGSF_EC], "BDTG", oneProng0Pi0woGSF_EC);
82  reco::details::loadTMVAWeights(fTMVAReader_[k_woGwGSF_EC], "BDTG", oneProng0Pi0wGSF_EC);
83  reco::details::loadTMVAWeights(fTMVAReader_[k_wGwoGSF_EC], "BDTG", oneProng1Pi0woGSF_EC);
84  reco::details::loadTMVAWeights(fTMVAReader_[k_wGwGSF_EC], "BDTG", oneProng1Pi0wGSF_EC);
85 
86 }
87 
88 void AntiElectronIDMVA3::Initialize_from_string(const std::string& methodName,
89  const std::string& oneProngNoEleMatch0Pi0woGSF_BL,
90  const std::string& oneProngNoEleMatch0Pi0wGSF_BL,
91  const std::string& oneProngNoEleMatch1Pi0woGSF_BL,
92  const std::string& oneProngNoEleMatch1Pi0wGSF_BL,
93  const std::string& oneProng0Pi0woGSF_BL,
94  const std::string& oneProng0Pi0wGSF_BL,
95  const std::string& oneProng1Pi0woGSF_BL,
96  const std::string& oneProng1Pi0wGSF_BL,
97  const std::string& oneProngNoEleMatch0Pi0woGSF_EC,
98  const std::string& oneProngNoEleMatch0Pi0wGSF_EC,
99  const std::string& oneProngNoEleMatch1Pi0woGSF_EC,
100  const std::string& oneProngNoEleMatch1Pi0wGSF_EC,
101  const std::string& oneProng0Pi0woGSF_EC,
102  const std::string& oneProng0Pi0wGSF_EC,
103  const std::string& oneProng1Pi0woGSF_EC,
104  const std::string& oneProng1Pi0wGSF_EC)
105 {
106  for ( unsigned i = 0; i < 16; ++i ) {
107  if ( fTMVAReader_[i] ) delete fTMVAReader_[i];
108  }
109 
110  isInitialized_ = kTRUE;
111  methodName_ = methodName;
112 
113  bookMVAs();
114 
115  fTMVAReader_[k_NoEleMatchwoGwoGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch0Pi0woGSF_BL.data());
116  fTMVAReader_[k_NoEleMatchwoGwGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch0Pi0wGSF_BL.data());
117  fTMVAReader_[k_NoEleMatchwGwoGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch1Pi0woGSF_BL.data());
118  fTMVAReader_[k_NoEleMatchwGwGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch1Pi0wGSF_BL.data());
119  fTMVAReader_[k_woGwoGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProng0Pi0woGSF_BL.data());
120  fTMVAReader_[k_woGwGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProng0Pi0wGSF_BL.data());
121  fTMVAReader_[k_wGwoGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProng1Pi0woGSF_BL.data());
122  fTMVAReader_[k_wGwGSF_BL]->BookMVA(TMVA::Types::kBDT, oneProng1Pi0wGSF_BL.data());
123  fTMVAReader_[k_NoEleMatchwoGwoGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch0Pi0woGSF_EC.data());
124  fTMVAReader_[k_NoEleMatchwoGwGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch0Pi0wGSF_EC.data());
125  fTMVAReader_[k_NoEleMatchwGwoGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch1Pi0woGSF_EC.data());
126  fTMVAReader_[k_NoEleMatchwGwGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProngNoEleMatch1Pi0wGSF_EC.data());
127  fTMVAReader_[k_woGwoGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProng0Pi0woGSF_EC.data());
128  fTMVAReader_[k_woGwGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProng0Pi0wGSF_EC.data());
129  fTMVAReader_[k_wGwoGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProng1Pi0woGSF_EC.data());
130  fTMVAReader_[k_wGwGSF_EC]->BookMVA(TMVA::Types::kBDT, oneProng1Pi0wGSF_EC.data());
131 
132 }
133 
135 {
136 
137  GammadEta_ = 0.;
138  GammadPhi_ = 0.;
139  GammadPt_ = 0.;
140 
142  Tau_Pt_ = 0.;
143  Tau_dCrackEta_ = 0.;
144  Tau_dCrackPhi_ = 0.;
145  Tau_EmFraction_ = 0.;
146  Tau_NumGammaCands_ = 0.;
147  Tau_HadrHoP_ = 0.;
148  Tau_HadrEoP_ = 0.;
149  Tau_VisMass_ = 0.;
150  Tau_HadrMva_ = 0.;
151  Tau_GammaEtaMom_ = 0.;
152  Tau_GammaPhiMom_ = 0.;
153  Tau_GammaEnFrac_ = 0.;
154  Tau_GSFChi2_ = 0.;
155  Tau_NumHitsVariable_ = 0.;
156  Tau_GSFTrackResol_ = 0.;
157  Tau_GSFTracklnPt_ = 0.;
158  Tau_GSFTrackEta_ = 0.;
159 
160  Elec_EtotOverPin_ = 0.;
162  Elec_Fbrem_ = 0.;
163  Elec_Chi2GSF_ = 0.;
164  Elec_GSFNumHits_ = 0.;
165  Elec_GSFTrackResol_ = 0.;
166  Elec_GSFTracklnPt_ = 0.;
167  Elec_GSFTrackEta_ = 0.;
168 
169  //TMVA::Tools::Instance();
170 
171  TMVA::Reader *readerNoEleMatchwoGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
172  readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
173  readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
174  readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
175  readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
176  readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
177  readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
178  readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
179  readerNoEleMatchwoGwoGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
180  readerNoEleMatchwoGwoGSF_BL->SetVerbose(verbosity_);
181 
182  TMVA::Reader *readerNoEleMatchwoGwGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
183  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
184  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
185  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
186  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
187  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
188  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
189  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
190  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
191  readerNoEleMatchwoGwGSF_BL->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
192  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
193  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
194  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
195  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
196  readerNoEleMatchwoGwGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
197  readerNoEleMatchwoGwGSF_BL->SetVerbose(verbosity_);
198 
199  TMVA::Reader *readerNoEleMatchwGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
200  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
201  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
202  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
203  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
204  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
205  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
206  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
207  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
208  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
209  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
210  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
211  readerNoEleMatchwGwoGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
212  readerNoEleMatchwGwoGSF_BL->SetVerbose(verbosity_);
213 
214  TMVA::Reader *readerNoEleMatchwGwGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
215  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
216  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
217  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
218  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
219  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
220  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
221  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
222  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
223  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
224  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
225  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
226  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
227  readerNoEleMatchwGwGSF_BL->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
228  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
229  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
230  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
231  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
232  readerNoEleMatchwGwGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
233  readerNoEleMatchwGwGSF_BL->SetVerbose(verbosity_);
234 
235  TMVA::Reader *readerwoGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
236  readerwoGwoGSF_BL->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
237  readerwoGwoGSF_BL->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
238  readerwoGwoGSF_BL->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
239  readerwoGwoGSF_BL->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
240  readerwoGwoGSF_BL->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
241  readerwoGwoGSF_BL->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
242  readerwoGwoGSF_BL->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
243  readerwoGwoGSF_BL->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
244  readerwoGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
245  readerwoGwoGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
246  readerwoGwoGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
247  readerwoGwoGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
248  readerwoGwoGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
249  readerwoGwoGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
250  readerwoGwoGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
251  readerwoGwoGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
252  readerwoGwoGSF_BL->SetVerbose(verbosity_);
253 
254  TMVA::Reader *readerwoGwGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
255  readerwoGwGSF_BL->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
256  readerwoGwGSF_BL->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
257  readerwoGwGSF_BL->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
258  readerwoGwGSF_BL->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
259  readerwoGwGSF_BL->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
260  readerwoGwGSF_BL->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
261  readerwoGwGSF_BL->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
262  readerwoGwGSF_BL->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
263  readerwoGwGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
264  readerwoGwGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
265  readerwoGwGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
266  readerwoGwGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
267  readerwoGwGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
268  readerwoGwGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
269  readerwoGwGSF_BL->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
270  readerwoGwGSF_BL->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
271  readerwoGwGSF_BL->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
272  readerwoGwGSF_BL->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
273  readerwoGwGSF_BL->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
274  readerwoGwGSF_BL->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
275  readerwoGwGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
276  readerwoGwGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
277  readerwoGwGSF_BL->SetVerbose(verbosity_);
278 
279  TMVA::Reader *readerwGwoGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
280  readerwGwoGSF_BL->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
281  readerwGwoGSF_BL->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
282  readerwGwoGSF_BL->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
283  readerwGwoGSF_BL->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
284  readerwGwoGSF_BL->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
285  readerwGwoGSF_BL->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
286  readerwGwoGSF_BL->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
287  readerwGwoGSF_BL->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
288  readerwGwoGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
289  readerwGwoGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
290  readerwGwoGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
291  readerwGwoGSF_BL->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
292  readerwGwoGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
293  readerwGwoGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
294  readerwGwoGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
295  readerwGwoGSF_BL->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
296  readerwGwoGSF_BL->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
297  readerwGwoGSF_BL->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
298  readerwGwoGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
299  readerwGwoGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
300  readerwGwoGSF_BL->SetVerbose(verbosity_);
301 
302  TMVA::Reader *readerwGwGSF_BL = new TMVA::Reader( "!Color:Silent:Error" );
303  readerwGwGSF_BL->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
304  readerwGwGSF_BL->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
305  readerwGwGSF_BL->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
306  readerwGwGSF_BL->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
307  readerwGwGSF_BL->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
308  readerwGwGSF_BL->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
309  readerwGwGSF_BL->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
310  readerwGwGSF_BL->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
311  readerwGwGSF_BL->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
312  readerwGwGSF_BL->AddVariable("Tau_Pt",&Tau_Pt_);
313  readerwGwGSF_BL->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
314  readerwGwGSF_BL->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
315  readerwGwGSF_BL->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
316  readerwGwGSF_BL->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
317  readerwGwGSF_BL->AddVariable("Tau_VisMass",&Tau_VisMass_);
318  readerwGwGSF_BL->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
319  readerwGwGSF_BL->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
320  readerwGwGSF_BL->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
321  readerwGwGSF_BL->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
322  readerwGwGSF_BL->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
323  readerwGwGSF_BL->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
324  readerwGwGSF_BL->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
325  readerwGwGSF_BL->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
326  readerwGwGSF_BL->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
327  readerwGwGSF_BL->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
328  readerwGwGSF_BL->AddVariable("Tau_dCrackPhi",&Tau_dCrackPhi_);
329  readerwGwGSF_BL->SetVerbose(verbosity_);
330 
332 
333  TMVA::Reader *readerNoEleMatchwoGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
334  readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
335  readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
336  readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
337  readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
338  readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
339  readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
340  readerNoEleMatchwoGwoGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
341  readerNoEleMatchwoGwoGSF_EC->SetVerbose(verbosity_);
342 
343  TMVA::Reader *readerNoEleMatchwoGwGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
344  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
345  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
346  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
347  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
348  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
349  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
350  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
351  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
352  readerNoEleMatchwoGwGSF_EC->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
353  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
354  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
355  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
356  readerNoEleMatchwoGwGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
357  readerNoEleMatchwoGwGSF_EC->SetVerbose(verbosity_);
358 
359  TMVA::Reader *readerNoEleMatchwGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
360  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
361  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
362  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
363  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
364  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
365  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
366  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
367  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
368  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
369  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
370  readerNoEleMatchwGwoGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
371  readerNoEleMatchwGwoGSF_EC->SetVerbose(verbosity_);
372 
373  TMVA::Reader *readerNoEleMatchwGwGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
374  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
375  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
376  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
377  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
378  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
379  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
380  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
381  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
382  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
383  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
384  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
385  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
386  readerNoEleMatchwGwGSF_EC->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
387  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
388  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
389  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
390  readerNoEleMatchwGwGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
391  readerNoEleMatchwGwGSF_EC->SetVerbose(verbosity_);
392 
393  TMVA::Reader *readerwoGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
394  readerwoGwoGSF_EC->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
395  readerwoGwoGSF_EC->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
396  readerwoGwoGSF_EC->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
397  readerwoGwoGSF_EC->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
398  readerwoGwoGSF_EC->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
399  readerwoGwoGSF_EC->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
400  readerwoGwoGSF_EC->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
401  readerwoGwoGSF_EC->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
402  readerwoGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
403  readerwoGwoGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
404  readerwoGwoGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
405  readerwoGwoGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
406  readerwoGwoGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
407  readerwoGwoGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
408  readerwoGwoGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
409  readerwoGwoGSF_EC->SetVerbose(verbosity_);
410 
411  TMVA::Reader *readerwoGwGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
412  readerwoGwGSF_EC->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
413  readerwoGwGSF_EC->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
414  readerwoGwGSF_EC->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
415  readerwoGwGSF_EC->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
416  readerwoGwGSF_EC->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
417  readerwoGwGSF_EC->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
418  readerwoGwGSF_EC->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
419  readerwoGwGSF_EC->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
420  readerwoGwGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
421  readerwoGwGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
422  readerwoGwGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
423  readerwoGwGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
424  readerwoGwGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
425  readerwoGwGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
426  readerwoGwGSF_EC->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
427  readerwoGwGSF_EC->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
428  readerwoGwGSF_EC->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
429  readerwoGwGSF_EC->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
430  readerwoGwGSF_EC->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
431  readerwoGwGSF_EC->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
432  readerwoGwGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
433  readerwoGwGSF_EC->SetVerbose(verbosity_);
434 
435  TMVA::Reader *readerwGwoGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
436  readerwGwoGSF_EC->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
437  readerwGwoGSF_EC->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
438  readerwGwoGSF_EC->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
439  readerwGwoGSF_EC->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
440  readerwGwoGSF_EC->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
441  readerwGwoGSF_EC->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
442  readerwGwoGSF_EC->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
443  readerwGwoGSF_EC->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
444  readerwGwoGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
445  readerwGwoGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
446  readerwGwoGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
447  readerwGwoGSF_EC->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
448  readerwGwoGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
449  readerwGwoGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
450  readerwGwoGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
451  readerwGwoGSF_EC->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
452  readerwGwoGSF_EC->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
453  readerwGwoGSF_EC->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
454  readerwGwoGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
455  readerwGwoGSF_EC->SetVerbose(verbosity_);
456 
457  TMVA::Reader *readerwGwGSF_EC = new TMVA::Reader( "!Color:Silent:Error" );
458  readerwGwGSF_EC->AddVariable("Elec_EtotOverPin",&Elec_EtotOverPin_);
459  readerwGwGSF_EC->AddVariable("Elec_EgammaOverPdif",&Elec_EgammaOverPdif_);
460  readerwGwGSF_EC->AddVariable("Elec_Fbrem",&Elec_Fbrem_);
461  readerwGwGSF_EC->AddVariable("Elec_Chi2GSF",&Elec_Chi2GSF_);
462  readerwGwGSF_EC->AddVariable("Elec_GSFNumHits",&Elec_GSFNumHits_);
463  readerwGwGSF_EC->AddVariable("Elec_GSFTrackResol",&Elec_GSFTrackResol_);
464  readerwGwGSF_EC->AddVariable("Elec_GSFTracklnPt",&Elec_GSFTracklnPt_);
465  readerwGwGSF_EC->AddVariable("Elec_GSFTrackEta",&Elec_GSFTrackEta_);
466  readerwGwGSF_EC->AddVariable("Tau_EtaAtEcalEntrance",&Tau_EtaAtEcalEntrance_);
467  readerwGwGSF_EC->AddVariable("Tau_Pt",&Tau_Pt_);
468  readerwGwGSF_EC->AddVariable("Tau_EmFraction",&Tau_EmFraction_);
469  readerwGwGSF_EC->AddVariable("Tau_NumGammaCands",&Tau_NumGammaCands_);
470  readerwGwGSF_EC->AddVariable("Tau_HadrHoP",&Tau_HadrHoP_);
471  readerwGwGSF_EC->AddVariable("Tau_HadrEoP",&Tau_HadrEoP_);
472  readerwGwGSF_EC->AddVariable("Tau_VisMass",&Tau_VisMass_);
473  readerwGwGSF_EC->AddVariable("Tau_HadrMva",&Tau_HadrMva_);
474  readerwGwGSF_EC->AddVariable("Tau_GammaEtaMom",&Tau_GammaEtaMom_);
475  readerwGwGSF_EC->AddVariable("Tau_GammaPhiMom",&Tau_GammaPhiMom_);
476  readerwGwGSF_EC->AddVariable("Tau_GammaEnFrac",&Tau_GammaEnFrac_);
477  readerwGwGSF_EC->AddVariable("Tau_GSFChi2",&Tau_GSFChi2_);
478  readerwGwGSF_EC->AddVariable("(Tau_GSFNumHits - Tau_KFNumHits)/(Tau_GSFNumHits + Tau_KFNumHits)",&Tau_NumHitsVariable_);
479  readerwGwGSF_EC->AddVariable("Tau_GSFTrackResol",&Tau_GSFTrackResol_);
480  readerwGwGSF_EC->AddVariable("Tau_GSFTracklnPt",&Tau_GSFTracklnPt_);
481  readerwGwGSF_EC->AddVariable("Tau_GSFTrackEta",&Tau_GSFTrackEta_);
482  readerwGwGSF_EC->AddVariable("Tau_dCrackEta",&Tau_dCrackEta_);
483  readerwGwGSF_EC->SetVerbose(verbosity_);
484 
485  fTMVAReader_[k_NoEleMatchwoGwoGSF_BL] = readerNoEleMatchwoGwoGSF_BL;
486  fTMVAReader_[k_NoEleMatchwoGwGSF_BL] = readerNoEleMatchwoGwGSF_BL;
487  fTMVAReader_[k_NoEleMatchwGwoGSF_BL] = readerNoEleMatchwGwoGSF_BL;
488  fTMVAReader_[k_NoEleMatchwGwGSF_BL] = readerNoEleMatchwGwGSF_BL;
489  fTMVAReader_[k_woGwoGSF_BL] = readerwoGwoGSF_BL;
490  fTMVAReader_[k_woGwGSF_BL] = readerwoGwGSF_BL;
491  fTMVAReader_[k_wGwoGSF_BL] = readerwGwoGSF_BL;
492  fTMVAReader_[k_wGwGSF_BL] = readerwGwGSF_BL;
493  fTMVAReader_[k_NoEleMatchwoGwoGSF_EC] = readerNoEleMatchwoGwoGSF_EC;
494  fTMVAReader_[k_NoEleMatchwoGwGSF_EC] = readerNoEleMatchwoGwGSF_EC;
495  fTMVAReader_[k_NoEleMatchwGwoGSF_EC] = readerNoEleMatchwGwoGSF_EC;
496  fTMVAReader_[k_NoEleMatchwGwGSF_EC] = readerNoEleMatchwGwGSF_EC;
497  fTMVAReader_[k_woGwoGSF_EC] = readerwoGwoGSF_EC;
498  fTMVAReader_[k_woGwGSF_EC] = readerwoGwGSF_EC;
499  fTMVAReader_[k_wGwoGSF_EC] = readerwGwoGSF_EC;
500  fTMVAReader_[k_wGwGSF_EC] = readerwGwGSF_EC;
501 
502 }
503 
504 double AntiElectronIDMVA3::MVAValue(Float_t TauEtaAtEcalEntrance,
505  Float_t TauPt,
506  Float_t TaudCrackEta,
507  Float_t TaudCrackPhi,
508  Float_t TauEmFraction,
509  Float_t TauSignalPFGammaCands,
510  Float_t TauLeadPFChargedHadrHoP,
511  Float_t TauLeadPFChargedHadrEoP,
512  Float_t TauVisMass,
513  Float_t TauHadrMva,
514  const std::vector<Float_t>& GammasdEta,
515  const std::vector<Float_t>& GammasdPhi,
516  const std::vector<Float_t>& GammasPt,
517  Float_t TauKFNumHits,
518  Float_t TauGSFNumHits,
519  Float_t TauGSFChi2,
520  Float_t TauGSFTrackResol,
521  Float_t TauGSFTracklnPt,
522  Float_t TauGSFTrackEta,
523  Float_t TauPhi,
524  Float_t TauSignalPFChargedCands,
525  Float_t TauHasGsf,
526  Float_t ElecEta,
527  Float_t ElecPhi,
528  Float_t ElecPt,
529  Float_t ElecEe,
530  Float_t ElecEgamma,
531  Float_t ElecPin,
532  Float_t ElecPout,
533  Float_t ElecFbrem,
534  Float_t ElecChi2GSF,
535  Float_t ElecGSFNumHits,
536  Float_t ElecGSFTrackResol,
537  Float_t ElecGSFTracklnPt,
538  Float_t ElecGSFTrackEta)
539 {
540  double sumPt = 0.;
541  double dEta = 0.;
542  double dEta2 = 0.;
543  double dPhi = 0.;
544  double dPhi2 = 0.;
545  double sumPt2 = 0.;
546  for ( unsigned int i = 0 ; i < GammasPt.size() ; ++i ) {
547  double pt_i = GammasPt[i];
548  double phi_i = GammasdPhi[i];
549  if ( GammasdPhi[i] > TMath::Pi() ) phi_i = GammasdPhi[i] - 2*TMath::Pi();
550  else if ( GammasdPhi[i] < -TMath::Pi() ) phi_i = GammasdPhi[i] + 2*TMath::Pi();
551  double eta_i = GammasdEta[i];
552  sumPt += pt_i;
553  sumPt2 += (pt_i*pt_i);
554  dEta += (pt_i*eta_i);
555  dEta2 += (pt_i*eta_i*eta_i);
556  dPhi += (pt_i*phi_i);
557  dPhi2 += (pt_i*phi_i*phi_i);
558  }
559 
560  Float_t TauGammaEnFrac = sumPt/TauPt;
561 
562  if ( sumPt > 0. ) {
563  dEta /= sumPt;
564  dPhi /= sumPt;
565  dEta2 /= sumPt;
566  dPhi2 /= sumPt;
567  }
568 
569  Float_t TauGammaEtaMom = TMath::Sqrt(dEta2)*TMath::Sqrt(TauGammaEnFrac)*TauPt;
570  Float_t TauGammaPhiMom = TMath::Sqrt(dPhi2)*TMath::Sqrt(TauGammaEnFrac)*TauPt;
571 
572  return MVAValue(TauEtaAtEcalEntrance,
573  TauPt,
574  TaudCrackEta,
575  TaudCrackPhi,
576  TauEmFraction,
577  TauSignalPFGammaCands,
578  TauLeadPFChargedHadrHoP,
579  TauLeadPFChargedHadrEoP,
580  TauVisMass,
581  TauHadrMva,
582  TauGammaEtaMom,
583  TauGammaPhiMom,
584  TauGammaEnFrac,
585  TauKFNumHits,
586  TauGSFNumHits,
587  TauGSFChi2,
588  TauGSFTrackResol,
589  TauGSFTracklnPt,
590  TauGSFTrackEta,
591  TauPhi,
592  TauSignalPFChargedCands,
593  TauHasGsf,
594  ElecEta,
595  ElecPhi,
596  ElecPt,
597  ElecEe,
598  ElecEgamma,
599  ElecPin,
600  ElecPout,
601  ElecFbrem,
602  ElecChi2GSF,
603  ElecGSFNumHits,
604  ElecGSFTrackResol,
605  ElecGSFTracklnPt,
606  ElecGSFTrackEta);
607 }
608 
609 double AntiElectronIDMVA3::MVAValue(Float_t TauEtaAtEcalEntrance,
610  Float_t TauPt,
611  Float_t TaudCrackEta,
612  Float_t TaudCrackPhi,
613  Float_t TauEmFraction,
614  Float_t TauSignalPFGammaCands,
615  Float_t TauLeadPFChargedHadrHoP,
616  Float_t TauLeadPFChargedHadrEoP,
617  Float_t TauVisMass,
618  Float_t TauHadrMva,
619  Float_t TauGammaEtaMom,
620  Float_t TauGammaPhiMom,
621  Float_t TauGammaEnFrac,
622  Float_t TauKFNumHits,
623  Float_t TauGSFNumHits,
624  Float_t TauGSFChi2,
625  Float_t TauGSFTrackResol,
626  Float_t TauGSFTracklnPt,
627  Float_t TauGSFTrackEta,
628  Float_t TauPhi,
629  Float_t TauSignalPFChargedCands,
630  Float_t TauHasGsf,
631  Float_t ElecEta,
632  Float_t ElecPhi,
633  Float_t ElecPt,
634  Float_t ElecEe,
635  Float_t ElecEgamma,
636  Float_t ElecPin,
637  Float_t ElecPout,
638  Float_t ElecFbrem,
639  Float_t ElecChi2GSF,
640  Float_t ElecGSFNumHits,
641  Float_t ElecGSFTrackResol,
642  Float_t ElecGSFTracklnPt,
643  Float_t ElecGSFTrackEta)
644 {
645 
646  if ( !isInitialized_ ) {
647  //std::cout << "Error: AntiElectronMVA not properly initialized.\n";
648  return -99.;
649  }
650 
651  Tau_EtaAtEcalEntrance_ = TauEtaAtEcalEntrance;
652  Tau_Pt_ = TauPt;
653  Tau_dCrackEta_ = TaudCrackEta;
654  Tau_dCrackPhi_ = TaudCrackPhi;
655  Tau_EmFraction_ = TMath::Max(TauEmFraction,float(0.0));
656  Tau_NumGammaCands_ = TauSignalPFGammaCands;
657  Tau_HadrHoP_ = TauLeadPFChargedHadrHoP;
658  Tau_HadrEoP_ = TauLeadPFChargedHadrEoP;
659  Tau_VisMass_ = TauVisMass;
660  Tau_HadrMva_ = TauHadrMva;
661  Tau_GammaEtaMom_ = TauGammaEtaMom;
662  Tau_GammaPhiMom_ = TauGammaPhiMom;
663  Tau_GammaEnFrac_ = TauGammaEnFrac;
664  Tau_GSFChi2_ = TauGSFChi2;
665  Tau_NumHitsVariable_ = (TauGSFNumHits-TauKFNumHits)/(TauGSFNumHits+TauKFNumHits);
666  Tau_GSFTrackResol_ = TauGSFTrackResol;
667  Tau_GSFTracklnPt_ = TauGSFTracklnPt;
668  Tau_GSFTrackEta_ = TauGSFTrackEta;
669 
670  Elec_EtotOverPin_ = (ElecEe + ElecEgamma)/ElecPin;
671  Elec_EgammaOverPdif_ = ElecEgamma/(ElecPin - ElecPout);
672  Elec_Fbrem_ = ElecFbrem;
673  Elec_Chi2GSF_ = ElecChi2GSF;
674  Elec_GSFNumHits_ = ElecGSFNumHits;
675  Elec_GSFTrackResol_ = ElecGSFTrackResol;
676  Elec_GSFTracklnPt_ = ElecGSFTracklnPt;
677  Elec_GSFTrackEta_ = ElecGSFTrackEta;
678 
679  double mva = -99.;
680  if ( TauSignalPFChargedCands == 3 ) mva = 1.0;
681  else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCands == 0 && TauHasGsf < 0.5) {
682  if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatchwoGwoGSF_BL]->EvaluateMVA(methodName_);
683  else mva = fTMVAReader_[k_NoEleMatchwoGwoGSF_EC]->EvaluateMVA(methodName_);
684  }
685  else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCands == 0 && TauHasGsf > 0.5) {
686  if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatchwoGwGSF_BL]->EvaluateMVA(methodName_);
687  else mva = fTMVAReader_[k_NoEleMatchwoGwGSF_EC]->EvaluateMVA(methodName_);
688  }
689  else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCands > 0 && TauHasGsf < 0.5) {
690  if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatchwGwoGSF_BL]->EvaluateMVA(methodName_);
691  else mva = fTMVAReader_[k_NoEleMatchwGwoGSF_EC]->EvaluateMVA(methodName_);
692  }
693  else if ( deltaR(TauEtaAtEcalEntrance, TauPhi, ElecEta, ElecPhi) > 0.3 && TauSignalPFGammaCands > 0 && TauHasGsf > 0.5) {
694  if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_NoEleMatchwGwGSF_BL]->EvaluateMVA(methodName_);
695  else mva = fTMVAReader_[k_NoEleMatchwGwGSF_EC]->EvaluateMVA(methodName_);
696  }
697  else if ( TauSignalPFGammaCands == 0 && TauHasGsf < 0.5) {
698  if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_woGwoGSF_BL]->EvaluateMVA(methodName_);
699  else mva = fTMVAReader_[k_woGwoGSF_EC]->EvaluateMVA(methodName_);
700  }
701  else if ( TauSignalPFGammaCands == 0 && TauHasGsf > 0.5) {
702  if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_woGwGSF_BL]->EvaluateMVA(methodName_);
703  else mva = fTMVAReader_[k_woGwGSF_EC]->EvaluateMVA(methodName_);
704  }
705  else if ( TauSignalPFGammaCands > 0 && TauHasGsf < 0.5) {
706  if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_wGwoGSF_BL]->EvaluateMVA(methodName_);
707  else mva = fTMVAReader_[k_wGwoGSF_EC]->EvaluateMVA(methodName_);
708  }
709  else if ( TauSignalPFGammaCands > 0 && TauHasGsf > 0.5) {
710  if ( TMath::Abs(TauEtaAtEcalEntrance) < 1.5 ) mva = fTMVAReader_[k_wGwGSF_BL]->EvaluateMVA(methodName_);
711  else mva = fTMVAReader_[k_wGwGSF_EC]->EvaluateMVA(methodName_);
712  }
713  return mva;
714 }
715 
716 
718  const reco::GsfElectron& theGsfEle)
719 
720 {
721  Float_t TauEtaAtEcalEntrance = -99.;
722  float sumEtaTimesEnergy = 0;
723  float sumEnergy = 0;
724  for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
725  reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
726  sumEtaTimesEnergy += pfcandidate->positionAtECALEntrance().eta()*pfcandidate->energy();
727  sumEnergy += pfcandidate->energy();
728  }
729  if(sumEnergy>0)TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
730 
731  Float_t TauPt = thePFTau.pt();
732  Float_t TauEmFraction = TMath::Max(thePFTau.emFraction(), (Float_t)0.);
733  Float_t TauSignalPFGammaCands = thePFTau.signalPFGammaCands().size();
734  Float_t TauLeadPFChargedHadrHoP = 0.;
735  Float_t TauLeadPFChargedHadrEoP = 0.;
736  if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
737  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
738  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
739  }
740  Float_t TauVisMass = thePFTau.mass();
741  Float_t TauHadrMva = TMath::Max(thePFTau.electronPreIDOutput(),float(-1.0));
742  std::vector<Float_t> GammasdEta;
743  std::vector<Float_t> GammasdPhi;
744  std::vector<Float_t> GammasPt;
745  for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
746  reco::PFCandidateRef gamma = thePFTau.signalPFGammaCands().at(i);
747  if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
748  GammasdEta.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
749  GammasdPhi.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
750  } else {
751  GammasdEta.push_back(gamma->eta() - thePFTau.eta());
752  GammasdPhi.push_back(gamma->phi() - thePFTau.phi());
753  }
754  GammasPt.push_back(gamma->pt());
755  }
756  Float_t TauKFNumHits = -99.;
757  if((thePFTau.leadPFChargedHadrCand()->trackRef()).isNonnull()){
758  TauKFNumHits = thePFTau.leadPFChargedHadrCand()->trackRef()->numberOfValidHits();
759  }
760  Float_t TauGSFNumHits = -99.;
761  Float_t TauGSFChi2 = -99.;
762  Float_t TauGSFTrackResol = -99.;
763  Float_t TauGSFTracklnPt = -99.;
764  Float_t TauGSFTrackEta = -99.;
765  if((thePFTau.leadPFChargedHadrCand()->gsfTrackRef()).isNonnull()){
766  TauGSFChi2 = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->normalizedChi2();
767  TauGSFNumHits = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->numberOfValidHits();
768  if ( thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt() > 0. ) {
769  TauGSFTrackResol = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->ptError()/thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt();
770  TauGSFTracklnPt = log(thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt())*TMath::Ln10();
771  }
772  TauGSFTrackEta = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->eta();
773  }
774  Float_t TauPhi = thePFTau.phi();
775  float sumPhiTimesEnergy = 0;
776  float sumEnergyPhi = 0;
777  for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
778  reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
779  sumPhiTimesEnergy += pfcandidate->positionAtECALEntrance().phi()*pfcandidate->energy();
780  sumEnergyPhi += pfcandidate->energy();
781  }
782  if(sumEnergy>0)TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
783  Float_t TaudCrackPhi = dCrackPhi(TauPhi,TauEtaAtEcalEntrance) ;
784  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance) ;
785  Float_t TauSignalPFChargedCands = thePFTau.signalPFChargedHadrCands().size();
786  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
787 
788  Float_t ElecEta = theGsfEle.eta();
789  Float_t ElecPhi = theGsfEle.phi();
790  Float_t ElecPt = theGsfEle.pt();
791  //Variables related to the electron Cluster
792  Float_t ElecEe = 0.;
793  Float_t ElecEgamma = 0.;
794  reco::SuperClusterRef pfSuperCluster = theGsfEle.pflowSuperCluster();
795  if ( pfSuperCluster.isNonnull() && pfSuperCluster.isAvailable() ) {
796  for ( reco::CaloCluster_iterator pfCluster = pfSuperCluster->clustersBegin();
797  pfCluster != pfSuperCluster->clustersEnd(); ++pfCluster ) {
798  double pfClusterEn = (*pfCluster)->energy();
799  if ( pfCluster == pfSuperCluster->clustersBegin() ) ElecEe += pfClusterEn;
800  else ElecEgamma += pfClusterEn;
801  }
802  }
803  Float_t ElecPin = TMath::Sqrt(theGsfEle.trackMomentumAtVtx().Mag2());
804  Float_t ElecPout = TMath::Sqrt(theGsfEle.trackMomentumOut().Mag2());
805  Float_t ElecFbrem = theGsfEle.fbrem();
806  //Variables related to the GsfTrack
807  Float_t ElecChi2GSF = -99.;
808  Float_t ElecGSFNumHits = -99.;
809  Float_t ElecGSFTrackResol = -99.;
810  Float_t ElecGSFTracklnPt = -99.;
811  Float_t ElecGSFTrackEta = -99.;
812  if ( theGsfEle.gsfTrack().isNonnull() ) {
813  ElecChi2GSF = (theGsfEle).gsfTrack()->normalizedChi2();
814  ElecGSFNumHits = (theGsfEle).gsfTrack()->numberOfValidHits();
815  if ( theGsfEle.gsfTrack()->pt() > 0. ) {
816  ElecGSFTrackResol = theGsfEle.gsfTrack()->ptError()/theGsfEle.gsfTrack()->pt();
817  ElecGSFTracklnPt = log(theGsfEle.gsfTrack()->pt())*TMath::Ln10();
818  }
819  ElecGSFTrackEta = theGsfEle.gsfTrack()->eta();
820  }
821 
822  return MVAValue(TauEtaAtEcalEntrance,
823  TauPt,
824  TaudCrackEta,
825  TaudCrackPhi,
826  TauEmFraction,
827  TauSignalPFGammaCands,
828  TauLeadPFChargedHadrHoP,
829  TauLeadPFChargedHadrEoP,
830  TauVisMass,
831  TauHadrMva,
832  GammasdEta,
833  GammasdPhi,
834  GammasPt,
835  TauKFNumHits,
836  TauGSFNumHits,
837  TauGSFChi2,
838  TauGSFTrackResol,
839  TauGSFTracklnPt,
840  TauGSFTrackEta,
841  TauPhi,
842  TauSignalPFChargedCands,
843  TauHasGsf,
844  ElecEta,
845  ElecPhi,
846  ElecPt,
847  ElecEe,
848  ElecEgamma,
849  ElecPin,
850  ElecPout,
851  ElecFbrem,
852  ElecChi2GSF,
853  ElecGSFNumHits,
854  ElecGSFTrackResol,
855  ElecGSFTracklnPt,
856  ElecGSFTrackEta);
857 }
858 
860 {
861  Float_t TauEtaAtEcalEntrance = -99.;
862  float sumEtaTimesEnergy = 0;
863  float sumEnergy = 0;
864  for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
865  reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
866  sumEtaTimesEnergy += pfcandidate->positionAtECALEntrance().eta()*pfcandidate->energy();
867  sumEnergy += pfcandidate->energy();
868  }
869  if(sumEnergy>0)TauEtaAtEcalEntrance = sumEtaTimesEnergy/sumEnergy;
870 
871  Float_t TauPt = thePFTau.pt();
872  Float_t TauEmFraction = TMath::Max(thePFTau.emFraction(), (Float_t)0.);
873  Float_t TauSignalPFGammaCands = thePFTau.signalPFGammaCands().size();
874  Float_t TauLeadPFChargedHadrHoP = 0.;
875  Float_t TauLeadPFChargedHadrEoP = 0.;
876  if ( thePFTau.leadPFChargedHadrCand()->p() > 0. ) {
877  TauLeadPFChargedHadrHoP = thePFTau.leadPFChargedHadrCand()->hcalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
878  TauLeadPFChargedHadrEoP = thePFTau.leadPFChargedHadrCand()->ecalEnergy()/thePFTau.leadPFChargedHadrCand()->p();
879  }
880  Float_t TauVisMass = thePFTau.mass();
881  Float_t TauHadrMva = TMath::Max(thePFTau.electronPreIDOutput(),float(-1.0));
882  std::vector<Float_t> GammasdEta;
883  std::vector<Float_t> GammasdPhi;
884  std::vector<Float_t> GammasPt;
885  for ( unsigned i = 0 ; i < thePFTau.signalPFGammaCands().size(); ++i ) {
886  reco::PFCandidateRef gamma = thePFTau.signalPFGammaCands().at(i);
887  if ( thePFTau.leadPFChargedHadrCand().isNonnull() ) {
888  GammasdEta.push_back(gamma->eta() - thePFTau.leadPFChargedHadrCand()->eta());
889  GammasdPhi.push_back(gamma->phi() - thePFTau.leadPFChargedHadrCand()->phi());
890  } else {
891  GammasdEta.push_back(gamma->eta() - thePFTau.eta());
892  GammasdPhi.push_back(gamma->phi() - thePFTau.phi());
893  }
894  GammasPt.push_back(gamma->pt());
895  }
896  Float_t TauKFNumHits = -99.;
897  if((thePFTau.leadPFChargedHadrCand()->trackRef()).isNonnull()){
898  TauKFNumHits = thePFTau.leadPFChargedHadrCand()->trackRef()->numberOfValidHits();
899  }
900  Float_t TauGSFNumHits = -99.;
901  Float_t TauGSFChi2 = -99.;
902  Float_t TauGSFTrackResol = -99.;
903  Float_t TauGSFTracklnPt = -99.;
904  Float_t TauGSFTrackEta = -99.;
905  if((thePFTau.leadPFChargedHadrCand()->gsfTrackRef()).isNonnull()){
906  TauGSFChi2 = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->normalizedChi2();
907  TauGSFNumHits = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->numberOfValidHits();
908  if ( thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt() > 0. ) {
909  TauGSFTrackResol = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->ptError()/thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt();
910  TauGSFTracklnPt = log(thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->pt())*TMath::Ln10();
911  }
912  TauGSFTrackEta = thePFTau.leadPFChargedHadrCand()->gsfTrackRef()->eta();
913  }
914  Float_t TauPhi = thePFTau.phi();
915  float sumPhiTimesEnergy = 0;
916  float sumEnergyPhi = 0;
917  for(unsigned int j = 0 ; j < (thePFTau.signalPFCands()).size() ; j++){
918  reco::PFCandidateRef pfcandidate = (thePFTau.signalPFCands()).at(j);
919  sumPhiTimesEnergy += pfcandidate->positionAtECALEntrance().phi()*pfcandidate->energy();
920  sumEnergyPhi += pfcandidate->energy();
921  }
922  if(sumEnergy>0)TauPhi = sumPhiTimesEnergy/sumEnergyPhi;
923  Float_t TaudCrackPhi = dCrackPhi(TauPhi,TauEtaAtEcalEntrance) ;
924  Float_t TaudCrackEta = dCrackEta(TauEtaAtEcalEntrance) ;
925  Float_t TauSignalPFChargedCands = thePFTau.signalPFChargedHadrCands().size();
926  Float_t TauHasGsf = thePFTau.leadPFChargedHadrCand()->gsfTrackRef().isNonnull();
927 
928  Float_t dummyElecEta = 9.9;
929 
930  return MVAValue(TauEtaAtEcalEntrance,
931  TauPt,
932  TaudCrackEta,
933  TaudCrackPhi,
934  TauEmFraction,
935  TauSignalPFGammaCands,
936  TauLeadPFChargedHadrHoP,
937  TauLeadPFChargedHadrEoP,
938  TauVisMass,
939  TauHadrMva,
940  GammasdEta,
941  GammasdPhi,
942  GammasPt,
943  TauKFNumHits,
944  TauGSFNumHits,
945  TauGSFChi2,
946  TauGSFTrackResol,
947  TauGSFTracklnPt,
948  TauGSFTrackEta,
949  TauPhi,
950  TauSignalPFChargedCands,
951  TauHasGsf,
952  dummyElecEta,
953  0.,
954  0.,
955  0.,
956  0.,
957  0.,
958  0.,
959  0.,
960  0.,
961  0.,
962  0.,
963  0.,
964  0.);
965 }
966 
967 
968 double
970  if(TMath::Abs(b)<TMath::Abs(a)) return b;
971  else return a;
972 }
973 
974 //compute the unsigned distance to the closest phi-crack in the barrel
975 double
977 
978  double pi= TMath::Pi();// 3.14159265358979323846;
979 
980  //Location of the 18 phi-cracks
981  static std::vector<double> cPhi;
982  if(cPhi.size()==0)
983  {
984  cPhi.resize(18,0);
985  cPhi[0]=2.97025;
986  for(unsigned i=1;i<=17;++i) cPhi[i]=cPhi[0]-2*i*pi/18;
987  }
988 
989  //Shift of this location if eta<0
990  double delta_cPhi=0.00638;
991 
992  double m; //the result
993 
994  if (eta>=- 1.47464 && eta<= 1.47464){
995 
996  //the location is shifted
997  if(eta<0) phi +=delta_cPhi;
998 
999  if (phi>=-pi && phi<=pi){
1000 
1001  //the problem of the extrema
1002  if (phi<cPhi[17] || phi>=cPhi[0]){
1003  if (phi<0) phi+= 2*pi;
1004  m = minimum(phi -cPhi[0],phi-cPhi[17]-2*pi);
1005  }
1006 
1007  //between these extrema...
1008  else{
1009  bool OK = false;
1010  unsigned i=16;
1011  while(!OK){
1012  if (phi<cPhi[i]){
1013  m=minimum(phi-cPhi[i+1],phi-cPhi[i]);
1014  OK=true;
1015  }
1016  else i-=1;
1017  }
1018  }
1019  }
1020  else{
1021  m=0.; //if there is a problem, we assum that we are in a crack
1022  //std::cout<<"Problem in dminphi"<<std::endl;
1023  }
1024  }
1025  else{
1026  return -99.;
1027  //std::cout<<"Encap region"<<std::endl;
1028  }
1029 
1030  return TMath::Abs(m);
1031 }
1032 
1033 //compute the unsigned distance to the closest phi-crack in the barrel
1034 double
1036 
1037  //Location of the eta-cracks
1038  double cracks[5] = {0, 4.44747e-01, 7.92824e-01, 1.14090e+00, 1.47464e+00};
1039 
1040  double m=99.; //the result
1041 
1042  for(int i=0;i<5;i++){
1043  double d = minimum(eta-cracks[i], eta+cracks[i]);
1044  if (TMath::Abs(d)<TMath::Abs(m)){
1045  m=d;
1046  }
1047  }
1048 
1049  return TMath::Abs(m);
1050 }
const double Pi
int i
Definition: DBlmapReader.cc:9
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:272
float emFraction() const
Definition: PFTau.cc:158
const PFCandidateRefVector & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:75
float fbrem() const
Definition: GsfElectron.h:639
bool isAvailable() const
Definition: Ref.h:276
T eta() const
virtual double eta() const
momentum pseudorapidity
const PFCandidateRefVector & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:73
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
virtual double mass() const
mass
void Initialize_from_file(const std::string &methodName, const std::string &oneProngNoEleMatch0Pi0woGSF_BL, const std::string &oneProngNoEleMatch0Pi0wGSF_BL, const std::string &oneProngNoEleMatch1Pi0woGSF_BL, const std::string &oneProngNoEleMatch1Pi0wGSF_BL, const std::string &oneProng0Pi0woGSF_BL, const std::string &oneProng0Pi0wGSF_BL, const std::string &oneProng1Pi0woGSF_BL, const std::string &oneProng1Pi0wGSF_BL, const std::string &oneProngNoEleMatch0Pi0woGSF_EC, const std::string &oneProngNoEleMatch0Pi0wGSF_EC, const std::string &oneProngNoEleMatch1Pi0woGSF_EC, const std::string &oneProngNoEleMatch1Pi0wGSF_EC, const std::string &oneProng0Pi0woGSF_EC, const std::string &oneProng0Pi0wGSF_EC, const std::string &oneProng1Pi0woGSF_EC, const std::string &oneProng1Pi0wGSF_EC)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
math::XYZVectorF trackMomentumOut() const
Definition: GsfElectron.h:274
double dCrackEta(double eta)
int j
Definition: DBlmapReader.cc:9
double dCrackPhi(double phi, double eta)
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
TMVA::Reader * fTMVAReader_[16]
const PFCandidateRef & leadPFChargedHadrCand() const
Definition: PFTau.cc:62
const PFCandidateRefVector & signalPFGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:79
virtual double pt() const
transverse momentum
double b
Definition: hdecay.h:120
double minimum(double a, double b)
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:76
double a
Definition: hdecay.h:121
void Initialize_from_string(const std::string &methodName, const std::string &oneProngNoEleMatch0Pi0woGSF_BL, const std::string &oneProngNoEleMatch0Pi0wGSF_BL, const std::string &oneProngNoEleMatch1Pi0woGSF_BL, const std::string &oneProngNoEleMatch1Pi0wGSF_BL, const std::string &oneProng0Pi0woGSF_BL, const std::string &oneProng0Pi0wGSF_BL, const std::string &oneProng1Pi0woGSF_BL, const std::string &oneProng1Pi0wGSF_BL, const std::string &oneProngNoEleMatch0Pi0woGSF_EC, const std::string &oneProngNoEleMatch0Pi0wGSF_EC, const std::string &oneProngNoEleMatch1Pi0woGSF_EC, const std::string &oneProngNoEleMatch1Pi0wGSF_EC, const std::string &oneProng0Pi0woGSF_EC, const std::string &oneProng0Pi0wGSF_EC, const std::string &oneProng1Pi0woGSF_EC, const std::string &oneProng1Pi0wGSF_EC)
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
double pi
double MVAValue(Float_t TauEtaAtEcalEntrance, Float_t TauPt, Float_t TaudCrackEta, Float_t TaudCrackPhi, Float_t TauEmFraction, Float_t TauSignalPFGammaCands, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauVisMass, Float_t TauHadrMva, const std::vector< Float_t > &GammasdEta, const std::vector< Float_t > &GammasdPhi, const std::vector< Float_t > &GammasPt, Float_t TauKFNumHits, Float_t TauGSFNumHits, Float_t TauGSFChi2, Float_t TauGSFTrackResol, Float_t TauGSFTracklnPt, Float_t TauGSFTrackEta, Float_t TauPhi, Float_t TauSignalPFChargedCands, Float_t TauHasGsf, Float_t ElecEta, Float_t ElecPhi, Float_t ElecPt, Float_t ElecEe, Float_t ElecEgamma, Float_t ElecPin, Float_t ElecPout, Float_t ElecFbrem, Float_t ElecChi2GSF, Float_t ElecGSFNumHits, Float_t ElecGSFTrackResol, Float_t ElecGSFTracklnPt, Float_t ElecGSFTrackEta)
float electronPreIDOutput() const
Definition: PFTau.cc:165
virtual double phi() const
momentum azimuthal angle
SuperClusterRef pflowSuperCluster() const
Definition: GsfElectron.h:174
tuple size
Write out results.
list at
Definition: asciidump.py:428
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
void loadTMVAWeights(TMVA::Reader *reader, const std::string &method, const std::string &weightFile, bool verbose=false)
Definition: DDAxes.h:10