CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::SoftMuonMvaEstimator Class Reference

#include <SoftMuonMvaEstimator.h>

Public Member Functions

float computeMva (const pat::Muon &imuon) const
 
 SoftMuonMvaEstimator (const edm::FileInPath &weightsfile)
 
 ~SoftMuonMvaEstimator ()
 

Private Attributes

std::unique_ptr< const GBRForestgbrForest_
 

Detailed Description

Definition at line 18 of file SoftMuonMvaEstimator.h.

Constructor & Destructor Documentation

◆ SoftMuonMvaEstimator()

SoftMuonMvaEstimator::SoftMuonMvaEstimator ( const edm::FileInPath weightsfile)

Definition at line 12 of file SoftMuonMvaEstimator.cc.

12  {
13  gbrForest_ = createGBRForest(weightsfile);
14 }

References createGBRForest(), and gbrForest_.

◆ ~SoftMuonMvaEstimator()

SoftMuonMvaEstimator::~SoftMuonMvaEstimator ( )

Definition at line 16 of file SoftMuonMvaEstimator.cc.

16 {}

Member Function Documentation

◆ computeMva()

float SoftMuonMvaEstimator::computeMva ( const pat::Muon imuon) const

Definition at line 42 of file SoftMuonMvaEstimator.cc.

42  {
43  float var[kLast]{};
44 
45  reco::TrackRef gTrack = muon.globalTrack();
46  reco::TrackRef iTrack = muon.innerTrack();
47  reco::TrackRef oTrack = muon.outerTrack();
48 
49  if (!(muon.innerTrack().isNonnull() and muon.outerTrack().isNonnull() and muon.globalTrack().isNonnull())) {
50  return -1;
51  }
52 
53  //VARIABLE EXTRACTION
54  var[kPt] = muon.pt();
55  var[kEta] = muon.eta();
56  var[kMomID] = -1;
57  var[kPID] = -1;
58 
59  var[kChi2LocalMomentum] = muon.combinedQuality().chi2LocalMomentum;
60  var[kChi2LocalPosition] = muon.combinedQuality().chi2LocalPosition;
61  var[kGlbTrackProbability] = muon.combinedQuality().glbTrackProbability;
62  var[kTrkRelChi2] = muon.combinedQuality().trkRelChi2;
63 
64  var[kTrkKink] = muon.combinedQuality().trkKink;
65  var[kLog2PlusGlbKink] = TMath::Log(2 + muon.combinedQuality().glbKink);
66  var[kSegmentCompatibility] = muon.segmentCompatibility();
67 
68  var[kTimeAtIpInOutErr] = muon.time().timeAtIpInOutErr;
69 
70  //TRACK RELATED VARIABLES
71 
72  var[kIValidFraction] = iTrack->validFraction();
73  var[kInnerChi2] = iTrack->normalizedChi2();
74  var[kLayersWithMeasurement] = iTrack->hitPattern().trackerLayersWithMeasurement();
75 
76  var[kOuterChi2] = oTrack->normalizedChi2();
77 
78  var[kQProd] = iTrack->charge() * oTrack->charge();
79 
80  //vComb Calculation
81 
82  const reco::HitPattern& gMpattern = gTrack->hitPattern();
83 
84  std::vector<int> fvDThits{0, 0, 0, 0};
85  std::vector<int> fvRPChits{0, 0, 0, 0};
86  std::vector<int> fvCSChits{0, 0, 0, 0};
87 
88  var[kVMuonHitComb] = 0;
89 
90  for (int i = 0; i < gMpattern.numberOfAllHits(reco::HitPattern::TRACK_HITS); i++) {
91  uint32_t hit = gMpattern.getHitPattern(reco::HitPattern::TRACK_HITS, i);
92  if (!gMpattern.validHitFilter(hit))
93  continue;
94 
95  int muStation0 = gMpattern.getMuonStation(hit) - 1;
96  if (muStation0 >= 0 && muStation0 < 4) {
97  if (gMpattern.muonDTHitFilter(hit))
98  fvDThits[muStation0]++;
99  if (gMpattern.muonRPCHitFilter(hit))
100  fvRPChits[muStation0]++;
101  if (gMpattern.muonCSCHitFilter(hit))
102  fvCSChits[muStation0]++;
103  }
104  }
105 
106  for (unsigned int station = 0; station < 4; ++station) {
107  var[kVMuonHitComb] += (fvDThits[station]) / 2.;
108  var[kVMuonHitComb] += fvRPChits[station];
109 
110  if (fvCSChits[station] > 6) {
111  var[kVMuonHitComb] += 6;
112  } else {
113  var[kVMuonHitComb] += fvCSChits[station];
114  }
115  }
116 
117  if (var[kChi2LocalMomentum] < 5000 and var[kChi2LocalPosition] < 2000 and var[kGlbTrackProbability] < 5000 and
118  var[kTrkKink] < 900 and var[kLog2PlusGlbKink] < 50 and var[kTimeAtIpInOutErr] < 4 and var[kOuterChi2] < 1000 and
119  var[kInnerChi2] < 10 and var[kTrkRelChi2] < 3) {
120  return gbrForest_->GetAdaBoostClassifier(var);
121  } else {
122  return -1;
123  }
124 }

