4 #include "TMVA/Tools.h"
5 #include "TMVA/Reader.h"
12 using namespace HWWFunctions;
16 fMethodname(
"BDTG method"),
17 fIsInitialized(kFALSE)
20 for(UInt_t
i=0;
i<6; ++
i) {
29 for(UInt_t
i=0;
i<6; ++
i) {
36 TString Subdet0Pt10To20Weights ,
37 TString Subdet1Pt10To20Weights ,
38 TString Subdet2Pt10To20Weights,
39 TString Subdet0Pt20ToInfWeights,
40 TString Subdet1Pt20ToInfWeights,
41 TString Subdet2Pt20ToInfWeights) {
43 if (version != 1 && version != 2 && version != 3) {
44 edm::LogError(
"InvalidInput") <<
"[ElectronIDMVA::Initialize] Version must be 1 or 2 or 3. Aborting.";
53 for(UInt_t
i=0;
i<6; ++
i) {
56 fTMVAReader[
i] =
new TMVA::Reader(
"!Color:!Silent:Error" );
61 fTMVAReader[
i] =
new TMVA::Reader(
"!Color:!Silent:Error" );
73 }
else if (version == 2) {
74 fTMVAReader[
i] =
new TMVA::Reader(
"!Color:!Silent:Error" );
88 }
else if (version == 3) {
110 if (i == 2 || i == 5) {
136 edm::LogError(
"NotInitialized") <<
"Error: ElectronIDMVA not properly initialized.";
141 if (fabs(hww.
els_etaSC().at(ele)) < 1.0) subdet = 0;
142 else if (fabs(hww.
els_etaSC().at(ele)) < 1.479) subdet = 1;
145 if (hww.
els_p4().at(ele).Pt() > 20.0) ptBin = 1;
168 Double_t ElePt = hww.
els_p4().at(ele).pt();
169 Double_t EleEta = hww.
els_etaSC().at(ele);
203 Double_t mva = -9999;
206 if (subdet == 0 && ptBin == 0) MVABin = 0;
207 if (subdet == 1 && ptBin == 0) MVABin = 1;
208 if (subdet == 2 && ptBin == 0) MVABin = 2;
209 if (subdet == 0 && ptBin == 1) MVABin = 3;
210 if (subdet == 1 && ptBin == 1) MVABin = 4;
211 if (subdet == 2 && ptBin == 1) MVABin = 5;
212 assert(MVABin >= 0 && MVABin <= 5);
221 << hww.
els_p4().at(ele).pt() <<
" " << hww.
els_etaSC().at(ele) <<
" --> MVABin " << MVABin <<
" : "
233 << fMVAVar_EleOneOverEMinusOneOverP <<
" "
260 Double_t EleSigmaIEtaIEta,
267 Double_t EleESeedClusterOverPout,
268 Double_t EleSigmaIPhiIPhi,
270 Double_t EleOneOverEMinusOneOverP,
271 Double_t EleESeedClusterOverPIn,
277 edm::LogError(
"NotInitialized") <<
"Error: ElectronIDMVA not properly initialized.";
282 if (fabs(EleSCEta) < 1.0) subdet = 0;
283 else if (fabs(EleSCEta) < 1.479) subdet = 1;
286 if (ElePt > 20.0) ptBin = 1;
304 Double_t mva = -9999;
307 if (subdet == 0 && ptBin == 0) MVABin = 0;
308 if (subdet == 1 && ptBin == 0) MVABin = 1;
309 if (subdet == 2 && ptBin == 0) MVABin = 2;
310 if (subdet == 0 && ptBin == 1) MVABin = 3;
311 if (subdet == 1 && ptBin == 1) MVABin = 4;
312 if (subdet == 2 && ptBin == 1) MVABin = 5;
313 assert(MVABin >= 0 && MVABin <= 5);
322 Double_t EleSigmaIEtaIEta,
330 Double_t EleESeedClusterOverPout,
331 Double_t EleSigmaIPhiIPhi,
333 Double_t EleOneOverEMinusOneOverP,
334 Double_t EleESeedClusterOverPIn,
337 Double_t EleGsfTrackChi2OverNdof,
338 Double_t EledEtaCalo,
339 Double_t EledPhiCalo,
341 Double_t EleSCEtaWidth,
342 Double_t EleSCPhiWidth,
343 Double_t EleCovIEtaIPhi,
344 Double_t ElePreShowerOverRaw,
345 Double_t EleChargedIso03,
346 Double_t EleNeutralHadronIso03,
347 Double_t EleGammaIso03,
348 Double_t EleChargedIso04,
349 Double_t EleNeutralHadronIso04,
350 Double_t EleGammaIso04,
355 edm::LogError(
"NotInitialized") <<
"Error: ElectronIDMVA not properly initialized.";
361 Rho = PileupEnergyDensity;
364 if (fabs(EleEta) < 1.0) subdet = 0;
365 else if (fabs(EleEta) < 1.479) subdet = 1;
368 if (ElePt > 20.0) ptBin = 1;
398 = (EleNeutralHadronIso03
409 = (EleNeutralHadronIso04
417 Double_t mva = -9999;
420 if (subdet == 0 && ptBin == 0) MVABin = 0;
421 if (subdet == 1 && ptBin == 0) MVABin = 1;
422 if (subdet == 2 && ptBin == 0) MVABin = 2;
423 if (subdet == 0 && ptBin == 1) MVABin = 3;
424 if (subdet == 1 && ptBin == 1) MVABin = 4;
425 if (subdet == 2 && ptBin == 1) MVABin = 5;
426 assert(MVABin >= 0 && MVABin <= 5);
431 if (printDebug == kTRUE) {
432 LogDebug(
"ElectronIDMVA") << ElePt <<
" " << EleEta <<
" " <<
" --> MVABin " << MVABin <<
" : "
471 Double_t EffectiveArea = 0;
473 if (fabs(Eta) < 1.0) {
486 }
else if (fabs(Eta) >= 1.0 && fabs(Eta) < 1.479 ) {
499 }
else if (fabs(Eta) >= 1.479 && fabs(Eta) < 2.0 ) {
512 }
else if (fabs(Eta) >= 2.0 && fabs(Eta) < 2.25 ) {
525 }
else if (fabs(Eta) >= 2.25 && fabs(Eta) < 2.5 ) {
540 return EffectiveArea;
std::vector< float > & els_ip3derr()
std::vector< float > & els_iso04_pf_nhad05()
Float_t fMVAVar_EleESeedClusterOverPIn
Float_t fMVAVar_ElePreShowerOverRaw
Float_t fMVAVar_EleIP3dSig
double electron_dzPV_wwV1(HWW &, unsigned int index)
Float_t fMVAVar_EleDEtaIn
Float_t fMVAVar_EleSigmaIPhiIPhi
Double_t MVAValue(HWW &, const unsigned int ele, const unsigned int vertex)
std::vector< float > & els_e3x3()
std::vector< float > & els_ndof()
Float_t fMVAVar_EleHoverE
std::vector< float > & els_hOverE()
Float_t fMVAVar_EleNeutralHadronIso03OverPt
std::vector< int > & els_nSeed()
std::vector< float > & els_ip3d()
std::vector< float > & els_fbrem()
Float_t fMVAVar_EleSCEtaWidth
Float_t fMVAVar_EledPhiCalo
Float_t fMVAVar_EleChargedIso03OverPt
std::vector< int > & els_gsftrkidx()
Float_t fMVAVar_EledEtaCalo
std::vector< float > & els_eOverPIn()
std::vector< int > & els_scindex()
std::vector< float > & els_iso03_pf_ch()
std::vector< float > & els_iso03_pf_gamma05()
Float_t fMVAVar_EleGammaIso03OverPt
Float_t fMVAVar_EleNeutralHadronIso04OverPt
edm::LuminosityBlockNumber_t & evt_lumiBlock()
Float_t fMVAVar_EleSCPhiWidth
Float_t fMVAVar_EleCovIEtaIPhi
std::vector< float > & els_eSeedOverPOut()
std::vector< float > & els_chi2()
Float_t fMVAVar_EleGammaIso04OverPt
std::vector< float > & els_eSC()
std::vector< float > & els_dEtaOut()
double electron_d0PV_wwV1(HWW &, unsigned int index)
std::vector< float > & els_dPhiOut()
std::vector< LorentzVector > & els_p4()
std::vector< float > & els_etaSC()
std::vector< float > & els_eSCPresh()
Double_t ElectronEffectiveArea(EElectronEffectiveAreaType type, Double_t Eta)
std::vector< float > & els_iso03_pf_nhad05()
std::vector< float > & els_iso04_pf_gamma05()
Float_t fMVAVar_EleSigmaIEtaIEta
std::vector< float > & els_etaSCwidth()
EElectronEffectiveAreaType
std::vector< float > & scs_sigmaIEtaIPhi()
std::vector< float > & els_eSCRaw()
Float_t fMVAVar_EleESeedClusterOverPout
std::vector< float > & els_dPhiIn()
std::vector< float > & els_iso04_pf_ch()
std::pair< double, double > gsftrks_d0_pv(HWW &, int itrk, int ipv)
Float_t fMVAVar_EleEOverP
std::vector< float > & els_dEtaIn()
TMVA::Reader * fTMVAReader[6]
std::vector< float > & els_phiSCwidth()
std::vector< float > & els_eSeedOverPIn()
Float_t fMVAVar_EleOneOverEMinusOneOverP
Float_t fMVAVar_EleDPhiIn
void Initialize(TString methodName, unsigned int version, TString Subdet0Pt10To20Weights, TString Subdet1Pt10To20Weights, TString Subdet2Pt10To20Weights, TString Subdet0Pt20ToInfWeights, TString Subdet1Pt20ToInfWeights, TString Subdet2Pt20ToInfWeights)
std::vector< float > & els_sigmaIEtaIEta()
Power< A, B >::type pow(const A &a, const B &b)
Float_t fMVAVar_EleChargedIso04OverPt
std::vector< LorentzVector > & els_trk_p4()
edm::RunNumber_t & evt_run()
std::vector< float > & els_sigmaIPhiIPhi()
edm::EventNumber_t & evt_event()
Float_t fMVAVar_EleGsfTrackChi2OverNdof