CMS 3D CMS Logo

Typedefs | Functions
SoftMuonMvaRun3Estimator.cc File Reference
#include "PhysicsTools/PatAlgos/interface/SoftMuonMvaRun3Estimator.h"
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "PhysicsTools/XGBoost/interface/XGBooster.h"

Go to the source code of this file.

Typedefs

typedef std::pair< const reco::MuonChamberMatch *, const reco::MuonSegmentMatch * > MatchPair
 

Functions

float dX (const MatchPair &match)
 
float dY (const MatchPair &match)
 
void fillMatchInfo (pat::XGBooster &booster, const pat::Muon &muon)
 
void fillMatchInfoForStation (std::string prefix, pat::XGBooster &booster, const MatchPair &match)
 
const MatchPairgetBetterMatch (const MatchPair &match1, const MatchPair &match2)
 
float pullDxDz (const MatchPair &match)
 
float pullDyDz (const MatchPair &match)
 
float pullX (const MatchPair &match)
 
float pullY (const MatchPair &match)
 

Typedef Documentation

◆ MatchPair

typedef std::pair<const reco::MuonChamberMatch*, const reco::MuonSegmentMatch*> MatchPair

Definition at line 5 of file SoftMuonMvaRun3Estimator.cc.

Function Documentation

◆ dX()

float dX ( const MatchPair match)

Definition at line 23 of file SoftMuonMvaRun3Estimator.cc.

References match().

Referenced by RPCPointVsRecHit::analyze(), RPCRecHitValid::analyze(), Quantile::calculateQ(), FWFramedTextTableCellRenderer::draw(), FWTextTableCellRenderer::draw(), FWRPZViewGeometry::estimateProjectionSizeDT(), MuonShowerDigiFiller::fill(), fillMatchInfoForStation(), getVertexD0(), muon::isGoodMuon(), MuonDetCleaner< T1, T2 >::produce(), pullX(), and LinkByRecHit::testHFEMAndHFHADByRecHit().

23  {
24  if (match.first and match.second->hasPhi())
25  return (match.first->x - match.second->x);
26  else
27  return 9999.;
28 }
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

◆ dY()

float dY ( const MatchPair match)

Definition at line 45 of file SoftMuonMvaRun3Estimator.cc.

References match().

Referenced by Quantile::calculateQ(), FWCollectionSummaryModelCellRenderer::draw(), FWColumnLabelCellRenderer::draw(), FWRPZViewGeometry::estimateProjectionSizeDT(), fillMatchInfoForStation(), getVertexD0(), muon::isGoodMuon(), pullY(), and LinkByRecHit::testHFEMAndHFHADByRecHit().

45  {
46  if (match.first and match.second->hasZed())
47  return (match.first->y - match.second->y);
48  else
49  return 9999.;
50 }
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

◆ fillMatchInfo()

void fillMatchInfo ( pat::XGBooster booster,
const pat::Muon muon 
)

Definition at line 76 of file SoftMuonMvaRun3Estimator.cc.

References reco::MuonSegmentMatch::BelongsToTrackByDR, reco::MuonSegmentMatch::BestInStationByDR, fillMatchInfoForStation(), dqmdumpme::first, getBetterMatch(), mps_fire::i, oniaPATMuonsWithTrigger_cff::matches, and relativeConstraints::station.

Referenced by pat::computeSoftMvaRun3().

76  {
77  // Initiate containter for results
78  const int n_stations = 2;
79  std::vector<MatchPair> matches;
80  for (unsigned int i = 0; i < n_stations; ++i)
81  matches.push_back(std::pair(nullptr, nullptr));
82 
83  // Find best matches
84  for (auto& chamberMatch : muon.matches()) {
85  unsigned int station = chamberMatch.station() - 1;
86  if (station >= n_stations)
87  continue;
88 
89  // Find best segment match.
90  // We could consider all segments, but we will restrict to segments
91  // that match to this candidate better than to other muon candidates
92  for (auto& segmentMatch : chamberMatch.segmentMatches) {
93  if (not segmentMatch.isMask(reco::MuonSegmentMatch::BestInStationByDR) ||
94  not segmentMatch.isMask(reco::MuonSegmentMatch::BelongsToTrackByDR))
95  continue;
96 
97  // Multiple segment matches are possible in different
98  // chambers that are either overlapping or belong to
99  // different detectors. We need to select one.
100  auto match_pair = MatchPair(&chamberMatch, &segmentMatch);
101 
102  if (matches[station].first)
103  matches[station] = getBetterMatch(matches[station], match_pair);
104  else
105  matches[station] = match_pair;
106  }
107  }
108 
109  // Fill matching information
110  fillMatchInfoForStation("match1", booster, matches[0]);
111  fillMatchInfoForStation("match2", booster, matches[1]);
112 }
const MatchPair & getBetterMatch(const MatchPair &match1, const MatchPair &match2)
void fillMatchInfoForStation(std::string prefix, pat::XGBooster &booster, const MatchPair &match)
static const unsigned int BestInStationByDR
std::pair< const reco::MuonChamberMatch *, const reco::MuonSegmentMatch * > MatchPair
static const unsigned int BelongsToTrackByDR

