CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AntiElectronIDMVA.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------------------------------
2 // $Id $
3 //
4 // AntiElectronIDMVA
5 //
6 // Helper Class for applying MVA anti-electron discrimination
7 //
8 // Authors: L.Bianchini
9 //--------------------------------------------------------------------------------------------------
10 
11 /*
12  proposed WP: epsilonB ~ 18% epsilonS ~ 91% wrt signal taus passing discr. ag. electrons Medium.
13  bool pass =
14  (abs(TauEta)<1.5 && TauSignalPFGammaCands==0 && MVAValue(...)>0.054) ||
15  (abs(TauEta)<1.5 && TauSignalPFGammaCands>0 && TauHasGsf>0.5 && MVAValue(...)>0.060) ||
16  (abs(TauEta)<1.5 && TauSignalPFGammaCands>0 && TauHasGsf<0.5 && MVAValue(...)>0.054) ||
17  (abs(TauEta)>1.5 && TauSignalPFGammaCands==0 && MVAValue(...)>0.060) ||
18  (abs(TauEta)>1.5 && TauSignalPFGammaCands>0 && TauHasGsf>0.5 && MVAValue(...)>0.053) ||
19  (abs(TauEta)>1.5 && TauSignalPFGammaCands>0 && TauHasGsf<0.5 && MVAValue(...)>0.049);
20 */
21 
22 
23 #ifndef RECOTAUTAG_RECOTAU_AntiElectronIDMVA_H
24 #define RECOTAUTAG_RECOTAU_AntiElectronIDMVA_H
25 
27 
28 #include "TMVA/Tools.h"
29 #include "TMVA/Reader.h"
30 
31 #include <vector>
32 
34  public:
35 
38 
39  void Initialize(std::string methodName,
40  std::string oneProng0Pi0_BL,
41  std::string oneProng1pi0wGSF_BL,
42  std::string oneProng1pi0woGSF_BL,
43  std::string oneProng0Pi0_EC,
44  std::string oneProng1pi0wGSF_EC,
45  std::string oneProng1pi0woGSF_EC
46  );
47 
48  // RECOMMENDED:
49  double MVAValue(Float_t TauEta, Float_t TauPt,
50  Float_t TauSignalPFChargedCands, Float_t TauSignalPFGammaCands,
51  Float_t TauLeadPFChargedHadrMva,
52  Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP,
53  Float_t TauHasGsf, Float_t TauVisMass, Float_t TauEmFraction,
54  std::vector<Float_t>* GammasdEta, std::vector<Float_t>* GammasdPhi, std::vector<Float_t>* GammasPt
55  );
56 
57  /*
58  where:
59 
60  TauEta = myTau->eta();
61  TauPt = myTau->pt();
62  TauSignalPFChargedCands = myTau->signalPFChargedHadrCands().size();
63  TauSignalPFGammaCands = myTau->signalPFGammaCands().size();
64  TauLeadPFChargedHadrMva = myTau->electronPreIDOutput();
65  TauLeadPFChargedHadrHoP = myTau->leadPFChargedHadrCand()->hcalEnergy()/myTau->leadPFChargedHadrCand()->p();
66  TauLeadPFChargedHadrEoP = myTau->leadPFChargedHadrCand()->ecalEnergy()/myTau->leadPFChargedHadrCand()->p();
67  TauHasGsf = (myTau->leadPFChargedHadrCand()->gsfTrackRef()).isNonnull();
68  TauVisMass = myTau->mass();
69  TauEmFraction = myTau->emFraction();
70 
71  GammasdEta = new std::vector< float >();
72  GammasdPhi = new std::vector< float >();
73  GammasPt = new std::vector< float >();
74 
75  for(unsigned int k = 0 ; k < (myTau->signalPFGammaCands()).size() ; k++){
76  reco::PFCandidateRef gamma = (myTau->signalPFGammaCands()).at(k);
77  if( (myTau->leadPFChargedHadrCand()).isNonnull() ){
78  GammasdEta->push_back( gamma->eta() - myTau->leadPFChargedHadrCand()->eta() );
79  GammasdPhi->push_back( gamma->phi() - myTau->leadPFChargedHadrCand()->phi() );
80  }
81  else{
82  GammasdEta->push_back( gamma->eta() - myTau->eta() );
83  GammasdPhi->push_back( gamma->phi() - myTau->phi() );
84  }
85  GammasPt->push_back( gamma->pt() );
86  }
87  */
88 
89  double MVAValue(Float_t TauEta, Float_t TauPt,
90  Float_t TauSignalPFChargedCands, Float_t TauSignalPFGammaCands,
91  Float_t TauLeadPFChargedHadrMva,
92  Float_t TauLeadPFChargedHadrHoP , Float_t TauLeadPFChargedHadrEoP,
93  Float_t TauHasGsf, Float_t TauVisMass, Float_t TauEmFraction,
94  Float_t GammaEtaMom, Float_t GammaPhiMom, Float_t GammaEnFrac
95  );
96  /*
97  see AntiElectronIDMVA.cc for GammaEtaMom,GammaPhiMom,GammaEnFrac
98  */
99 
100 
101  double MVAValue(const reco::PFTauRef& thePFTauRef);
102 
103  private:
104 
106  std::string methodName_;
107  TMVA::Reader* fTMVAReader_[6];
109  Float_t TauVisMass_;
110  Float_t GammadEta_;
111  Float_t GammadPhi_;
112  Float_t GammadPt_;
116  Float_t TauEmFraction_;
117 
119 };
120 
121 #endif
Float_t TauLeadPFChargedHadrMva_
Float_t TauLeadPFChargedHadrHoP_
double MVAValue(Float_t TauEta, Float_t TauPt, Float_t TauSignalPFChargedCands, Float_t TauSignalPFGammaCands, Float_t TauLeadPFChargedHadrMva, Float_t TauLeadPFChargedHadrHoP, Float_t TauLeadPFChargedHadrEoP, Float_t TauHasGsf, Float_t TauVisMass, Float_t TauEmFraction, std::vector< Float_t > *GammasdEta, std::vector< Float_t > *GammasdPhi, std::vector< Float_t > *GammasPt)
TMVA::Reader * fTMVAReader_[6]
Float_t TauLeadPFChargedHadrEoP_
void Initialize(std::string methodName, std::string oneProng0Pi0_BL, std::string oneProng1pi0wGSF_BL, std::string oneProng1pi0woGSF_BL, std::string oneProng0Pi0_EC, std::string oneProng1pi0wGSF_EC, std::string oneProng1pi0woGSF_EC)