10 #include "TObjString.h"
15 asg::AsgMessaging(
"BDTHelper"),
28 std::unique_ptr<TFile>
file(TFile::Open(weightFileName));
30 ATH_MSG_ERROR(
"Cannot find input BDT file: " << weightFileName);
31 return StatusCode::FAILURE;
35 TTree*
tree =
dynamic_cast<TTree*
> (
file->Get(
"BDT"));
38 return StatusCode::FAILURE;
40 m_BDT = std::make_unique<MVAUtils::BDT>(
tree);
42 TNamed*
varList =
dynamic_cast<TNamed*
> (
file->Get(
"varList"));
44 ATH_MSG_ERROR(
"No variable list in file: " << weightFileName);
45 return StatusCode::FAILURE;
55 return StatusCode::SUCCESS;
59 std::vector<TString> parsedString;
62 size_t arraySize =
objList->GetEntries();
65 for(
size_t i = 0;
i < arraySize; ++
i) {
66 if (
auto *
str =
dynamic_cast<TObjString*
> (
objList->At(
i))) {
67 TString
var =
str->String();
68 var.ReplaceAll(
" ",
"");
69 if(
var.Contains(
":=")) {
72 if(0==
var.Length())
continue;
73 parsedString.push_back(
var);
87 std::map<TString, float>::const_iterator itr = availableVariables.find(
name);
88 if(itr==availableVariables.end()) {
92 values.push_back(itr->second);
100 std::vector<float>
values;
104 std::map<TString, float*>::const_iterator itr = availableVariables.find(
name);
105 if(itr==availableVariables.end()) {
109 values.push_back(*itr->second);
117 std::vector<float>
values;
123 if(
name.Index(
".")>=0){
140 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");
153 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");
166 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");
179 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");