CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MvaBoostedDoubleSecondaryVertexEstimator.cc
Go to the documentation of this file.
2 
4 
5 
7 {
8  TMVAReader = new TMVA::Reader("Color:Silent:Error");
9  TMVAReader->SetVerbose(false);
10 
11  TMVAReader->AddVariable("PFLepton_ptrel", &mva_PFLepton_ptrel);
12  TMVAReader->AddVariable("z_ratio1", &mva_z_ratio);
13  TMVAReader->AddVariable("tau_dot", &mva_tau_dot);
14  TMVAReader->AddVariable("SV_mass_0", &mva_SV_mass_0);
15  TMVAReader->AddVariable("SV_vtx_EnergyRatio_0", &mva_SV_EnergyRatio_0);
16  TMVAReader->AddVariable("SV_vtx_EnergyRatio_1", &mva_SV_EnergyRatio_1);
17  TMVAReader->AddVariable("PFLepton_IP2D", &mva_PFLepton_IP2D);
18  TMVAReader->AddVariable("tau2/tau1", &mva_tau21);
19  TMVAReader->AddVariable("nSL", &mva_nSL);
20  TMVAReader->AddVariable("jetNTracksEtaRel", &mva_jetNTracksEtaRel);
21 
22  TMVAReader->AddSpectator("massGroomed", &mva_massGroomed);
23  TMVAReader->AddSpectator("flavour", &mva_flavour);
24  TMVAReader->AddSpectator("nbHadrons", &mva_nbHadrons);
25  TMVAReader->AddSpectator("ptGroomed", &mva_ptGroomed);
26  TMVAReader->AddSpectator("etaGroomed", &mva_etaGroomed);
27 
28  reco::details::loadTMVAWeights(TMVAReader, "BDTG", weightFile.c_str());
29 }
30 
31 
33 {
34  delete TMVAReader;
35 }
36 
37 
38 float MvaBoostedDoubleSecondaryVertexEstimator::mvaValue(float PFLepton_ptrel, float z_ratio, float tau_dot, float SV_mass_0,
39  float SV_EnergyRatio_0, float SV_EnergyRatio_1, float PFLepton_IP2D,
40  float tau21, float nSL, float jetNTracksEtaRel)
41 {
42  mva_PFLepton_ptrel = PFLepton_ptrel;
43  mva_z_ratio = z_ratio;
44  mva_tau_dot = tau_dot;
45  mva_SV_mass_0 = SV_mass_0;
46  mva_SV_EnergyRatio_0 = SV_EnergyRatio_0;
47  mva_SV_EnergyRatio_1 = SV_EnergyRatio_1;
48  mva_PFLepton_IP2D = PFLepton_IP2D;
49  mva_tau21 = tau21;
50  mva_nSL = nSL;
51  mva_jetNTracksEtaRel = jetNTracksEtaRel;
52 
53  // evaluate the MVA
54  float value = TMVAReader->EvaluateMVA("BDTG");
55 
56  return value;
57 }
void loadTMVAWeights(TMVA::Reader *reader, const std::string &method, const std::string &weightFile, bool verbose=false)
float mvaValue(float, float, float, float, float, float, float, float, float, float)