1 #ifndef CommonTools_Utils_TMVAEvaluator_h
2 #define CommonTools_Utils_TMVAEvaluator_h
10 #include "TMVA/Reader.h"
11 #include "TMVA/IMethod.h"
22 const std::vector<std::string> &
variables,
const std::vector<std::string> & spectators,
bool useGBRForest=
false,
bool useAdaBoost=
false);
24 const std::vector<std::string> & spectators,
bool useAdaBoost=
false);
26 const std::vector<std::string> & variables,
const std::vector<std::string> & spectators,
bool useAdaBoost=
false);
27 float evaluateTMVA(
const std::map<std::string,float> &
inputs,
bool useSpectators)
const;
29 float evaluate(
const std::map<std::string,float> & inputs,
bool useSpectators=
false)
const;
38 [[cms::thread_guard(
"m_mutex")]] std::unique_ptr<TMVA::Reader>
mReader;
39 #if ROOT_VERSION_CODE < ROOT_VERSION(6,7,0)
40 std::unique_ptr<TMVA::IMethod> mIMethod;
44 [[cms::thread_guard(
"m_mutex")]]
mutable std::map<std::string,std::pair<size_t,float>>
mVariables;
45 [[cms::thread_guard(
"m_mutex")]]
mutable std::map<std::string,std::pair<size_t,float>>
mSpectators;
48 #endif // CommonTools_Utils_TMVAEvaluator_h
std::map< std::string, std::pair< size_t, float > > mVariables
static boost::mutex mutex
void initializeGBRForest(const GBRForest *gbrForest, const std::vector< std::string > &variables, const std::vector< std::string > &spectators, bool useAdaBoost=false)
void initialize(const std::string &options, const std::string &method, const std::string &weightFile, const std::vector< std::string > &variables, const std::vector< std::string > &spectators, bool useGBRForest=false, bool useAdaBoost=false)
std::map< std::string, std::pair< size_t, float > > mSpectators
float evaluateTMVA(const std::map< std::string, float > &inputs, bool useSpectators) const
std::shared_ptr< const GBRForest > mGBRForest
std::unique_ptr< TMVA::Reader > mReader
float evaluate(const std::map< std::string, float > &inputs, bool useSpectators=false) const
float evaluateGBRForest(const std::map< std::string, float > &inputs) const