CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MatcherUsingTracksAlgorithm.cc
Go to the documentation of this file.
2 
5 
8 
15 
18 
19 
21  whichTrack1_(None), whichTrack2_(None),
22  whichState1_(AtVertex), whichState2_(AtVertex),
23  srcCut_(iConfig.existsAs<std::string>("srcPreselection") ? iConfig.getParameter<std::string>("srcPreselection") : ""),
24  matchedCut_(iConfig.existsAs<std::string>("matchedPreselection") ? iConfig.getParameter<std::string>("matchedPreselection") : ""),
25  requireSameCharge_(iConfig.existsAs<bool>("requireSameCharge") ? iConfig.getParameter<bool>("requireSameCharge") : false)
26 {
27  std::string algo = iConfig.getParameter<std::string>("algorithm");
28  if (algo == "byTrackRef") { algo_ = ByTrackRef; }
29  else if (algo == "byPropagatingSrc") { algo_ = ByPropagatingSrc; }
30  else if (algo == "byPropagatingMatched") { algo_ = ByPropagatingMatched; }
31  else if (algo == "byDirectComparison") { algo_ = ByDirectComparison; }
32  else throw cms::Exception("Configuration") << "Value '" << algo << "' for algorithm not yet implemented.\n";
33 
34  getConf(iConfig, "src", whichTrack1_, whichState1_);
35  getConf(iConfig, "matched", whichTrack2_, whichState2_);
36 
37  if (algo_ == ByTrackRef) {
38  // validate the config
39  if (whichTrack1_ == None || whichTrack2_ == None) throw cms::Exception("Configuration") << "Algorithm 'byTrackRef' needs tracks not to be 'none'.\n";
41  // read matching cuts
42  maxLocalPosDiff_ = iConfig.getParameter<double>("maxDeltaLocalPos");
43  maxGlobalMomDeltaR_ = iConfig.getParameter<double>("maxDeltaR");
44  maxGlobalMomDeltaEta_ = iConfig.existsAs<double>("maxDeltaEta") ? iConfig.getParameter<double>("maxDeltaEta") : maxGlobalMomDeltaR_;
45  maxGlobalMomDeltaPhi_ = iConfig.existsAs<double>("maxDeltaPhi") ? iConfig.getParameter<double>("maxDeltaPhi") : maxGlobalMomDeltaR_;
46  maxGlobalDPtRel_ = iConfig.getParameter<double>("maxDeltaPtRel");
47 
48  // choice of sorting variable
49  std::string sortBy = iConfig.getParameter<std::string>("sortBy");
50  if (sortBy == "deltaLocalPos") sortBy_ = LocalPosDiff;
51  else if (sortBy == "deltaPtRel") sortBy_ = GlobalDPtRel;
52  else if (sortBy == "deltaR") sortBy_ = GlobalMomDeltaR;
53  else if (sortBy == "deltaEta") sortBy_ = GlobalMomDeltaEta;
54  else if (sortBy == "deltaPhi") sortBy_ = GlobalMomDeltaPhi;
55  else if (sortBy == "chi2") sortBy_ = Chi2;
56  else throw cms::Exception("Configuration") << "Parameter 'sortBy' must be one of: deltaLocalPos, deltaPtRel, deltaR, chi2.\n";
57  // validate the config
58  if (algo_ == ByPropagatingSrc) {
59  if (whichTrack2_ == None || whichState2_ == AtVertex) {
61  //throw cms::Exception("Configuration") << "Destination track must be non-null, and state must not be 'AtVertex' (not yet).\n";
62  }
63  } else if (algo_ == ByPropagatingMatched) {
64  if (whichTrack1_ == None || whichState1_ == AtVertex) {
66  //throw cms::Exception("Configuration") << "Destination track must be non-null, and state must not be 'AtVertex' (not yet).\n";
67  }
68  } else if (algo_ == ByDirectComparison) {
69  bool firstAtVertex = (whichTrack1_ == None || whichState1_ == AtVertex);
70  bool secAtVertex = (whichTrack2_ == None || whichState2_ == AtVertex);
71  if (firstAtVertex) {
72  if (!secAtVertex) throw cms::Exception("Configuration") << "When using 'byDirectComparison' with 'src' at vertex (or None), 'matched' must be at vertex too.\n";
73  } else {
74  if (secAtVertex) throw cms::Exception("Configuration") << "When using 'byDirectComparison' with 'src' not at vertex, 'matched' can't be at vertex or None.\n";
75  if (whichState1_ != whichState2_) throw cms::Exception("Configuration") << "You can't use 'byDirectComparison' with non-matching states.\n";
76  }
77  }
78 
79  useChi2_ = iConfig.existsAs<bool>("computeChi2") ? iConfig.getParameter<bool>("computeChi2") : false;
80  if (useChi2_) {
81  if (whichTrack1_ == None && whichTrack2_ == None) throw cms::Exception("Configuration") << "Can't compute chi2s if both tracks are set to 'none'.\n";
82  maxChi2_ = iConfig.getParameter<double>("maxChi2");
83  chi2DiagonalOnly_ = iConfig.getParameter<bool>("chi2DiagonalOnly");
85  chi2UseVertex_ = iConfig.getParameter<bool>("chi2UsePosition");
86  } else {
87  chi2UseVertex_ = iConfig.getParameter<bool>("chi2UseVertex");
88  if (algo_ == ByDirectComparison) {
89  std::string choice = iConfig.getParameter<std::string>("chi2MomentumForDxy");
90  if (choice == "src") chi2FirstMomentum_ = true;
91  else if (choice != "matched") throw cms::Exception("Configuration") << "chi2MomentumForDxy must be 'src' or 'matched'\n";
92  }
93  }
94  } else maxChi2_ = 1;
95 
96  if (sortBy_ == Chi2 && !useChi2_) throw cms::Exception("Configuration") << "Can't sort by chi2s if 'computeChi2s' is not set to true.\n";
97  }
98 }
99 
100 void
101 MatcherUsingTracksAlgorithm::getConf(const edm::ParameterSet & iConfig, const std::string &whatFor, WhichTrack &whichTrack, WhichState &whichState) {
102  std::string s_whichTrack = iConfig.getParameter<std::string>(whatFor+"Track");
103  if (s_whichTrack == "none") { whichTrack = None; }
104  else if (s_whichTrack == "tracker") { whichTrack = TrackerTk; }
105  else if (s_whichTrack == "muon") { whichTrack = MuonTk; }
106  else if (s_whichTrack == "global") { whichTrack = GlobalTk; }
107  else throw cms::Exception("Configuration") << "Parameter 'useTrack' must be 'none', 'tracker', 'muon', 'global'\n";
108  if ((whichTrack != None) && (algo_ != ByTrackRef)) {
109  std::string s_whichState = iConfig.getParameter<std::string>(whatFor+"State");
110  if (s_whichState == "atVertex") { whichState = AtVertex; }
111  else if (s_whichState == "innermost") { whichState = Innermost; }
112  else if (s_whichState == "outermost") { whichState = Outermost; }
113  else throw cms::Exception("Configuration") << "Parameter 'useState' must be 'atVertex', 'innermost', 'outermost'\n";
114  }
115 }
116 
119 bool
120 MatcherUsingTracksAlgorithm::match(const reco::Candidate &c1, const reco::Candidate &c2, float &deltR, float &deltEta, float &deltPhi, float &deltaLocalPos, float &deltaPtRel, float &chi2) const {
121  if (!(srcCut_(c1) && matchedCut_(c2))) return false;
122  if (requireSameCharge_ && (c1.charge() != c2.charge())) return false;
123  switch (algo_) {
124  case ByTrackRef: {
127  if (t1.isNonnull()) {
128  if (t1 == t2) return true;
129  if (t1.id() != t2.id()) { edm::LogWarning("MatcherUsingTracksAlgorithm") << "Trying to match by reference tracks coming from different collections.\n"; }
130  }
131  }
132  case ByPropagatingSrc: {
135  return matchWithPropagation(start, target, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2);
136  }
137  case ByPropagatingMatched: {
140  return matchWithPropagation(start, target, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2);
141  }
142  case ByPropagatingSrcTSCP: {
145  return matchWithPropagation(start, target, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2);
146  }
147  case ByPropagatingMatchedTSCP: {
150  return matchWithPropagation(start, target, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2);
151  }
152 
153  case ByDirectComparison: {
156  return matchByDirectComparison(start, otherstart, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2);
157  }
158  }
159  return false;
160 }
161 
165 int
166 MatcherUsingTracksAlgorithm::match(const reco::Candidate &c1, const edm::View<reco::Candidate> &c2s, float &deltR, float &deltEta, float &deltPhi, float &deltaLocalPos, float &deltaPtRel, float &chi2) const {
167  if (!srcCut_(c1)) return -1;
168 
169  // working and output variables
171  int match = -1;
172 
173  // pre-fetch some states if needed
176  } else if (algo_ == ByPropagatingMatched) target = targetState(c1, whichTrack1_, whichState1_);
177 
178  // loop on the collection
180  for (it = c2s.begin(), ed = c2s.end(), i = 0; it != ed; ++it, ++i) {
181  if (!matchedCut_(*it)) continue;
182  if (requireSameCharge_ && (c1.charge() != it->charge()) ) continue;
183  bool exit = false;
184  switch (algo_) {
185  case ByTrackRef: {
188  if (t1.isNonnull()) {
189  if (t1 == t2) { match = i; exit = true; }
190  if (t1.id() != t2.id()) { edm::LogWarning("MatcherUsingTracksAlgorithm") << "Trying to match by reference tracks coming from different collections.\n"; }
191  }
192  } break;
193  case ByPropagatingSrc:
194  case ByPropagatingMatched: {
196  else if (algo_ == ByPropagatingSrc) target = targetState(*it, whichTrack2_, whichState2_);
197  if (matchWithPropagation(start, target, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2)) {
198  match = i;
199  }
200  } break;
201  case ByDirectComparison: {
203  if (matchByDirectComparison(start, otherstart, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2)) {
204  match = i;
205  }
206  } break;
207  case ByPropagatingSrcTSCP: {
209  if (matchWithPropagation(start, otherstart, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2)) {
210  match = i;
211  }
212  } break;
215  if (matchWithPropagation(otherstart, start, deltR, deltEta, deltPhi, deltaLocalPos, deltaPtRel, chi2)) {
216  match = i;
217  }
218  } break;
219  }
220  if (exit) break;
221  }
222 
223  return match;
224 }
225 
226 void
228  iSetup.get<IdealMagneticFieldRecord>().get(magfield_);
229  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAny", propagator_);
231 }
232 
233 
236  reco::TrackRef tk;
237  const reco::RecoCandidate *rc = dynamic_cast<const reco::RecoCandidate *>(&reco);
238  if (rc == 0) throw cms::Exception("Invalid Data") << "Input object is not a RecoCandidate.\n";
239  switch (whichTrack) {
240  case TrackerTk: tk = rc->track(); break;
241  case MuonTk : tk = rc->standAloneMuon(); break;
242  case GlobalTk : tk = rc->combinedMuon(); break;
243  default: break; // just to make gcc happy
244  }
245  return tk;
246 }
247 
251  if (whichTrack != None) {
252  reco::TrackRef tk = getTrack(reco, whichTrack);
253  if (tk.isNull()) {
254  ret = FreeTrajectoryState();
255  } else {
256  switch (whichState) {
260  }
261  }
262  } else {
263  ret = FreeTrajectoryState( GlobalPoint( reco.vx(), reco.vy(), reco.vz()),
264  GlobalVector(reco.px(), reco.py(), reco.pz()),
265  reco.charge(),
266  magfield_.product());
267  }
268  return ret;
269 }
270 
274  reco::TrackRef tk = getTrack(reco, whichTrack);
275  if (tk.isNonnull()) {
276  switch (whichState) {
279  default: break; // just to make gcc happy
280  }
281  }
282  return ret;
283 }
284 
285 bool
288  float &lastDeltaR,
289  float &lastDeltaEta,
290  float &lastDeltaPhi,
291  float &lastDeltaLocalPos,
292  float &lastGlobalDPtRel,
293  float &lastChi2) const
294 {
295  if ((start.momentum().mag() == 0) || !target.isValid()) return false;
296 
297  TrajectoryStateOnSurface tsos = propagator_->propagate(start, target.surface());
298 
299  bool isBest = false;
300  if (tsos.isValid()) {
301  float thisLocalPosDiff = (tsos.localPosition()-target.localPosition()).mag();
302  float thisGlobalMomDeltaR = deltaR(tsos.globalMomentum(), target.globalMomentum());
303  float thisGlobalMomDeltaPhi = fabs(deltaPhi(tsos.globalMomentum().phi(), target.globalMomentum().phi()));
304  float thisGlobalMomDeltaEta = fabs(tsos.globalMomentum().eta() - target.globalMomentum().eta());
305  float thisGlobalDPtRel = (tsos.globalMomentum().perp() - target.globalMomentum().perp())/target.globalMomentum().perp();
306 
307  if ((thisLocalPosDiff < maxLocalPosDiff_) &&
308  (thisGlobalMomDeltaR < maxGlobalMomDeltaR_) &&
309  (thisGlobalMomDeltaEta < maxGlobalMomDeltaEta_) &&
310  (thisGlobalMomDeltaPhi < maxGlobalMomDeltaPhi_) &&
311  (fabs(thisGlobalDPtRel) < maxGlobalDPtRel_)) {
312  float thisChi2 = useChi2_ ? getChi2(target, tsos, chi2DiagonalOnly_, chi2UseVertex_) : 0;
313  if (thisChi2 >= maxChi2_) return false;
314  switch (sortBy_) {
315  case LocalPosDiff: isBest = (thisLocalPosDiff < lastDeltaLocalPos); break;
316  case GlobalMomDeltaR: isBest = (thisGlobalMomDeltaR < lastDeltaR); break;
317  case GlobalMomDeltaEta: isBest = (thisGlobalMomDeltaEta < lastDeltaEta); break;
318  case GlobalMomDeltaPhi: isBest = (thisGlobalMomDeltaPhi < lastDeltaPhi); break;
319  case GlobalDPtRel: isBest = (thisGlobalDPtRel < lastGlobalDPtRel); break;
320  case Chi2: isBest = (thisChi2 < lastChi2); break;
321  }
322  if (isBest) {
323  lastDeltaLocalPos = thisLocalPosDiff;
324  lastDeltaR = thisGlobalMomDeltaR;
325  lastDeltaEta = thisGlobalMomDeltaEta;
326  lastDeltaPhi = thisGlobalMomDeltaPhi;
327  lastGlobalDPtRel = thisGlobalDPtRel;
328  lastChi2 = thisChi2;
329  }
330  } // if match
331  }
332 
333  return isBest;
334 }
335 
336 bool
338  const FreeTrajectoryState &target,
339  float &lastDeltaR,
340  float &lastDeltaEta,
341  float &lastDeltaPhi,
342  float &lastDeltaLocalPos,
343  float &lastGlobalDPtRel,
344  float &lastChi2) const
345 {
346  if ((start.momentum().mag() == 0) || (target.momentum().mag() == 0)) return false;
347  TSCPBuilderNoMaterial propagator;
348  /*2.2.X*/ try {
349  TrajectoryStateClosestToPoint tscp = propagator(start, target.position());
350  // if (!tscp.isValid()) return false; // in 3.1.X
351 
352  bool isBest = false;
353  float thisLocalPosDiff = (tscp.position()-target.position()).mag();
354  float thisGlobalMomDeltaR = deltaR(tscp.momentum(), target.momentum());
355  float thisGlobalMomDeltaPhi = fabs(deltaPhi(tscp.momentum().phi(), target.momentum().phi()));
356  float thisGlobalMomDeltaEta = fabs(tscp.momentum().eta() - target.momentum().eta());
357  float thisGlobalDPtRel = (tscp.momentum().perp() - target.momentum().perp())/target.momentum().perp();
358 
359  if ((thisLocalPosDiff < maxLocalPosDiff_) &&
360  (thisGlobalMomDeltaR < maxGlobalMomDeltaR_) &&
361  (thisGlobalMomDeltaEta < maxGlobalMomDeltaEta_) &&
362  (thisGlobalMomDeltaPhi < maxGlobalMomDeltaPhi_) &&
363  (fabs(thisGlobalDPtRel) < maxGlobalDPtRel_)) {
364  float thisChi2 = useChi2_ ? getChi2(target, tscp, chi2DiagonalOnly_, chi2UseVertex_) : 0;
365  if (thisChi2 >= maxChi2_) return false;
366  switch (sortBy_) {
367  case LocalPosDiff: isBest = (thisLocalPosDiff < lastDeltaLocalPos); break;
368  case GlobalMomDeltaR: isBest = (thisGlobalMomDeltaR < lastDeltaR); break;
369  case GlobalMomDeltaEta: isBest = (thisGlobalMomDeltaEta < lastDeltaEta); break;
370  case GlobalMomDeltaPhi: isBest = (thisGlobalMomDeltaPhi < lastDeltaPhi); break;
371  case GlobalDPtRel: isBest = (thisGlobalDPtRel < lastGlobalDPtRel); break;
372  case Chi2: isBest = (thisChi2 < lastChi2); break;
373  }
374  if (isBest) {
375  lastDeltaLocalPos = thisLocalPosDiff;
376  lastDeltaR = thisGlobalMomDeltaR;
377  lastDeltaEta = thisGlobalMomDeltaEta;
378  lastDeltaPhi = thisGlobalMomDeltaPhi;
379  lastGlobalDPtRel = thisGlobalDPtRel;
380  lastChi2 = thisChi2;
381  }
382  } // if match
383 
384  return isBest;
385  /*2.2.X*/ } catch (const TrajectoryStateException &err) { return false; }
386 }
387 
388 
389 bool
391  const FreeTrajectoryState &target,
392  float &lastDeltaR,
393  float &lastDeltaEta,
394  float &lastDeltaPhi,
395  float &lastDeltaLocalPos,
396  float &lastGlobalDPtRel,
397  float &lastChi2) const
398 {
399  if ((start.momentum().mag() == 0) || target.momentum().mag() == 0) return false;
400 
401  bool isBest = false;
402  float thisLocalPosDiff = (start.position()-target.position()).mag();
403  float thisGlobalMomDeltaR = deltaR(start.momentum(), target.momentum());
404  float thisGlobalMomDeltaPhi = fabs(deltaPhi(start.momentum().phi(), target.momentum().phi()));
405  float thisGlobalMomDeltaEta = fabs(start.momentum().eta() - target.momentum().eta());
406  float thisGlobalDPtRel = (start.momentum().perp() - target.momentum().perp())/target.momentum().perp();
407 
408  if ((thisLocalPosDiff < maxLocalPosDiff_) &&
409  (thisGlobalMomDeltaR < maxGlobalMomDeltaR_) &&
410  (thisGlobalMomDeltaEta < maxGlobalMomDeltaEta_) &&
411  (thisGlobalMomDeltaPhi < maxGlobalMomDeltaPhi_) &&
412  (fabs(thisGlobalDPtRel) < maxGlobalDPtRel_)) {
413  float thisChi2 = useChi2_ ? getChi2(start, target, chi2DiagonalOnly_, chi2UseVertex_, chi2FirstMomentum_) : 0;
414  if (thisChi2 >= maxChi2_) return false;
415  switch (sortBy_) {
416  case LocalPosDiff: isBest = (thisLocalPosDiff < lastDeltaLocalPos); break;
417  case GlobalMomDeltaR: isBest = (thisGlobalMomDeltaR < lastDeltaR); break;
418  case GlobalMomDeltaEta: isBest = (thisGlobalMomDeltaEta < lastDeltaEta); break;
419  case GlobalMomDeltaPhi: isBest = (thisGlobalMomDeltaPhi < lastDeltaPhi); break;
420  case GlobalDPtRel: isBest = (thisGlobalDPtRel < lastGlobalDPtRel); break;
421  case Chi2: isBest = (thisChi2 < lastChi2); break;
422  }
423  if (isBest) {
424  lastDeltaLocalPos = thisLocalPosDiff;
425  lastDeltaR = thisGlobalMomDeltaR;
426  lastDeltaEta = thisGlobalMomDeltaEta;
427  lastDeltaPhi = thisGlobalMomDeltaPhi;
428  lastGlobalDPtRel = thisGlobalDPtRel;
429  lastChi2 = thisChi2;
430  }
431  } // if match
432 
433  return isBest;
434 }
435 
436 double
437 MatcherUsingTracksAlgorithm::getChi2(const FreeTrajectoryState &start, const FreeTrajectoryState &other, bool diagonalOnly, bool useVertex, bool useFirstMomentum) {
438  if (!start.hasError() && !other.hasError()) throw cms::Exception("LogicError") << "At least one of the two states must have errors to make chi2s.\n";
440  if (start.hasError()) cov += start.curvilinearError().matrix();
441  if (other.hasError()) cov += other.curvilinearError().matrix();
442  cropAndInvert(cov, diagonalOnly, !useVertex);
443  GlobalVector p1 = start.momentum(), p2 = other.momentum();
444  GlobalPoint x1 = start.position(), x2 = other.position();
445  GlobalVector p = useFirstMomentum ? p1 : p2; double pt = p.perp(), pm = p.mag();
446  double dsz = (x1.z()-x2.z())*pt/pm - ( (x1.x()-x2.x())*p.x() + (x1.y()-x2.y())*p.y() ) / pt * p.z()/pm;
447  double dxy = ( -(x1.x()-x2.x())*p.y() + (x1.y()-x2.y())*p.x() )/pt;
448  AlgebraicVector5 diff(start.charge()/p1.mag()-other.charge()/p2.mag(),
449  p1.theta()-p2.theta(),
450  (p1.phi()-p2.phi()).value(),
451  dxy,
452  dsz);
453  return ROOT::Math::Similarity(diff, cov);
454 }
455 
456 double
457 MatcherUsingTracksAlgorithm::getChi2(const FreeTrajectoryState &start, const TrajectoryStateClosestToPoint &other, bool diagonalOnly, bool useVertex) {
458  if (!start.hasError() && !other.hasError()) throw cms::Exception("LogicError") << "At least one of the two states must have errors to make chi2s.\n";
459  double pt; // needed by pgconvert
462  if (other.hasError()) cov += other.perigeeError().covarianceMatrix();
463  cropAndInvert(cov, diagonalOnly, !useVertex);
465  AlgebraicVector5 pgpar2 = other.perigeeParameters().vector();
466  AlgebraicVector5 diff(pgpar1-pgpar2);
467  return ROOT::Math::Similarity(diff, cov);
468 }
469 
470 double
471 MatcherUsingTracksAlgorithm::getChi2(const TrajectoryStateOnSurface &start, const TrajectoryStateOnSurface &other, bool diagonalOnly, bool usePosition) {
472  if (!start.hasError() && !other.hasError()) throw cms::Exception("LogicError") << "At least one of the two states must have errors to make chi2s.\n";
474  if (start.hasError()) cov += start.localError().matrix();
475  if (other.hasError()) cov += other.localError().matrix();
476  cropAndInvert(cov, diagonalOnly, !usePosition);
478  return ROOT::Math::Similarity(diff, cov);
479 }
480 
481 void
482 MatcherUsingTracksAlgorithm::cropAndInvert(AlgebraicSymMatrix55 &cov, bool diagonalOnly, bool top3by3only) {
483  if (!top3by3only) {
484  if (diagonalOnly) {
485  for (size_t i = 0; i < 5; ++i) { for (size_t j = i+1; j < 5; ++j) {
486  cov(i,j) = 0;
487  } }
488  }
489  cov.Invert();
490  } else {
491  // get 3x3 covariance
492  AlgebraicSymMatrix33 momCov = cov.Sub<AlgebraicSymMatrix33>(0,0); // get 3x3 matrix
493  if (diagonalOnly) { momCov(0,1) = 0; momCov(0,2) = 0; momCov(1,2) = 0; }
494  // invert
495  momCov.Invert();
496  // place it
497  cov.Place_at(momCov,0,0);
498  // zero the rest
499  for (size_t i = 3; i < 5; ++i) { for (size_t j = i; j < 5; ++j) {
500  cov(i,j) = 0;
501  } }
502  }
503 }
504 
505 
T getParameter(std::string const &) const
const AlgebraicVector5 & vector() const
int i
Definition: DBlmapReader.cc:9
PerigeeTrajectoryParameters ftsToPerigeeParameters(const FTS &originalFTS, const GlobalPoint &referencePoint, double &pt)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
T perp() const
Definition: PV3DBase.h:72
const PerigeeTrajectoryError & perigeeError() const
TrajectoryStateOnSurface innerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field)
const LocalTrajectoryParameters & localParameters() const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void getConf(const edm::ParameterSet &iConfig, const std::string &whatFor, WhichTrack &whichTrack, WhichState &whichState)
Parse some configuration.
FreeTrajectoryState innerFreeState(const reco::Track &tk, const MagneticField *field)
virtual double pz() const =0
z coordinate of momentum vector
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
virtual double vx() const =0
x coordinate of vertex position
T y() const
Definition: PV3DBase.h:63
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrackCharge charge() const
virtual reco::TrackRef standAloneMuon() const
reference to a stand-alone muon Track
static double getChi2(const FreeTrajectoryState &start, const FreeTrajectoryState &other, bool diagonalOnly, bool useVertex, bool useFirstMomentum)
const CurvilinearTrajectoryError & curvilinearError() const
bool matchWithPropagation(const FreeTrajectoryState &start, const FreeTrajectoryState &target, float &lastDeltaR, float &lastDeltaEta, float &lastDeltaPhi, float &lastDeltaLocalPos, float &lastGlobalDPtRel, float &lastChi2) const
virtual double vy() const =0
y coordinate of vertex position
virtual reco::TrackRef track() const
reference to a Track
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
const SurfaceType & surface() const
bool isNull() const
Checks for null.
Definition: Ref.h:247
T mag() const
Definition: PV3DBase.h:67
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
const PerigeeTrajectoryParameters & perigeeParameters() const
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:18
edm::ESHandle< GlobalTrackingGeometry > geometry_
T z() const
Definition: PV3DBase.h:64
edm::ESHandle< MagneticField > magfield_
int j
Definition: DBlmapReader.cc:9
const AlgebraicSymMatrix55 & matrix() const
virtual int charge() const =0
electric charge
MatcherUsingTracksAlgorithm(const edm::ParameterSet &iConfig)
const LocalTrajectoryError & localError() const
virtual double py() const =0
y coordinate of momentum vector
double p2[4]
Definition: TauolaWrapper.h:90
GlobalVector momentum() const
edm::ESHandle< Propagator > propagator_
const AlgebraicSymMatrix55 & covarianceMatrix() const
virtual double px() const =0
x coordinate of momentum vector
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
TrajectoryStateOnSurface targetState(const reco::Candidate &reco, WhichTrack whichTrack, WhichState whichState) const
End state for the propagation.
GlobalPoint position() const
StringCutObjectSelector< reco::Candidate, true > srcCut_
ROOT::Math::SVector< double, 5 > AlgebraicVector5
FreeTrajectoryState initialFreeState(const reco::Track &tk, const MagneticField *field)
const GlobalPoint & referencePoint() const
FreeTrajectoryState startingState(const reco::Candidate &reco, WhichTrack whichTrack, WhichState whichState) const
Starting state for the propagation.
const T & get() const
Definition: EventSetup.h:55
TrajectoryStateOnSurface outerStateOnSurface(const reco::Track &tk, const TrackingGeometry &geom, const MagneticField *field)
T const * product() const
Definition: ESHandle.h:62
static void cropAndInvert(AlgebraicSymMatrix55 &cov, bool diagonalOnly, bool top3by3only)
Possibly crop the 3x3 part of the matrix or remove off-diagonal terms, then invert.
AlgebraicVector5 mixedFormatVector() const
T eta() const
Definition: PV3DBase.h:76
virtual double vz() const =0
z coordinate of vertex position
double p1[4]
Definition: TauolaWrapper.h:89
const AlgebraicSymMatrix55 & matrix() const
GlobalVector globalMomentum() const
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...
const_iterator begin() const
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
const_iterator end() const
FreeTrajectoryState outerFreeState(const reco::Track &tk, const MagneticField *field)
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
reco::TrackRef getTrack(const reco::Candidate &reco, WhichTrack which) const
Get track reference out of a Candidate (via dynamic_cast to reco::RecoCandidate)
volatile std::atomic< bool > shutdown_flag false
StringCutObjectSelector< reco::Candidate, true > matchedCut_
Definition: Chi2.h:17
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...
T x() const
Definition: PV3DBase.h:62
Global3DVector GlobalVector
Definition: GlobalVector.h:10
virtual reco::TrackRef combinedMuon() const
reference to a stand-alone muon Track