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,
82  const TrajectoryStateClosestToPoint &other,
83  bool diagonalOnly,
84  bool useVertex);
85 
90  static double getChi2(const TrajectoryStateOnSurface &start,
91  const TrajectoryStateOnSurface &other,
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 
145  bool matchWithPropagation(const FreeTrajectoryState &start,
147  float &lastDeltaR,
148  float &lastDeltaEta,
149  float &lastDeltaPhi,
150  float &lastDeltaLocalPos,
151  float &lastGlobalDPtRel,
152  float &lastChi2) const;
153 
156  bool matchWithPropagation(const FreeTrajectoryState &start,
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
Definition: start.py:1
bool hasChi2() const
Return &#39;true&#39; if the matcher will produce also chi2.
void getConf(const edm::ParameterSet &iConfig, const std::string &whatFor, WhichTrack &whichTrack, WhichState &whichState)
Parse some configuration.
static double getChi2(const FreeTrajectoryState &start, const FreeTrajectoryState &other, bool diagonalOnly, bool useVertex, bool useFirstMomentum)
bool matchWithPropagation(const FreeTrajectoryState &start, const FreeTrajectoryState &target, float &lastDeltaR, float &lastDeltaEta, float &lastDeltaPhi, float &lastDeltaLocalPos, float &lastGlobalDPtRel, float &lastChi2) const
static const double deltaEta
Definition: CaloConstants.h:8
StringCutObjectSelector< reco::Candidate, true > matchedCut_
bool hasMetrics() const
Return &#39;true&#39; if the matcher will produce meaningful deltaR, deltaLocalPos, deltaPtRel values...
edm::ESHandle< GlobalTrackingGeometry > geometry_
edm::ESHandle< MagneticField > magfield_
StringCutObjectSelector< reco::Candidate, true > srcCut_
MatcherUsingTracksAlgorithm(const edm::ParameterSet &iConfig)
edm::ESHandle< Propagator > propagator_
TrajectoryStateOnSurface targetState(const reco::Candidate &reco, WhichTrack whichTrack, WhichState whichState) const
End state for the propagation.
FreeTrajectoryState startingState(const reco::Candidate &reco, WhichTrack whichTrack, WhichState whichState) const
Starting state for the propagation.
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
static void cropAndInvert(AlgebraicSymMatrix55 &cov, bool diagonalOnly, bool top3by3only)
Possibly crop the 3x3 part of the matrix or remove off-diagonal terms, then invert.
fixed size matrix
bool match(const reco::Candidate &c1, const reco::Candidate &c2, float &deltaR, float &deltaEta, float &deltaPhi, float &deltaLocalPos, float &deltaPtRel, float &chi2) const
void init(const edm::EventSetup &iSetup)
Call this method at the beginning of each run, to initialize geometry, magnetic field and propagators...
def which(cmd)
Definition: eostools.py:336
reco::TrackRef getTrack(const reco::Candidate &reco, WhichTrack which) const
Get track reference out of a Candidate (via dynamic_cast to reco::RecoCandidate)
Definition: Chi2.h:15
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...