CMS 3D CMS Logo

MatcherUsingTracksAlgorithm.h
Go to the documentation of this file.
1 #ifndef MuonAnalysis_MuonAssociators_MatcherUsingTracksAlgorithm_h
2 #define MuonAnalysis_MuonAssociators_MatcherUsingTracksAlgorithm_h
3 //
4 //
5 
16 
21 
28 
30 public:
31  explicit MatcherUsingTracksAlgorithm(const edm::ParameterSet &iConfig);
33 
35  void init(const edm::EventSetup &iSetup);
36 
39  bool match(const reco::Candidate &c1,
40  const reco::Candidate &c2,
41  float &deltaR,
42  float &deltaEta,
43  float &deltaPhi,
44  float &deltaLocalPos,
45  float &deltaPtRel,
46  float &chi2) const;
47 
51  int match(const reco::Candidate &tk,
52  const edm::View<reco::Candidate> &c2s,
53  float &deltaR,
54  float &deltaEta,
55  float &deltaPhi,
56  float &deltaLocalPos,
57  float &deltaPtRel,
58  float &chi2) const;
59 
61  bool hasMetrics() const { return algo_ != ByTrackRef; }
62 
64  bool hasChi2() const { return useChi2_; }
65 
71  static double getChi2(const FreeTrajectoryState &start,
73  bool diagonalOnly,
74  bool useVertex,
75  bool useFirstMomentum);
76 
81  static double getChi2(const FreeTrajectoryState &start,
83  bool diagonalOnly,
84  bool useVertex);
85 
90  static double getChi2(const TrajectoryStateOnSurface &start,
92  bool diagonalOnly,
93  bool usePosition);
94 
96  static void cropAndInvert(AlgebraicSymMatrix55 &cov, bool diagonalOnly, bool top3by3only);
97 
98 private:
99  enum AlgoType {
106  }; // propagate closest to point
109 
113 
114  // Preselection cuts on both sides
116 
117  // Matching cuts
123  float maxChi2_;
128 
129  //- Tools
133 
136 
138  FreeTrajectoryState startingState(const reco::Candidate &reco, WhichTrack whichTrack, WhichState whichState) const;
139 
141  TrajectoryStateOnSurface targetState(const reco::Candidate &reco, WhichTrack whichTrack, WhichState whichState) const;
142 
147  float &lastDeltaR,
148  float &lastDeltaEta,
149  float &lastDeltaPhi,
150  float &lastDeltaLocalPos,
151  float &lastGlobalDPtRel,
152  float &lastChi2) const;
153 
158  float &lastDeltaR,
159  float &lastDeltaEta,
160  float &lastDeltaPhi,
161  float &lastDeltaLocalPos,
162  float &lastGlobalDPtRel,
163  float &lastChi2) const;
164 
167  const FreeTrajectoryState &other,
168  float &lastDeltaR,
169  float &lastDeltaEta,
170  float &lastDeltaPhi,
171  float &lastDeltaLocalPos,
172  float &lastGlobalDPtRel,
173  float &lastChi2) const;
174 
176  void getConf(const edm::ParameterSet &iConfig,
177  const std::string &whatFor,
178  WhichTrack &whichTrack,
179  WhichState &whichState);
180 };
181 
182 #endif
MatcherUsingTracksAlgorithm::AlgoType
AlgoType
Definition: MatcherUsingTracksAlgorithm.h:99
MatcherUsingTracksAlgorithm::targetState
TrajectoryStateOnSurface targetState(const reco::Candidate &reco, WhichTrack whichTrack, WhichState whichState) const
End state for the propagation.
Definition: MatcherUsingTracksAlgorithm.cc:359
MatcherUsingTracksAlgorithm::geometry_
edm::ESHandle< GlobalTrackingGeometry > geometry_
Definition: MatcherUsingTracksAlgorithm.h:132
Propagator.h
TrajectoryStateOnSurface.h
MatcherUsingTracksAlgorithm::chi2UseVertex_
bool chi2UseVertex_
Definition: MatcherUsingTracksAlgorithm.h:125
start
Definition: start.py:1
HLT_2018_cff.useVertex
useVertex
Definition: HLT_2018_cff.py:25062
ESHandle.h
TrajectoryStateClosestToPoint.h
MatcherUsingTracksAlgorithm::GlobalMomDeltaEta
Definition: MatcherUsingTracksAlgorithm.h:126
MatcherUsingTracksAlgorithm::hasChi2
bool hasChi2() const
Return 'true' if the matcher will produce also chi2.
Definition: MatcherUsingTracksAlgorithm.h:64
MatcherUsingTracksAlgorithm::maxChi2_
float maxChi2_
Definition: MatcherUsingTracksAlgorithm.h:123
MatcherUsingTracksAlgorithm::None
Definition: MatcherUsingTracksAlgorithm.h:107
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
edm::Ref< TrackCollection >
MatcherUsingTracksAlgorithm::maxGlobalMomDeltaEta_
float maxGlobalMomDeltaEta_
Definition: MatcherUsingTracksAlgorithm.h:120
CandidateFwd.h
Chi2
Definition: Chi2.h:15
MatcherUsingTracksAlgorithm::maxLocalPosDiff_
float maxLocalPosDiff_
Definition: MatcherUsingTracksAlgorithm.h:118
MatcherUsingTracksAlgorithm::sortBy_
SortBy sortBy_
Definition: MatcherUsingTracksAlgorithm.h:127
MatcherUsingTracksAlgorithm::ByTrackRef
Definition: MatcherUsingTracksAlgorithm.h:100
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MatcherUsingTracksAlgorithm::GlobalTk
Definition: MatcherUsingTracksAlgorithm.h:107
MatcherUsingTracksAlgorithm::matchByDirectComparison
bool matchByDirectComparison(const FreeTrajectoryState &start, const FreeTrajectoryState &other, float &lastDeltaR, float &lastDeltaEta, float &lastDeltaPhi, float &lastDeltaLocalPos, float &lastGlobalDPtRel, float &lastChi2) const
Compare directly two states. return true if current pair is the new best match (in that case,...
Definition: MatcherUsingTracksAlgorithm.cc:503
MatcherUsingTracksAlgorithm::MuonTk
Definition: MatcherUsingTracksAlgorithm.h:107
TrackFwd.h
MatcherUsingTracksAlgorithm::getConf
void getConf(const edm::ParameterSet &iConfig, const std::string &whatFor, WhichTrack &whichTrack, WhichState &whichState)
Parse some configuration.
Definition: MatcherUsingTracksAlgorithm.cc:130
spr::deltaEta
static const double deltaEta
Definition: CaloConstants.h:8
MatcherUsingTracksAlgorithm::init
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
Definition: MatcherUsingTracksAlgorithm.cc:302
MatcherUsingTracksAlgorithm::srcCut_
StringCutObjectSelector< reco::Candidate, true > srcCut_
Definition: MatcherUsingTracksAlgorithm.h:115
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
MatcherUsingTracksAlgorithm::Innermost
Definition: MatcherUsingTracksAlgorithm.h:108
MatcherUsingTracksAlgorithm::whichState2_
WhichState whichState2_
Definition: MatcherUsingTracksAlgorithm.h:112
MatcherUsingTracksAlgorithm::~MatcherUsingTracksAlgorithm
virtual ~MatcherUsingTracksAlgorithm()
Definition: MatcherUsingTracksAlgorithm.h:32
edm::ESHandle< MagneticField >
trackingPlots.other
other
Definition: trackingPlots.py:1465
MatcherUsingTracksAlgorithm::WhichState
WhichState
Definition: MatcherUsingTracksAlgorithm.h:108
MatcherUsingTracksAlgorithm::MatcherUsingTracksAlgorithm
MatcherUsingTracksAlgorithm(const edm::ParameterSet &iConfig)
Definition: MatcherUsingTracksAlgorithm.cc:19
MatcherUsingTracksAlgorithm::ByDirectComparison
Definition: MatcherUsingTracksAlgorithm.h:101
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
MatcherUsingTracksAlgorithm::useChi2_
bool useChi2_
Definition: MatcherUsingTracksAlgorithm.h:125
MatcherUsingTracksAlgorithm::ByPropagatingMatchedTSCP
Definition: MatcherUsingTracksAlgorithm.h:105
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MatcherUsingTracksAlgorithm::TrackerTk
Definition: MatcherUsingTracksAlgorithm.h:107
MatcherUsingTracksAlgorithm::matchWithPropagation
bool matchWithPropagation(const FreeTrajectoryState &start, const FreeTrajectoryState &target, float &lastDeltaR, float &lastDeltaEta, float &lastDeltaPhi, float &lastDeltaLocalPos, float &lastGlobalDPtRel, float &lastChi2) const
Definition: MatcherUsingTracksAlgorithm.cc:441
MatcherUsingTracksAlgorithm::whichTrack2_
WhichTrack whichTrack2_
Definition: MatcherUsingTracksAlgorithm.h:111
edm::View
Definition: CaloClusterFwd.h:14
MatcherUsingTracksAlgorithm::hasMetrics
bool hasMetrics() const
Return 'true' if the matcher will produce meaningful deltaR, deltaLocalPos, deltaPtRel values.
Definition: MatcherUsingTracksAlgorithm.h:61
MatcherUsingTracksAlgorithm::cropAndInvert
static void cropAndInvert(AlgebraicSymMatrix55 &cov, bool diagonalOnly, bool top3by3only)
Possibly crop the 3x3 part of the matrix or remove off-diagonal terms, then invert.
Definition: MatcherUsingTracksAlgorithm.cc:622
MatcherUsingTracksAlgorithm::getTrack
reco::TrackRef getTrack(const reco::Candidate &reco, WhichTrack which) const
Get track reference out of a Candidate (via dynamic_cast to reco::RecoCandidate)
Definition: MatcherUsingTracksAlgorithm.cc:308
edm::ParameterSet
Definition: ParameterSet.h:36
MatcherUsingTracksAlgorithm::chi2FirstMomentum_
bool chi2FirstMomentum_
Definition: MatcherUsingTracksAlgorithm.h:125
MatcherUsingTracksAlgorithm::maxGlobalDPtRel_
float maxGlobalDPtRel_
Definition: MatcherUsingTracksAlgorithm.h:122
MatcherUsingTracksAlgorithm::chi2DiagonalOnly_
bool chi2DiagonalOnly_
Definition: MatcherUsingTracksAlgorithm.h:125
MatcherUsingTracksAlgorithm::maxGlobalMomDeltaPhi_
float maxGlobalMomDeltaPhi_
Definition: MatcherUsingTracksAlgorithm.h:121
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
MatcherUsingTracksAlgorithm::ByPropagatingSrc
Definition: MatcherUsingTracksAlgorithm.h:102
MagneticField.h
MatcherUsingTracksAlgorithm::LocalPosDiff
Definition: MatcherUsingTracksAlgorithm.h:126
edm::EventSetup
Definition: EventSetup.h:57
TrajectoryStateClosestToPoint
Definition: TrajectoryStateClosestToPoint.h:18
MatcherUsingTracksAlgorithm::SortBy
SortBy
Definition: MatcherUsingTracksAlgorithm.h:126
HLT_2018_cff.usePosition
usePosition
Definition: HLT_2018_cff.py:10155
MatcherUsingTracksAlgorithm::propagator_
edm::ESHandle< Propagator > propagator_
Definition: MatcherUsingTracksAlgorithm.h:131
MatcherUsingTracksAlgorithm::getChi2
static double getChi2(const FreeTrajectoryState &start, const FreeTrajectoryState &other, bool diagonalOnly, bool useVertex, bool useFirstMomentum)
Definition: MatcherUsingTracksAlgorithm.cc:560
MatcherUsingTracksAlgorithm::whichState1_
WhichState whichState1_
Definition: MatcherUsingTracksAlgorithm.h:112
InputTag.h
reco::Candidate
Definition: Candidate.h:27
MatcherUsingTracksAlgorithm::whichTrack1_
WhichTrack whichTrack1_
Definition: MatcherUsingTracksAlgorithm.h:111
MatcherUsingTracksAlgorithm::magfield_
edm::ESHandle< MagneticField > magfield_
Definition: MatcherUsingTracksAlgorithm.h:130
MatcherUsingTracksAlgorithm::AtVertex
Definition: MatcherUsingTracksAlgorithm.h:108
StringCutObjectSelector.h
MatcherUsingTracksAlgorithm::matchedCut_
StringCutObjectSelector< reco::Candidate, true > matchedCut_
Definition: MatcherUsingTracksAlgorithm.h:115
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
MatcherUsingTracksAlgorithm::match
bool match(const reco::Candidate &c1, const reco::Candidate &c2, float &deltaR, float &deltaEta, float &deltaPhi, float &deltaLocalPos, float &deltaPtRel, float &chi2) const
Definition: MatcherUsingTracksAlgorithm.cc:160
MatcherUsingTracksAlgorithm::Outermost
Definition: MatcherUsingTracksAlgorithm.h:108
StringCutObjectSelector< reco::Candidate, true >
EventSetup.h
MatcherUsingTracksAlgorithm::startingState
FreeTrajectoryState startingState(const reco::Candidate &reco, WhichTrack whichTrack, WhichState whichState) const
Starting state for the propagation.
Definition: MatcherUsingTracksAlgorithm.cc:329
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
MatcherUsingTracksAlgorithm::ByPropagatingMatched
Definition: MatcherUsingTracksAlgorithm.h:103
HLT_2018_cff.diagonalOnly
diagonalOnly
Definition: HLT_2018_cff.py:10156
MatcherUsingTracksAlgorithm::algo_
AlgoType algo_
Definition: MatcherUsingTracksAlgorithm.h:110
ParameterSet.h
MatcherUsingTracksAlgorithm::WhichTrack
WhichTrack
Definition: MatcherUsingTracksAlgorithm.h:107
MatcherUsingTracksAlgorithm::maxGlobalMomDeltaR_
float maxGlobalMomDeltaR_
Definition: MatcherUsingTracksAlgorithm.h:119
GlobalTrackingGeometry.h
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
eostools.which
def which(cmd)
Definition: eostools.py:336
MatcherUsingTracksAlgorithm::GlobalMomDeltaPhi
Definition: MatcherUsingTracksAlgorithm.h:126
MatcherUsingTracksAlgorithm::GlobalDPtRel
Definition: MatcherUsingTracksAlgorithm.h:126
MatcherUsingTracksAlgorithm::requireSameCharge_
bool requireSameCharge_
Definition: MatcherUsingTracksAlgorithm.h:124
MatcherUsingTracksAlgorithm
Definition: MatcherUsingTracksAlgorithm.h:29
MatcherUsingTracksAlgorithm::GlobalMomDeltaR
Definition: MatcherUsingTracksAlgorithm.h:126
MatcherUsingTracksAlgorithm::ByPropagatingSrcTSCP
Definition: MatcherUsingTracksAlgorithm.h:104