CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MvaSoftMuonEstimator.cc
Go to the documentation of this file.
1 // * Author: Alberto Zucchetta
2 // * Mail: a.zucchetta@cern.ch
3 // * January 16, 2015
4 
5 #include <limits>
6 
11 
13  TMVAReader = new TMVA::Reader("Color:Silent:Error");
14  TMVAReader->SetVerbose(false);
15  TMVAReader->AddVariable("TagInfo1.sip3d", &mva_sip3d);
16  TMVAReader->AddVariable("TagInfo1.sip2d", &mva_sip2d);
17  TMVAReader->AddVariable("TagInfo1.ptRel", &mva_ptRel);
18  TMVAReader->AddVariable("TagInfo1.deltaR", &mva_deltaR);
19  TMVAReader->AddVariable("TagInfo1.ratio", &mva_ratio);
20  reco::details::loadTMVAWeights(TMVAReader, "BDT", weightFile.c_str());
21 }
22 
24  delete TMVAReader;
25 }
26 
27 
28 // b-tag a jet based on track-to-jet parameters in the extened info collection
29 float MvaSoftMuonEstimator::mvaValue(float sip3d, float sip2d, float ptRel, float deltaR, float ratio) {
30  mva_sip3d = sip3d;
31  mva_sip2d = sip2d;
32  mva_ptRel = ptRel;
34  mva_ratio = ratio;
35  // Evaluate tagger
36  float tag = TMVAReader->EvaluateMVA("BDT");
37  // Transform output between approximately 0 and 1
38  tag = (tag+1.)/2.;
39 
40  return tag;
41 }
42 
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
float mvaValue(float, float, float, float, float)
void loadTMVAWeights(TMVA::Reader *reader, const std::string &method, const std::string &weightFile, bool verbose=false)