17 template <
bool PROMPT>
20 : forestLabel_(
cfg.getParameter<
std::
string>(
"GBRForestLabel")),
21 dbFileName_(
cfg.getParameter<
std::
string>(
"GBRForestFileName")),
22 useForestFromDB_((!forestLabel_.
empty()) && dbFileName_.
empty()) {
23 if (useForestFromDB_) {
29 if (!dbFileName_.empty()) {
30 TFile gbrfile(dbFileName_.c_str());
31 forestFromFile_.reset((
GBRForest *)gbrfile.Get(forestLabel_.c_str()));
36 forest_ = forestFromFile_.get();
37 if (useForestFromDB_) {
38 forest_ = &es.
getData(forestToken_);
45 auto tmva_pt_ = trk.
pt();
46 auto tmva_ndof_ = trk.
ndof();
48 auto tmva_nlayers3D_ =
52 float chi2n_no1Dmod =
chi2n;
56 const auto &
hit = *(*ith);
57 if (
hit.dimension() == 1)
61 if (count1dhits > 0) {
66 auto tmva_chi2n_ =
chi2n;
67 auto tmva_chi2n_no1dmod_ = chi2n_no1Dmod;
68 auto tmva_eta_ = trk.
eta();
73 auto tmva_minlost_ =
std::min(lostIn, lostOut);
77 float gbrVals_[PROMPT ? 16 : 12];
78 gbrVals_[0] = tmva_pt_;
79 gbrVals_[1] = tmva_lostmidfrac_;
80 gbrVals_[2] = tmva_minlost_;
81 gbrVals_[3] = tmva_nhits_;
82 gbrVals_[4] = tmva_relpterr_;
83 gbrVals_[5] = tmva_eta_;
84 gbrVals_[6] = tmva_chi2n_no1dmod_;
85 gbrVals_[7] = tmva_chi2n_;
86 gbrVals_[8] = tmva_nlayerslost_;
87 gbrVals_[9] = tmva_nlayers3D_;
88 gbrVals_[10] = tmva_nlayers_;
89 gbrVals_[11] = tmva_ndof_;
96 auto tmva_absdzPV_ =
std::abs(trk.
dz(bestVertex));
98 gbrVals_[12] = tmva_absd0PV_;
99 gbrVals_[13] = tmva_absdzPV_;
100 gbrVals_[14] = tmva_absdz_;
101 gbrVals_[15] = tmva_absd0_;
104 return forest_->GetClassifier(gbrVals_);
107 static const char *
name();
114 std::unique_ptr<GBRForest> forestFromFile_;
118 const bool useForestFromDB_;
126 return "TrackMVAClassifierDetached";
130 return "TrackMVAClassifierPrompt";
int numberOfLostHits(HitCategory category) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
double ptError() const
error on Pt (set to 1000 TeV if charge==0 for safety)
unsigned short numberOfValidHits() const
number of valid hits found
int trackerLayersWithMeasurement() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
double pt() const
track transverse momentum
double ndof() const
number of degrees of freedom of the fit
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Abs< T >::type abs(const T &t)
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
#define DEFINE_FWK_MODULE(type)
unsigned short numberOfLostHits() const
number of cases where track crossed a layer without getting a hit.
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
double eta() const
pseudorapidity of momentum vector
int trackerLayersWithoutMeasurement(HitCategory category) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
double chi2() const
chi-squared of the fit
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Structure Point Contains parameters of Gaussian fits to DMRs.
Point getBestVertex(reco::Track const &trk, reco::VertexCollection const &vertices, const size_t minNtracks=2)
int pixelLayersWithMeasurement() const
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...