10 #include "TObjString.h"
15 asg::AsgMessaging(
"BDTHelper"),
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;
52 return StatusCode::SUCCESS;
56 std::vector<TString> parsedString;
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(
":=")) {
69 if(0==
var.Length())
continue;
70 parsedString.push_back(
var);
84 std::map<TString, float>::const_iterator itr = availableVariables.find(
name);
85 if(itr==availableVariables.end()) {
89 values.push_back(itr->second);
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");
130 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");