17 template <
bool PROMPT>
20 : forestLabel_(
cfg.getParameter<
std::
string>(
"GBRForestLabel")),
21 dbFileName_(
cfg.getParameter<
std::
string>(
"GBRForestFileName")),
22 useForestFromDB_((!forestLabel_.
empty()) & dbFileName_.
empty()) {}
25 if (!dbFileName_.empty()) {
26 TFile gbrfile(dbFileName_.c_str());
27 forestFromFile_.reset((
GBRForest *)gbrfile.Get(forestLabel_.c_str()));
32 forest_ = forestFromFile_.get();
33 if (useForestFromDB_) {
36 forest_ = forestHandle.
product();
43 auto tmva_pt_ = trk.
pt();
44 auto tmva_ndof_ = trk.
ndof();
46 auto tmva_nlayers3D_ =
50 float chi2n_no1Dmod =
chi2n;
54 const auto &
hit = *(*ith);
55 if (
hit.dimension() == 1)
59 if (count1dhits > 0) {
64 auto tmva_chi2n_ =
chi2n;
65 auto tmva_chi2n_no1dmod_ = chi2n_no1Dmod;
66 auto tmva_eta_ = trk.
eta();
71 auto tmva_minlost_ =
std::min(lostIn, lostOut);
75 float gbrVals_[PROMPT ? 16 : 12];
76 gbrVals_[0] = tmva_pt_;
77 gbrVals_[1] = tmva_lostmidfrac_;
78 gbrVals_[2] = tmva_minlost_;
79 gbrVals_[3] = tmva_nhits_;
80 gbrVals_[4] = tmva_relpterr_;
81 gbrVals_[5] = tmva_eta_;
82 gbrVals_[6] = tmva_chi2n_no1dmod_;
83 gbrVals_[7] = tmva_chi2n_;
84 gbrVals_[8] = tmva_nlayerslost_;
85 gbrVals_[9] = tmva_nlayers3D_;
86 gbrVals_[10] = tmva_nlayers_;
87 gbrVals_[11] = tmva_ndof_;
94 auto tmva_absdzPV_ =
std::abs(trk.
dz(bestVertex));
96 gbrVals_[12] = tmva_absd0PV_;
97 gbrVals_[13] = tmva_absdzPV_;
98 gbrVals_[14] = tmva_absdz_;
99 gbrVals_[15] = tmva_absd0_;
102 return forest_->GetClassifier(gbrVals_);
105 static const char *
name();
112 std::unique_ptr<GBRForest> forestFromFile_;
116 const bool useForestFromDB_;
123 return "TrackMVAClassifierDetached";
127 return "TrackMVAClassifierPrompt";