CMS 3D CMS Logo

TrackExtenderWithMTD.cc
Go to the documentation of this file.
7 
10 
13 
15 
17 
22 
27 
29 
33 
35 
38 
41 
43 
46 
47 #include <sstream>
48 
50 
53 
56 #include "CLHEP/Units/GlobalPhysicalConstants.h"
57 
60 
61 using namespace std;
62 using namespace edm;
63 using namespace reco;
64 
65 namespace {
66  class MTDHitMatchingInfo {
67  public:
68  MTDHitMatchingInfo() {
69  hit = nullptr;
72  }
73 
74  //Operator used to sort the hits while performing the matching step at the MTD
75  inline bool operator<(const MTDHitMatchingInfo& m2) const {
76  //only for good matching in time use estChi2, otherwise use mostly time compatibility
77  constexpr double chi2_cut = 10.;
78  constexpr double low_weight = 3.;
79  constexpr double high_weight = 8.;
80  if (timeChi2 < chi2_cut && m2.timeChi2 < chi2_cut)
81  return chi2(low_weight) < m2.chi2(low_weight);
82  else
83  return chi2(high_weight) < m2.chi2(high_weight);
84  }
85 
86  inline double chi2(double timeWeight = 1.) const { return estChi2 + timeWeight * timeChi2; }
87 
88  const MTDTrackingRecHit* hit;
89  double estChi2;
90  double timeChi2;
91  };
92 
93  struct TrackTofPidInfo {
94  double tmtd;
95  double tmtderror;
96  double pathlength;
97 
98  double betaerror;
99 
100  double dt;
101  double dterror;
102  double dtchi2;
103 
104  double dt_best;
105  double dterror_best;
106  double dtchi2_best;
107 
108  double gammasq_pi;
109  double beta_pi;
110  double dt_pi;
111 
112  double gammasq_k;
113  double beta_k;
114  double dt_k;
115 
116  double gammasq_p;
117  double beta_p;
118  double dt_p;
119 
120  double prob_pi;
121  double prob_k;
122  double prob_p;
123  };
124 
125  const TrackTofPidInfo computeTrackTofPidInfo(double magp2,
126  double length,
127  double t_mtd,
128  double t_mtderr,
129  double t_vtx,
130  double t_vtx_err,
131  bool addPIDError = true) {
132  constexpr double m_pi = 0.13957018;
133  constexpr double m_pi_inv2 = 1.0 / m_pi / m_pi;
134  constexpr double m_k = 0.493677;
135  constexpr double m_k_inv2 = 1.0 / m_k / m_k;
136  constexpr double m_p = 0.9382720813;
137  constexpr double m_p_inv2 = 1.0 / m_p / m_p;
138  constexpr double c_cm_ns = geant_units::operators::convertMmToCm(CLHEP::c_light); // [mm/ns] -> [cm/ns]
139  constexpr double c_inv = 1.0 / c_cm_ns;
140 
141  TrackTofPidInfo tofpid;
142 
143  tofpid.tmtd = t_mtd;
144  tofpid.tmtderror = t_mtderr;
145  tofpid.pathlength = length;
146 
147  tofpid.gammasq_pi = 1. + magp2 * m_pi_inv2;
148  tofpid.beta_pi = std::sqrt(1. - 1. / tofpid.gammasq_pi);
149  tofpid.dt_pi = tofpid.pathlength / tofpid.beta_pi * c_inv;
150 
151  tofpid.gammasq_k = 1. + magp2 * m_k_inv2;
152  tofpid.beta_k = std::sqrt(1. - 1. / tofpid.gammasq_k);
153  tofpid.dt_k = tofpid.pathlength / tofpid.beta_k * c_inv;
154 
155  tofpid.gammasq_p = 1. + magp2 * m_p_inv2;
156  tofpid.beta_p = std::sqrt(1. - 1. / tofpid.gammasq_p);
157  tofpid.dt_p = tofpid.pathlength / tofpid.beta_p * c_inv;
158 
159  tofpid.dt = tofpid.tmtd - tofpid.dt_pi - t_vtx; //assume by default the pi hypothesis
160  tofpid.dterror = sqrt(tofpid.tmtderror * tofpid.tmtderror + t_vtx_err * t_vtx_err);
161  tofpid.betaerror = 0;
162  if (addPIDError) {
163  tofpid.dterror =
164  sqrt(tofpid.dterror * tofpid.dterror + (tofpid.dt_p - tofpid.dt_pi) * (tofpid.dt_p - tofpid.dt_pi));
165  tofpid.betaerror = tofpid.beta_p - tofpid.beta_pi;
166  }
167 
168  tofpid.dtchi2 = (tofpid.dt * tofpid.dt) / (tofpid.dterror * tofpid.dterror);
169 
170  tofpid.dt_best = tofpid.dt;
171  tofpid.dterror_best = tofpid.dterror;
172  tofpid.dtchi2_best = tofpid.dtchi2;
173 
174  tofpid.prob_pi = -1.;
175  tofpid.prob_k = -1.;
176  tofpid.prob_p = -1.;
177 
178  if (!addPIDError) {
179  //*TODO* deal with heavier nucleons and/or BSM case here?
180  double chi2_pi = tofpid.dtchi2;
181  double chi2_k =
182  (tofpid.tmtd - tofpid.dt_k - t_vtx) * (tofpid.tmtd - tofpid.dt_k - t_vtx) / (tofpid.dterror * tofpid.dterror);
183  double chi2_p =
184  (tofpid.tmtd - tofpid.dt_p - t_vtx) * (tofpid.tmtd - tofpid.dt_p - t_vtx) / (tofpid.dterror * tofpid.dterror);
185 
186  double rawprob_pi = exp(-0.5 * chi2_pi);
187  double rawprob_k = exp(-0.5 * chi2_k);
188  double rawprob_p = exp(-0.5 * chi2_p);
189  double normprob = 1. / (rawprob_pi + rawprob_k + rawprob_p);
190 
191  tofpid.prob_pi = rawprob_pi * normprob;
192  tofpid.prob_k = rawprob_k * normprob;
193  tofpid.prob_p = rawprob_p * normprob;
194 
195  double prob_heavy = 1. - tofpid.prob_pi;
196  constexpr double heavy_threshold = 0.75;
197 
198  if (prob_heavy > heavy_threshold) {
199  if (chi2_k < chi2_p) {
200  tofpid.dt_best = (tofpid.tmtd - tofpid.dt_k - t_vtx);
201  tofpid.dtchi2_best = chi2_k;
202  } else {
203  tofpid.dt_best = (tofpid.tmtd - tofpid.dt_p - t_vtx);
204  tofpid.dtchi2_best = chi2_p;
205  }
206  }
207  }
208  return tofpid;
209  }
210 
211  bool getTrajectoryStateClosestToBeamLine(const Trajectory& traj,
212  const reco::BeamSpot& bs,
213  const Propagator* thePropagator,
215  // get the state closest to the beamline
216  TrajectoryStateOnSurface stateForProjectionToBeamLineOnSurface =
217  traj.closestMeasurement(GlobalPoint(bs.x0(), bs.y0(), bs.z0())).updatedState();
218 
219  if (!stateForProjectionToBeamLineOnSurface.isValid()) {
220  edm::LogError("CannotPropagateToBeamLine") << "the state on the closest measurement isnot valid. skipping track.";
221  return false;
222  }
223 
224  const FreeTrajectoryState& stateForProjectionToBeamLine = *stateForProjectionToBeamLineOnSurface.freeState();
225 
226  TSCBLBuilderWithPropagator tscblBuilder(*thePropagator);
227  tscbl = tscblBuilder(stateForProjectionToBeamLine, bs);
228 
229  return tscbl.isValid();
230  }
231 
232  bool trackPathLength(const Trajectory& traj,
234  const Propagator* thePropagator,
235  double& pathlength) {
236  pathlength = 0.;
237 
238  bool validpropagation = true;
239  double pathlength1 = 0.;
240  double pathlength2 = 0.;
241 
242  //add pathlength layer by layer
243  for (auto it = traj.measurements().begin(); it != traj.measurements().end() - 1; ++it) {
244  const auto& propresult = thePropagator->propagateWithPath(it->updatedState(), (it + 1)->updatedState().surface());
245  double layerpathlength = std::abs(propresult.second);
246  if (layerpathlength == 0.) {
247  validpropagation = false;
248  }
249  pathlength1 += layerpathlength;
250  }
251 
252  //add distance from bs to first measurement
253  auto const& tscblPCA = tscbl.trackStateAtPCA();
254  auto const& aSurface = traj.direction() == alongMomentum ? traj.firstMeasurement().updatedState().surface()
255  : traj.lastMeasurement().updatedState().surface();
256  pathlength2 = thePropagator->propagateWithPath(tscblPCA, aSurface).second;
257  if (pathlength2 == 0.) {
258  validpropagation = false;
259  }
260  pathlength = pathlength1 + pathlength2;
261 
262  return validpropagation;
263  }
264 
265  bool trackPathLength(const Trajectory& traj,
266  const reco::BeamSpot& bs,
267  const Propagator* thePropagator,
268  double& pathlength) {
269  pathlength = 0.;
270 
272  bool tscbl_status = getTrajectoryStateClosestToBeamLine(traj, bs, thePropagator, tscbl);
273 
274  if (!tscbl_status)
275  return false;
276 
277  return trackPathLength(traj, tscbl, thePropagator, pathlength);
278  }
279 
280 } // namespace
281 
282 template <class TrackCollection>
284 public:
287 
289 
290  template <class H, class T>
291  void fillValueMap(edm::Event& iEvent, const H& handle, const std::vector<T>& vec, const edm::EDPutToken& token) const;
292 
293  void produce(edm::Event& ev, const edm::EventSetup& es) final;
294 
295  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
296 
298  const Trajectory& traj,
299  const double,
300  const double,
302  const MTDDetLayerGeometry*,
303  const MagneticField* field,
304  const Propagator* prop,
305  const reco::BeamSpot& bs,
306  const double vtxTime,
307  const bool matchVertex,
308  MTDHitMatchingInfo& bestHit) const;
309 
311  const Trajectory& traj,
312  const double,
313  const double,
315  const MTDDetLayerGeometry*,
316  const MagneticField* field,
317  const Propagator* prop,
318  const reco::BeamSpot& bs,
319  const double vtxTime,
320  const bool matchVertex,
321  MTDHitMatchingInfo& bestHit) const;
322 
323  void fillMatchingHits(const DetLayer*,
325  const Trajectory&,
326  const double,
327  const double,
329  const Propagator*,
330  const reco::BeamSpot&,
331  const double&,
332  const bool,
334  MTDHitMatchingInfo&) const;
335 
338  if (!recHits.empty()) {
339  GlobalPoint first = gtg_->idToDet(recHits.front()->geographicalId())->position();
340  GlobalPoint last = gtg_->idToDet(recHits.back()->geographicalId())->position();
341 
342  // maybe perp2?
343  auto rFirst = first.mag2();
344  auto rLast = last.mag2();
345  if (rFirst < rLast)
347  if (rFirst > rLast)
349  }
350  LogDebug("TrackExtenderWithMTD") << "Impossible to determine the rechits order" << endl;
352  }
353 
354  reco::Track buildTrack(const reco::Track&,
355  const Trajectory&,
356  const Trajectory&,
357  const reco::BeamSpot&,
358  const MagneticField* field,
359  const Propagator* prop,
360  bool hasMTD,
361  float& pathLength,
362  float& tmtdOut,
363  float& sigmatmtdOut) const;
364  reco::TrackExtra buildTrackExtra(const Trajectory& trajectory) const;
365 
366  string dumpLayer(const DetLayer* layer) const;
367 
368 private:
384 
391 
392  const bool updateTraj_, updateExtra_, updatePattern_;
393  const std::string mtdRecHitBuilder_, propagator_, transientTrackBuilder_;
394  std::unique_ptr<MeasurementEstimator> theEstimator;
395  std::unique_ptr<TrackTransformer> theTransformer;
399 
400  const float estMaxChi2_;
401  const float estMaxNSigma_;
402  const float btlChi2Cut_;
403  const float btlTimeChi2Cut_;
404  const float etlChi2Cut_;
405  const float etlTimeChi2Cut_;
406 
407  const bool useVertex_;
408  const bool useSimVertex_;
409  const float dzCut_;
410  const float bsTimeSpread_;
411 };
412 
413 template <class TrackCollection>
415  : tracksToken_(consumes<InputCollection>(iConfig.getParameter<edm::InputTag>("tracksSrc"))),
416  hitsToken_(consumes<MTDTrackingDetSetVector>(iConfig.getParameter<edm::InputTag>("hitsSrc"))),
417  bsToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotSrc"))),
418  updateTraj_(iConfig.getParameter<bool>("updateTrackTrajectory")),
419  updateExtra_(iConfig.getParameter<bool>("updateTrackExtra")),
420  updatePattern_(iConfig.getParameter<bool>("updateTrackHitPattern")),
421  mtdRecHitBuilder_(iConfig.getParameter<std::string>("MTDRecHitBuilder")),
422  propagator_(iConfig.getParameter<std::string>("Propagator")),
423  transientTrackBuilder_(iConfig.getParameter<std::string>("TransientTrackBuilder")),
424  estMaxChi2_(iConfig.getParameter<double>("estimatorMaxChi2")),
425  estMaxNSigma_(iConfig.getParameter<double>("estimatorMaxNSigma")),
426  btlChi2Cut_(iConfig.getParameter<double>("btlChi2Cut")),
427  btlTimeChi2Cut_(iConfig.getParameter<double>("btlTimeChi2Cut")),
428  etlChi2Cut_(iConfig.getParameter<double>("etlChi2Cut")),
429  etlTimeChi2Cut_(iConfig.getParameter<double>("etlTimeChi2Cut")),
430  useVertex_(iConfig.getParameter<bool>("useVertex")),
431  useSimVertex_(iConfig.getParameter<bool>("useSimVertex")),
432  dzCut_(iConfig.getParameter<double>("dZCut")),
433  bsTimeSpread_(iConfig.getParameter<double>("bsTimeSpread")) {
434  if (useVertex_) {
435  if (useSimVertex_) {
436  genVtxPositionToken_ = consumes<GlobalPoint>(iConfig.getParameter<edm::InputTag>("genVtxPositionSrc"));
437  genVtxTimeToken_ = consumes<float>(iConfig.getParameter<edm::InputTag>("genVtxTimeSrc"));
438  } else
439  vtxToken_ = consumes<VertexCollection>(iConfig.getParameter<edm::InputTag>("vtxSrc"));
440  }
441 
442  theEstimator = std::make_unique<Chi2MeasurementEstimator>(estMaxChi2_, estMaxNSigma_);
443  theTransformer = std::make_unique<TrackTransformer>(iConfig.getParameterSet("TrackTransformer"));
444 
445  btlMatchChi2Token = produces<edm::ValueMap<float>>("btlMatchChi2");
446  etlMatchChi2Token = produces<edm::ValueMap<float>>("etlMatchChi2");
447  btlMatchTimeChi2Token = produces<edm::ValueMap<float>>("btlMatchTimeChi2");
448  etlMatchTimeChi2Token = produces<edm::ValueMap<float>>("etlMatchTimeChi2");
449  pathLengthToken = produces<edm::ValueMap<float>>("pathLength");
450  tmtdToken = produces<edm::ValueMap<float>>("tmtd");
451  sigmatmtdToken = produces<edm::ValueMap<float>>("sigmatmtd");
452  pOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackp");
453  betaOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackBeta");
454  t0OrigTrkToken = produces<edm::ValueMap<float>>("generalTrackt0");
455  sigmat0OrigTrkToken = produces<edm::ValueMap<float>>("generalTracksigmat0");
456  pathLengthOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackPathLength");
457  tmtdOrigTrkToken = produces<edm::ValueMap<float>>("generalTracktmtd");
458  sigmatmtdOrigTrkToken = produces<edm::ValueMap<float>>("generalTracksigmatmtd");
459  assocOrigTrkToken = produces<edm::ValueMap<int>>("generalTrackassoc");
460 
461  produces<edm::OwnVector<TrackingRecHit>>();
462  produces<reco::TrackExtraCollection>();
463  produces<TrackCollection>();
464 }
465 
466 template <class TrackCollection>
469  desc.add<edm::InputTag>("tracksSrc", edm::InputTag("generalTracks"));
470  desc.add<edm::InputTag>("hitsSrc", edm::InputTag("mtdTrackingRecHits"));
471  desc.add<edm::InputTag>("beamSpotSrc", edm::InputTag("offlineBeamSpot"));
472  desc.add<edm::InputTag>("genVtxPositionSrc", edm::InputTag("genParticles:xyz0"));
473  desc.add<edm::InputTag>("genVtxTimeSrc", edm::InputTag("genParticles:t0"));
474  desc.add<edm::InputTag>("vtxSrc", edm::InputTag("offlinePrimaryVertices4D"));
475  desc.add<bool>("updateTrackTrajectory", true);
476  desc.add<bool>("updateTrackExtra", true);
477  desc.add<bool>("updateTrackHitPattern", true);
478  desc.add<std::string>("TransientTrackBuilder", "TransientTrackBuilder");
479  desc.add<std::string>("MTDRecHitBuilder", "MTDRecHitBuilder");
480  desc.add<std::string>("Propagator", "PropagatorWithMaterialForMTD");
482  false,
483  "KFFitterForRefitInsideOut",
484  "KFSmootherForRefitInsideOut",
485  "PropagatorWithMaterialForMTD",
486  "alongMomentum",
487  true,
488  "WithTrackAngle",
489  "MuonRecHitBuilder",
490  "MTDRecHitBuilder");
491  desc.add<edm::ParameterSetDescription>("TrackTransformer", transDesc);
492  desc.add<double>("estimatorMaxChi2", 500.);
493  desc.add<double>("estimatorMaxNSigma", 10.);
494  desc.add<double>("btlChi2Cut", 50.);
495  desc.add<double>("btlTimeChi2Cut", 10.);
496  desc.add<double>("etlChi2Cut", 50.);
497  desc.add<double>("etlTimeChi2Cut", 10.);
498  desc.add<bool>("useVertex", false);
499  desc.add<bool>("useSimVertex", false);
500  desc.add<double>("dZCut", 0.1);
501  desc.add<double>("bsTimeSpread", 0.2);
502  descriptions.add("trackExtenderWithMTDBase", desc);
503 }
504 
505 template <class TrackCollection>
506 template <class H, class T>
508  const H& handle,
509  const std::vector<T>& vec,
510  const edm::EDPutToken& token) const {
511  auto out = std::make_unique<edm::ValueMap<T>>();
513  filler.insert(handle, vec.begin(), vec.end());
514  filler.fill();
515  iEvent.put(token, std::move(out));
516 }
517 
518 template <class TrackCollection>
520  //this produces pieces of the track extra
521  Traj2TrackHits t2t;
522 
523  theTransformer->setServices(es);
524 
525  TrackingRecHitRefProd hitsRefProd = ev.getRefBeforePut<TrackingRecHitCollection>();
526  reco::TrackExtraRefProd extrasRefProd = ev.getRefBeforePut<reco::TrackExtraCollection>();
527 
529 
531  es.get<MTDRecoGeometryRecord>().get(geo);
532 
535 
536  es.get<TransientTrackRecord>().get(transientTrackBuilder_, builder_);
537  es.get<TransientRecHitRecord>().get(mtdRecHitBuilder_, hitbuilder_);
538 
540  es.get<TrackingComponentsRecord>().get(propagator_, propH);
541  const Propagator* prop = propH.product();
542 
544  es.get<TrackerTopologyRcd>().get(httopo);
545  const TrackerTopology& ttopo = *httopo;
546 
547  auto output = std::make_unique<TrackCollection>();
548  auto extras = std::make_unique<reco::TrackExtraCollection>();
549  auto outhits = std::make_unique<edm::OwnVector<TrackingRecHit>>();
550 
551  std::vector<float> btlMatchChi2;
552  std::vector<float> etlMatchChi2;
553  std::vector<float> btlMatchTimeChi2;
554  std::vector<float> etlMatchTimeChi2;
555  std::vector<float> pathLengthsRaw;
556  std::vector<float> tmtdRaw;
557  std::vector<float> sigmatmtdRaw;
558  std::vector<float> pOrigTrkRaw;
559  std::vector<float> betaOrigTrkRaw;
560  std::vector<float> t0OrigTrkRaw;
561  std::vector<float> sigmat0OrigTrkRaw;
562  std::vector<float> pathLengthsOrigTrkRaw;
563  std::vector<float> tmtdOrigTrkRaw;
564  std::vector<float> sigmatmtdOrigTrkRaw;
565  std::vector<int> assocOrigTrkRaw;
566 
567  auto const tracksH = ev.getHandle(tracksToken_);
568  const auto& tracks = *tracksH;
569 
570  //MTD hits DetSet
571  const auto& hits = ev.get(hitsToken_);
572 
573  //beam spot
574  const auto& bs = ev.get(bsToken_);
575 
576  const Vertex* pv = nullptr;
577  if (useVertex_ && !useSimVertex_) {
578  auto const& vtxs = ev.get(vtxToken_);
579  if (!vtxs.empty())
580  pv = &vtxs[0];
581  }
582 
583  std::unique_ptr<math::XYZTLorentzVectorF> genPV(nullptr);
584  if (useVertex_ && useSimVertex_) {
585  const auto& genVtxPosition = ev.get(genVtxPositionToken_);
586  const auto& genVtxTime = ev.get(genVtxTimeToken_);
587  genPV = std::make_unique<math::XYZTLorentzVectorF>(
588  genVtxPosition.x(), genVtxPosition.y(), genVtxPosition.z(), genVtxTime);
589  }
590 
591  double vtxTime = 0.;
592  if (useVertex_) {
593  if (useSimVertex_ && genPV) {
594  vtxTime = genPV->t();
595  } else if (pv)
596  vtxTime = pv->t(); //already in ns
597  }
598 
599  std::vector<unsigned> track_indices;
600  unsigned itrack = 0;
601 
602  for (const auto& track : tracks) {
603  double trackVtxTime = 0.;
604  if (useVertex_) {
605  double dz;
606  if (useSimVertex_)
607  dz = std::abs(track.dz(math::XYZPoint(*genPV)));
608  else
609  dz = std::abs(track.dz(pv->position()));
610 
611  if (dz < dzCut_)
612  trackVtxTime = vtxTime;
613  }
614 
615  reco::TransientTrack ttrack(track, magfield.product(), gtg_);
616  const auto& trajs = theTransformer->transform(track);
617  auto thits = theTransformer->getTransientRecHits(ttrack);
619  MTDHitMatchingInfo mBTL, mETL;
620  if (!trajs.empty()) {
621  // get the outermost trajectory point on the track
622  TrajectoryStateOnSurface tsos = builder_->build(track).outermostMeasurementState();
624  bool tscbl_status = getTrajectoryStateClosestToBeamLine(trajs.front(), bs, prop, tscbl);
625 
626  if (tscbl_status) {
627  double pmag2 = tscbl.trackStateAtPCA().momentum().mag2();
628  double pathlength0;
629  trackPathLength(trajs.front(), tscbl, prop, pathlength0);
630 
631  const auto& btlhits = tryBTLLayers(tsos,
632  trajs.front(),
633  pmag2,
634  pathlength0,
635  hits,
636  geo.product(),
637  magfield.product(),
638  prop,
639  bs,
640  trackVtxTime,
641  trackVtxTime != 0.,
642  mBTL);
643  mtdthits.insert(mtdthits.end(), btlhits.begin(), btlhits.end());
644 
645  // in the future this should include an intermediate refit before propagating to the ETL
646  // for now it is ok
647  const auto& etlhits = tryETLLayers(tsos,
648  trajs.front(),
649  pmag2,
650  pathlength0,
651  hits,
652  geo.product(),
653  magfield.product(),
654  prop,
655  bs,
656  trackVtxTime,
657  trackVtxTime != 0.,
658  mETL);
659  mtdthits.insert(mtdthits.end(), etlhits.begin(), etlhits.end());
660  }
661  }
662 
663  auto ordering = checkRecHitsOrdering(thits);
665  thits.insert(thits.end(), mtdthits.begin(), mtdthits.end());
666  } else {
667  std::reverse(mtdthits.begin(), mtdthits.end());
668  mtdthits.insert(mtdthits.end(), thits.begin(), thits.end());
669  thits.swap(mtdthits);
670  }
671 
672  const auto& trajwithmtd = mtdthits.empty() ? trajs : theTransformer->transform(ttrack, thits);
673  float pMap = 0.f, betaMap = 0.f, t0Map = 0.f, sigmat0Map = -1.f, pathLengthMap = -1.f, tmtdMap = 0.f,
674  sigmatmtdMap = -1.f;
675  int iMap = -1;
676 
677  for (const auto& trj : trajwithmtd) {
678  const auto& thetrj = (updateTraj_ ? trj : trajs.front());
679  float pathLength = 0.f, tmtd = 0.f, sigmatmtd = -1.f;
680  reco::Track result = buildTrack(track,
681  thetrj,
682  trj,
683  bs,
684  magfield.product(),
685  prop,
686  !trajwithmtd.empty() && !mtdthits.empty(),
687  pathLength,
688  tmtd,
689  sigmatmtd);
690  if (result.ndof() >= 0) {
692  reco::TrackExtra::TrajParams trajParams;
694  size_t hitsstart = outhits->size();
695  if (updatePattern_) {
696  t2t(trj, *outhits, trajParams, chi2s); // this fills the output hit collection
697  } else {
698  t2t(thetrj, *outhits, trajParams, chi2s);
699  }
700  size_t hitsend = outhits->size();
701  extras->push_back(buildTrackExtra(trj)); // always push back the fully built extra, update by setting in track
702  extras->back().setHits(hitsRefProd, hitsstart, hitsend - hitsstart);
703  extras->back().setTrajParams(trajParams, chi2s);
704  //create the track
705  output->push_back(result);
706  btlMatchChi2.push_back(mBTL.hit ? mBTL.estChi2 : -1);
707  etlMatchChi2.push_back(mETL.hit ? mETL.estChi2 : -1);
708  btlMatchTimeChi2.push_back(mBTL.hit ? mBTL.timeChi2 : -1);
709  etlMatchTimeChi2.push_back(mETL.hit ? mETL.timeChi2 : -1);
710  pathLengthsRaw.push_back(pathLength);
711  tmtdRaw.push_back(tmtd);
712  sigmatmtdRaw.push_back(sigmatmtd);
713  pathLengthMap = pathLength;
714  tmtdMap = tmtd;
715  sigmatmtdMap = sigmatmtd;
716  auto& backtrack = output->back();
717  iMap = output->size() - 1;
718  pMap = backtrack.p();
719  betaMap = backtrack.beta();
720  t0Map = backtrack.t0();
721  sigmat0Map = std::copysign(std::sqrt(std::abs(backtrack.covt0t0())), backtrack.covt0t0());
722  reco::TrackExtraRef extraRef(extrasRefProd, extras->size() - 1);
723  backtrack.setExtra((updateExtra_ ? extraRef : track.extra()));
724  for (unsigned ihit = hitsstart; ihit < hitsend; ++ihit) {
725  backtrack.appendHitPattern((*outhits)[ihit], ttopo);
726  }
727  } else {
728  LogTrace("TrackExtenderWithMTD") << "Error in the MTD track refitting. This should not happen";
729  }
730  }
731 
732  pOrigTrkRaw.push_back(pMap);
733  betaOrigTrkRaw.push_back(betaMap);
734  t0OrigTrkRaw.push_back(t0Map);
735  sigmat0OrigTrkRaw.push_back(sigmat0Map);
736  pathLengthsOrigTrkRaw.push_back(pathLengthMap);
737  tmtdOrigTrkRaw.push_back(tmtdMap);
738  sigmatmtdOrigTrkRaw.push_back(sigmatmtdMap);
739  assocOrigTrkRaw.push_back(iMap);
740  ++itrack;
741  }
742 
743  auto outTrksHandle = ev.put(std::move(output));
744  ev.put(std::move(extras));
745  ev.put(std::move(outhits));
746 
747  fillValueMap(ev, outTrksHandle, btlMatchChi2, btlMatchChi2Token);
748  fillValueMap(ev, outTrksHandle, etlMatchChi2, etlMatchChi2Token);
749  fillValueMap(ev, outTrksHandle, btlMatchTimeChi2, btlMatchTimeChi2Token);
750  fillValueMap(ev, outTrksHandle, etlMatchTimeChi2, etlMatchTimeChi2Token);
751  fillValueMap(ev, outTrksHandle, pathLengthsRaw, pathLengthToken);
752  fillValueMap(ev, outTrksHandle, tmtdRaw, tmtdToken);
753  fillValueMap(ev, outTrksHandle, sigmatmtdRaw, sigmatmtdToken);
754  fillValueMap(ev, tracksH, pOrigTrkRaw, pOrigTrkToken);
755  fillValueMap(ev, tracksH, betaOrigTrkRaw, betaOrigTrkToken);
756  fillValueMap(ev, tracksH, t0OrigTrkRaw, t0OrigTrkToken);
757  fillValueMap(ev, tracksH, sigmat0OrigTrkRaw, sigmat0OrigTrkToken);
758  fillValueMap(ev, tracksH, pathLengthsOrigTrkRaw, pathLengthOrigTrkToken);
759  fillValueMap(ev, tracksH, tmtdOrigTrkRaw, tmtdOrigTrkToken);
760  fillValueMap(ev, tracksH, sigmatmtdOrigTrkRaw, sigmatmtdOrigTrkToken);
761  fillValueMap(ev, tracksH, assocOrigTrkRaw, assocOrigTrkToken);
762 }
763 
764 namespace {
765  bool cmp_for_detset(const unsigned one, const unsigned two) { return one < two; };
766 
767  void find_hits_in_dets(const MTDTrackingDetSetVector& hits,
768  const Trajectory& traj,
769  const DetLayer* layer,
770  const TrajectoryStateOnSurface& tsos,
771  const double pmag2,
772  const double pathlength0,
773  const double vtxTime,
774  const reco::BeamSpot& bs,
775  const float bsTimeSpread,
776  const Propagator* prop,
778  bool useVtxConstraint,
779  std::set<MTDHitMatchingInfo>& out) {
780  pair<bool, TrajectoryStateOnSurface> comp = layer->compatible(tsos, *prop, *estimator);
781  if (comp.first) {
782  const vector<DetLayer::DetWithState> compDets = layer->compatibleDets(tsos, *prop, *estimator);
783  if (!compDets.empty()) {
784  for (const auto& detWithState : compDets) {
785  auto range = hits.equal_range(detWithState.first->geographicalId(), cmp_for_detset);
786  if (range.first == range.second)
787  continue;
788 
789  auto pl = prop->propagateWithPath(tsos, detWithState.second.surface());
790  if (pl.second == 0.)
791  continue;
792 
793  const double tot_pl = pathlength0 + std::abs(pl.second);
794  const double t_vtx = useVtxConstraint ? vtxTime : 0.;
795 
796  constexpr double vtx_res = 0.008;
797  const double t_vtx_err = useVtxConstraint ? vtx_res : bsTimeSpread;
798 
799  constexpr double t_res_manual = 0.035;
800 
801  for (auto detitr = range.first; detitr != range.second; ++detitr) {
802  for (const auto& hit : *detitr) {
803  auto est = estimator->estimate(detWithState.second, hit);
804  if (!est.first)
805  continue;
806 
807  TrackTofPidInfo tof = computeTrackTofPidInfo(pmag2,
808  tot_pl,
809  hit.time(),
810  t_res_manual, //put hit error by hand for the moment
811  t_vtx,
812  t_vtx_err, //put vtx error by hand for the moment
813  false);
814  MTDHitMatchingInfo mi;
815  mi.hit = &hit;
816  mi.estChi2 = est.second;
817  mi.timeChi2 = tof.dtchi2_best; //use the chi2 for the best matching hypothesis
818 
819  out.insert(mi);
820  }
821  }
822  }
823  }
824  }
825  }
826 } // namespace
827 
828 template <class TrackCollection>
830  const TrajectoryStateOnSurface& tsos,
831  const Trajectory& traj,
832  const double pmag2,
833  const double pathlength0,
835  const MTDDetLayerGeometry* geo,
836  const MagneticField* field,
837  const Propagator* prop,
838  const reco::BeamSpot& bs,
839  const double vtxTime,
840  const bool matchVertex,
841  MTDHitMatchingInfo& bestHit) const {
842  const vector<const DetLayer*>& layers = geo->allBTLLayers();
843 
845  bestHit = MTDHitMatchingInfo();
846  for (const DetLayer* ilay : layers)
847  fillMatchingHits(ilay, tsos, traj, pmag2, pathlength0, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
848  return output;
849 }
850 
851 template <class TrackCollection>
853  const TrajectoryStateOnSurface& tsos,
854  const Trajectory& traj,
855  const double pmag2,
856  const double pathlength0,
858  const MTDDetLayerGeometry* geo,
859  const MagneticField* field,
860  const Propagator* prop,
861  const reco::BeamSpot& bs,
862  const double vtxTime,
863  const bool matchVertex,
864  MTDHitMatchingInfo& bestHit) const {
865  const vector<const DetLayer*>& layers = geo->allETLLayers();
866 
868  bestHit = MTDHitMatchingInfo();
869  for (const DetLayer* ilay : layers) {
870  const BoundDisk& disk = static_cast<const MTDRingForwardDoubleLayer*>(ilay)->specificSurface();
871  const double diskZ = disk.position().z();
872 
873  if (tsos.globalPosition().z() * diskZ < 0)
874  continue; // only propagate to the disk that's on the same side
875 
876  fillMatchingHits(ilay, tsos, traj, pmag2, pathlength0, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
877  }
878  return output;
879 }
880 
881 template <class TrackCollection>
883  const TrajectoryStateOnSurface& tsos,
884  const Trajectory& traj,
885  const double pmag2,
886  const double pathlength0,
888  const Propagator* prop,
889  const reco::BeamSpot& bs,
890  const double& vtxTime,
891  const bool matchVertex,
893  MTDHitMatchingInfo& bestHit) const {
894  std::set<MTDHitMatchingInfo> hitsInLayer;
895  bool hitMatched = false;
896 
897  using namespace std::placeholders;
898  auto find_hits = std::bind(find_hits_in_dets,
899  std::cref(hits),
900  std::cref(traj),
901  ilay,
902  std::cref(tsos),
903  pmag2,
904  pathlength0,
905  _1,
906  std::cref(bs),
907  bsTimeSpread_,
908  prop,
909  theEstimator.get(),
910  _2,
911  std::ref(hitsInLayer));
912 
913  if (useVertex_ && matchVertex)
914  find_hits(vtxTime, true);
915  else
916  find_hits(0, false);
917 
918  //just take the first hit because the hits are sorted on their matching quality
919  if (!hitsInLayer.empty()) {
920  //check hits to pass minimum quality matching requirements
921  auto const& firstHit = *hitsInLayer.begin();
922  if (firstHit.estChi2 < etlChi2Cut_ && firstHit.timeChi2 < etlTimeChi2Cut_) {
923  hitMatched = true;
924  output.push_back(hitbuilder_->build(firstHit.hit));
925  if (firstHit < bestHit)
926  bestHit = firstHit;
927  }
928  }
929 
930  if (useVertex_ && matchVertex && !hitMatched) {
931  //try a second search with beamspot hypothesis
932  hitsInLayer.clear();
933  find_hits(0, false);
934  if (!hitsInLayer.empty()) {
935  auto const& firstHit = *hitsInLayer.begin();
936  if (firstHit.timeChi2 < etlTimeChi2Cut_) {
937  if (firstHit.estChi2 < etlChi2Cut_) {
938  hitMatched = true;
939  output.push_back(hitbuilder_->build(firstHit.hit));
940  if (firstHit < bestHit)
941  bestHit = firstHit;
942  }
943  }
944  }
945  }
946 }
947 
948 //below is unfortunately ripped from other places but
949 //since track producer doesn't know about MTD we have to do this
950 template <class TrackCollection>
952  const Trajectory& traj,
953  const Trajectory& trajWithMtd,
954  const reco::BeamSpot& bs,
955  const MagneticField* field,
956  const Propagator* thePropagator,
957  bool hasMTD,
958  float& pathLengthOut,
959  float& tmtdOut,
960  float& sigmatmtdOut) const {
962  bool tsbcl_status = getTrajectoryStateClosestToBeamLine(traj, bs, thePropagator, tscbl);
963 
964  if (!tsbcl_status)
965  return reco::Track();
966 
968  math::XYZPoint pos(v.x(), v.y(), v.z());
970  math::XYZVector mom(p.x(), p.y(), p.z());
971 
972  int ndof = traj.ndof();
973 
974  double t0 = 0.;
975  double covt0t0 = -1.;
976  pathLengthOut = -1.f; // if there is no MTD flag the pathlength with -1
977  tmtdOut = 0.f;
978  sigmatmtdOut = -1.f;
979  double betaOut = 0.;
980  double covbetabeta = -1.;
981 
982  //compute path length for time backpropagation, using first MTD hit for the momentum
983  if (hasMTD) {
984  double pathlength;
985  bool validpropagation = trackPathLength(trajWithMtd, bs, thePropagator, pathlength);
986  double thit = 0.;
987  double thiterror = -1.;
988  bool validmtd = false;
989 
990  //need to better handle the cases with >1 hit in MTD
991  for (auto const& hit : trajWithMtd.measurements()) {
992  bool ismtd = hit.recHit()->geographicalId().det() == DetId::Forward &&
993  ForwardSubdetector(hit.recHit()->geographicalId().subdetId()) == FastTime;
994  if (ismtd) {
995  const MTDTrackingRecHit* mtdhit = static_cast<const MTDTrackingRecHit*>(hit.recHit()->hit());
996  thit = mtdhit->time();
997  thiterror = mtdhit->timeError();
998  validmtd = true;
999  break;
1000  }
1001  }
1002 
1003  if (validmtd && validpropagation) {
1004  //here add the PID uncertainty for later use in the 1st step of 4D vtx reconstruction
1005  TrackTofPidInfo tofInfo = computeTrackTofPidInfo(p.mag2(), pathlength, thit, thiterror, 0., 0., true);
1006  pathLengthOut = pathlength; // set path length if we've got a timing hit
1007  tmtdOut = thit;
1008  sigmatmtdOut = thiterror;
1009  t0 = tofInfo.dt;
1010  covt0t0 = tofInfo.dterror * tofInfo.dterror;
1011  betaOut = tofInfo.beta_pi;
1012  covbetabeta = tofInfo.betaerror * tofInfo.betaerror;
1013  }
1014  }
1015 
1016  return reco::Track(traj.chiSquared(),
1017  int(ndof),
1018  pos,
1019  mom,
1020  tscbl.trackStateAtPCA().charge(),
1022  orig.algo(),
1024  t0,
1025  betaOut,
1026  covt0t0,
1027  covbetabeta);
1028 }
1029 
1030 template <class TrackCollection>
1032  static const string metname = "TrackExtenderWithMTD";
1033 
1034  const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
1035 
1036  // put the collection of TrackingRecHit in the event
1037 
1038  // sets the outermost and innermost TSOSs
1039  // ToDo: validation for track states with MTD
1040  TrajectoryStateOnSurface outerTSOS;
1041  TrajectoryStateOnSurface innerTSOS;
1042  unsigned int innerId = 0, outerId = 0;
1044  DetId outerDetId;
1045 
1046  if (trajectory.direction() == alongMomentum) {
1047  LogTrace(metname) << "alongMomentum";
1048  outerTSOS = trajectory.lastMeasurement().updatedState();
1049  innerTSOS = trajectory.firstMeasurement().updatedState();
1050  outerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
1051  innerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
1052  outerRecHit = trajectory.lastMeasurement().recHit();
1053  outerDetId = trajectory.lastMeasurement().recHit()->geographicalId();
1054  } else if (trajectory.direction() == oppositeToMomentum) {
1055  LogTrace(metname) << "oppositeToMomentum";
1056  outerTSOS = trajectory.firstMeasurement().updatedState();
1057  innerTSOS = trajectory.lastMeasurement().updatedState();
1058  outerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
1059  innerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
1060  outerRecHit = trajectory.firstMeasurement().recHit();
1061  outerDetId = trajectory.firstMeasurement().recHit()->geographicalId();
1062  } else
1063  LogError(metname) << "Wrong propagation direction!";
1064 
1065  const GeomDet* outerDet = gtg_->idToDet(outerDetId);
1066  GlobalPoint outerTSOSPos = outerTSOS.globalParameters().position();
1067  bool inside = outerDet->surface().bounds().inside(outerDet->toLocal(outerTSOSPos));
1068 
1069  GlobalPoint hitPos =
1070  (outerRecHit->isValid()) ? outerRecHit->globalPosition() : outerTSOS.globalParameters().position();
1071 
1072  if (!inside) {
1073  LogTrace(metname) << "The Global Muon outerMostMeasurementState is not compatible with the recHit detector!"
1074  << " Setting outerMost postition to recHit position if recHit isValid: "
1075  << outerRecHit->isValid();
1076  LogTrace(metname) << "From " << outerTSOSPos << " to " << hitPos;
1077  }
1078 
1079  //build the TrackExtra
1080  GlobalPoint v = (inside) ? outerTSOSPos : hitPos;
1081  GlobalVector p = outerTSOS.globalParameters().momentum();
1082  math::XYZPoint outpos(v.x(), v.y(), v.z());
1083  math::XYZVector outmom(p.x(), p.y(), p.z());
1084 
1085  v = innerTSOS.globalParameters().position();
1086  p = innerTSOS.globalParameters().momentum();
1087  math::XYZPoint inpos(v.x(), v.y(), v.z());
1088  math::XYZVector inmom(p.x(), p.y(), p.z());
1089 
1090  reco::TrackExtra trackExtra(outpos,
1091  outmom,
1092  true,
1093  inpos,
1094  inmom,
1095  true,
1096  outerTSOS.curvilinearError(),
1097  outerId,
1098  innerTSOS.curvilinearError(),
1099  innerId,
1100  trajectory.direction(),
1101  trajectory.seedRef());
1102 
1103  return trackExtra;
1104 }
1105 
1106 template <class TrackCollection>
1108  stringstream output;
1109 
1110  const BoundSurface* sur = nullptr;
1111  const BoundCylinder* bc = nullptr;
1112  const BoundDisk* bd = nullptr;
1113 
1114  sur = &(layer->surface());
1115  if ((bc = dynamic_cast<const BoundCylinder*>(sur))) {
1116  output << " Cylinder of radius: " << bc->radius() << endl;
1117  } else if ((bd = dynamic_cast<const BoundDisk*>(sur))) {
1118  output << " Disk at: " << bd->position().z() << endl;
1119  }
1120  return output.str();
1121 }
1122 
1123 //define this as a plug-in
1130 
Vector3DBase
Definition: Vector3DBase.h:8
ConfigurationDescriptions.h
edm::RefProd< TrackingRecHitCollection >
TrackExtenderWithMTDT::etlMatchChi2Token
edm::EDPutToken etlMatchChi2Token
Definition: TrackExtenderWithMTD.cc:370
Propagator.h
class-composition.H
H
Definition: class-composition.py:31
TrackExtenderWithMTDT::theEstimator
std::unique_ptr< MeasurementEstimator > theEstimator
Definition: TrackExtenderWithMTD.cc:394
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Chi2MeasurementEstimator.h
MeasurementEstimator
Definition: MeasurementEstimator.h:19
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
TrajectoryStateClosestToBeamLine
Definition: TrajectoryStateClosestToBeamLine.h:15
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
TrackExtenderWithMTDT::genVtxTimeToken_
edm::EDGetTokenT< float > genVtxTimeToken_
Definition: TrackExtenderWithMTD.cc:389
BTLDetId.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
electrons_cff.bool
bool
Definition: electrons_cff.py:393
SiPixelPI::one
Definition: SiPixelPayloadInspectorHelper.h:39
TrackExtenderWithMTDT::etlTimeChi2Cut_
const float etlTimeChi2Cut_
Definition: TrackExtenderWithMTD.cc:405
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
GeomDet
Definition: GeomDet.h:27
PixelTopology.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ESHandle.h
DetLayer
Definition: DetLayer.h:21
Trajectory::seedRef
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:303
Trajectory::chiSquared
float chiSquared() const
Definition: Trajectory.h:241
GlobalTrajectoryParameters::position
GlobalPoint position() const
Definition: GlobalTrajectoryParameters.h:60
Trajectory::direction
PropagationDirection const & direction() const
Definition: Trajectory.cc:133
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
TrackExtenderWithMTDT::useSimVertex_
const bool useSimVertex_
Definition: TrackExtenderWithMTD.cc:408
patZpeak.handle
handle
Definition: patZpeak.py:23
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
edm::EDGetTokenT< InputCollection >
m_pi
#define m_pi
Definition: RPCConst.cc:8
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
reco::TrackBase::undefQuality
Definition: TrackBase.h:151
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
TransientRecHitRecord.h
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
c_cm_ns
constexpr double c_cm_ns
Definition: Phase2TrackerDigitizerAlgorithm.h:56
TrackExtenderWithMTDT::estMaxChi2_
const float estMaxChi2_
Definition: TrackExtenderWithMTD.cc:400
pos
Definition: PixelAliasList.h:18
TrackExtenderWithMTDT::btlMatchTimeChi2Token
edm::EDPutToken btlMatchTimeChi2Token
Definition: TrackExtenderWithMTD.cc:371
RefitDirection::GeometricalDirection
GeometricalDirection
Definition: RefitDirection.h:15
FreeTrajectoryState::charge
TrackCharge charge() const
Definition: FreeTrajectoryState.h:69
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
TrackExtenderWithMTDT::sigmatmtdToken
edm::EDPutToken sigmatmtdToken
Definition: TrackExtenderWithMTD.cc:375
TrackExtenderWithMTDT::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TrackExtenderWithMTD.cc:467
oppositeToMomentum
Definition: PropagationDirection.h:4
EDProducer.h
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
Surface
Definition: Surface.h:36
TrackExtenderWithMTDT::tmtdOrigTrkToken
edm::EDPutToken tmtdOrigTrkToken
Definition: TrackExtenderWithMTD.cc:381
GeometricSearchDet::compatible
virtual std::pair< bool, TrajectoryStateOnSurface > compatible(const TrajectoryStateOnSurface &ts, const Propagator &, const MeasurementEstimator &) const =0
TransientTrackingRecHit.h
GeometricSearchDet::compatibleDets
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
Definition: GeometricSearchDet.cc:35
TrajectoryMeasurement::updatedState
TrajectoryStateOnSurface const & updatedState() const
Definition: TrajectoryMeasurement.h:184
TrackExtenderWithMTDT::btlMatchChi2Token
edm::EDPutToken btlMatchChi2Token
Definition: TrackExtenderWithMTD.cc:369
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
MTDTrayBarrelLayer.h
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
TrackExtenderWithMTDT::builder_
edm::ESHandle< TransientTrackBuilder > builder_
Definition: TrackExtenderWithMTD.cc:396
TransientTrack.h
findQualityFiles.v
v
Definition: findQualityFiles.py:179
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
TrackExtenderWithMTDT::genVtxPositionToken_
edm::EDGetTokenT< GlobalPoint > genVtxPositionToken_
Definition: TrackExtenderWithMTD.cc:388
ETLDetId.h
PV3DBase::mag2
T mag2() const
Definition: PV3DBase.h:63
TrackExtenderWithMTDT::pathLengthToken
edm::EDPutToken pathLengthToken
Definition: TrackExtenderWithMTD.cc:373
dqmdumpme.first
first
Definition: dqmdumpme.py:55
BoundDisk
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
TrackExtenderWithMTDT::bsTimeSpread_
const float bsTimeSpread_
Definition: TrackExtenderWithMTD.cc:410
TrackExtenderWithMTDT::buildTrack
reco::Track buildTrack(const reco::Track &, const Trajectory &, const Trajectory &, const reco::BeamSpot &, const MagneticField *field, const Propagator *prop, bool hasMTD, float &pathLength, float &tmtdOut, float &sigmatmtdOut) const
Definition: TrackExtenderWithMTD.cc:951
TrackExtenderWithMTDT::fillMatchingHits
void fillMatchingHits(const DetLayer *, const TrajectoryStateOnSurface &, const Trajectory &, const double, const double, const MTDTrackingDetSetVector &, const Propagator *, const reco::BeamSpot &, const double &, const bool, TransientTrackingRecHit::ConstRecHitContainer &, MTDHitMatchingInfo &) const
Definition: TrackExtenderWithMTD.cc:882
groupFilesInBlocks.reverse
reverse
Definition: groupFilesInBlocks.py:131
edm::Ref< TrackExtraCollection >
TrackExtenderWithMTDT::updateTraj_
const bool updateTraj_
Definition: TrackExtenderWithMTD.cc:392
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
ndof
Definition: HIMultiTrackSelector.h:49
TrackExtenderWithMTDT::buildTrackExtra
reco::TrackExtra buildTrackExtra(const Trajectory &trajectory) const
Definition: TrackExtenderWithMTD.cc:1031
TrackExtenderWithMTDT::estMaxNSigma_
const float estMaxNSigma_
Definition: TrackExtenderWithMTD.cc:401
dt
float dt
Definition: AMPTWrapper.h:136
TrackExtenderWithMTDT::useVertex_
const bool useVertex_
Definition: TrackExtenderWithMTD.cc:407
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
Propagator
Definition: Propagator.h:44
DetId
Definition: DetId.h:17
reco::TrackExtra
Definition: TrackExtra.h:26
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MakerMacros.h
cms::cuda::bs
bs
Definition: HistoContainer.h:127
dqmdumpme.last
last
Definition: dqmdumpme.py:56
Track.h
TrajectoryStateOnSurface::freeState
FreeTrajectoryState const * freeState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:58
TrackExtenderWithMTDT::tryETLLayers
TransientTrackingRecHit::ConstRecHitContainer tryETLLayers(const TrajectoryStateOnSurface &, const Trajectory &traj, const double, const double, const MTDTrackingDetSetVector &, const MTDDetLayerGeometry *, const MagneticField *field, const Propagator *prop, const reco::BeamSpot &bs, const double vtxTime, const bool matchVertex, MTDHitMatchingInfo &bestHit) const
Definition: TrackExtenderWithMTD.cc:852
TrackExtenderWithMTDT::vtxToken_
edm::EDGetTokenT< VertexCollection > vtxToken_
Definition: TrackExtenderWithMTD.cc:390
PVValHelper::estimator
estimator
Definition: PVValidationHelpers.h:44
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
TrackFwd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
config.ordering
ordering
Definition: config.py:7
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TrackExtenderWithMTDT::t0OrigTrkToken
edm::EDPutToken t0OrigTrkToken
Definition: TrackExtenderWithMTD.cc:378
TrackExtenderWithMTDT::TrackExtenderWithMTDT
TrackExtenderWithMTDT(const ParameterSet &pset)
Definition: TrackExtenderWithMTD.cc:414
edm::EDPutToken
Definition: EDPutToken.h:38
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:148
Bounds::inside
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
TrackExtenderWithMTDT::TrackType
TrackCollection::value_type TrackType
Definition: TrackExtenderWithMTD.cc:285
FreeTrajectoryState::curvilinearError
const CurvilinearTrajectoryError & curvilinearError() const
Definition: FreeTrajectoryState.h:89
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::bounds
const Bounds & bounds() const
Definition: Surface.h:87
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
reco::BeamSpot
Definition: BeamSpot.h:21
TransientTrackRecord
Definition: TransientTrackRecord.h:11
reco::Track
Definition: Track.h:27
IdealMagneticFieldRecord.h
edm::ESHandle< TransientTrackBuilder >
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
TrackExtenderWithMTDT::hitbuilder_
edm::ESHandle< TransientTrackingRecHitBuilder > hitbuilder_
Definition: TrackExtenderWithMTD.cc:397
TrackExtenderWithMTDT::fillValueMap
void fillValueMap(edm::Event &iEvent, const H &handle, const std::vector< T > &vec, const edm::EDPutToken &token) const
Definition: TrackExtenderWithMTD.cc:507
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Traj2TrackHits.h
Point3DBase< float, GlobalTag >
TrackExtenderWithMTDT::assocOrigTrkToken
edm::EDPutToken assocOrigTrkToken
Definition: TrackExtenderWithMTD.cc:383
ParameterSetDescription.h
GeomDet::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:58
TrackExtenderWithMTDT::bsToken_
edm::EDGetTokenT< reco::BeamSpot > bsToken_
Definition: TrackExtenderWithMTD.cc:387
MTDTrackingRecHit::timeError
float timeError() const
Definition: MTDTrackingRecHit.h:28
GlobalTrajectoryParameters::momentum
GlobalVector momentum() const
Definition: GlobalTrajectoryParameters.h:65
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
MTDTrackingRecHit.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
RefitDirection::undetermined
Definition: RefitDirection.h:15
edm::View
Definition: CaloClusterFwd.h:14
TransientTrackBuilder.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TrackExtenderWithMTDT::gtg_
edm::ESHandle< GlobalTrackingGeometry > gtg_
Definition: TrackExtenderWithMTD.cc:398
Trajectory::ndof
int ndof(bool bon=true) const
Definition: Trajectory.cc:97
TrackExtenderWithMTDT::theTransformer
std::unique_ptr< TrackTransformer > theTransformer
Definition: TrackExtenderWithMTD.cc:395
MTDRingForwardDoubleLayer.h
Trajectory::RecHitContainer
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:42
TSCBLBuilderWithPropagator.h
Event.h
TrackExtenderWithMTDT::sigmatmtdOrigTrkToken
edm::EDPutToken sigmatmtdOrigTrkToken
Definition: TrackExtenderWithMTD.cc:382
TrackingRecHit::ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: TrackingRecHit.h:32
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MTDDetRing.h
TrackExtenderWithMTDT::hitsToken_
edm::EDGetTokenT< MTDTrackingDetSetVector > hitsToken_
Definition: TrackExtenderWithMTD.cc:386
GeantUnits.h
Trajectory::lastMeasurement
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:150
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
Traj2TrackHits
Definition: Traj2TrackHits.h:16
FastTime
Definition: ForwardSubdetector.h:6
TrackExtenderWithMTDT::tracksToken_
edm::EDGetTokenT< InputCollection > tracksToken_
Definition: TrackExtenderWithMTD.cc:385
MTDTrackingRecHit
A 2D TrackerRecHit with time and time error information.
Definition: MTDTrackingRecHit.h:10
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
LorentzVector.h
TrackExtenderWithMTDT::sigmat0OrigTrkToken
edm::EDPutToken sigmat0OrigTrkToken
Definition: TrackExtenderWithMTD.cc:379
createfilelist.int
int
Definition: createfilelist.py:10
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
iEvent
int iEvent
Definition: GenABIO.cc:224
GsfTrack.h
edm::stream::EDProducer
Definition: EDProducer.h:38
TrackExtenderWithMTDT::betaOrigTrkToken
edm::EDPutToken betaOrigTrkToken
Definition: TrackExtenderWithMTD.cc:377
MagneticField.h
TrackTransformer.h
edm::EventSetup
Definition: EventSetup.h:57
MTDRecoGeometryRecord.h
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TransientTrackRecord.h
get
#define get
MTDDetLayerGeometry
Definition: MTDDetLayerGeometry.h:19
TrackExtenderWithMTDT::tryBTLLayers
TransientTrackingRecHit::ConstRecHitContainer tryBTLLayers(const TrajectoryStateOnSurface &, const Trajectory &traj, const double, const double, const MTDTrackingDetSetVector &, const MTDDetLayerGeometry *, const MagneticField *field, const Propagator *prop, const reco::BeamSpot &bs, const double vtxTime, const bool matchVertex, MTDHitMatchingInfo &bestHit) const
Definition: TrackExtenderWithMTD.cc:829
MTDDetLayerGeometry::allBTLLayers
const std::vector< const DetLayer * > & allBTLLayers() const
return the BTL DetLayers (barrel), inside-out
Definition: MTDDetLayerGeometry.cc:70
MTDTrackingRecHit::time
float time() const
Definition: MTDTrackingRecHit.h:27
MTDRecoGeometryRecord
Definition: MTDRecoGeometryRecord.h:18
TrackTransformer::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &descriptions, bool DoPredictionsOnly=false, const std::string &Fitter="KFFitterForRefitInsideOut", const std::string &Smoother="KFSmootherForRefitInsideOut", const std::string &Propagator="SmartPropagatorAnyRK", const std::string &RefitDirection="alongMomentum", bool RefitRPCHits=true, const std::string &TrackerRecHitBuilder="WithTrackAngle", const std::string &MuonRecHitBuilder="MuonRecHitBuilder", const std::string &MTDRecHitBuilder="MTDRecHitBuilder")
fillDescriptions
Definition: TrackTransformer.cc:58
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
reco::TrackBase::algo
TrackAlgorithm algo() const
Definition: TrackBase.h:547
VertexFwd.h
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
TSCBLBuilderWithPropagator
Definition: TSCBLBuilderWithPropagator.h:16
Trajectory.h
Trajectory::recHits
ConstRecHitContainer recHits() const
Definition: Trajectory.h:186
edmNew::DetSetVector
Definition: DetSetNew.h:13
SiPixelPI::two
Definition: SiPixelPayloadInspectorHelper.h:39
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
TrackExtenderWithMTDT::dumpLayer
string dumpLayer(const DetLayer *layer) const
Definition: TrackExtenderWithMTD.cc:1107
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
TrackExtenderWithMTDT::transientTrackBuilder_
const std::string transientTrackBuilder_
Definition: TrackExtenderWithMTD.cc:393
GsfTrackFwd.h
Trajectory::firstMeasurement
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:166
MTDDetLayerGeometry.h
reco::TransientTrack
Definition: TransientTrack.h:19
TrackExtenderWithMTDT::pathLengthOrigTrkToken
edm::EDPutToken pathLengthOrigTrkToken
Definition: TrackExtenderWithMTD.cc:380
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
TrackExtenderWithMTDT::produce
void produce(edm::Event &ev, const edm::EventSetup &es) final
Definition: TrackExtenderWithMTD.cc:519
reco::TrackExtraBase::Chi2sFive
std::vector< unsigned char > Chi2sFive
Definition: TrackExtraBase.h:25
c_inv
constexpr double c_inv
Definition: Phase2TrackerDigitizerAlgorithm.h:57
TrajectoryMeasurement::ConstRecHitPointer
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
Definition: TrajectoryMeasurement.h:28
PVValHelper::dz
Definition: PVValidationHelpers.h:50
Trajectory
Definition: Trajectory.h:38
Frameworkfwd.h
TrackExtenderWithMTDT::checkRecHitsOrdering
RefitDirection::GeometricalDirection checkRecHitsOrdering(TransientTrackingRecHit::ConstRecHitContainer const &recHits) const
Definition: TrackExtenderWithMTD.cc:336
MTDDetTray.h
TrackingComponentsRecord.h
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
TrajectoryStateOnSurface::curvilinearError
const CurvilinearTrajectoryError & curvilinearError() const
Definition: TrajectoryStateOnSurface.h:72
TrackExtenderWithMTDT::pOrigTrkToken
edm::EDPutToken pOrigTrkToken
Definition: TrackExtenderWithMTD.cc:376
RefitDirection::insideOut
Definition: RefitDirection.h:15
GeometricSearchDet::surface
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
EventSetup.h
BoundCylinder
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Propagator::propagateWithPath
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
Definition: Propagator.cc:10
Trajectory::closestMeasurement
TrajectoryMeasurement const & closestMeasurement(GlobalPoint) const
Definition: Trajectory.cc:256
TrajectoryStateOnSurface::surface
const SurfaceType & surface() const
Definition: TrajectoryStateOnSurface.h:78
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
TrackExtenderWithMTD
TrackExtenderWithMTDT< reco::TrackCollection > TrackExtenderWithMTD
Definition: TrackExtenderWithMTD.cc:1129
MTDDetLayerGeometry::allETLLayers
const std::vector< const DetLayer * > & allETLLayers() const
return the ETL DetLayers (endcap), -Z to +Z
Definition: MTDDetLayerGeometry.cc:72
mps_fire.result
result
Definition: mps_fire.py:311
TrackExtenderWithMTDT::etlMatchTimeChi2Token
edm::EDPutToken etlMatchTimeChi2Token
Definition: TrackExtenderWithMTD.cc:372
edm::helper::Filler
Definition: ValueMap.h:22
MTDChannelIdentifier.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
TrajectoryStateOnSurface::globalParameters
const GlobalTrajectoryParameters & globalParameters() const
Definition: TrajectoryStateOnSurface.h:64
TrackExtenderWithMTDT::btlChi2Cut_
const float btlChi2Cut_
Definition: TrackExtenderWithMTD.cc:402
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
operator<
bool operator<(DTCELinkId const &lhs, DTCELinkId const &rhs)
Definition: DTCELinkId.h:70
TrajectoryStateClosestToBeamLine::isValid
bool isValid() const
Definition: TrajectoryStateClosestToBeamLine.h:50
ParameterSet.h
TrackExtenderWithMTDT::dzCut_
const float dzCut_
Definition: TrackExtenderWithMTD.cc:409
TrajectoryStateClosestToBeamLine::trackStateAtPCA
FTS const & trackStateAtPCA() const
Definition: TrajectoryStateClosestToBeamLine.h:32
DetId::Forward
Definition: DetId.h:30
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
TrackExtenderWithMTDT
Definition: TrackExtenderWithMTD.cc:283
edm::Event
Definition: Event.h:73
TrackExtenderWithMTDT::btlTimeChi2Cut_
const float btlTimeChi2Cut_
Definition: TrackExtenderWithMTD.cc:403
MTDTransientTrackingRecHitBuilder.h
MagneticField
Definition: MagneticField.h:19
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition: volumeBasedMagneticField_160812_cfi.py:11
RefitDirection::outsideIn
Definition: RefitDirection.h:15
Topology.h
reco::TrackExtraBase::TrajParams
std::vector< LocalTrajectoryParameters > TrajParams
Definition: TrackExtraBase.h:24
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
TrackExtenderWithMTDT::etlChi2Cut_
const float etlChi2Cut_
Definition: TrackExtenderWithMTD.cc:404
reco::Vertex
Definition: Vertex.h:35
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2128
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
TrackExtenderWithMTDT::tmtdToken
edm::EDPutToken tmtdToken
Definition: TrackExtenderWithMTD.cc:374
hit
Definition: SiStripHitEffFromCalibTree.cc:88
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::OwnVector< TrackingRecHit >
TrackExtenderWithMTDT::InputCollection
edm::View< TrackType > InputCollection
Definition: TrackExtenderWithMTD.cc:286
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:318
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12