#include <BDTHelper.h>
|
| | BDTHelper () |
| | ~BDTHelper () |
| StatusCode | initialize (const TString &weightFileName) |
| float | getGradBoostMVA (const std::map< TString, float > &availableVariables) const |
| float | getResponse (const std::map< TString, float * > &availableVariables) const |
| MVAUtils::BDT * | getBDT () const |
| void | setLevel (MSG::Level lvl) |
| | Change the current logging level.
|
| bool | msgLvl (const MSG::Level lvl) const |
| | Test the output level of the object.
|
| MsgStream & | msg () const |
| | The standard message stream.
|
| MsgStream & | msg (const MSG::Level lvl) const |
| | The standard message stream.
|
|
| std::vector< TString > | parseString (const TString &str, const TString &delim=",") const |
| std::vector< float > | getInputVariables (const std::map< TString, float > &availableVariables) const |
| std::vector< float > | getInputVariables (const std::map< TString, float * > &availableVariables) const |
| void | initMessaging () const |
| | Initialize our message level and MessageSvc.
|
|
| std::unique_ptr< MVAUtils::BDT > | m_BDT |
| std::vector< TString > | m_inputVariableNames |
| std::string | m_nm |
| | Message source name.
|
| boost::thread_specific_ptr< MsgStream > | m_msg_tls |
| | MsgStream instance (a std::cout like with print-out levels)
|
| std::atomic< IMessageSvc * > | m_imsg { nullptr } |
| | MessageSvc pointer.
|
| std::atomic< MSG::Level > | m_lvl { MSG::NIL } |
| | Current logging level.
|
| std::atomic_flag m_initialized | ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
| | Messaging initialized (initMessaging)
|
Definition at line 16 of file BDTHelper.h.
◆ BDTHelper()
| tauRecTools::BDTHelper::BDTHelper |
( |
| ) |
|
Definition at line 14 of file BDTHelper.cxx.
14 :
15 asg::AsgMessaging("BDTHelper"),
17}
◆ ~BDTHelper()
| tauRecTools::BDTHelper::~BDTHelper |
( |
| ) |
|
◆ getBDT()
◆ getGradBoostMVA()
| float tauRecTools::BDTHelper::getGradBoostMVA |
( |
const std::map< TString, float > & | availableVariables | ) |
const |
Definition at line 113 of file BDTHelper.cxx.
113 {
115
117 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");
118 return -999;
119 }
120 else {
121 return m_BDT->GetGradBoostMVA(values);
122 }
123}
◆ getInputVariables() [1/2]
| std::vector< float > tauRecTools::BDTHelper::getInputVariables |
( |
const std::map< TString, float * > & | availableVariables | ) |
const |
|
private |
Definition at line 96 of file BDTHelper.cxx.
96 {
98
99
101 std::map<TString, float*>::const_iterator itr = availableVariables.find(name);
102 if(itr==availableVariables.end()) {
104 }
105 else {
106 values.push_back(*itr->second);
107 }
108 }
109
111}
◆ getInputVariables() [2/2]
| std::vector< float > tauRecTools::BDTHelper::getInputVariables |
( |
const std::map< TString, float > & | availableVariables | ) |
const |
|
private |
Definition at line 79 of file BDTHelper.cxx.
79 {
81
82
84 std::map<TString, float>::const_iterator itr = availableVariables.find(name);
85 if(itr==availableVariables.end()) {
87 }
88 else {
89 values.push_back(itr->second);
90 }
91 }
92
94}
◆ getResponse()
| float tauRecTools::BDTHelper::getResponse |
( |
const std::map< TString, float * > & | availableVariables | ) |
const |
Definition at line 126 of file BDTHelper.cxx.
126 {
128
130 ATH_MSG_ERROR(
"There are missing variables when calculating the BDT score, will return -999");
131 return -999;
132 }
133 else {
134 return m_BDT->GetResponse(values);
135 }
136}
◆ initialize()
| StatusCode tauRecTools::BDTHelper::initialize |
( |
const TString & | weightFileName | ) |
|
Definition at line 23 of file BDTHelper.cxx.
23 {
24
25 std::unique_ptr<TFile>
file(TFile::Open(weightFileName));
27 ATH_MSG_ERROR(
"Cannot find input BDT file: " << weightFileName);
28 return StatusCode::FAILURE;
29 }
31
32 TTree*
tree =
dynamic_cast<TTree*
> (
file->Get(
"BDT"));
35 return StatusCode::FAILURE;
36 }
37 m_BDT = std::make_unique<MVAUtils::BDT>(
tree);
38
39 TNamed*
varList =
dynamic_cast<TNamed*
> (
file->Get(
"varList"));
40 if (!varList) {
41 ATH_MSG_ERROR(
"No variable list in file: " << weightFileName);
42 return StatusCode::FAILURE;
43 }
46
47
49
51
52 return StatusCode::SUCCESS;
53}
◆ initMessaging()
| void AthMessaging::initMessaging |
( |
| ) |
const |
|
privateinherited |
Initialize our message level and MessageSvc.
This method should only be called once.
Definition at line 39 of file AthMessaging.cxx.
40{
42
43 if (
m_lvl == MSG::NIL) {
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)
◆ msg() [1/2]
| MsgStream & asg::AsgMessaging::msg |
( |
| ) |
const |
|
inherited |
The standard message stream.
- Returns
- A reference to the default message stream of this object.
Definition at line 49 of file AsgMessaging.cxx.
49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else
53 return m_msg;
54#endif
55 }
◆ msg() [2/2]
| MsgStream & asg::AsgMessaging::msg |
( |
const MSG::Level | lvl | ) |
const |
|
inherited |
The standard message stream.
- Parameters
-
| lvl | The message level to set the stream to |
- Returns
- A reference to the default message stream, set to level "lvl"
Definition at line 57 of file AsgMessaging.cxx.
57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else
61 m_msg << lvl;
62 return m_msg;
63#endif
64 }
◆ msgLvl()
| bool asg::AsgMessaging::msgLvl |
( |
const MSG::Level | lvl | ) |
const |
|
inherited |
Test the output level of the object.
- Parameters
-
| lvl | The message level to test against |
- Returns
- boolean Indicting if messages at given level will be printed
-
true If messages at level "lvl" will be printed
Definition at line 41 of file AsgMessaging.cxx.
41 {
42#ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44#else
45 return m_msg.msgLevel( lvl );
46#endif
47 }
◆ parseString()
| std::vector< TString > tauRecTools::BDTHelper::parseString |
( |
const TString & | str, |
|
|
const TString & | delim = "," ) const |
|
private |
Definition at line 55 of file BDTHelper.cxx.
55 {
56 std::vector<TString> parsedString;
57
59 size_t arraySize =
objList->GetEntries();
60
61
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(
":=")) {
68 }
69 if(0==
var.Length())
continue;
70 parsedString.push_back(var);
71 }
72 }
73
75
76 return parsedString;
77}
◆ setLevel()
| void AthMessaging::setLevel |
( |
MSG::Level | lvl | ) |
|
|
inherited |
◆ ATLAS_THREAD_SAFE
| std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
|
mutableprivateinherited |
◆ m_BDT
◆ m_imsg
| std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr } |
|
mutableprivateinherited |
◆ m_inputVariableNames
| std::vector<TString> tauRecTools::BDTHelper::m_inputVariableNames |
|
private |
◆ m_lvl
| std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL } |
|
mutableprivateinherited |
◆ m_msg_tls
| boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls |
|
mutableprivateinherited |
MsgStream instance (a std::cout like with print-out levels)
Definition at line 132 of file AthMessaging.h.
◆ m_nm
| std::string AthMessaging::m_nm |
|
privateinherited |
The documentation for this class was generated from the following files: