File indexing completed on 2024-04-06 12:24:36
0001 #include "RecoBTag/TrackProbability/interface/TrackClassFilter.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include <iostream>
0004
0005 using namespace std;
0006
0007 bool TrackClassFilter::operator()(const first_argument_type& input, const second_argument_type& category) const {
0008 const reco::Track& track = input.track;
0009
0010
0011 const bool usequality = input.useQuality;
0012
0013 const TrackProbabilityCategoryData& d = category.category;
0014
0015 double p = track.p();
0016 double eta = track.eta();
0017 double nhit = track.numberOfValidHits();
0018 double npix = track.hitPattern().numberOfValidPixelHits();
0019 bool firstPixel = track.hitPattern().hasValidHitInPixelLayer(PixelSubdetector::SubDetector::PixelBarrel, 1);
0020 double chi = track.normalizedChi2();
0021
0022
0023 bool chicut = (chi >= d.chiMin && chi < d.chiMax);
0024 if (d.chiMin <= 0.01 && d.chiMax <= 0.01)
0025 chicut = true;
0026
0027
0028 bool fisrtPixelCut =
0029 ((firstPixel && d.withFirstPixel == 1) || (!firstPixel && d.withFirstPixel == -1) || d.withFirstPixel == 0);
0030
0031
0032 reco::TrackBase::TrackQuality trackQualityUndef = reco::TrackBase::qualityByName("undefQuality");
0033 reco::TrackBase::TrackQuality trackQualityLoose = reco::TrackBase::qualityByName("loose");
0034 reco::TrackBase::TrackQuality trackQualityTight = reco::TrackBase::qualityByName("tight");
0035 reco::TrackBase::TrackQuality trackQualityhighPur = reco::TrackBase::qualityByName("highPurity");
0036 reco::TrackBase::TrackQuality trackQualityConfirmed = reco::TrackBase::qualityByName("confirmed");
0037 reco::TrackBase::TrackQuality trackQualityGoodIterative = reco::TrackBase::qualityByName("goodIterative");
0038
0039 signed short trakQuality = -1;
0040 if (track.quality(trackQualityUndef))
0041 trakQuality = 5;
0042 if (track.quality(trackQualityLoose))
0043 trakQuality = 0;
0044 if (track.quality(trackQualityTight))
0045 trakQuality = 1;
0046 if (track.quality(trackQualityhighPur))
0047 trakQuality = 2;
0048 if (track.quality(trackQualityConfirmed))
0049 trakQuality = 3;
0050 if (track.quality(trackQualityGoodIterative))
0051 trakQuality = 4;
0052
0053 bool result = (p > d.pMin && p < d.pMax && fabs(eta) > d.etaMin && fabs(eta) < d.etaMax && nhit >= d.nHitsMin &&
0054 nhit <= d.nHitsMax && npix >= d.nPixelHitsMin && npix <= d.nPixelHitsMax && chicut && fisrtPixelCut &&
0055 ((trakQuality == d.trackQuality && usequality == 1) || usequality == 0));
0056
0057
0058
0059
0060
0061
0062 return result;
0063 }
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076