10#include "TObjString.h"
25 std::unique_ptr<TFile>
file(TFile::Open(weightFileName));
27 ATH_MSG_ERROR(
"Cannot find input BDT file: " << weightFileName);
28 return StatusCode::FAILURE;
32 TTree*
tree =
dynamic_cast<TTree*
> (
file->Get(
"BDT"));
35 return StatusCode::FAILURE;
37 m_BDT = std::make_unique<MVAUtils::BDT>(
tree);
39 TNamed* varList =
dynamic_cast<TNamed*
> (
file->Get(
"varList"));
41 ATH_MSG_ERROR(
"No variable list in file: " << weightFileName);
42 return StatusCode::FAILURE;
44 TString names = varList->GetTitle();
52 return StatusCode::SUCCESS;
56 std::vector<TString> parsedString;
58 TObjArray* objList =
str.Tokenize(delim);
59 size_t arraySize = objList->GetEntries();
62 for(
size_t i = 0; i < arraySize; ++i) {
63 if (
auto *
str =
dynamic_cast<TObjString*
> (objList->At(i))) {
64 TString var =
str->String();
65 var.ReplaceAll(
" ",
"");
66 if(var.Contains(
":=")) {
67 var=var(var.Index(
":=")+2, var.Length()-var.Index(
":=")-2);
69 if(0==var.Length())
continue;
70 parsedString.push_back(var);
80 std::vector<float> values;
84 std::map<TString, float>::const_iterator itr = availableVariables.find(name);
85 if(itr==availableVariables.end()) {
89 values.push_back(itr->second);
97 std::vector<float> values;
101 std::map<TString, float*>::const_iterator itr = availableVariables.find(name);
102 if(itr==availableVariables.end()) {
106 values.push_back(*itr->second);
117 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");
121 return m_BDT->GetGradBoostMVA(values);
130 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");
134 return m_BDT->GetResponse(values);
AsgMessaging(const std::string &name)
Constructor with a name.