◆ fillMatchInfoForStation()

void fillMatchInfoForStation ( std::string  prefix,
pat::XGBooster booster,
const MatchPair match 
)

Definition at line 67 of file SoftMuonMvaRun3Estimator.cc.

References dX(), dY(), match(), hcallasereventfilter2012_cfi::prefix, pullDxDz(), pullDyDz(), pullX(), pullY(), and pat::XGBooster::set().

Referenced by fillMatchInfo().

67  {
68  booster.set(prefix + "_dX", dX(match));
69  booster.set(prefix + "_pullX", pullX(match));
70  booster.set(prefix + "_pullDxDz", pullDxDz(match));
71  booster.set(prefix + "_dY", dY(match));
72  booster.set(prefix + "_pullY", pullY(match));
73  booster.set(prefix + "_pullDyDz", pullDyDz(match));
74 }
float pullDyDz(const MatchPair &match)
float pullDxDz(const MatchPair &match)
float dX(const MatchPair &match)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void set(std::string name, float value)
Definition: XGBooster.cc:79
float pullY(const MatchPair &match)
float pullX(const MatchPair &match)
float dY(const MatchPair &match)

◆ getBetterMatch()

const MatchPair& getBetterMatch ( const MatchPair match1,
const MatchPair match2 
)

Definition at line 7 of file SoftMuonMvaRun3Estimator.cc.

References funct::abs(), and MuonSubdetId::DT.

Referenced by fillMatchInfo().

7  {
8  // Prefer DT over CSC simply because it's closer to IP
9  // and will have less multiple scattering (at least for
10  // RB1 vs ME1/3 case). RB1 & ME1/2 overlap is tiny
11  if (match2.first->detector() == MuonSubdetId::DT and match1.first->detector() != MuonSubdetId::DT)
12  return match2;
13 
14  // For the rest compare local x match. We expect that
15  // segments belong to the muon, so the difference in
16  // local x is a reflection on how well we can measure it
17  if (abs(match1.first->x - match1.second->x) > abs(match2.first->x - match2.second->x))
18  return match2;
19 
20  return match1;
21 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static constexpr int DT
Definition: MuonSubdetId.h:11

◆ pullDxDz()

float pullDxDz ( const MatchPair match)

Definition at line 37 of file SoftMuonMvaRun3Estimator.cc.

References match(), funct::pow(), and mathSSE::sqrt().

Referenced by fillMatchInfoForStation().

37  {
38  if (match.first and match.second->hasPhi())
39  return (match.first->dXdZ - match.second->dXdZ) /
40  sqrt(pow(match.first->dXdZErr, 2) + pow(match.second->dXdZErr, 2));
41  else
42  return 9999.;
43 }
T sqrt(T t)
Definition: SSEVec.h:23
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ pullDyDz()

float pullDyDz ( const MatchPair match)

Definition at line 59 of file SoftMuonMvaRun3Estimator.cc.

References match(), funct::pow(), and mathSSE::sqrt().

Referenced by fillMatchInfoForStation().

59  {
60  if (match.first and match.second->hasZed())
61  return (match.first->dYdZ - match.second->dYdZ) /
62  sqrt(pow(match.first->dYdZErr, 2) + pow(match.second->dYdZErr, 2));
63  else
64  return 9999.;
65 }
T sqrt(T t)
Definition: SSEVec.h:23
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ pullX()

float pullX ( const MatchPair match)

Definition at line 30 of file SoftMuonMvaRun3Estimator.cc.

References dX(), match(), funct::pow(), and mathSSE::sqrt().

Referenced by ME0RecHitsValidation::analyze(), DMRChecker::analyze(), CkfDebugger::computePulls(), fillMatchInfoForStation(), muon::overlap(), and SimpleVertexTree::~SimpleVertexTree().

30  {
31  if (match.first and match.second->hasPhi())
32  return dX(match) / sqrt(pow(match.first->xErr, 2) + pow(match.second->xErr, 2));
33  else
34  return 9999.;
35 }
T sqrt(T t)
Definition: SSEVec.h:23
float dX(const MatchPair &match)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ pullY()

float pullY ( const MatchPair match)

Definition at line 52 of file SoftMuonMvaRun3Estimator.cc.

References dY(), match(), funct::pow(), and mathSSE::sqrt().

Referenced by ME0RecHitsValidation::analyze(), DMRChecker::analyze(), CkfDebugger::computePulls(), fillMatchInfoForStation(), muon::overlap(), and SimpleVertexTree::~SimpleVertexTree().

52  {
53  if (match.first and match.second->hasZed())
54  return dY(match) / sqrt(pow(match.first->yErr, 2) + pow(match.second->yErr, 2));
55  else
56  return 9999.;
57 }
T sqrt(T t)
Definition: SSEVec.h:23
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
float dY(const MatchPair &match)