Skip to content

Commit

Permalink
Add checks for TVMA::Experimental::RBDT since it is not a template an…
Browse files Browse the repository at this point in the history
…ymore (#395)

* Add checks for TVMA::Experimental::RBDT since it is not a template anymore

after ROOT 6.32.0, failing with a compilation error.

* Close #ifndef

* Fix format

---------

Co-authored-by: jmcarcell <[email protected]>
  • Loading branch information
jmcarcell and jmcarcell authored Jul 30, 2024
1 parent 1ce364c commit dae0778
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions addons/TMVAHelper/TMVAHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// ROOT
#include "ROOT/RVec.hxx"
#include "RVersion.h"
#include "TMVA/RBDT.hxx"

// TBB
Expand All @@ -22,7 +23,11 @@ class tmva_helper_xgb {
private:
// Default backend (template parameter) is:
// TMVA::Experimental::BranchlessJittedForest<float>
#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 32, 0)
std::vector<TMVA::Experimental::RBDT> m_interpreters;
#else
std::vector<TMVA::Experimental::RBDT<>> m_interpreters;
#endif
};

#endif
7 changes: 7 additions & 0 deletions addons/TMVAHelper/src/TMVAHelper.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#include "TMVAHelper/TMVAHelper.h"

#include "RVersion.h"

tmva_helper_xgb::tmva_helper_xgb(const std::string &filename,
const std::string &name,
const unsigned int nslots) {

const unsigned int nslots_actual = std::max(nslots, 1U);
m_interpreters.reserve(nslots_actual);
for (unsigned int islot = 0; islot < nslots_actual; ++islot) {

#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 32, 0)
m_interpreters.emplace_back(TMVA::Experimental::RBDT(name, filename));
#else
m_interpreters.emplace_back(TMVA::Experimental::RBDT<>(name, filename));
#endif
}
}

Expand Down

0 comments on commit dae0778

Please sign in to comment.