CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConvBremHeavyObjectCache.cc
Go to the documentation of this file.
2 #include "TMVA/Reader.h"
3 #include "TMVA/MethodBDT.h"
4 
5 
6 namespace convbremhelpers {
8 
9  pfcalib_.reset( new PFEnergyCalibration() );
10 
11  const bool useConvBremFinder_ = conf.getParameter<bool>("useConvBremFinder");
12 
13  if(useConvBremFinder_) {
14  const std::string& mvaWeightFileConvBremBarrelLowPt =
15  conf.getParameter<std::string>("pf_convBremFinderID_mvaWeightFileBarrelLowPt");
16  const std::string mvaWeightFileConvBremBarrelHighPt =
17  conf.getParameter<std::string>("pf_convBremFinderID_mvaWeightFileBarrelHighPt");
18  const std::string mvaWeightFileConvBremEndcapsLowPt =
19  conf.getParameter<std::string>("pf_convBremFinderID_mvaWeightFileEndcapsLowPt");
20  const std::string mvaWeightFileConvBremEndcapsHighPt =
21  conf.getParameter<std::string>("pf_convBremFinderID_mvaWeightFileEndcapsHighPt");
22 
23  const std::string path_mvaWeightFileConvBremBarrelLowPt =
24  edm::FileInPath( mvaWeightFileConvBremBarrelLowPt.c_str() ).fullPath();
25  const std::string path_mvaWeightFileConvBremBarrelHighPt =
26  edm::FileInPath( mvaWeightFileConvBremBarrelHighPt.c_str() ).fullPath();
27  const std::string path_mvaWeightFileConvBremEndcapsLowPt =
28  edm::FileInPath( mvaWeightFileConvBremEndcapsLowPt.c_str() ).fullPath();
29  const std::string path_mvaWeightFileConvBremEndcapsHighPt =
30  edm::FileInPath( mvaWeightFileConvBremEndcapsHighPt.c_str() ).fullPath();
31 
32  gbrBarrelLowPt_ = setupMVA(path_mvaWeightFileConvBremBarrelLowPt);
33  gbrBarrelHighPt_ = setupMVA(path_mvaWeightFileConvBremBarrelHighPt);
34  gbrEndcapsLowPt_ = setupMVA(path_mvaWeightFileConvBremEndcapsLowPt);
35  gbrEndcapsHighPt_ = setupMVA(path_mvaWeightFileConvBremEndcapsHighPt);
36 
37  }
38  }
39 
40  std::unique_ptr<const GBRForest> HeavyObjectCache::setupMVA(const std::string& weights) {
41  TMVA::Reader reader("!Color:Silent");
42  reader.AddVariable("kftrack_secR",&secR);
43  reader.AddVariable("kftrack_sTIP",&sTIP);
44  reader.AddVariable("kftrack_nHITS1",&nHITS1);
45  reader.AddVariable("kftrack_Epout",&Epout);
46  reader.AddVariable("kftrack_detaBremKF",&detaBremKF);
47  reader.AddVariable("kftrack_ptRatioGsfKF",&ptRatioGsfKF);
48  std::unique_ptr<TMVA::IMethod> temp( reader.BookMVA("BDT", weights.c_str()) );
49  return std::unique_ptr<const GBRForest>( new GBRForest( dynamic_cast<TMVA::MethodBDT*>( reader.FindMVA("BDT") ) ) );
50  }
51 }
T getParameter(std::string const &) const
std::unique_ptr< const GBRForest > setupMVA(const std::string &)
std::unique_ptr< const GBRForest > gbrEndcapsHighPt_
std::unique_ptr< const GBRForest > gbrEndcapsLowPt_
std::unique_ptr< const GBRForest > gbrBarrelLowPt_
HeavyObjectCache(const edm::ParameterSet &)
tuple conf
Definition: dbtoconf.py:185
std::unique_ptr< const PFEnergyCalibration > pfcalib_
std::unique_ptr< const GBRForest > gbrBarrelHighPt_