References gbrForest_, reco::HitPattern::getHitPattern(), reco::HitPattern::getMuonStation(), mps_fire::i, JetComb::kEta, kPt, reco::HitPattern::muonCSCHitFilter(), reco::HitPattern::muonDTHitFilter(), reco::HitPattern::muonRPCHitFilter(), reco::HitPattern::numberOfAllHits(), relativeConstraints::station, reco::HitPattern::TRACK_HITS, reco::HitPattern::validHitFilter(), and trigObjTnPSource_cfi::var.

Member Data Documentation

◆ gbrForest_

std::unique_ptr<const GBRForest> pat::SoftMuonMvaEstimator::gbrForest_
private

Definition at line 27 of file SoftMuonMvaEstimator.h.

Referenced by computeMva(), and SoftMuonMvaEstimator().

kPt
example_track example_trackconst char *const kPt
Definition: TSelector.cc:33
reco::HitPattern::getHitPattern
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:530
mps_fire.i
i
Definition: mps_fire.py:355
muon
Definition: MuonCocktails.h:17
reco::HitPattern::muonRPCHitFilter
static bool muonRPCHitFilter(uint16_t pattern)
Definition: HitPattern.h:640
relativeConstraints.station
station
Definition: relativeConstraints.py:67
pat::SoftMuonMvaEstimator::gbrForest_
std::unique_ptr< const GBRForest > gbrForest_
Definition: SoftMuonMvaEstimator.h:27
reco::HitPattern::validHitFilter
static bool validHitFilter(uint16_t pattern)
Definition: HitPattern.h:765
createGBRForest
std::unique_ptr< const GBRForest > createGBRForest(const std::string &weightsFile)
Definition: GBRForestTools.cc:244
reco::HitPattern::muonCSCHitFilter
static bool muonCSCHitFilter(uint16_t pattern)
Definition: HitPattern.h:632
edm::Ref< TrackCollection >
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
reco::HitPattern
Definition: HitPattern.h:147
reco::HitPattern::getMuonStation
static uint16_t getMuonStation(uint16_t pattern)
Muon station (1-4). Only valid for muon patterns, of course. only for patterns from muon,...
Definition: HitPattern.h:732
reco::HitPattern::TRACK_HITS
Definition: HitPattern.h:155
reco::HitPattern::numberOfAllHits
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:773
JetComb::kEta
Definition: TtSemiLepJetComb.h:17
reco::HitPattern::muonDTHitFilter
static bool muonDTHitFilter(uint16_t pattern)
Definition: HitPattern.h:624
hit
Definition: SiStripHitEffFromCalibTree.cc:88