CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFRecoTauDiscriminationAgainstElectronMVA.cc
Go to the documentation of this file.
1 /* class PFRecoTauDiscriminationAgainstElectronMVA
2  * created : Nov 23 2011,
3  * revised : ,
4  * Authorss : Lorenzo Bianchini (LLR Ecole-Polytechnique)
5  */
6 
10 
11 #include <string>
12 
13 using namespace reco;
14 
16  public:
18 
19  method_ = iConfig.getParameter<std::string>("method");
20  inputFileName1prongBL_ = iConfig.getParameter<edm::FileInPath>("inputFileName1prongBL");
21  inputFileName1prongStripsWgsfBL_ = iConfig.getParameter<edm::FileInPath>("inputFileName1prongStripsWgsfBL");
22  inputFileName1prongStripsWOgsfBL_ = iConfig.getParameter<edm::FileInPath>("inputFileName1prongStripsWOgsfBL");
23  inputFileName1prongEC_ = iConfig.getParameter<edm::FileInPath>("inputFileName1prongEC");
24  inputFileName1prongStripsWgsfEC_ = iConfig.getParameter<edm::FileInPath>("inputFileName1prongStripsWgsfEC");
25  inputFileName1prongStripsWOgsfEC_ = iConfig.getParameter<edm::FileInPath>("inputFileName1prongStripsWOgsfEC");
26 
27  returnMVA_ = iConfig.getParameter<bool>("returnMVA");
28  minMVA1prongBL_ = iConfig.getParameter<double>("minMVA1prongBL");
29  minMVA1prongStripsWgsfBL_ = iConfig.getParameter<double>("minMVA1prongStripsWgsfBL");
30  minMVA1prongStripsWOgsfBL_ = iConfig.getParameter<double>("minMVA1prongStripsWOgsfBL");
31  minMVA1prongEC_ = iConfig.getParameter<double>("minMVA1prongEC");
32  minMVA1prongStripsWgsfEC_ = iConfig.getParameter<double>("minMVA1prongStripsWgsfEC");
33  minMVA1prongStripsWOgsfEC_ = iConfig.getParameter<double>("minMVA1prongStripsWOgsfEC");
34 
35  mva_ = new AntiElectronIDMVA();
36  mva_->Initialize(method_,
37  inputFileName1prongBL_.fullPath().data(),
38  inputFileName1prongStripsWgsfBL_.fullPath().data(),
39  inputFileName1prongStripsWOgsfBL_.fullPath().data(),
40  inputFileName1prongEC_.fullPath().data(),
41  inputFileName1prongStripsWgsfEC_.fullPath().data(),
42  inputFileName1prongStripsWOgsfEC_.fullPath().data()
43  );
44 
45 
46  }
47 
48  double discriminate(const PFTauRef& thePFTauRef);
49 
51 
52  private:
53 
62  bool returnMVA_ ;
63  double minMVA1prongBL_ ;
66  double minMVA1prongEC_ ;
69 };
70 
72 {
73  double mva = -1.0;
74  double workingPoint = 0.0;
75 
76  if( (*thePFTauRef).leadPFChargedHadrCand().isNonnull() ) {
77 
78  mva = mva_->MVAValue( thePFTauRef );
79 
80  workingPoint =
81  ((*thePFTauRef).signalPFChargedHadrCands().size()==3 ||
82  (fabs((*thePFTauRef).eta())<1.5 && ((*thePFTauRef).signalPFGammaCands().size())<=0 && mva > minMVA1prongBL_) ||
83  (fabs((*thePFTauRef).eta())<1.5 && ((*thePFTauRef).signalPFGammaCands().size())>0 && (((*thePFTauRef).leadPFChargedHadrCand())->gsfTrackRef()).isNonnull()>0.5 && mva > minMVA1prongStripsWgsfBL_) ||
84  (fabs((*thePFTauRef).eta())<1.5 && ((*thePFTauRef).signalPFGammaCands().size())>0 && (((*thePFTauRef).leadPFChargedHadrCand())->gsfTrackRef()).isNonnull()<0.5 && mva > minMVA1prongStripsWOgsfBL_) ||
85  (fabs((*thePFTauRef).eta())>1.5 && ((*thePFTauRef).signalPFGammaCands().size())<=0 && mva > minMVA1prongEC_) ||
86  (fabs((*thePFTauRef).eta())>1.5 && ((*thePFTauRef).signalPFGammaCands().size())>0 && (((*thePFTauRef).leadPFChargedHadrCand())->gsfTrackRef()).isNonnull()>0.5 && mva > minMVA1prongStripsWgsfEC_) ||
87  (fabs((*thePFTauRef).eta())>1.5 && ((*thePFTauRef).signalPFGammaCands().size())>0 && (((*thePFTauRef).leadPFChargedHadrCand())->gsfTrackRef()).isNonnull()<0.5 && mva > minMVA1prongStripsWOgsfEC_)) ? 1.0 : 0.0;
88 
89  }
90 
91  return ( returnMVA_ ? mva : workingPoint);
92 }
93 
T getParameter(std::string const &) const
DEFINE_FWK_MODULE(CosmicTrackingParticleSelector)
std::string fullPath() const
Definition: FileInPath.cc:171