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 } // namespace
211 template <class TrackCollection>
213 public:
216 
218 
219  template <class H, class T>
220  void fillValueMap(edm::Event& iEvent, const H& handle, const std::vector<T>& vec, const edm::EDPutToken& token) const;
221 
222  void produce(edm::Event& ev, const edm::EventSetup& es) final;
223 
224  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
225 
227  const Trajectory& traj,
229  const MTDDetLayerGeometry*,
230  const MagneticField* field,
231  const Propagator* prop,
232  const reco::BeamSpot& bs,
233  const double vtxTime,
234  const bool matchVertex,
235  MTDHitMatchingInfo& bestHit) const;
236 
238  const Trajectory& traj,
240  const MTDDetLayerGeometry*,
241  const MagneticField* field,
242  const Propagator* prop,
243  const reco::BeamSpot& bs,
244  const double vtxTime,
245  const bool matchVertex,
246  MTDHitMatchingInfo& bestHit) const;
247 
248  void fillMatchingHits(const DetLayer*,
250  const Trajectory&,
252  const Propagator*,
253  const reco::BeamSpot&,
254  const double&,
255  const bool,
257  MTDHitMatchingInfo&) const;
258 
261  if (!recHits.empty()) {
262  GlobalPoint first = gtg->idToDet(recHits.front()->geographicalId())->position();
263  GlobalPoint last = gtg->idToDet(recHits.back()->geographicalId())->position();
264 
265  // maybe perp2?
266  auto rFirst = first.mag2();
267  auto rLast = last.mag2();
268  if (rFirst < rLast)
270  if (rFirst > rLast)
272  }
273  LogDebug("TrackExtenderWithMTD") << "Impossible to determine the rechits order" << endl;
275  }
276 
277  reco::Track buildTrack(const reco::Track&,
278  const Trajectory&,
279  const Trajectory&,
280  const reco::BeamSpot&,
281  const MagneticField* field,
282  const Propagator* prop,
283  bool hasMTD,
284  float& pathLength,
285  float& tmtdOut,
286  float& sigmatmtdOut) const;
287  reco::TrackExtra buildTrackExtra(const Trajectory& trajectory) const;
288 
289  string dumpLayer(const DetLayer* layer) const;
290 
291 private:
307 
314 
315  const bool updateTraj_, updateExtra_, updatePattern_;
316  const std::string mtdRecHitBuilder_, propagator_, transientTrackBuilder_;
317  std::unique_ptr<MeasurementEstimator> theEstimator;
318  std::unique_ptr<TrackTransformer> theTransformer;
323 
324  const float estMaxChi2_;
325  const float estMaxNSigma_;
326  const float btlChi2Cut_;
327  const float btlTimeChi2Cut_;
328  const float etlChi2Cut_;
329  const float etlTimeChi2Cut_;
330 
331  const bool useVertex_;
332  const bool useSimVertex_;
333  const float dzCut_;
334  const float bsTimeSpread_;
335 };
336 
337 template <class TrackCollection>
339  : tracksToken_(consumes<InputCollection>(iConfig.getParameter<edm::InputTag>("tracksSrc"))),
340  hitsToken_(consumes<MTDTrackingDetSetVector>(iConfig.getParameter<edm::InputTag>("hitsSrc"))),
341  bsToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotSrc"))),
342  updateTraj_(iConfig.getParameter<bool>("updateTrackTrajectory")),
343  updateExtra_(iConfig.getParameter<bool>("updateTrackExtra")),
344  updatePattern_(iConfig.getParameter<bool>("updateTrackHitPattern")),
345  mtdRecHitBuilder_(iConfig.getParameter<std::string>("MTDRecHitBuilder")),
346  propagator_(iConfig.getParameter<std::string>("Propagator")),
347  transientTrackBuilder_(iConfig.getParameter<std::string>("TransientTrackBuilder")),
348  estMaxChi2_(iConfig.getParameter<double>("estimatorMaxChi2")),
349  estMaxNSigma_(iConfig.getParameter<double>("estimatorMaxNSigma")),
350  btlChi2Cut_(iConfig.getParameter<double>("btlChi2Cut")),
351  btlTimeChi2Cut_(iConfig.getParameter<double>("btlTimeChi2Cut")),
352  etlChi2Cut_(iConfig.getParameter<double>("etlChi2Cut")),
353  etlTimeChi2Cut_(iConfig.getParameter<double>("etlTimeChi2Cut")),
354  useVertex_(iConfig.getParameter<bool>("useVertex")),
355  useSimVertex_(iConfig.getParameter<bool>("useSimVertex")),
356  dzCut_(iConfig.getParameter<double>("dZCut")),
357  bsTimeSpread_(iConfig.getParameter<double>("bsTimeSpread")) {
358  if (useVertex_) {
359  if (useSimVertex_) {
360  genVtxPositionToken_ = consumes<GlobalPoint>(iConfig.getParameter<edm::InputTag>("genVtxPositionSrc"));
361  genVtxTimeToken_ = consumes<float>(iConfig.getParameter<edm::InputTag>("genVtxTimeSrc"));
362  } else
363  vtxToken_ = consumes<VertexCollection>(iConfig.getParameter<edm::InputTag>("vtxSrc"));
364  }
365 
366  theEstimator = std::make_unique<Chi2MeasurementEstimator>(estMaxChi2_, estMaxNSigma_);
367  theTransformer = std::make_unique<TrackTransformer>(iConfig.getParameterSet("TrackTransformer"));
368 
369  btlMatchChi2Token = produces<edm::ValueMap<float>>("btlMatchChi2");
370  etlMatchChi2Token = produces<edm::ValueMap<float>>("etlMatchChi2");
371  btlMatchTimeChi2Token = produces<edm::ValueMap<float>>("btlMatchTimeChi2");
372  etlMatchTimeChi2Token = produces<edm::ValueMap<float>>("etlMatchTimeChi2");
373  pathLengthToken = produces<edm::ValueMap<float>>("pathLength");
374  tmtdToken = produces<edm::ValueMap<float>>("tmtd");
375  sigmatmtdToken = produces<edm::ValueMap<float>>("sigmatmtd");
376  pOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackp");
377  betaOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackBeta");
378  t0OrigTrkToken = produces<edm::ValueMap<float>>("generalTrackt0");
379  sigmat0OrigTrkToken = produces<edm::ValueMap<float>>("generalTracksigmat0");
380  pathLengthOrigTrkToken = produces<edm::ValueMap<float>>("generalTrackPathLength");
381  tmtdOrigTrkToken = produces<edm::ValueMap<float>>("generalTracktmtd");
382  sigmatmtdOrigTrkToken = produces<edm::ValueMap<float>>("generalTracksigmatmtd");
383  assocOrigTrkToken = produces<edm::ValueMap<int>>("generalTrackassoc");
384 
385  produces<edm::OwnVector<TrackingRecHit>>();
386  produces<reco::TrackExtraCollection>();
387  produces<TrackCollection>();
388 }
389 
390 template <class TrackCollection>
392  edm::ParameterSetDescription desc, transDesc;
393  desc.add<edm::InputTag>("tracksSrc", edm::InputTag("generalTracks"));
394  desc.add<edm::InputTag>("hitsSrc", edm::InputTag("mtdTrackingRecHits"));
395  desc.add<edm::InputTag>("beamSpotSrc", edm::InputTag("offlineBeamSpot"));
396  desc.add<edm::InputTag>("genVtxPositionSrc", edm::InputTag("genParticles:xyz0"));
397  desc.add<edm::InputTag>("genVtxTimeSrc", edm::InputTag("genParticles:t0"));
398  desc.add<edm::InputTag>("vtxSrc", edm::InputTag("offlinePrimaryVertices4D"));
399  desc.add<bool>("updateTrackTrajectory", true);
400  desc.add<bool>("updateTrackExtra", true);
401  desc.add<bool>("updateTrackHitPattern", true);
402  desc.add<std::string>("TransientTrackBuilder", "TransientTrackBuilder");
403  desc.add<std::string>("MTDRecHitBuilder", "MTDRecHitBuilder");
404  desc.add<std::string>("Propagator", "PropagatorWithMaterialForMTD");
406  false,
407  "KFFitterForRefitInsideOut",
408  "KFSmootherForRefitInsideOut",
409  "PropagatorWithMaterialForMTD",
410  "alongMomentum",
411  true,
412  "WithTrackAngle",
413  "MuonRecHitBuilder",
414  "MTDRecHitBuilder");
415  desc.add<edm::ParameterSetDescription>("TrackTransformer", transDesc);
416  desc.add<double>("estimatorMaxChi2", 500.);
417  desc.add<double>("estimatorMaxNSigma", 10.);
418  desc.add<double>("btlChi2Cut", 50.);
419  desc.add<double>("btlTimeChi2Cut", 10.);
420  desc.add<double>("etlChi2Cut", 50.);
421  desc.add<double>("etlTimeChi2Cut", 10.);
422  desc.add<bool>("useVertex", false);
423  desc.add<bool>("useSimVertex", false);
424  desc.add<double>("dZCut", 0.1);
425  desc.add<double>("bsTimeSpread", 0.2);
426  descriptions.add("trackExtenderWithMTDBase", desc);
427 }
428 
429 template <class TrackCollection>
430 template <class H, class T>
432  const H& handle,
433  const std::vector<T>& vec,
434  const edm::EDPutToken& token) const {
435  auto out = std::make_unique<edm::ValueMap<T>>();
437  filler.insert(handle, vec.begin(), vec.end());
438  filler.fill();
439  iEvent.put(token, std::move(out));
440 }
441 
442 template <class TrackCollection>
444  //this produces pieces of the track extra
445  Traj2TrackHits t2t;
446 
447  theTransformer->setServices(es);
448 
449  TrackingRecHitRefProd hitsRefProd = ev.getRefBeforePut<TrackingRecHitCollection>();
450  reco::TrackExtraRefProd extrasRefProd = ev.getRefBeforePut<reco::TrackExtraCollection>();
451 
453 
455  es.get<MTDRecoGeometryRecord>().get(geo);
456 
459 
460  es.get<TransientTrackRecord>().get(transientTrackBuilder_, builder);
461  es.get<TransientRecHitRecord>().get(mtdRecHitBuilder_, hitbuilder);
462 
464  es.get<TrackingComponentsRecord>().get(propagator_, prop);
465 
467  es.get<TrackerTopologyRcd>().get(httopo);
468  const TrackerTopology& ttopo = *httopo;
469 
470  auto output = std::make_unique<TrackCollection>();
471  auto extras = std::make_unique<reco::TrackExtraCollection>();
472  auto outhits = std::make_unique<edm::OwnVector<TrackingRecHit>>();
473 
474  std::vector<float> btlMatchChi2;
475  std::vector<float> etlMatchChi2;
476  std::vector<float> btlMatchTimeChi2;
477  std::vector<float> etlMatchTimeChi2;
478  std::vector<float> pathLengthsRaw;
479  std::vector<float> tmtdRaw;
480  std::vector<float> sigmatmtdRaw;
481  std::vector<float> pOrigTrkRaw;
482  std::vector<float> betaOrigTrkRaw;
483  std::vector<float> t0OrigTrkRaw;
484  std::vector<float> sigmat0OrigTrkRaw;
485  std::vector<float> pathLengthsOrigTrkRaw;
486  std::vector<float> tmtdOrigTrkRaw;
487  std::vector<float> sigmatmtdOrigTrkRaw;
488  std::vector<int> assocOrigTrkRaw;
489 
491  ev.getByToken(tracksToken_, tracksH);
492  const auto& tracks = *tracksH;
493 
495  ev.getByToken(hitsToken_, hitsH);
496  const auto& hits = *hitsH;
497 
499  ev.getByToken(bsToken_, bsH);
500  const auto& bs = *bsH;
501 
502  const Vertex* pv = nullptr;
503  if (useVertex_ && !useSimVertex_) {
505  ev.getByToken(vtxToken_, vtxH);
506  if (!vtxH.product()->empty())
507  pv = &(vtxH.product()->at(0));
508  }
509 
510  std::unique_ptr<math::XYZTLorentzVectorF> genPV(nullptr);
511  if (useVertex_ && useSimVertex_) {
512  const auto& genVtxPositionHandle = ev.getHandle(genVtxPositionToken_);
513  const auto& genVtxTimeHandle = ev.getHandle(genVtxTimeToken_);
514  genPV = std::make_unique<math::XYZTLorentzVectorF>(
515  genVtxPositionHandle->x(), genVtxPositionHandle->y(), genVtxPositionHandle->z(), *(genVtxTimeHandle));
516  }
517 
518  double vtxTime = 0.;
519  if (useVertex_) {
520  if (useSimVertex_ && genPV) {
521  vtxTime = genPV->t();
522  } else if (pv)
523  vtxTime = pv->t(); //already in ns
524  }
525 
526  std::vector<unsigned> track_indices;
527  unsigned itrack = 0;
528 
529  for (const auto& track : tracks) {
530  double trackVtxTime = 0.;
531  if (useVertex_) {
532  double dz;
533  if (useSimVertex_)
534  dz = std::abs(track.dz(math::XYZPoint(*genPV)));
535  else
536  dz = std::abs(track.dz(pv->position()));
537 
538  if (dz < dzCut_)
539  trackVtxTime = vtxTime;
540  }
541 
542  reco::TransientTrack ttrack(track, magfield.product(), gtg);
543  const auto& trajs = theTransformer->transform(track);
544  auto thits = theTransformer->getTransientRecHits(ttrack);
546  MTDHitMatchingInfo mBTL, mETL;
547  if (!trajs.empty()) {
548  const auto& btlhits = tryBTLLayers(track,
549  trajs.front(),
550  hits,
551  geo.product(),
552  magfield.product(),
553  prop.product(),
554  bs,
555  trackVtxTime,
556  trackVtxTime != 0.,
557  mBTL);
558  mtdthits.insert(mtdthits.end(), btlhits.begin(), btlhits.end());
559 
560  // in the future this should include an intermediate refit before propagating to the ETL
561  // for now it is ok
562  const auto& etlhits = tryETLLayers(track,
563  trajs.front(),
564  hits,
565  geo.product(),
566  magfield.product(),
567  prop.product(),
568  bs,
569  trackVtxTime,
570  trackVtxTime != 0.,
571  mETL);
572  mtdthits.insert(mtdthits.end(), etlhits.begin(), etlhits.end());
573  }
574 
575  auto ordering = checkRecHitsOrdering(thits);
577  thits.insert(thits.end(), mtdthits.begin(), mtdthits.end());
578  } else {
579  std::reverse(mtdthits.begin(), mtdthits.end());
580  mtdthits.insert(mtdthits.end(), thits.begin(), thits.end());
581  thits.swap(mtdthits);
582  }
583 
584  const auto& trajwithmtd = theTransformer->transform(ttrack, thits);
585  float pMap = 0.f, betaMap = 0.f, t0Map = 0.f, sigmat0Map = -1.f, pathLengthMap = -1.f, tmtdMap = 0.f,
586  sigmatmtdMap = -1.f;
587  int iMap = -1;
588 
589  for (const auto& trj : trajwithmtd) {
590  const auto& thetrj = (updateTraj_ ? trj : trajs.front());
591  float pathLength = 0.f, tmtd = 0.f, sigmatmtd = -1.f;
592  reco::Track result = buildTrack(track,
593  thetrj,
594  trj,
595  bs,
596  magfield.product(),
597  prop.product(),
598  !trajwithmtd.empty() && !mtdthits.empty(),
599  pathLength,
600  tmtd,
601  sigmatmtd);
602  if (result.ndof() >= 0) {
604  reco::TrackExtra::TrajParams trajParams;
606  size_t hitsstart = outhits->size();
607  if (updatePattern_) {
608  t2t(trj, *outhits, trajParams, chi2s); // this fills the output hit collection
609  } else {
610  t2t(thetrj, *outhits, trajParams, chi2s);
611  }
612  size_t hitsend = outhits->size();
613  extras->push_back(buildTrackExtra(trj)); // always push back the fully built extra, update by setting in track
614  extras->back().setHits(hitsRefProd, hitsstart, hitsend - hitsstart);
615  extras->back().setTrajParams(trajParams, chi2s);
616  //create the track
617  output->push_back(result);
618  btlMatchChi2.push_back(mBTL.hit ? mBTL.estChi2 : -1);
619  etlMatchChi2.push_back(mETL.hit ? mETL.estChi2 : -1);
620  btlMatchTimeChi2.push_back(mBTL.hit ? mBTL.timeChi2 : -1);
621  etlMatchTimeChi2.push_back(mETL.hit ? mETL.timeChi2 : -1);
622  pathLengthsRaw.push_back(pathLength);
623  tmtdRaw.push_back(tmtd);
624  sigmatmtdRaw.push_back(sigmatmtd);
625  pathLengthMap = pathLength;
626  tmtdMap = tmtd;
627  sigmatmtdMap = sigmatmtd;
628  auto& backtrack = output->back();
629  iMap = output->size() - 1;
630  pMap = backtrack.p();
631  betaMap = backtrack.beta();
632  t0Map = backtrack.t0();
633  sigmat0Map = std::copysign(std::sqrt(std::abs(backtrack.covt0t0())), backtrack.covt0t0());
634  reco::TrackExtraRef extraRef(extrasRefProd, extras->size() - 1);
635  backtrack.setExtra((updateExtra_ ? extraRef : track.extra()));
636  for (unsigned ihit = hitsstart; ihit < hitsend; ++ihit) {
637  backtrack.appendHitPattern((*outhits)[ihit], ttopo);
638  }
639  } else {
640  LogTrace("TrackExtenderWithMTD") << "Error in the MTD track refitting. This should not happen";
641  }
642  }
643 
644  pOrigTrkRaw.push_back(pMap);
645  betaOrigTrkRaw.push_back(betaMap);
646  t0OrigTrkRaw.push_back(t0Map);
647  sigmat0OrigTrkRaw.push_back(sigmat0Map);
648  pathLengthsOrigTrkRaw.push_back(pathLengthMap);
649  tmtdOrigTrkRaw.push_back(tmtdMap);
650  sigmatmtdOrigTrkRaw.push_back(sigmatmtdMap);
651  assocOrigTrkRaw.push_back(iMap);
652  ++itrack;
653  }
654 
655  auto outTrksHandle = ev.put(std::move(output));
656  ev.put(std::move(extras));
657  ev.put(std::move(outhits));
658 
659  fillValueMap(ev, outTrksHandle, btlMatchChi2, btlMatchChi2Token);
660  fillValueMap(ev, outTrksHandle, etlMatchChi2, etlMatchChi2Token);
661  fillValueMap(ev, outTrksHandle, btlMatchTimeChi2, btlMatchTimeChi2Token);
662  fillValueMap(ev, outTrksHandle, etlMatchTimeChi2, etlMatchTimeChi2Token);
663  fillValueMap(ev, outTrksHandle, pathLengthsRaw, pathLengthToken);
664  fillValueMap(ev, outTrksHandle, tmtdRaw, tmtdToken);
665  fillValueMap(ev, outTrksHandle, sigmatmtdRaw, sigmatmtdToken);
666  fillValueMap(ev, tracksH, pOrigTrkRaw, pOrigTrkToken);
667  fillValueMap(ev, tracksH, betaOrigTrkRaw, betaOrigTrkToken);
668  fillValueMap(ev, tracksH, t0OrigTrkRaw, t0OrigTrkToken);
669  fillValueMap(ev, tracksH, sigmat0OrigTrkRaw, sigmat0OrigTrkToken);
670  fillValueMap(ev, tracksH, pathLengthsOrigTrkRaw, pathLengthOrigTrkToken);
671  fillValueMap(ev, tracksH, tmtdOrigTrkRaw, tmtdOrigTrkToken);
672  fillValueMap(ev, tracksH, sigmatmtdOrigTrkRaw, sigmatmtdOrigTrkToken);
673  fillValueMap(ev, tracksH, assocOrigTrkRaw, assocOrigTrkToken);
674 }
675 
676 namespace {
677  bool cmp_for_detset(const unsigned one, const unsigned two) { return one < two; };
678 
679  bool getTrajectoryStateClosestToBeamLine(const Trajectory& traj,
680  const reco::BeamSpot& bs,
681  const Propagator* thePropagator,
683  // get the state closest to the beamline
684  TrajectoryStateOnSurface stateForProjectionToBeamLineOnSurface =
685  traj.closestMeasurement(GlobalPoint(bs.x0(), bs.y0(), bs.z0())).updatedState();
686 
687  if (!stateForProjectionToBeamLineOnSurface.isValid()) {
688  edm::LogError("CannotPropagateToBeamLine") << "the state on the closest measurement isnot valid. skipping track.";
689  return false;
690  }
691 
692  const FreeTrajectoryState& stateForProjectionToBeamLine = *stateForProjectionToBeamLineOnSurface.freeState();
693 
694  TSCBLBuilderWithPropagator tscblBuilder(*thePropagator);
695  tscbl = tscblBuilder(stateForProjectionToBeamLine, bs);
696 
697  return tscbl.isValid();
698  }
699 
700  bool trackPathLength(const Trajectory& traj,
701  const reco::BeamSpot& bs,
702  const Propagator* thePropagator,
703  double& pathlength) {
704  pathlength = 0.;
705 
707  bool tscbl_status = getTrajectoryStateClosestToBeamLine(traj, bs, thePropagator, tscbl);
708 
709  if (!tscbl_status)
710  return false;
711 
712  bool validpropagation = true;
713  double pathlength1 = 0.;
714  double pathlength2 = 0.;
715 
716  //add pathlength layer by layer
717  for (auto it = traj.measurements().begin(); it != traj.measurements().end() - 1; ++it) {
718  const auto& propresult = thePropagator->propagateWithPath(it->updatedState(), (it + 1)->updatedState().surface());
719  double layerpathlength = std::abs(propresult.second);
720  if (layerpathlength == 0.) {
721  validpropagation = false;
722  }
723  pathlength1 += layerpathlength;
724  }
725 
726  //add distance from bs to first measurement
727  if (traj.direction() == alongMomentum) {
728  const auto& propresult2 =
729  thePropagator->propagateWithPath(tscbl.trackStateAtPCA(), traj.firstMeasurement().updatedState().surface());
730  pathlength2 = propresult2.second;
731  if (pathlength2 == 0.) {
732  validpropagation = false;
733  }
734  pathlength = pathlength1 + pathlength2;
735  } else {
736  const auto& propresult2 =
737  thePropagator->propagateWithPath(tscbl.trackStateAtPCA(), traj.lastMeasurement().updatedState().surface());
738  pathlength2 = propresult2.second;
739  if (pathlength2 == 0.) {
740  validpropagation = false;
741  }
742  pathlength = pathlength1 + pathlength2;
743  }
744 
745  return validpropagation;
746  }
747 
748  void find_hits_in_dets(const MTDTrackingDetSetVector& hits,
749  const Trajectory& traj,
750  const DetLayer* layer,
751  const TrajectoryStateOnSurface& tsos,
752  const double vtxTime,
753  const reco::BeamSpot& bs,
754  const float bsTimeSpread,
755  const Propagator* prop,
756  const std::unique_ptr<MeasurementEstimator>& theEstimator,
757  bool useVtxConstraint,
758  std::set<MTDHitMatchingInfo>& out) {
760  bool tscbl_status = getTrajectoryStateClosestToBeamLine(traj, bs, prop, tscbl);
761 
762  if (!tscbl_status)
763  return;
764 
766 
767  double pathlength;
768  trackPathLength(traj, bs, prop, pathlength);
769 
770  pair<bool, TrajectoryStateOnSurface> comp = layer->compatible(tsos, *prop, *theEstimator);
771  if (comp.first) {
772  vector<DetLayer::DetWithState> compDets = layer->compatibleDets(tsos, *prop, *theEstimator);
773  if (!compDets.empty()) {
774  for (const auto& detWithState : compDets) {
775  auto range = hits.equal_range(detWithState.first->geographicalId(), cmp_for_detset);
776  for (auto detitr = range.first; detitr != range.second; ++detitr) {
777  for (auto itr = detitr->begin(); itr != detitr->end(); ++itr) {
778  auto est = theEstimator->estimate(detWithState.second, *itr);
779  auto pl = prop->propagateWithPath(tsos, detWithState.second.surface());
780 
781  if (!est.first || std::abs(pl.second) == 0.)
782  continue;
783 
784  double tot_pl = pathlength + std::abs(pl.second);
785  double t_vtx = useVtxConstraint ? vtxTime : 0.;
786 
787  constexpr double vtx_res = 0.008;
788  double t_vtx_err = useVtxConstraint ? vtx_res : bsTimeSpread;
789 
790  constexpr double t_res_manual = 0.035;
791 
792  TrackTofPidInfo tof = computeTrackTofPidInfo(p.mag2(),
793  tot_pl,
794  itr->time(),
795  t_res_manual, //put hit error by hand for the moment
796  t_vtx,
797  t_vtx_err, //put vtx error by hand for the moment
798  false);
799  MTDHitMatchingInfo mi;
800  mi.hit = &(*itr);
801  mi.estChi2 = est.second;
802  mi.timeChi2 = tof.dtchi2_best; //use the chi2 for the best matching hypothesis
803 
804  out.insert(mi);
805  }
806  }
807  }
808  }
809  }
810  }
811 } // namespace
812 
813 template <class TrackCollection>
815  const TrackType& track,
816  const Trajectory& traj,
818  const MTDDetLayerGeometry* geo,
819  const MagneticField* field,
820  const Propagator* prop,
821  const reco::BeamSpot& bs,
822  const double vtxTime,
823  const bool matchVertex,
824  MTDHitMatchingInfo& bestHit) const {
825  const vector<const DetLayer*>& layers = geo->allBTLLayers();
826 
827  auto tTrack = builder->build(track);
828  // get the outermost trajectory point on the track
829  TrajectoryStateOnSurface tsos = tTrack.outermostMeasurementState();
830 
832  bestHit = MTDHitMatchingInfo();
833  for (const DetLayer* ilay : layers)
834  fillMatchingHits(ilay, tsos, traj, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
835  return output;
836 }
837 
838 template <class TrackCollection>
840  const TrackType& track,
841  const Trajectory& traj,
843  const MTDDetLayerGeometry* geo,
844  const MagneticField* field,
845  const Propagator* prop,
846  const reco::BeamSpot& bs,
847  const double vtxTime,
848  const bool matchVertex,
849  MTDHitMatchingInfo& bestHit) const {
850  const vector<const DetLayer*>& layers = geo->allETLLayers();
851 
852  auto tTrack = builder->build(track);
853  // get the outermost trajectory point on the track
854  TrajectoryStateOnSurface tsos = tTrack.outermostMeasurementState();
855 
857  bestHit = MTDHitMatchingInfo();
858  for (const DetLayer* ilay : layers) {
859  const BoundDisk& disk = static_cast<const MTDRingForwardDoubleLayer*>(ilay)->specificSurface();
860  const double diskZ = disk.position().z();
861 
862  if (tsos.globalPosition().z() * diskZ < 0)
863  continue; // only propagate to the disk that's on the same side
864 
865  fillMatchingHits(ilay, tsos, traj, hits, prop, bs, vtxTime, matchVertex, output, bestHit);
866  }
867  return output;
868 }
869 
870 template <class TrackCollection>
872  const TrajectoryStateOnSurface& tsos,
873  const Trajectory& traj,
875  const Propagator* prop,
876  const reco::BeamSpot& bs,
877  const double& vtxTime,
878  const bool matchVertex,
880  MTDHitMatchingInfo& bestHit) const {
881  std::set<MTDHitMatchingInfo> hitsInLayer;
882  bool hitMatched = false;
883 
884  using namespace std::placeholders;
885  auto find_hits = std::bind(find_hits_in_dets,
886  hits,
887  traj,
888  ilay,
889  tsos,
890  _1,
891  bs,
892  bsTimeSpread_,
893  prop,
894  std::ref(theEstimator),
895  _2,
896  std::ref(hitsInLayer));
897 
898  if (useVertex_ && matchVertex)
899  find_hits(vtxTime, true);
900  else
901  find_hits(0, false);
902 
903  //just take the first hit because the hits are sorted on their matching quality
904  if (!hitsInLayer.empty()) {
905  //check hits to pass minimum quality matching requirements
906  if (hitsInLayer.begin()->estChi2 < etlChi2Cut_ && hitsInLayer.begin()->timeChi2 < etlTimeChi2Cut_) {
907  hitMatched = true;
908  output.push_back(hitbuilder->build(hitsInLayer.begin()->hit));
909  if (*(hitsInLayer.begin()) < bestHit)
910  bestHit = *(hitsInLayer.begin());
911  }
912  }
913 
914  if (useVertex_ && matchVertex && !hitMatched) {
915  //try a second search with beamspot hypothesis
916  hitsInLayer.clear();
917  find_hits(0, false);
918  if (!hitsInLayer.empty()) {
919  if (hitsInLayer.begin()->timeChi2 < etlTimeChi2Cut_) {
920  if (hitsInLayer.begin()->estChi2 < etlChi2Cut_) {
921  hitMatched = true;
922  output.push_back(hitbuilder->build(hitsInLayer.begin()->hit));
923  if ((*hitsInLayer.begin()) < bestHit)
924  bestHit = *(hitsInLayer.begin());
925  }
926  }
927  }
928  }
929 }
930 
931 //below is unfortunately ripped from other places but
932 //since track producer doesn't know about MTD we have to do this
933 template <class TrackCollection>
935  const Trajectory& traj,
936  const Trajectory& trajWithMtd,
937  const reco::BeamSpot& bs,
938  const MagneticField* field,
939  const Propagator* thePropagator,
940  bool hasMTD,
941  float& pathLengthOut,
942  float& tmtdOut,
943  float& sigmatmtdOut) const {
945  bool tsbcl_status = getTrajectoryStateClosestToBeamLine(traj, bs, thePropagator, tscbl);
946 
947  if (!tsbcl_status)
948  return reco::Track();
949 
951  math::XYZPoint pos(v.x(), v.y(), v.z());
953  math::XYZVector mom(p.x(), p.y(), p.z());
954 
955  int ndof = traj.ndof();
956 
957  double t0 = 0.;
958  double covt0t0 = -1.;
959  pathLengthOut = -1.f; // if there is no MTD flag the pathlength with -1
960  tmtdOut = 0.f;
961  sigmatmtdOut = -1.f;
962  double betaOut = 0.;
963  double covbetabeta = -1.;
964 
965  //compute path length for time backpropagation, using first MTD hit for the momentum
966  if (hasMTD) {
967  double pathlength;
968  bool validpropagation = trackPathLength(trajWithMtd, bs, thePropagator, pathlength);
969  double thit = 0.;
970  double thiterror = -1.;
971  bool validmtd = false;
972 
973  //need to better handle the cases with >1 hit in MTD
974  for (auto const& hit : trajWithMtd.measurements()) {
975  bool ismtd = hit.recHit()->geographicalId().det() == DetId::Forward &&
976  ForwardSubdetector(hit.recHit()->geographicalId().subdetId()) == FastTime;
977  if (ismtd) {
978  const MTDTrackingRecHit* mtdhit = static_cast<const MTDTrackingRecHit*>(hit.recHit()->hit());
979  thit = mtdhit->time();
980  thiterror = mtdhit->timeError();
981  validmtd = true;
982  break;
983  }
984  }
985 
986  if (validmtd && validpropagation) {
987  //here add the PID uncertainty for later use in the 1st step of 4D vtx reconstruction
988  TrackTofPidInfo tofInfo = computeTrackTofPidInfo(p.mag2(), pathlength, thit, thiterror, 0., 0., true);
989  pathLengthOut = pathlength; // set path length if we've got a timing hit
990  tmtdOut = thit;
991  sigmatmtdOut = thiterror;
992  t0 = tofInfo.dt;
993  covt0t0 = tofInfo.dterror * tofInfo.dterror;
994  betaOut = tofInfo.beta_pi;
995  covbetabeta = tofInfo.betaerror * tofInfo.betaerror;
996  }
997  }
998 
999  return reco::Track(traj.chiSquared(),
1000  int(ndof),
1001  pos,
1002  mom,
1003  tscbl.trackStateAtPCA().charge(),
1005  orig.algo(),
1007  t0,
1008  betaOut,
1009  covt0t0,
1010  covbetabeta);
1011 }
1012 
1013 template <class TrackCollection>
1015  static const string metname = "TrackExtenderWithMTD";
1016 
1017  const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
1018 
1019  // put the collection of TrackingRecHit in the event
1020 
1021  // sets the outermost and innermost TSOSs
1022  // ToDo: validation for track states with MTD
1023  TrajectoryStateOnSurface outerTSOS;
1024  TrajectoryStateOnSurface innerTSOS;
1025  unsigned int innerId = 0, outerId = 0;
1027  DetId outerDetId;
1028 
1029  if (trajectory.direction() == alongMomentum) {
1030  LogTrace(metname) << "alongMomentum";
1031  outerTSOS = trajectory.lastMeasurement().updatedState();
1032  innerTSOS = trajectory.firstMeasurement().updatedState();
1033  outerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
1034  innerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
1035  outerRecHit = trajectory.lastMeasurement().recHit();
1036  outerDetId = trajectory.lastMeasurement().recHit()->geographicalId();
1037  } else if (trajectory.direction() == oppositeToMomentum) {
1038  LogTrace(metname) << "oppositeToMomentum";
1039  outerTSOS = trajectory.firstMeasurement().updatedState();
1040  innerTSOS = trajectory.lastMeasurement().updatedState();
1041  outerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
1042  innerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
1043  outerRecHit = trajectory.firstMeasurement().recHit();
1044  outerDetId = trajectory.firstMeasurement().recHit()->geographicalId();
1045  } else
1046  LogError(metname) << "Wrong propagation direction!";
1047 
1048  const GeomDet* outerDet = gtg->idToDet(outerDetId);
1049  GlobalPoint outerTSOSPos = outerTSOS.globalParameters().position();
1050  bool inside = outerDet->surface().bounds().inside(outerDet->toLocal(outerTSOSPos));
1051 
1052  GlobalPoint hitPos =
1053  (outerRecHit->isValid()) ? outerRecHit->globalPosition() : outerTSOS.globalParameters().position();
1054 
1055  if (!inside) {
1056  LogTrace(metname) << "The Global Muon outerMostMeasurementState is not compatible with the recHit detector!"
1057  << " Setting outerMost postition to recHit position if recHit isValid: "
1058  << outerRecHit->isValid();
1059  LogTrace(metname) << "From " << outerTSOSPos << " to " << hitPos;
1060  }
1061 
1062  //build the TrackExtra
1063  GlobalPoint v = (inside) ? outerTSOSPos : hitPos;
1064  GlobalVector p = outerTSOS.globalParameters().momentum();
1065  math::XYZPoint outpos(v.x(), v.y(), v.z());
1066  math::XYZVector outmom(p.x(), p.y(), p.z());
1067 
1068  v = innerTSOS.globalParameters().position();
1069  p = innerTSOS.globalParameters().momentum();
1070  math::XYZPoint inpos(v.x(), v.y(), v.z());
1071  math::XYZVector inmom(p.x(), p.y(), p.z());
1072 
1073  reco::TrackExtra trackExtra(outpos,
1074  outmom,
1075  true,
1076  inpos,
1077  inmom,
1078  true,
1079  outerTSOS.curvilinearError(),
1080  outerId,
1081  innerTSOS.curvilinearError(),
1082  innerId,
1083  trajectory.direction(),
1084  trajectory.seedRef());
1085 
1086  return trackExtra;
1087 }
1088 
1089 template <class TrackCollection>
1091  stringstream output;
1092 
1093  const BoundSurface* sur = nullptr;
1094  const BoundCylinder* bc = nullptr;
1095  const BoundDisk* bd = nullptr;
1096 
1097  sur = &(layer->surface());
1098  if ((bc = dynamic_cast<const BoundCylinder*>(sur))) {
1099  output << " Cylinder of radius: " << bc->radius() << endl;
1100  } else if ((bd = dynamic_cast<const BoundDisk*>(sur))) {
1101  output << " Disk at: " << bd->position().z() << endl;
1102  }
1103  return output.str();
1104 }
1105 
1106 //define this as a plug-in
1113 
Vector3DBase
Definition: Vector3DBase.h:8
ConfigurationDescriptions.h
edm::RefProd< TrackingRecHitCollection >
TrackExtenderWithMTDT::etlMatchChi2Token
edm::EDPutToken etlMatchChi2Token
Definition: TrackExtenderWithMTD.cc:293
Propagator.h
class-composition.H
H
Definition: class-composition.py:31
TrackExtenderWithMTDT::theEstimator
std::unique_ptr< MeasurementEstimator > theEstimator
Definition: TrackExtenderWithMTD.cc:317
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Chi2MeasurementEstimator.h
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
TrajectoryStateClosestToBeamLine
Definition: TrajectoryStateClosestToBeamLine.h:15
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
TrackExtenderWithMTDT::tryBTLLayers
TransientTrackingRecHit::ConstRecHitContainer tryBTLLayers(const TrackType &, const Trajectory &traj, 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:814
TrackExtenderWithMTDT::genVtxTimeToken_
edm::EDGetTokenT< float > genVtxTimeToken_
Definition: TrackExtenderWithMTD.cc:312
BTLDetId.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
TrackExtenderWithMTDT::etlTimeChi2Cut_
const float etlTimeChi2Cut_
Definition: TrackExtenderWithMTD.cc:329
GeomDet
Definition: GeomDet.h:27
edm::Handle::product
T const * product() const
Definition: Handle.h:70
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:32
TrackExtenderWithMTDT::useSimVertex_
const bool useSimVertex_
Definition: TrackExtenderWithMTD.cc:332
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:55
TrackExtenderWithMTDT::estMaxChi2_
const float estMaxChi2_
Definition: TrackExtenderWithMTD.cc:324
pos
Definition: PixelAliasList.h:18
TrackExtenderWithMTDT::btlMatchTimeChi2Token
edm::EDPutToken btlMatchTimeChi2Token
Definition: TrackExtenderWithMTD.cc:294
RefitDirection::GeometricalDirection
GeometricalDirection
Definition: RefitDirection.h:15
FreeTrajectoryState::charge
TrackCharge charge() const
Definition: FreeTrajectoryState.h:69
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
TrackExtenderWithMTDT::sigmatmtdToken
edm::EDPutToken sigmatmtdToken
Definition: TrackExtenderWithMTD.cc:298
TrackExtenderWithMTDT::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TrackExtenderWithMTD.cc:391
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:304
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:292
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
MTDTrayBarrelLayer.h
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
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:311
ETLDetId.h
edm::Handle
Definition: AssociativeIterator.h:50
TrackExtenderWithMTDT::pathLengthToken
edm::EDPutToken pathLengthToken
Definition: TrackExtenderWithMTD.cc:296
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:334
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:934
groupFilesInBlocks.reverse
reverse
Definition: groupFilesInBlocks.py:131
edm::Ref< TrackExtraCollection >
TrackExtenderWithMTDT::updateTraj_
const bool updateTraj_
Definition: TrackExtenderWithMTD.cc:315
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:1014
TrackExtenderWithMTDT::estMaxNSigma_
const float estMaxNSigma_
Definition: TrackExtenderWithMTD.cc:325
dt
float dt
Definition: AMPTWrapper.h:136
TrackExtenderWithMTDT::useVertex_
const bool useVertex_
Definition: TrackExtenderWithMTD.cc:331
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::vtxToken_
edm::EDGetTokenT< VertexCollection > vtxToken_
Definition: TrackExtenderWithMTD.cc:313
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
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:301
TrackExtenderWithMTDT::TrackExtenderWithMTDT
TrackExtenderWithMTDT(const ParameterSet &pset)
Definition: TrackExtenderWithMTD.cc:338
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:214
TrackExtenderWithMTDT::builder
edm::ESHandle< TransientTrackBuilder > builder
Definition: TrackExtenderWithMTD.cc:319
TrackExtenderWithMTDT::fillMatchingHits
void fillMatchingHits(const DetLayer *, const TrajectoryStateOnSurface &, const Trajectory &, const MTDTrackingDetSetVector &, const Propagator *, const reco::BeamSpot &, const double &, const bool, TransientTrackingRecHit::ConstRecHitContainer &, MTDHitMatchingInfo &) const
Definition: TrackExtenderWithMTD.cc:871
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::fillValueMap
void fillValueMap(edm::Event &iEvent, const H &handle, const std::vector< T > &vec, const edm::EDPutToken &token) const
Definition: TrackExtenderWithMTD.cc:431
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Traj2TrackHits.h
Point3DBase< float, GlobalTag >
TrackExtenderWithMTDT::assocOrigTrkToken
edm::EDPutToken assocOrigTrkToken
Definition: TrackExtenderWithMTD.cc:306
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:310
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
TrackExtenderWithMTDT::gtg
edm::ESHandle< GlobalTrackingGeometry > gtg
Definition: TrackExtenderWithMTD.cc:321
TransientTrackBuilder.h
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
Trajectory::ndof
int ndof(bool bon=true) const
Definition: Trajectory.cc:97
TrackExtenderWithMTDT::theTransformer
std::unique_ptr< TrackTransformer > theTransformer
Definition: TrackExtenderWithMTD.cc:318
MTDRingForwardDoubleLayer.h
edm::LogError
Definition: MessageLogger.h:183
Trajectory::RecHitContainer
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:42
TSCBLBuilderWithPropagator.h
Event.h
TrackExtenderWithMTDT::sigmatmtdOrigTrkToken
edm::EDPutToken sigmatmtdOrigTrkToken
Definition: TrackExtenderWithMTD.cc:305
TrackingRecHit::ConstRecHitContainer
std::vector< ConstRecHitPointer > ConstRecHitContainer
Definition: TrackingRecHit.h:32
TrackExtenderWithMTDT::tryETLLayers
TransientTrackingRecHit::ConstRecHitContainer tryETLLayers(const TrackType &, const Trajectory &traj, 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:839
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MTDDetRing.h
TrackExtenderWithMTDT::hitsToken_
edm::EDGetTokenT< MTDTrackingDetSetVector > hitsToken_
Definition: TrackExtenderWithMTD.cc:309
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:308
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:302
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:300
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
TrackExtenderWithMTDT::hitbuilder
edm::ESHandle< TransientTrackingRecHitBuilder > hitbuilder
Definition: TrackExtenderWithMTD.cc:320
TransientTrackRecord.h
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
get
#define get
MTDDetLayerGeometry
Definition: MTDDetLayerGeometry.h:19
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:17
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:45
Trajectory::measurements
DataContainer const & measurements() const
Definition: Trajectory.h:178
reco::TrackBase::algo
TrackAlgorithm algo() const
Definition: TrackBase.h:532
VertexFwd.h
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TSCBLBuilderWithPropagator
Definition: TSCBLBuilderWithPropagator.h:16
Trajectory.h
Trajectory::recHits
ConstRecHitContainer recHits() const
Definition: Trajectory.h:186
edmNew::DetSetVector
Definition: DetSetNew.h:13
TrackExtenderWithMTDT::dumpLayer
string dumpLayer(const DetLayer *layer) const
Definition: TrackExtenderWithMTD.cc:1090
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
TrackExtenderWithMTDT::transientTrackBuilder_
const std::string transientTrackBuilder_
Definition: TrackExtenderWithMTD.cc:316
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:303
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
TrackExtenderWithMTDT::produce
void produce(edm::Event &ev, const edm::EventSetup &es) final
Definition: TrackExtenderWithMTD.cc:443
reco::TrackExtraBase::Chi2sFive
std::vector< unsigned char > Chi2sFive
Definition: TrackExtraBase.h:25
c_inv
constexpr double c_inv
Definition: Phase2TrackerDigitizerAlgorithm.h:56
TrajectoryMeasurement::ConstRecHitPointer
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
Definition: TrajectoryMeasurement.h:28
TrackInfoProducer_cfi.updatedState
updatedState
Definition: TrackInfoProducer_cfi.py:6
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:259
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:299
RefitDirection::insideOut
Definition: RefitDirection.h:15
GeometricSearchDet::surface
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
EventSetup.h
BoundCylinder
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
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
TrackExtenderWithMTD
TrackExtenderWithMTDT< reco::TrackCollection > TrackExtenderWithMTD
Definition: TrackExtenderWithMTD.cc:1112
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:303
TrackExtenderWithMTDT::etlMatchTimeChi2Token
edm::EDPutToken etlMatchTimeChi2Token
Definition: TrackExtenderWithMTD.cc:295
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:671
TrajectoryStateOnSurface::globalParameters
const GlobalTrajectoryParameters & globalParameters() const
Definition: TrajectoryStateOnSurface.h:64
TrackExtenderWithMTDT::btlChi2Cut_
const float btlChi2Cut_
Definition: TrackExtenderWithMTD.cc:326
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:333
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:212
edm::Event
Definition: Event.h:73
TrackExtenderWithMTDT::btlTimeChi2Cut_
const float btlTimeChi2Cut_
Definition: TrackExtenderWithMTD.cc:327
MTDTransientTrackingRecHitBuilder.h
MagneticField
Definition: MagneticField.h:19
volumeBasedMagneticField_160812_cfi.magfield
magfield
Definition: volumeBasedMagneticField_160812_cfi.py:11
TrackExtenderWithMTDT::prop
edm::ESHandle< Propagator > prop
Definition: TrackExtenderWithMTD.cc:322
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:328
reco::Vertex
Definition: Vertex.h:35
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition: ParameterSet.cc:2121
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
TrackExtenderWithMTDT::tmtdToken
edm::EDPutToken tmtdToken
Definition: TrackExtenderWithMTD.cc:297
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:215
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316
TrackingComponentsRecord
Definition: TrackingComponentsRecord.h:12