CMS 3D CMS Logo

MtdTracksValidation.cc
Go to the documentation of this file.
1 #include <string>
2 
8 
11 
18 
24 
27 
35 
46 
59 
62 
72 
73 #include "CLHEP/Units/PhysicalConstants.h"
74 #include "MTDHit.h"
75 
77 public:
78  explicit MtdTracksValidation(const edm::ParameterSet&);
79  ~MtdTracksValidation() override;
80 
81  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
82 
83 private:
84  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
85 
86  void analyze(const edm::Event&, const edm::EventSetup&) override;
87 
88  const std::pair<bool, bool> checkAcceptance(
89  const reco::Track&, const edm::Event&, const edm::EventSetup&, size_t&, float&, float&, float&, float&);
90 
91  const bool trkTPSelLV(const TrackingParticle&);
92  const bool trkTPSelAll(const TrackingParticle&);
93  const bool trkRecSel(const reco::TrackBase&);
94  const bool trkRecSelLowPt(const reco::TrackBase&);
96 
97  const unsigned long int uniqueId(const uint32_t x, const EncodedEventId& y) {
98  const uint64_t a = static_cast<uint64_t>(x);
99  const uint64_t b = static_cast<uint64_t>(y.rawId());
100 
101  if (x < y.rawId())
102  return (b << 32) | a;
103  else
104  return (a << 32) | b;
105  }
106 
107  bool isETL(const double eta) const { return (std::abs(eta) > trackMinEtlEta_) && (std::abs(eta) < trackMaxEtlEta_); }
108 
111  MonitorElement* me3,
112  MonitorElement* me4,
113  MonitorElement* me5,
114  float var1,
115  float var2,
116  float var3,
117  float var4,
118  float var5,
119  bool flag);
120 
121  // ------------ member data ------------
122 
124  const bool optionalPlots_;
125  const float trackMaxPt_;
126  const float trackMaxBtlEta_;
127  const float trackMinEtlEta_;
128  const float trackMaxEtlEta_;
129 
130  static constexpr double simUnit_ = 1e9; // sim time in s while reco time in ns
131  static constexpr double etacutGEN_ = 4.; // |eta| < 4;
132  static constexpr double etacutREC_ = 3.; // |eta| < 3;
133  static constexpr double pTcutBTL_ = 0.7; // PT > 0.7 GeV
134  static constexpr double pTcutETL_ = 0.2; // PT > 0.2 GeV
135  static constexpr double depositBTLthreshold_ = 1; // threshold for energy deposit in BTL cell [MeV]
136  static constexpr double depositETLthreshold_ = 0.001; // threshold for energy deposit in ETL cell [MeV]
137  static constexpr double rBTL_ = 110.0;
138  static constexpr double zETL_ = 290.0;
139  static constexpr double etaMatchCut_ = 0.05;
140  static constexpr double cluDRradius_ = 0.05; // to cluster rechits around extrapolated track
141 
143 
146 
152 
157 
160 
174 
180 
189 
201 
205 
216 
230 
233 
252 
257 
269 
270  // ====== Trak-cluster matching based on MC truth
271  // - BTL TPmtd Direct, TPmtd Other, TPnomtd
274 
277 
280 
281  // - BTL TPmtd Direct hits: correct, wrong, missing association in MTD
287 
293 
296 
297  // - BTL TPmtd "other" hits: correct, wrong, missing association in MTD
303 
309 
312 
313  // - BTL TPnomtd but a reco cluster is associated
319 
320  // - ETL: one, two o no sim hits
321  MonitorElement* meETLTrackMatchedTPmtd1Eta_; // -- sim hit in >=1 etl disk
323  MonitorElement* meETLTrackMatchedTPmtd2Eta_; // -- sim hits in 2 etl disks
325  MonitorElement* meETLTrackMatchedTPnomtdEta_; // -- no sim hits in etl
327 
328  // - ETL >=1 sim hit: each correct, at least one wrong, each sim hit missing reco association
334 
340 
346 
347  // - ETL - 2 sim hits: both correct, at least one wrong or one missing, both missing reco association
353 
359 
365 
366  // - ETL - no sim hits, but reco hit associated to the track
372 };
373 
374 // ------------ constructor and destructor --------------
376  : folder_(iConfig.getParameter<std::string>("folder")),
377  optionalPlots_(iConfig.getParameter<bool>("optionalPlots")),
378  trackMaxPt_(iConfig.getParameter<double>("trackMaximumPt")),
379  trackMaxBtlEta_(iConfig.getParameter<double>("trackMaximumBtlEta")),
380  trackMinEtlEta_(iConfig.getParameter<double>("trackMinimumEtlEta")),
381  trackMaxEtlEta_(iConfig.getParameter<double>("trackMaximumEtlEta")) {
382  GenRecTrackToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTagG"));
383  RecTrackToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTagT"));
385  consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("SimTag"));
387  consumes<reco::SimToRecoCollection>(iConfig.getParameter<edm::InputTag>("TPtoRecoTrackAssoc"));
389  consumes<reco::RecoToSimCollection>(iConfig.getParameter<edm::InputTag>("TPtoRecoTrackAssoc"));
391  consumes<reco::TPToSimCollectionMtd>(iConfig.getParameter<edm::InputTag>("tp2SimAssociationMapTag"));
392  r2sAssociationMapToken_ = consumes<MtdRecoClusterToSimLayerClusterAssociationMap>(
393  iConfig.getParameter<edm::InputTag>("r2sAssociationMapTag"));
394  btlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("btlRecHits"));
395  etlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("etlRecHits"));
396  btlRecCluToken_ = consumes<FTLClusterCollection>(iConfig.getParameter<edm::InputTag>("recCluTagBTL"));
397  etlRecCluToken_ = consumes<FTLClusterCollection>(iConfig.getParameter<edm::InputTag>("recCluTagETL"));
398  trackAssocToken_ = consumes<edm::ValueMap<int>>(iConfig.getParameter<edm::InputTag>("trackAssocSrc"));
399  pathLengthToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("pathLengthSrc"));
400  tmtdToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("tmtd"));
401  SigmatmtdToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmatmtd"));
402  t0SrcToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0Src"));
403  Sigmat0SrcToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0Src"));
404  t0PidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0PID"));
405  Sigmat0PidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0PID"));
406  t0SafePidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0SafePID"));
407  Sigmat0SafePidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0SafePID"));
408  SigmaTofPiToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmaTofPi"));
409  SigmaTofKToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmaTofK"));
410  SigmaTofPToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmaTofP"));
411  trackMVAQualToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("trackMVAQual"));
413  consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("outermostHitPositionSrc"));
414  mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
415  mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>();
416  mtdlayerToken_ = esConsumes<MTDDetLayerGeometry, MTDRecoGeometryRecord>();
417  magfieldToken_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
418  builderToken_ = esConsumes<TransientTrackBuilder, TransientTrackRecord>(edm::ESInputTag("", "TransientTrackBuilder"));
419 }
420 
422 
423 // ------------ method called for each event ------------
425  using namespace edm;
426  using namespace geant_units::operators;
427  using namespace std;
428 
429  auto GenRecTrackHandle = makeValid(iEvent.getHandle(GenRecTrackToken_));
430 
431  auto btlRecCluHandle = makeValid(iEvent.getHandle(btlRecCluToken_));
432  auto etlRecCluHandle = makeValid(iEvent.getHandle(etlRecCluToken_));
433 
434  std::unordered_map<uint32_t, MTDHit> m_btlHits;
435  std::unordered_map<uint32_t, MTDHit> m_etlHits;
436  std::unordered_map<uint32_t, std::set<unsigned long int>> m_btlTrkPerCell;
437  std::unordered_map<uint32_t, std::set<unsigned long int>> m_etlTrkPerCell;
438  const auto& tp2SimAssociationMap = iEvent.get(tp2SimAssociationMapToken_);
439  const auto& r2sAssociationMap = iEvent.get(r2sAssociationMapToken_);
440 
441  const auto& tMtd = iEvent.get(tmtdToken_);
442  const auto& SigmatMtd = iEvent.get(SigmatmtdToken_);
443  const auto& t0Src = iEvent.get(t0SrcToken_);
444  const auto& Sigmat0Src = iEvent.get(Sigmat0SrcToken_);
445  const auto& t0Pid = iEvent.get(t0PidToken_);
446  const auto& Sigmat0Pid = iEvent.get(Sigmat0PidToken_);
447  const auto& t0Safe = iEvent.get(t0SafePidToken_);
448  const auto& Sigmat0Safe = iEvent.get(Sigmat0SafePidToken_);
449  const auto& SigmaTofPi = iEvent.get(SigmaTofPiToken_);
450  const auto& SigmaTofK = iEvent.get(SigmaTofKToken_);
451  const auto& SigmaTofP = iEvent.get(SigmaTofPToken_);
452  const auto& mtdQualMVA = iEvent.get(trackMVAQualToken_);
453  const auto& trackAssoc = iEvent.get(trackAssocToken_);
454  const auto& pathLength = iEvent.get(pathLengthToken_);
455  const auto& outermostHitPosition = iEvent.get(outermostHitPositionToken_);
456 
457  auto recoToSimH = makeValid(iEvent.getHandle(recoToSimAssociationToken_));
458  r2s_ = recoToSimH.product();
459 
460  unsigned int index = 0;
461 
462  // --- Loop over all RECO tracks ---
463  for (const auto& trackGen : *GenRecTrackHandle) {
464  const reco::TrackRef trackref(iEvent.getHandle(GenRecTrackToken_), index);
465  index++;
466 
467  if (trackAssoc[trackref] == -1) {
468  LogWarning("mtdTracks") << "Extended track not associated";
469  continue;
470  }
471 
472  const reco::TrackRef mtdTrackref = reco::TrackRef(iEvent.getHandle(RecTrackToken_), trackAssoc[trackref]);
473  const reco::Track& track = *mtdTrackref;
474 
475  bool isBTL = false;
476  bool isETL = false;
477  bool ETLdisc1 = false;
478  bool ETLdisc2 = false;
479  bool twoETLdiscs = false;
480  bool noCrack = std::abs(trackGen.eta()) < trackMaxBtlEta_ || std::abs(trackGen.eta()) > trackMinEtlEta_;
481 
482  if (trkRecSel(trackGen)) {
483  meTracktmtd_->Fill(tMtd[trackref]);
484  if (std::round(SigmatMtd[trackref] - Sigmat0Pid[trackref]) != 0) {
485  LogWarning("mtdTracks")
486  << "TimeError associated to refitted track is different from TimeError stored in tofPID "
487  "sigmat0 ValueMap: this should not happen";
488  }
489 
490  meTrackt0Src_->Fill(t0Src[trackref]);
491  meTrackSigmat0Src_->Fill(Sigmat0Src[trackref]);
492 
493  meTrackt0Pid_->Fill(t0Pid[trackref]);
494  meTrackSigmat0Pid_->Fill(Sigmat0Pid[trackref]);
495  meTrackt0SafePid_->Fill(t0Safe[trackref]);
496  meTrackSigmat0SafePid_->Fill(std::log10(std::max(Sigmat0Safe[trackref], 0.001f)));
497  meTrackMVAQual_->Fill(mtdQualMVA[trackref]);
498 
499  meTrackSigmaTof_[0]->Fill(SigmaTofPi[trackref] * 1e3); //save as ps
500  meTrackSigmaTof_[1]->Fill(SigmaTofK[trackref] * 1e3);
501  meTrackSigmaTof_[2]->Fill(SigmaTofP[trackref] * 1e3);
502  meTrackSigmaTofvsP_[0]->Fill(trackGen.p(), SigmaTofPi[trackref] * 1e3);
503  meTrackSigmaTofvsP_[1]->Fill(trackGen.p(), SigmaTofK[trackref] * 1e3);
504  meTrackSigmaTofvsP_[2]->Fill(trackGen.p(), SigmaTofP[trackref] * 1e3);
505 
506  meTrackPathLenghtvsEta_->Fill(std::abs(trackGen.eta()), pathLength[trackref]);
507  bool MTDEtlZnegD1 = false;
508  bool MTDEtlZnegD2 = false;
509  bool MTDEtlZposD1 = false;
510  bool MTDEtlZposD2 = false;
511  std::vector<edm::Ref<edmNew::DetSetVector<FTLCluster>, FTLCluster>> recoClustersRefs;
512 
513  if (std::abs(trackGen.eta()) < trackMaxBtlEta_) {
514  // --- all BTL tracks (with and without hit in MTD) ---
515  meBTLTrackEtaTot_->Fill(std::abs(trackGen.eta()));
516  meBTLTrackPhiTot_->Fill(trackGen.phi());
517  meBTLTrackPtTot_->Fill(trackGen.pt());
518 
519  bool MTDBtl = false;
520  int numMTDBtlvalidhits = 0;
521  for (const auto hit : track.recHits()) {
522  if (hit->isValid() == false)
523  continue;
524  MTDDetId Hit = hit->geographicalId();
525  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 1)) {
526  MTDBtl = true;
527  numMTDBtlvalidhits++;
528  const auto* mtdhit = static_cast<const MTDTrackingRecHit*>(hit);
529  const auto& hitCluster = mtdhit->mtdCluster();
530  if (hitCluster.size() != 0) {
531  auto recoClusterRef = edmNew::makeRefTo(btlRecCluHandle, &hitCluster);
532  recoClustersRefs.push_back(recoClusterRef);
533  }
534  }
535  }
536  meTrackNumHits_->Fill(numMTDBtlvalidhits);
537 
538  // --- keeping only tracks with last hit in MTD ---
539  if (MTDBtl == true) {
540  isBTL = true;
541  meBTLTrackEtaMtd_->Fill(std::abs(trackGen.eta()));
542  meBTLTrackPhiMtd_->Fill(trackGen.phi());
543  meBTLTrackPtMtd_->Fill(trackGen.pt());
545  meBTLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
546  }
547  if (isBTL && Sigmat0Safe[trackref] < 0.) {
548  meTrackNumHitsNT_->Fill(numMTDBtlvalidhits);
549  }
550  } //loop over (geometrical) BTL tracks
551 
552  else {
553  // --- all ETL tracks (with and without hit in MTD) ---
554  meETLTrackEtaTot_->Fill(std::abs(trackGen.eta()));
555  meETLTrackPhiTot_->Fill(trackGen.phi());
556  meETLTrackPtTot_->Fill(trackGen.pt());
557 
558  int numMTDEtlvalidhits = 0;
559  for (const auto hit : track.recHits()) {
560  if (hit->isValid() == false)
561  continue;
562  MTDDetId Hit = hit->geographicalId();
563  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 2)) {
564  isETL = true;
565  ETLDetId ETLHit = hit->geographicalId();
566 
567  const auto* mtdhit = static_cast<const MTDTrackingRecHit*>(hit);
568  const auto& hitCluster = mtdhit->mtdCluster();
569  if (hitCluster.size() != 0) {
570  auto recoClusterRef = edmNew::makeRefTo(etlRecCluHandle, &hitCluster);
571  recoClustersRefs.push_back(recoClusterRef);
572  }
573 
574  if ((ETLHit.zside() == -1) && (ETLHit.nDisc() == 1)) {
575  MTDEtlZnegD1 = true;
577  meETLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
578  numMTDEtlvalidhits++;
579  }
580  if ((ETLHit.zside() == -1) && (ETLHit.nDisc() == 2)) {
581  MTDEtlZnegD2 = true;
583  meETLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
584  numMTDEtlvalidhits++;
585  }
586  if ((ETLHit.zside() == 1) && (ETLHit.nDisc() == 1)) {
587  MTDEtlZposD1 = true;
589  meETLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
590  numMTDEtlvalidhits++;
591  }
592  if ((ETLHit.zside() == 1) && (ETLHit.nDisc() == 2)) {
593  MTDEtlZposD2 = true;
595  meETLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
596  numMTDEtlvalidhits++;
597  }
598  }
599  }
600  meTrackNumHits_->Fill(-numMTDEtlvalidhits);
601  if (isETL && Sigmat0Safe[trackref] < 0.) {
602  meTrackNumHitsNT_->Fill(-numMTDEtlvalidhits);
603  }
604 
605  // --- keeping only tracks with last hit in MTD ---
606  ETLdisc1 = (MTDEtlZnegD1 || MTDEtlZposD1);
607  ETLdisc2 = (MTDEtlZnegD2 || MTDEtlZposD2);
608  twoETLdiscs =
609  ((MTDEtlZnegD1 == true) && (MTDEtlZnegD2 == true)) || ((MTDEtlZposD1 == true) && (MTDEtlZposD2 == true));
610  if (ETLdisc1 || ETLdisc2) {
611  meETLTrackEtaMtd_->Fill(std::abs(trackGen.eta()));
612  meETLTrackPhiMtd_->Fill(trackGen.phi());
613  meETLTrackPtMtd_->Fill(trackGen.pt());
614  if (twoETLdiscs) {
615  meETLTrackEta2Mtd_->Fill(std::abs(trackGen.eta()));
616  meETLTrackPhi2Mtd_->Fill(trackGen.phi());
617  meETLTrackPt2Mtd_->Fill(trackGen.pt());
618  }
619  }
620  }
621 
622  if (isBTL)
623  meTrackOutermostHitR_->Fill(outermostHitPosition[trackref]);
624  if (isETL)
625  meTrackOutermostHitZ_->Fill(std::abs(outermostHitPosition[trackref]));
626 
627  LogDebug("MtdTracksValidation") << "Track p/pt = " << trackGen.p() << " " << trackGen.pt() << " eta "
628  << trackGen.eta() << " BTL " << isBTL << " ETL " << isETL << " 2disks "
629  << twoETLdiscs;
630 
631  // == TrackingParticle based matching
632  const reco::TrackBaseRef trkrefb(trackref);
633  auto tp_info = getMatchedTP(trkrefb);
634  if (tp_info != nullptr && trkTPSelAll(**tp_info)) {
635  // -- pT resolution plots
636  if (optionalPlots_) {
637  if (trackGen.pt() < trackMaxPt_) {
638  if (isBTL) {
639  meBTLTrackMatchedTPPtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) /
640  std::abs(trackGen.pt() - (*tp_info)->pt()));
641  meBTLTrackMatchedTPPtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt());
642  meBTLTrackMatchedTPPtRatioMtd_->Fill(track.pt() / (*tp_info)->pt());
644  (*tp_info)->pt(),
645  std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt()));
646  meBTLTrackMatchedTPDPtvsPtGen_->Fill((*tp_info)->pt(),
647  (trackGen.pt() - (*tp_info)->pt()) / (*tp_info)->pt());
648  meBTLTrackMatchedTPDPtvsPtMtd_->Fill((*tp_info)->pt(),
649  (track.pt() - (*tp_info)->pt()) / (*tp_info)->pt());
650  }
651  if (isETL && !twoETLdiscs && (std::abs(trackGen.eta()) > trackMinEtlEta_) &&
652  (std::abs(trackGen.eta()) < trackMaxEtlEta_)) {
653  meETLTrackMatchedTPPtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) /
654  std::abs(trackGen.pt() - (*tp_info)->pt()));
655  meETLTrackMatchedTPPtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt());
656  meETLTrackMatchedTPPtRatioMtd_->Fill(track.pt() / (*tp_info)->pt());
658  (*tp_info)->pt(),
659  std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt()));
660  meETLTrackMatchedTPDPtvsPtGen_->Fill((*tp_info)->pt(),
661  (trackGen.pt() - (*tp_info)->pt()) / ((*tp_info)->pt()));
662  meETLTrackMatchedTPDPtvsPtMtd_->Fill((*tp_info)->pt(),
663  (track.pt() - (*tp_info)->pt()) / ((*tp_info)->pt()));
664  }
665  if (isETL && twoETLdiscs) {
666  meETLTrackMatchedTP2PtResMtd_->Fill(std::abs(track.pt() - (*tp_info)->pt()) /
667  std::abs(trackGen.pt() - (*tp_info)->pt()));
668  meETLTrackMatchedTP2PtRatioGen_->Fill(trackGen.pt() / (*tp_info)->pt());
669  meETLTrackMatchedTP2PtRatioMtd_->Fill(track.pt() / (*tp_info)->pt());
671  (*tp_info)->pt(),
672  std::abs(track.pt() - (*tp_info)->pt()) / std::abs(trackGen.pt() - (*tp_info)->pt()));
673  meETLTrackMatchedTP2DPtvsPtGen_->Fill((*tp_info)->pt(),
674  (trackGen.pt() - (*tp_info)->pt()) / ((*tp_info)->pt()));
675  meETLTrackMatchedTP2DPtvsPtMtd_->Fill((*tp_info)->pt(),
676  (track.pt() - (*tp_info)->pt()) / ((*tp_info)->pt()));
677  }
678  }
679  }
680 
681  // -- Track matched to TP: all and with last hit in MTD
682  if (std::abs(trackGen.eta()) < trackMaxBtlEta_) {
683  meBTLTrackMatchedTPEtaTot_->Fill(std::abs(trackGen.eta()));
684  meBTLTrackMatchedTPPtTot_->Fill(trackGen.pt());
685  if (isBTL) {
686  meBTLTrackMatchedTPEtaMtd_->Fill(std::abs(trackGen.eta()));
687  meBTLTrackMatchedTPPtMtd_->Fill(trackGen.pt());
688  }
689  } else {
690  meETLTrackMatchedTPEtaTot_->Fill(std::abs(trackGen.eta()));
691  meETLTrackMatchedTPPtTot_->Fill(trackGen.pt());
692  if (isETL) {
693  meETLTrackMatchedTPEtaMtd_->Fill(std::abs(trackGen.eta()));
694  meETLTrackMatchedTPPtMtd_->Fill(trackGen.pt());
695  if (twoETLdiscs) {
696  meETLTrackMatchedTPEta2Mtd_->Fill(std::abs(trackGen.eta()));
697  meETLTrackMatchedTPPt2Mtd_->Fill(trackGen.pt());
698  }
699  }
700  }
701 
702  if (noCrack) {
703  if (trkTPSelLV(**tp_info)) {
704  meTrackMatchedTPEtaTotLV_->Fill(std::abs(trackGen.eta()));
705  meTrackMatchedTPPtTotLV_->Fill(trackGen.pt());
706  }
707  }
708 
709  bool hasTime = false;
710  double tsim = (*tp_info)->parentVertex()->position().t() * simUnit_;
711  double dT(-9999.);
712  double pullT(-9999.);
713  if (Sigmat0Safe[trackref] != -1.) {
714  dT = t0Safe[trackref] - tsim;
715  pullT = dT / Sigmat0Safe[trackref];
716  hasTime = true;
717  }
718 
719  // == MC truth matching
720  bool isTPmtdDirectBTL = false, isTPmtdOtherBTL = false, isTPmtdDirectCorrectBTL = false,
721  isTPmtdOtherCorrectBTL = false, isTPmtdETLD1 = false, isTPmtdETLD2 = false, isTPmtdCorrectETLD1 = false,
722  isTPmtdCorrectETLD2 = false;
723 
724  auto simClustersRefsIt = tp2SimAssociationMap.find(*tp_info);
725  const bool withMTD = (simClustersRefsIt != tp2SimAssociationMap.end());
726 
727  // If there is a mtdSimLayerCluster from the tracking particle
728  if (withMTD) {
729  // -- Get the refs to MtdSimLayerClusters associated to the TP
730  std::vector<edm::Ref<MtdSimLayerClusterCollection>> simClustersRefs;
731  for (const auto& ref : simClustersRefsIt->val) {
732  simClustersRefs.push_back(ref);
733  MTDDetId mtddetid = ref->detIds_and_rows().front().first;
734  if (mtddetid.mtdSubDetector() == 2) {
735  ETLDetId detid(mtddetid.rawId());
736  if (detid.nDisc() == 1)
737  isTPmtdETLD1 = true;
738  if (detid.nDisc() == 2)
739  isTPmtdETLD2 = true;
740  }
741  }
742 
743  // === BTL
744  // -- Sort BTL sim clusters by time
745  std::vector<edm::Ref<MtdSimLayerClusterCollection>>::iterator directSimClusIt;
746  if (std::abs(trackGen.eta()) < trackMaxBtlEta_ && !simClustersRefs.empty()) {
747  std::sort(simClustersRefs.begin(), simClustersRefs.end(), [](const auto& a, const auto& b) {
748  return a->simLCTime() < b->simLCTime();
749  });
750  // Find the first direct hit in time
751  directSimClusIt = std::find_if(simClustersRefs.begin(), simClustersRefs.end(), [](const auto& simCluster) {
752  return simCluster->trackIdOffset() == 0;
753  });
754  // Check if TP has direct or other sim cluster for BTL
755  for (const auto& simClusterRef : simClustersRefs) {
756  if (directSimClusIt != simClustersRefs.end() && simClusterRef == *directSimClusIt) {
757  isTPmtdDirectBTL = true;
758  } else if (simClusterRef->trackIdOffset() != 0) {
759  isTPmtdOtherBTL = true;
760  }
761  }
762  }
763 
764  // == Check if the track-cluster association is correct: Track->RecoClus->SimClus == Track->TP->SimClus
765  for (const auto& recClusterRef : recoClustersRefs) {
766  if (recClusterRef.isNonnull()) {
767  auto itp = r2sAssociationMap.equal_range(recClusterRef);
768  if (itp.first != itp.second) {
769  auto& simClustersRefs_RecoMatch = (*itp.first).second;
770 
771  for (const auto& simClusterRef_RecoMatch : simClustersRefs_RecoMatch) {
772  // Check if simClusterRef_RecoMatch exists in SimClusters
773  auto simClusterIt =
774  std::find(simClustersRefs.begin(), simClustersRefs.end(), simClusterRef_RecoMatch);
775 
776  // SimCluster found in SimClusters
777  if (simClusterIt != simClustersRefs.end()) {
778  if (isBTL) {
779  if (directSimClusIt != simClustersRefs.end() && simClusterRef_RecoMatch == *directSimClusIt) {
780  isTPmtdDirectCorrectBTL = true;
781  } else if (simClusterRef_RecoMatch->trackIdOffset() != 0) {
782  isTPmtdOtherCorrectBTL = true;
783  }
784  }
785  if (isETL) {
786  MTDDetId mtddetid = (*simClusterIt)->detIds_and_rows().front().first;
787  ETLDetId detid(mtddetid.rawId());
788  if (detid.nDisc() == 1)
789  isTPmtdCorrectETLD1 = true;
790  if (detid.nDisc() == 2)
791  isTPmtdCorrectETLD2 = true;
792  }
793  }
794  }
795  }
796  }
797  }
798 
799  // == BTL
800  if (std::abs(trackGen.eta()) < trackMaxBtlEta_) {
801  // -- Track matched to TP with sim hit in MTD
802  if (isTPmtdDirectBTL) {
804  meBTLTrackMatchedTPmtdDirectPt_->Fill(trackGen.pt());
805  } else if (isTPmtdOtherBTL) {
807  meBTLTrackMatchedTPmtdOtherPt_->Fill(trackGen.pt());
808  }
809  //-- Track matched to TP with sim hit in MTD, with associated reco cluster
810  if (isBTL) {
811  if (isTPmtdDirectBTL) {
812  // -- Track matched to TP with sim hit (direct), correctly associated reco cluster
813  if (isTPmtdDirectCorrectBTL) {
819  std::abs(trackGen.eta()),
820  trackGen.pt(),
821  mtdQualMVA[trackref],
822  dT,
823  pullT,
824  hasTime);
825  }
826  // -- Track matched to TP with sim hit (direct), incorrectly associated reco cluster
827  else {
833  std::abs(trackGen.eta()),
834  trackGen.pt(),
835  mtdQualMVA[trackref],
836  dT,
837  pullT,
838  hasTime);
839  }
840  }
841  // -- Track matched to TP with sim hit (other), correctly associated reco cluster
842  else if (isTPmtdOtherBTL) {
843  if (isTPmtdOtherCorrectBTL) {
849  std::abs(trackGen.eta()),
850  trackGen.pt(),
851  mtdQualMVA[trackref],
852  dT,
853  pullT,
854  hasTime);
855  }
856  // -- Track matched to TP with sim hit (other), incorrectly associated reco cluster
857  else {
863  std::abs(trackGen.eta()),
864  trackGen.pt(),
865  mtdQualMVA[trackref],
866  dT,
867  pullT,
868  hasTime);
869  }
870  }
871  }
872  // -- Track matched to TP with sim hit in MTD, missing associated reco cluster
873  else {
874  if (isTPmtdDirectBTL) {
877  } else if (isTPmtdOtherBTL) {
880  }
881  }
882  } // == end BTL
883  // == ETL
884  else {
885  // -- Track matched to TP with sim hit in one etl layer
886  if (isTPmtdETLD1 || isTPmtdETLD2) { // at least one hit (D1 or D2 or both)
887  meETLTrackMatchedTPmtd1Eta_->Fill(std::abs(trackGen.eta()));
888  meETLTrackMatchedTPmtd1Pt_->Fill(trackGen.pt());
889  }
890  // -- Track matched to TP with sim hits in both etl layers (D1 and D2)
891  if (isTPmtdETLD1 && isTPmtdETLD2) {
892  meETLTrackMatchedTPmtd2Eta_->Fill(std::abs(trackGen.eta()));
893  meETLTrackMatchedTPmtd2Pt_->Fill(trackGen.pt());
894  }
895  if (isETL) {
896  // -- Track matched to TP with sim hit in >=1 etl layer
897  if (isTPmtdETLD1 || isTPmtdETLD2) {
898  // - each hit is correctly associated to the track
899  if ((isTPmtdETLD1 && !isTPmtdETLD2 && ETLdisc1 && isTPmtdCorrectETLD1) ||
900  (isTPmtdETLD2 && !isTPmtdETLD1 && ETLdisc2 && isTPmtdCorrectETLD2) ||
901  (isTPmtdETLD1 && isTPmtdETLD2 && ETLdisc1 && ETLdisc2 && isTPmtdCorrectETLD1 &&
902  isTPmtdCorrectETLD2)) {
908  std::abs(trackGen.eta()),
909  trackGen.pt(),
910  mtdQualMVA[trackref],
911  dT,
912  pullT,
913  hasTime);
914  }
915  // - at least one reco hit is incorrectly associated or, if two sim hits, one reco hit is missing
916  else if ((isTPmtdETLD1 && !isTPmtdCorrectETLD1) || (isTPmtdETLD2 && !isTPmtdCorrectETLD2)) {
922  std::abs(trackGen.eta()),
923  trackGen.pt(),
924  mtdQualMVA[trackref],
925  dT,
926  pullT,
927  hasTime);
928  }
929  }
930  // -- Track matched to TP with sim hits in both etl layers (D1 and D2)
931  if (isTPmtdETLD1 && isTPmtdETLD2) {
932  // - each hit correctly associated to the track
933  if (ETLdisc1 && ETLdisc2 && isTPmtdCorrectETLD1 && isTPmtdCorrectETLD2) {
939  std::abs(trackGen.eta()),
940  trackGen.pt(),
941  mtdQualMVA[trackref],
942  dT,
943  pullT,
944  hasTime);
945  }
946  // - at least one reco hit incorrectly associated or one hit missing
947  else if ((ETLdisc1 || ETLdisc2) && (!isTPmtdCorrectETLD1 || !isTPmtdCorrectETLD2)) {
953  std::abs(trackGen.eta()),
954  trackGen.pt(),
955  mtdQualMVA[trackref],
956  dT,
957  pullT,
958  hasTime);
959  }
960  }
961  }
962  // -- Missing association with reco hits in MTD
963  else {
964  // -- Track matched to TP with sim hit in >=1 etl layers, no reco hits associated to the track
965  if (isTPmtdETLD1 || isTPmtdETLD2) {
967  meETLTrackMatchedTPmtd1NoAssocPt_->Fill(trackGen.pt());
968  }
969  // -- Track matched to TP with sim hit in 2 etl layers, no reco hits associated to the track
970  if (isTPmtdETLD1 && isTPmtdETLD2) {
972  meETLTrackMatchedTPmtd2NoAssocPt_->Fill(trackGen.pt());
973  }
974  }
975  } // == end ETL
976  } // --- end "withMTD"
977 
978  // - Track matched to TP without sim hit in MTD, but with reco cluster associated
979  // - BTL
980  if (std::abs(trackGen.eta()) < trackMaxBtlEta_) {
981  if (!isTPmtdDirectBTL && !isTPmtdOtherBTL) {
982  meBTLTrackMatchedTPnomtdEta_->Fill(std::abs(trackGen.eta()));
983  meBTLTrackMatchedTPnomtdPt_->Fill(trackGen.pt());
984  if (isBTL) {
990  std::abs(trackGen.eta()),
991  trackGen.pt(),
992  mtdQualMVA[trackref],
993  dT,
994  pullT,
995  hasTime);
996  }
997  }
998  }
999  // - ETL
1000  else if (!isTPmtdETLD1 && !isTPmtdETLD2) {
1001  meETLTrackMatchedTPnomtdEta_->Fill(std::abs(trackGen.eta()));
1002  meETLTrackMatchedTPnomtdPt_->Fill(trackGen.pt());
1003  if (isETL) {
1009  std::abs(trackGen.eta()),
1010  trackGen.pt(),
1011  mtdQualMVA[trackref],
1012  dT,
1013  pullT,
1014  hasTime);
1015  }
1016  }
1017 
1018  // == Time pull and detailed extrapolation check only on tracks associated to TP from signal event
1019  if (!trkTPSelLV(**tp_info)) {
1020  continue;
1021  }
1022  size_t nlayers(0);
1023  float extrho(0.);
1024  float exteta(0.);
1025  float extphi(0.);
1026  float selvar(0.);
1027  auto accept = checkAcceptance(trackGen, iEvent, iSetup, nlayers, extrho, exteta, extphi, selvar);
1028  if (accept.first && std::abs(exteta) < trackMaxBtlEta_) {
1030  meExtraBTLeneInCone_->Fill(selvar);
1031  }
1032  if (accept.second) {
1033  if (std::abs(exteta) < trackMaxBtlEta_) {
1035  }
1036  if (noCrack) {
1037  meExtraPtMtd_->Fill(trackGen.pt());
1038  if (nlayers == 2) {
1039  meExtraPtEtl2Mtd_->Fill(trackGen.pt());
1040  }
1041  }
1042  meExtraEtaMtd_->Fill(std::abs(trackGen.eta()));
1043  if (nlayers == 2) {
1044  meExtraEtaEtl2Mtd_->Fill(std::abs(trackGen.eta()));
1045  }
1046  if (accept.first && accept.second && !(isBTL || isETL)) {
1047  edm::LogInfo("MtdTracksValidation")
1048  << "MtdTracksValidation: extender fail in " << iEvent.id().run() << " " << iEvent.id().event()
1049  << " pt= " << trackGen.pt() << " eta= " << trackGen.eta();
1050  meExtraMTDfailExtenderEta_->Fill(std::abs(trackGen.eta()));
1051  if (noCrack) {
1052  meExtraMTDfailExtenderPt_->Fill(trackGen.pt());
1053  }
1054  }
1055  } // detailed extrapolation check
1056 
1057  // time res and time pull
1058  if (Sigmat0Safe[trackref] != -1.) {
1059  if (isBTL || isETL) {
1060  meTrackResTot_->Fill(dT);
1061  meTrackPullTot_->Fill(pullT);
1062  meTrackResTotvsMVAQual_->Fill(mtdQualMVA[trackref], dT);
1063  meTrackPullTotvsMVAQual_->Fill(mtdQualMVA[trackref], pullT);
1064  }
1065  } // time res and time pull
1066  } // TP matching
1067  } // trkRecSel
1068 
1069  // ETL tracks with low pt (0.2 < Pt [GeV] < 0.7)
1070  if (trkRecSelLowPt(trackGen)) {
1071  if ((std::abs(trackGen.eta()) > trackMinEtlEta_) && (std::abs(trackGen.eta()) < trackMaxEtlEta_)) {
1072  if (trackGen.pt() < 0.45) {
1073  meETLTrackEtaTotLowPt_[0]->Fill(std::abs(trackGen.eta()));
1074  } else {
1075  meETLTrackEtaTotLowPt_[1]->Fill(std::abs(trackGen.eta()));
1076  }
1077  }
1078  bool MTDEtlZnegD1 = false;
1079  bool MTDEtlZnegD2 = false;
1080  bool MTDEtlZposD1 = false;
1081  bool MTDEtlZposD2 = false;
1082  for (const auto hit : track.recHits()) {
1083  if (hit->isValid() == false)
1084  continue;
1085  MTDDetId Hit = hit->geographicalId();
1086  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 2)) {
1087  isETL = true;
1088  ETLDetId ETLHit = hit->geographicalId();
1089  if ((ETLHit.zside() == -1) && (ETLHit.nDisc() == 1)) {
1090  MTDEtlZnegD1 = true;
1091  }
1092  if ((ETLHit.zside() == -1) && (ETLHit.nDisc() == 2)) {
1093  MTDEtlZnegD2 = true;
1094  }
1095  if ((ETLHit.zside() == 1) && (ETLHit.nDisc() == 1)) {
1096  MTDEtlZposD1 = true;
1097  }
1098  if ((ETLHit.zside() == 1) && (ETLHit.nDisc() == 2)) {
1099  MTDEtlZposD2 = true;
1100  }
1101  }
1102  }
1103  if ((trackGen.eta() < -trackMinEtlEta_) && (trackGen.eta() > -trackMaxEtlEta_)) {
1104  twoETLdiscs = (MTDEtlZnegD1 == true) && (MTDEtlZnegD2 == true);
1105  }
1106  if ((trackGen.eta() > trackMinEtlEta_) && (trackGen.eta() < trackMaxEtlEta_)) {
1107  twoETLdiscs = (MTDEtlZposD1 == true) && (MTDEtlZposD2 == true);
1108  }
1109  if (isETL && (std::abs(trackGen.eta()) > trackMinEtlEta_) && (std::abs(trackGen.eta()) < trackMaxEtlEta_)) {
1110  if (trackGen.pt() < 0.45) {
1111  meETLTrackEtaMtdLowPt_[0]->Fill(std::abs(trackGen.eta()));
1112  } else {
1113  meETLTrackEtaMtdLowPt_[1]->Fill(std::abs(trackGen.eta()));
1114  }
1115  }
1116  if (isETL && twoETLdiscs) {
1117  if (trackGen.pt() < 0.45) {
1118  meETLTrackEta2MtdLowPt_[0]->Fill(std::abs(trackGen.eta()));
1119  } else {
1120  meETLTrackEta2MtdLowPt_[1]->Fill(std::abs(trackGen.eta()));
1121  }
1122  }
1123  } // trkRecSelLowPt
1124 
1125  } // RECO tracks loop
1126 }
1127 
1128 const std::pair<bool, bool> MtdTracksValidation::checkAcceptance(const reco::Track& track,
1129  const edm::Event& iEvent,
1130  edm::EventSetup const& iSetup,
1131  size_t& nlayers,
1132  float& extrho,
1133  float& exteta,
1134  float& extphi,
1135  float& selvar) {
1136  bool isMatched(false);
1137  nlayers = 0;
1138  extrho = 0.;
1139  exteta = -999.;
1140  extphi = -999.;
1141  selvar = 0.;
1142 
1143  auto geometryHandle = iSetup.getTransientHandle(mtdgeoToken_);
1144  const MTDGeometry* geom = geometryHandle.product();
1145  auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_);
1146  const MTDTopology* topology = topologyHandle.product();
1147 
1148  auto layerHandle = iSetup.getTransientHandle(mtdlayerToken_);
1149  const MTDDetLayerGeometry* layerGeo = layerHandle.product();
1150 
1151  auto magfieldHandle = iSetup.getTransientHandle(magfieldToken_);
1152  const MagneticField* mfield = magfieldHandle.product();
1153 
1154  auto ttrackBuilder = iSetup.getTransientHandle(builderToken_);
1155 
1156  auto tTrack = ttrackBuilder->build(track);
1157  TrajectoryStateOnSurface tsos = tTrack.outermostMeasurementState();
1158  float theMaxChi2 = 500.;
1159  float theNSigma = 10.;
1160  std::unique_ptr<MeasurementEstimator> theEstimator =
1161  std::make_unique<Chi2MeasurementEstimator>(theMaxChi2, theNSigma);
1162  SteppingHelixPropagator prop(mfield, anyDirection);
1163 
1164  auto btlRecHitsHandle = makeValid(iEvent.getHandle(btlRecHitsToken_));
1165  auto etlRecHitsHandle = makeValid(iEvent.getHandle(etlRecHitsToken_));
1166 
1167  edm::LogVerbatim("MtdTracksValidation")
1168  << "MtdTracksValidation: extrapolating track, pt= " << track.pt() << " eta= " << track.eta();
1169 
1170  //try BTL
1171  bool inBTL = false;
1172  float eneSum(0.);
1173  const std::vector<const DetLayer*>& layersBTL = layerGeo->allBTLLayers();
1174  for (const DetLayer* ilay : layersBTL) {
1175  std::pair<bool, TrajectoryStateOnSurface> comp = ilay->compatible(tsos, prop, *theEstimator);
1176  if (!comp.first)
1177  continue;
1178  if (!inBTL) {
1179  inBTL = true;
1180  extrho = comp.second.globalPosition().perp();
1181  exteta = comp.second.globalPosition().eta();
1182  extphi = comp.second.globalPosition().phi();
1183  edm::LogVerbatim("MtdTracksValidation") << "MtdTracksValidation: extrapolation at BTL surface, rho= " << extrho
1184  << " eta= " << exteta << " phi= " << extphi;
1185  }
1186  std::vector<DetLayer::DetWithState> compDets = ilay->compatibleDets(tsos, prop, *theEstimator);
1187  for (const auto& detWithState : compDets) {
1188  const auto& det = detWithState.first;
1189 
1190  // loop on compatible rechits and check energy in a fixed size cone around the extrapolation point
1191 
1192  edm::LogVerbatim("MtdTracksValidation")
1193  << "MtdTracksValidation: DetId= " << det->geographicalId().rawId()
1194  << " gp= " << detWithState.second.globalPosition().x() << " " << detWithState.second.globalPosition().y()
1195  << " " << detWithState.second.globalPosition().z() << " rho= " << detWithState.second.globalPosition().perp()
1196  << " eta= " << detWithState.second.globalPosition().eta()
1197  << " phi= " << detWithState.second.globalPosition().phi();
1198 
1199  for (const auto& recHit : *btlRecHitsHandle) {
1200  BTLDetId detId = recHit.id();
1201  DetId geoId = detId.geographicalId(MTDTopologyMode::crysLayoutFromTopoMode(topology->getMTDTopologyMode()));
1202  const MTDGeomDet* thedet = geom->idToDet(geoId);
1203  if (thedet == nullptr)
1204  throw cms::Exception("MtdTracksValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
1205  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
1206  if (geoId == det->geographicalId()) {
1207  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
1208  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
1209 
1210  Local3DPoint local_point(0., 0., 0.);
1211  local_point = topo.pixelToModuleLocalPoint(local_point, detId.row(topo.nrows()), detId.column(topo.nrows()));
1212  const auto& global_point = thedet->toGlobal(local_point);
1213  edm::LogVerbatim("MtdTracksValidation")
1214  << "MtdTracksValidation: Hit id= " << detId.rawId() << " ene= " << recHit.energy()
1215  << " dr= " << reco::deltaR(global_point, detWithState.second.globalPosition());
1216  if (reco::deltaR(global_point, detWithState.second.globalPosition()) < cluDRradius_) {
1217  eneSum += recHit.energy();
1218  //extrho = detWithState.second.globalPosition().perp();
1219  //exteta = detWithState.second.globalPosition().eta();
1220  //extphi = detWithState.second.globalPosition().phi();
1221  }
1222  }
1223  }
1224  }
1225  if (eneSum > depositBTLthreshold_) {
1226  nlayers++;
1227  selvar = eneSum;
1228  isMatched = true;
1229  edm::LogVerbatim("MtdTracksValidation")
1230  << "MtdTracksValidation: BTL matched, energy= " << eneSum << " #layers= " << nlayers;
1231  }
1232  }
1233  if (inBTL) {
1234  return std::make_pair(inBTL, isMatched);
1235  }
1236 
1237  //try ETL
1238  bool inETL = false;
1239  const std::vector<const DetLayer*>& layersETL = layerGeo->allETLLayers();
1240  for (const DetLayer* ilay : layersETL) {
1241  size_t hcount(0);
1242  const BoundDisk& disk = static_cast<const MTDSectorForwardDoubleLayer*>(ilay)->specificSurface();
1243  const double diskZ = disk.position().z();
1244  if (tsos.globalPosition().z() * diskZ < 0)
1245  continue; // only propagate to the disk that's on the same side
1246  std::pair<bool, TrajectoryStateOnSurface> comp = ilay->compatible(tsos, prop, *theEstimator);
1247  if (!comp.first)
1248  continue;
1249  if (!inETL) {
1250  inETL = true;
1251  extrho = comp.second.globalPosition().perp();
1252  exteta = comp.second.globalPosition().eta();
1253  extphi = comp.second.globalPosition().phi();
1254  }
1255  edm::LogVerbatim("MtdTracksValidation") << "MtdTracksValidation: extrapolation at ETL surface, rho= " << extrho
1256  << " eta= " << exteta << " phi= " << extphi;
1257  std::vector<DetLayer::DetWithState> compDets = ilay->compatibleDets(tsos, prop, *theEstimator);
1258  for (const auto& detWithState : compDets) {
1259  const auto& det = detWithState.first;
1260 
1261  // loop on compatible rechits and check hits in a fixed size cone around the extrapolation point
1262 
1263  edm::LogVerbatim("MtdTracksValidation")
1264  << "MtdTracksValidation: DetId= " << det->geographicalId().rawId()
1265  << " gp= " << detWithState.second.globalPosition().x() << " " << detWithState.second.globalPosition().y()
1266  << " " << detWithState.second.globalPosition().z() << " rho= " << detWithState.second.globalPosition().perp()
1267  << " eta= " << detWithState.second.globalPosition().eta()
1268  << " phi= " << detWithState.second.globalPosition().phi();
1269 
1270  for (const auto& recHit : *etlRecHitsHandle) {
1271  ETLDetId detId = recHit.id();
1272  DetId geoId = detId.geographicalId();
1273  const MTDGeomDet* thedet = geom->idToDet(geoId);
1274  if (thedet == nullptr)
1275  throw cms::Exception("MtdTracksValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
1276  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
1277  if (geoId == det->geographicalId()) {
1278  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
1279  const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
1280 
1281  Local3DPoint local_point(topo.localX(recHit.row()), topo.localY(recHit.column()), 0.);
1282  const auto& global_point = thedet->toGlobal(local_point);
1283  edm::LogVerbatim("MtdTracksValidation")
1284  << "MtdTracksValidation: Hit id= " << detId.rawId() << " time= " << recHit.time()
1285  << " dr= " << reco::deltaR(global_point, detWithState.second.globalPosition());
1286  if (reco::deltaR(global_point, detWithState.second.globalPosition()) < cluDRradius_) {
1287  hcount++;
1288  if (hcount == 1) {
1289  //extrho = detWithState.second.globalPosition().perp();
1290  //exteta = detWithState.second.globalPosition().eta();
1291  //extphi = detWithState.second.globalPosition().phi();
1292  }
1293  }
1294  }
1295  }
1296  }
1297  if (hcount > 0) {
1298  nlayers++;
1299  selvar = (float)hcount;
1300  isMatched = true;
1301  edm::LogVerbatim("MtdTracksValidation")
1302  << "MtdTracksValidation: ETL matched, counts= " << hcount << " #layers= " << nlayers;
1303  }
1304  }
1305 
1306  if (!inBTL && !inETL) {
1307  edm::LogVerbatim("MtdTracksValidation")
1308  << "MtdTracksValidation: track not extrapolating to MTD: pt= " << track.pt() << " eta= " << track.eta()
1309  << " phi= " << track.phi() << " vz= " << track.vz()
1310  << " vxy= " << std::sqrt(track.vx() * track.vx() + track.vy() * track.vy());
1311  }
1312  return std::make_pair(inETL, isMatched);
1313 }
1314 
1315 // ------------ method for histogram booking ------------
1317  ibook.setCurrentFolder(folder_);
1318 
1319  // histogram booking
1320  meBTLTrackRPTime_ = ibook.book1D("TrackBTLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3);
1321  meBTLTrackEtaTot_ = ibook.book1D("TrackBTLEtaTot", "Eta of tracks (Tot);#eta_{RECO}", 30, 0., 1.5);
1322  meBTLTrackPhiTot_ = ibook.book1D("TrackBTLPhiTot", "Phi of tracks (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2);
1323  meBTLTrackPtTot_ = ibook.book1D("TrackBTLPtTot", "Pt of tracks (Tot);pt_{RECO} [GeV]", 50, 0, 10);
1324  meBTLTrackEtaMtd_ = ibook.book1D("TrackBTLEtaMtd", "Eta of tracks (Mtd);#eta_{RECO}", 30, 0., 1.5);
1325  meBTLTrackPhiMtd_ = ibook.book1D("TrackBTLPhiMtd", "Phi of tracks (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2);
1326  meBTLTrackPtMtd_ = ibook.book1D("TrackBTLPtMtd", "Pt of tracks (Mtd);pt_{RECO} [GeV]", 50, 0, 10);
1328  ibook.book1D("TrackBTLPtRes", "Track pT resolution ;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
1329  meETLTrackRPTime_ = ibook.book1D("TrackETLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3);
1330  meETLTrackEtaTot_ = ibook.book1D("TrackETLEtaTot", "Eta of tracks (Tot);#eta_{RECO}", 30, 1.5, 3.0);
1331  meETLTrackPhiTot_ = ibook.book1D("TrackETLPhiTot", "Phi of tracks (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2);
1332  meETLTrackPhiTot_ = ibook.book1D("TrackETLPhiTot", "Phi of tracks (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2);
1333  meETLTrackPtTot_ = ibook.book1D("TrackETLPtTot", "Pt of tracks (Tot);pt_{RECO} [GeV]", 50, 0, 10);
1334 
1336  ibook.book1D("TrackETLEtaTotLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Tot);#eta_{RECO}", 30, 1.5, 3.0);
1338  ibook.book1D("TrackETLEtaTotLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Tot);#eta_{RECO}", 30, 1.5, 3.0);
1339 
1340  meETLTrackEtaMtd_ = ibook.book1D("TrackETLEtaMtd", "Eta of tracks (Mtd);#eta_{RECO}", 30, 1.5, 3.0);
1342  ibook.book1D("TrackETLEtaMtdLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Mtd);#eta_{RECO}", 30, 1.5, 3.0);
1344  ibook.book1D("TrackETLEtaMtdLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Mtd);#eta_{RECO}", 30, 1.5, 3.0);
1346  ibook.book1D("TrackETLEta2MtdLowPt0", "Eta of tracks, 0.2 < pt < 0.45 (Mtd 2 hit);#eta_{RECO}", 30, 1.5, 3.0);
1348  ibook.book1D("TrackETLEta2MtdLowPt1", "Eta of tracks, 0.45 < pt < 0.7 (Mtd 2 hit);#eta_{RECO}", 30, 1.5, 3.0);
1349 
1350  meETLTrackPhiMtd_ = ibook.book1D("TrackETLPhiMtd", "Phi of tracks (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2);
1351  meETLTrackPtMtd_ = ibook.book1D("TrackETLPtMtd", "Pt of tracks (Mtd);pt_{RECO} [GeV]", 50, 0, 10);
1352  meETLTrackEta2Mtd_ = ibook.book1D("TrackETLEta2Mtd", "Eta of tracks (Mtd 2 hit);#eta_{RECO}", 30, 1.5, 3.0);
1353  meETLTrackPhi2Mtd_ = ibook.book1D("TrackETLPhi2Mtd", "Phi of tracks (Mtd 2 hit);#phi_{RECO} [rad]", 100, -3.2, 3.2);
1354  meETLTrackPt2Mtd_ = ibook.book1D("TrackETLPt2Mtd", "Pt of tracks (Mtd 2 hit);pt_{RECO} [GeV]", 50, 0, 10);
1355 
1357  ibook.book1D("TrackETLPtRes", "Track pT resolution;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
1358 
1359  meTracktmtd_ = ibook.book1D("Tracktmtd", "Track time from TrackExtenderWithMTD;tmtd [ns]", 150, 1, 16);
1360  meTrackt0Src_ = ibook.book1D("Trackt0Src", "Track time from TrackExtenderWithMTD;t0Src [ns]", 100, -1.5, 1.5);
1362  ibook.book1D("TrackSigmat0Src", "Time Error from TrackExtenderWithMTD; #sigma_{t0Src} [ns]", 100, 0, 0.1);
1363 
1364  meTrackt0Pid_ = ibook.book1D("Trackt0Pid", "Track t0 as stored in TofPid;t0 [ns]", 100, -1, 1);
1365  meTrackSigmat0Pid_ = ibook.book1D("TrackSigmat0Pid", "Sigmat0 as stored in TofPid; #sigma_{t0} [ns]", 100, 0, 0.1);
1366  meTrackt0SafePid_ = ibook.book1D("Trackt0SafePID", "Track t0 Safe as stored in TofPid;t0 [ns]", 100, -1, 1);
1368  "TrackSigmat0SafePID", "Log10(Sigmat0 Safe) as stored in TofPid; Log10(#sigma_{t0} [ns])", 80, -3, 1);
1369  meTrackNumHits_ = ibook.book1D("TrackNumHits", "Number of valid MTD hits per track ; Number of hits", 10, -5, 5);
1370  meTrackNumHitsNT_ = ibook.book1D(
1371  "TrackNumHitsNT", "Number of valid MTD hits per track no time associated; Number of hits", 10, -5, 5);
1372  meTrackMVAQual_ = ibook.book1D("TrackMVAQual", "Track MVA Quality as stored in Value Map ; MVAQual", 100, -1, 1);
1374  "TrackPathLenghtvsEta", "MTD Track pathlength vs MTD track Eta;|#eta|;Pathlength", 100, 0, 3.2, 100.0, 400.0, "S");
1375 
1376  meTrackOutermostHitR_ = ibook.book1D("TrackOutermostHitR", "Track outermost hit position R; R[cm]", 40, 0, 120.);
1377  meTrackOutermostHitZ_ = ibook.book1D("TrackOutermostHitZ", "Track outermost hit position Z; z[cm]", 100, 0, 300.);
1378 
1379  meTrackSigmaTof_[0] =
1380  ibook.book1D("TrackSigmaTof_Pion", "Sigma(TOF) for pion hypothesis; #sigma_{t0} [ps]", 10, 0, 5);
1381  meTrackSigmaTof_[1] =
1382  ibook.book1D("TrackSigmaTof_Kaon", "Sigma(TOF) for kaon hypothesis; #sigma_{t0} [ps]", 25, 0, 25);
1383  meTrackSigmaTof_[2] =
1384  ibook.book1D("TrackSigmaTof_Proton", "Sigma(TOF) for proton hypothesis; #sigma_{t0} [ps]", 50, 0, 50);
1385 
1386  meTrackSigmaTofvsP_[0] = ibook.bookProfile("TrackSigmaTofvsP_Pion",
1387  "Sigma(TOF) for pion hypothesis vs p; p [GeV]; #sigma_{t0} [ps]",
1388  20,
1389  0,
1390  10.,
1391  0,
1392  50.,
1393  "S");
1394  meTrackSigmaTofvsP_[1] = ibook.bookProfile("TrackSigmaTofvsP_Kaon",
1395  "Sigma(TOF) for kaon hypothesis vs p; p [GeV]; #sigma_{t0} [ps]",
1396  20,
1397  0,
1398  10.,
1399  0,
1400  50.,
1401  "S");
1402  meTrackSigmaTofvsP_[2] = ibook.bookProfile("TrackSigmaTofvsP_Proton",
1403  "Sigma(TOF) for proton hypothesis vs p; p [GeV]; #sigma_{t0} [ps]",
1404  20,
1405  0,
1406  10.,
1407  0,
1408  50.,
1409  "S");
1410 
1411  meExtraPtMtd_ =
1412  ibook.book1D("ExtraPtMtd", "Pt of tracks associated to LV extrapolated to hits; track pt [GeV] ", 110, 0., 11.);
1413  meExtraPtEtl2Mtd_ = ibook.book1D("ExtraPtEtl2Mtd",
1414  "Pt of tracks associated to LV extrapolated to hits, 2 ETL layers; track pt [GeV] ",
1415  110,
1416  0.,
1417  11.);
1418  meExtraEtaMtd_ =
1419  ibook.book1D("ExtraEtaMtd", "Eta of tracks associated to LV extrapolated to hits; track eta ", 66, 0., 3.3);
1420  meExtraEtaEtl2Mtd_ = ibook.book1D(
1421  "ExtraEtaEtl2Mtd", "Eta of tracks associated to LV extrapolated to hits, 2 ETL layers; track eta ", 66, 0., 3.3);
1423  ibook.book1D("MatchedTPEtaTotLV", "Eta of tracks associated to LV matched to TP; track eta ", 66, 0., 3.3);
1425  ibook.book1D("MatchedTPPtTotLV", "Pt of tracks associated to LV matched to TP; track pt [GeV] ", 110, 0., 11.);
1426 
1428  ibook.book1D("BTLTrackMatchedTPEtaTot", "Eta of tracks matched to TP; track eta ", 30, 0., 1.5);
1430  ibook.book1D("BTLTrackMatchedTPEtaMtd", "Eta of tracks matched to TP with time; track eta ", 30, 0., 1.5);
1432  ibook.book1D("BTLTrackMatchedTPPtTot", "Pt of tracks matched to TP; track pt [GeV] ", 50, 0., 10.);
1434  ibook.book1D("BTLTrackMatchedTPPtMtd", "Pt of tracks matched to TP with time; track pt [GeV] ", 50, 0., 10.);
1436  ibook.book1D("ETLTrackMatchedTPEtaTot", "Eta of tracks matched to TP; track eta ", 30, 1.5, 3.0);
1438  "ETLTrackMatchedTPEtaMtd", "Eta of tracks matched to TP with time (>=1 ETL hit); track eta ", 30, 1.5, 3.0);
1440  "ETLTrackMatchedTPEta2Mtd", "Eta of tracks matched to TP with time (2 ETL hits); track eta ", 30, 1.5, 3.0);
1442  ibook.book1D("ETLTrackMatchedTPPtTot", "Pt of tracks matched to TP; track pt [GeV] ", 50, 0., 10.);
1444  "ETLTrackMatchedTPPtMtd", "Pt of tracks matched to TP with time (>=1 ETL hit); track pt [GeV] ", 50, 0., 10.);
1446  "ETLTrackMatchedTPPt2Mtd", "Pt of tracks matched to TP with time (2 ETL hits); track pt [GeV] ", 50, 0., 10.);
1447 
1448  if (optionalPlots_) {
1450  "TrackMatchedTPBTLPtResMtd",
1451  "Pt resolution of tracks matched to TP-BTL hit ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ",
1452  100,
1453  0.,
1454  4.);
1456  "TrackMatchedTPETLPtResMtd",
1457  "Pt resolution of tracks matched to TP-ETL hit ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ",
1458  100,
1459  0.,
1460  4.);
1462  "TrackMatchedTPETL2PtResMtd",
1463  "Pt resolution of tracks matched to TP-ETL 2hits ;|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ",
1464  100,
1465  0.,
1466  4.);
1468  "TrackMatchedTPBTLPtRatioGen", "Pt ratio of Gentracks (BTL) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1);
1470  "TrackMatchedTPETLPtRatioGen", "Pt ratio of Gentracks (ETL 1hit) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1);
1472  "TrackMatchedTPETL2PtRatioGen", "Pt ratio of Gentracks (ETL 2hits) ;pT_{Gentrack}/pT_{truth} ", 100, 0.9, 1.1);
1474  ibook.book1D("TrackMatchedTPBTLPtRatioMtd",
1475  "Pt ratio of tracks matched to TP-BTL hit ;pT_{MTDtrack}/pT_{truth} ",
1476  100,
1477  0.9,
1478  1.1);
1480  ibook.book1D("TrackMatchedTPETLPtRatioMtd",
1481  "Pt ratio of tracks matched to TP-ETL hit ;pT_{MTDtrack}/pT_{truth} ",
1482  100,
1483  0.9,
1484  1.1);
1486  ibook.book1D("TrackMatchedTPETL2PtRatioMtd",
1487  "Pt ratio of tracks matched to TP-ETL 2hits ;pT_{MTDtrack}/pT_{truth} ",
1488  100,
1489  0.9,
1490  1.1);
1492  ibook.bookProfile("TrackMatchedTPBTLPtResvsPtMtd",
1493  "Pt resolution of tracks matched to TP-BTL hit vs Pt;pT_{truth} "
1494  "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ",
1495  20,
1496  0.7,
1497  10.,
1498  0.,
1499  4.,
1500  "s");
1502  ibook.bookProfile("TrackMatchedTPETLPtResvsPtMtd",
1503  "Pt resolution of tracks matched to TP-ETL hit vs Pt;pT_{truth} "
1504  "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ",
1505  20,
1506  0.7,
1507  10.,
1508  0.,
1509  4.,
1510  "s");
1512  ibook.bookProfile("TrackMatchedTPETL2PtResvsPtMtd",
1513  "Pt resolution of tracks matched to TP-ETL 2hits Pt pT;pT_{truth} "
1514  "[GeV];|pT_{MTDtrack}-pT_{truth}|/|pT_{Gentrack}-pT_{truth}| ",
1515  20,
1516  0.7,
1517  10.,
1518  0.,
1519  4.,
1520  "s");
1522  "TrackMatchedTPBTLDPtvsPtGen",
1523  "Pt relative difference of Gentracks (BTL) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ",
1524  20,
1525  0.7,
1526  10.,
1527  -0.1,
1528  0.1,
1529  "s");
1531  "TrackMatchedTPETLDPtvsPtGen",
1532  "Pt relative difference of Gentracks (ETL 1hit) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ",
1533  20,
1534  0.7,
1535  10.,
1536  -0.1,
1537  0.1,
1538  "s");
1540  "TrackMatchedTPETL2DPtvsPtGen",
1541  "Pt relative difference of Gentracks (ETL 2hits) vs Pt;pT_{truth} [GeV];pT_{Gentrack}-pT_{truth}/pT_{truth} ",
1542  20,
1543  0.7,
1544  10.,
1545  -0.1,
1546  0.1,
1547  "s");
1548  meBTLTrackMatchedTPDPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPBTLDPtvsPtMtd",
1549  "Pt relative difference of tracks matched to TP-BTL hits vs "
1550  "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ",
1551  20,
1552  0.7,
1553  10.,
1554  -0.1,
1555  0.1,
1556  "s");
1557  meETLTrackMatchedTPDPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPETLDPtvsPtMtd",
1558  "Pt relative difference of tracks matched to TP-ETL hits vs "
1559  "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ",
1560  20,
1561  0.7,
1562  10.,
1563  -0.1,
1564  0.1,
1565  "s");
1566  meETLTrackMatchedTP2DPtvsPtMtd_ = ibook.bookProfile("TrackMatchedTPETL2DPtvsPtMtd",
1567  "Pt relative difference of tracks matched to TP-ETL 2hits vs "
1568  "Pt;pT_{truth} [GeV];pT_{MTDtrack}-pT_{truth}/pT_{truth} ",
1569  20,
1570  0.7,
1571  10.,
1572  -0.1,
1573  0.1,
1574  "s");
1575  } // end optional plots
1576 
1577  meTrackResTot_ = ibook.book1D(
1578  "TrackRes", "t_{rec} - t_{sim} for LV associated tracks matched to TP; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15);
1579  meTrackPullTot_ = ibook.book1D(
1580  "TrackPull", "Pull for LV associated tracks matched to TP; (t_{rec}-t_{sim})/#sigma_{t}", 50, -5., 5.);
1582  "TrackResvsMVA",
1583  "t_{rec} - t_{sim} for LV associated tracks matched to TP vs MVA Quality; MVAQual; t_{rec} - t_{sim} [ns] ",
1584  100,
1585  -1.,
1586  1.,
1587  -0.15,
1588  0.15,
1589  "s");
1591  "TrackPullvsMVA",
1592  "Pull for LV associated tracks matched to TP vs MVA Quality; MVAQual; (t_{rec}-t_{sim})/#sigma_{t}",
1593  100,
1594  -1.,
1595  1.,
1596  -5.,
1597  5.,
1598  "s");
1599 
1600  meExtraPhiAtBTL_ = ibook.book1D(
1601  "ExtraPhiAtBTL", "Phi at BTL surface of extrapolated tracks associated to LV; phi [deg]", 720, -180., 180.);
1603  ibook.book1D("ExtraPhiAtBTLmatched",
1604  "Phi at BTL surface of extrapolated tracks associated to LV matched with BTL hits; phi [deg]",
1605  720,
1606  -180.,
1607  180.);
1609  ibook.book1D("ExtraBTLeneInCone",
1610  "BTL reconstructed energy in cone arounnd extrapolated track associated to LV; E [MeV]",
1611  100,
1612  0.,
1613  50.);
1615  ibook.book1D("ExtraMTDfailExtenderEta",
1616  "Eta of tracks associated to LV extrapolated to MTD with no track extender match to hits; track eta",
1617  66,
1618  0.,
1619  3.3);
1620  ;
1622  "ExtraMTDfailExtenderPt",
1623  "Pt of tracks associated to LV extrapolated to MTD with no track extender match to hits; track pt [GeV] ",
1624  110,
1625  0.,
1626  11.);
1627 
1628  // Book the histograms for track-hit matching based on MC truth
1630  ibook.book1D("BTLTrackMatchedTPmtdDirectEta",
1631  "Eta of tracks matched to TP with sim hit in MTD (direct);#eta_{RECO}",
1632  30,
1633  0.,
1634  1.5);
1636  ibook.book1D("BTLTrackMatchedTPmtdDirectPt",
1637  "Pt of tracks matched to TP with sim hit in MTD (direct); track pt [GeV]",
1638  50,
1639  0.,
1640  10.);
1641 
1642  meBTLTrackMatchedTPmtdOtherEta_ = ibook.book1D("BTLTrackMatchedTPmtdOtherEta",
1643  "Eta of tracks matched to TP with sim hit in MTD (other);#eta_{RECO}",
1644  30,
1645  0.,
1646  1.5);
1648  ibook.book1D("BTLTrackMatchedTPmtdOtherPt",
1649  "Pt of tracks matched to TP with sim hit in MTD (other); track pt [GeV]",
1650  50,
1651  0.,
1652  10.);
1653 
1655  "BTLTrackMatchedTPnomtdEta", "Eta of tracks matched to TP w/o sim hit in MTD;#eta_{RECO}", 30, 0., 1.5);
1657  "BTLTrackMatchedTPnomtdPt", "Pt of tracks matched to TP w/o sim hit in MTD; track pt [GeV]", 50, 0., 10.);
1658 
1660  "BTLTrackMatchedTPmtdDirectCorrectAssocEta",
1661  "Eta of tracks matched to TP with sim hit in MTD (direct), correct track-MTD association;#eta_{RECO}",
1662  30,
1663  0.,
1664  1.5);
1666  "BTLTrackMatchedTPmtdDirectCorrectAssocPt",
1667  "Pt of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association;track pt [GeV]",
1668  50,
1669  0.,
1670  10.);
1672  "BTLTrackMatchedTPmtdDirectCorrectAssocMVAQual",
1673  "MVA of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association; MVA score",
1674  100,
1675  -1.,
1676  1.);
1678  ibook.book1D("BTLTrackMatchedTPmtdDirectCorrectAssocTimeRes",
1679  "Time resolution of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD "
1680  "association; t_{rec} - t_{sim} [ns] ",
1681  120,
1682  -0.15,
1683  0.15);
1685  ibook.book1D("BTLTrackMatchedTPmtdDirectCorrectAssocTimePull",
1686  "Time pull of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association; "
1687  "(t_{rec}-t_{sim})/#sigma_{t}",
1688  50,
1689  -5.,
1690  5.);
1691 
1693  ibook.book1D("BTLTrackMatchedTPmtdDirectWrongAssocEta",
1694  "Eta of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association;#eta_{RECO}",
1695  30,
1696  0.,
1697  1.5);
1699  "BTLTrackMatchedTPmtdDirectWrongAssocPt",
1700  "Pt of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association;track pt [GeV]",
1701  50,
1702  0.,
1703  10.);
1705  ibook.book1D("BTLTrackMatchedTPmtdDirectWrongAssocMVAQual",
1706  "MVA of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association; MVA score",
1707  100,
1708  -1.,
1709  1.);
1711  ibook.book1D("BTLTrackMatchedTPmtdDirectWrongAssocTimeRes",
1712  "Time resolution of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD "
1713  "association; t_{rec} - t_{sim} [ns] ",
1714  120,
1715  -0.15,
1716  0.15);
1718  ibook.book1D("BTLTrackMatchedTPmtdDirectWrongAssocTimePull",
1719  "Time pull of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association; "
1720  "(t_{rec}-t_{sim})/#sigma_{t}",
1721  50,
1722  -5.,
1723  5.);
1724 
1726  ibook.book1D("BTLTrackMatchedTPmtdDirectNoAssocEta",
1727  "Eta of tracks matched to TP with sim hit in MTD (direct) - no track-MTD association;#eta_{RECO}",
1728  30,
1729  0.,
1730  1.5);
1732  ibook.book1D("BTLTrackMatchedTPmtdDirectNoAssocPt",
1733  "Pt of tracks matched to TP with sim hit in MTD (direct) - no track-MTD association;track pt [GeV]",
1734  50,
1735  0.,
1736  10.);
1737 
1739  "BTLTrackMatchedTPmtdOtherCorrectAssocEta",
1740  "Eta of tracks matched to TP with sim hit in MTD (direct), correct track-MTD association;#eta_{RECO}",
1741  30,
1742  0.,
1743  1.5);
1745  "BTLTrackMatchedTPmtdOtherCorrectAssocPt",
1746  "Pt of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association;track pt [GeV]",
1747  50,
1748  0.,
1749  10.);
1751  "BTLTrackMatchedTPmtdOtherCorrectAssocMVAQual",
1752  "MVA of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association; MVA score",
1753  100,
1754  -1.,
1755  1.);
1757  ibook.book1D("BTLTrackMatchedTPmtdOtherCorrectAssocTimeRes",
1758  "Time resolution of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD "
1759  "association; t_{rec} - t_{sim} [ns] ",
1760  120,
1761  -0.15,
1762  0.15);
1764  ibook.book1D("BTLTrackMatchedTPmtdOtherCorrectAssocTimePull",
1765  "Time pull of tracks matched to TP with sim hit in MTD (direct) - correct track-MTD association; "
1766  "(t_{rec}-t_{sim})/#sigma_{t}",
1767  50,
1768  -5.,
1769  5.);
1770 
1772  ibook.book1D("BTLTrackMatchedTPmtdOtherWrongAssocEta",
1773  "Eta of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association;#eta_{RECO}",
1774  30,
1775  0.,
1776  1.5);
1778  "BTLTrackMatchedTPmtdOtherWrongAssocPt",
1779  "Pt of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association;track pt [GeV]",
1780  50,
1781  0.,
1782  10.);
1784  ibook.book1D("BTLTrackMatchedTPmtdOtherWrongAssocMVAQual",
1785  "MVA of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association; MVA score",
1786  100,
1787  -1.,
1788  1.);
1790  ibook.book1D("BTLTrackMatchedTPmtdOtherWrongAssocTimeRes",
1791  "Time resolution of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD "
1792  "association; t_{rec} - t_{sim} [ns] ",
1793  120,
1794  -0.15,
1795  0.15);
1797  ibook.book1D("BTLTrackMatchedTPmtdOtherWrongAssocTimePull",
1798  "Time pull of tracks matched to TP with sim hit in MTD (direct) - wrong track-MTD association; "
1799  "(t_{rec}-t_{sim})/#sigma_{t}",
1800  50,
1801  -5.,
1802  5.);
1803 
1805  ibook.book1D("BTLTrackMatchedTPmtdOtherNoAssocEta",
1806  "Eta of tracks matched to TP with sim hit in MTD (direct) - no track-MTD association;#eta_{RECO}",
1807  30,
1808  0.,
1809  1.5);
1811  ibook.book1D("BTLTrackMatchedTPmtdOtherNoAssocPt",
1812  "Pt of tracks matched to TP with sim hit in MTD (direct) - no track-MTD association;track pt [GeV]",
1813  50,
1814  0.,
1815  10.);
1816 
1818  ibook.book1D("BTLTrackMatchedTPnomtdAssocEta",
1819  "Eta of tracks matched to TP w/o sim hit in MTD, with associated reco cluster;#eta_{RECO}",
1820  30,
1821  0.,
1822  1.5);
1824  ibook.book1D("BTLTrackMatchedTPnomtdAssocPt",
1825  "Pt of tracks matched to TP w/o sim hit in MTD, with associated reco cluster;track pt [GeV]",
1826  50,
1827  0.,
1828  10.);
1830  ibook.book1D("BTLTrackMatchedTPnomtdAssocMVAQual",
1831  "MVA of tracks matched to TP w/o sim hit in MTD, with associated reco cluster; MVA score",
1832  100,
1833  -1.,
1834  1.);
1835  meBTLTrackMatchedTPnomtdAssocTimeRes_ = ibook.book1D("BTLTrackMatchedTPnomtdAssocTimeRes",
1836  "Time resolution of tracks matched to TP w/o sim hit in MTD, "
1837  "with associated reco cluster; t_{rec} - t_{sim} [ns] ",
1838  120,
1839  -0.15,
1840  0.15);
1841  meBTLTrackMatchedTPnomtdAssocTimePull_ = ibook.book1D("BTLTrackMatchedTPnomtdAssocTimePull",
1842  "Time pull of tracks matched to TP w/o sim hit in MTD, with "
1843  "associated reco cluster; (t_{rec}-t_{sim})/#sigma_{t}",
1844  50,
1845  -5.,
1846  5.);
1847 
1848  meETLTrackMatchedTPmtd1Eta_ = ibook.book1D("ETLTrackMatchedTPmtd1Eta",
1849  "Eta of tracks matched to TP with sim hit in MTD (>= 1 hit);#eta_{RECO}",
1850  30,
1851  1.5,
1852  3.0);
1853  meETLTrackMatchedTPmtd1Pt_ = ibook.book1D("ETLTrackMatchedTPmtd1Pt",
1854  "Pt of tracks matched to TP with sim hit in MTD (>= 1 hit); track pt [GeV]",
1855  50,
1856  0.,
1857  10.);
1858 
1860  "ETLTrackMatchedTPmtd2Eta", "Eta of tracks matched to TP with sim hit in MTD (2 hits);#eta_{RECO}", 30, 1.5, 3.0);
1862  "ETLTrackMatchedTPmtd2Pt", "Pt of tracks matched to TP with sim hit in MTD (2 hits); track pt [GeV]", 50, 0., 10.);
1863 
1865  "ETLTrackMatchedTPnomtdEta", "Eta of tracks matched to TP w/o sim hit in MTD;#eta_{RECO}", 30, 1.5, 3.0);
1867  "ETLTrackMatchedTPnomtdPt", "Pt of tracks matched to TP w/o sim hit in MTD; track pt [GeV]", 50, 0., 10.);
1868 
1870  "ETLTrackMatchedTPmtd1CorrectAssocEta",
1871  "Eta of tracks matched to TP with sim hit in MTD (>= 1 hit), correct track-MTD association;#eta_{RECO}",
1872  30,
1873  1.5,
1874  3.0);
1876  "ETLTrackMatchedTPmtd1CorrectAssocPt",
1877  "Pt of tracks matched to TP with sim hit in MTD (>= 1 hit) - correct track-MTD association;track pt [GeV]",
1878  50,
1879  0.,
1880  10.);
1882  "ETLTrackMatchedTPmtd1CorrectAssocMVAQual",
1883  "MVA of tracks matched to TP with sim hit in MTD (>= 1 hit) - correct track-MTD association; MVA score",
1884  100,
1885  -1.,
1886  1.);
1888  ibook.book1D("ETLTrackMatchedTPmtd1CorrectAssocTimeRes",
1889  "Time resolution of tracks matched to TP with sim hit in MTD (>= 1 hit) - correct track-MTD "
1890  "association; t_{rec} - t_{sim} [ns] ",
1891  120,
1892  -0.15,
1893  0.15);
1895  ibook.book1D("ETLTrackMatchedTPmtd1CorrectAssocTimePull",
1896  "Time pull of tracks matched to TP with sim hit in MTD (>= 1 hit) - correct track-MTD association; "
1897  "(t_{rec}-t_{sim})/#sigma_{t}",
1898  50,
1899  -5.,
1900  5.);
1901 
1903  "ETLTrackMatchedTPmtd2CorrectAssocEta",
1904  "Eta of tracks matched to TP with sim hit in MTD (2 hits), correct track-MTD association;#eta_{RECO}",
1905  30,
1906  1.5,
1907  3.0);
1909  "ETLTrackMatchedTPmtd2CorrectAssocPt",
1910  "Pt of tracks matched to TP with sim hit in MTD (2 hits) - correct track-MTD association;track pt [GeV]",
1911  50,
1912  0.,
1913  10.);
1915  "ETLTrackMatchedTPmtd2CorrectAssocMVAQual",
1916  "MVA of tracks matched to TP with sim hit in MTD (2 hits) - correct track-MTD association; MVA score",
1917  100,
1918  -1.,
1919  1.);
1921  ibook.book1D("ETLTrackMatchedTPmtd2CorrectAssocTimeRes",
1922  "Time resolution of tracks matched to TP with sim hit in MTD (2 hits) - correct track-MTD "
1923  "association; t_{rec} - t_{sim} [ns] ",
1924  120,
1925  -0.15,
1926  0.15);
1928  ibook.book1D("ETLTrackMatchedTPmtd2CorrectAssocTimePull",
1929  "Time pull of tracks matched to TP with sim hit in MTD (2 hits) - correct track-MTD association; "
1930  "(t_{rec}-t_{sim})/#sigma_{t}",
1931  50,
1932  -5.,
1933  5.);
1934 
1936  "ETLTrackMatchedTPmtd1WrongAssocEta",
1937  "Eta of tracks matched to TP with sim hit in MTD (>= 1 hit), wrong track-MTD association;#eta_{RECO}",
1938  30,
1939  1.5,
1940  3.0);
1942  "ETLTrackMatchedTPmtd1WrongAssocPt",
1943  "Pt of tracks matched to TP with sim hit in MTD (>= 1 hit) - wrong track-MTD association;track pt [GeV]",
1944  50,
1945  0.,
1946  10.);
1948  "ETLTrackMatchedTPmtd1WrongAssocMVAQual",
1949  "MVA of tracks matched to TP with sim hit in MTD (>= 1 hit) - wrong track-MTD association; MVA score",
1950  100,
1951  -1.,
1952  1.);
1954  ibook.book1D("ETLTrackMatchedTPmtd1WrongAssocTimeRes",
1955  "Time resolution of tracks matched to TP with sim hit in MTD (>= 1 hit) - wrong track-MTD "
1956  "association; t_{rec} - t_{sim} [ns] ",
1957  120,
1958  -0.15,
1959  0.15);
1961  ibook.book1D("ETLTrackMatchedTPmtd1WrongAssocTimePull",
1962  "Time pull of tracks matched to TP with sim hit in MTD (>= 1 hit) - wrong track-MTD association; "
1963  "(t_{rec}-t_{sim})/#sigma_{t}",
1964  50,
1965  -5.,
1966  5.);
1967 
1969  ibook.book1D("ETLTrackMatchedTPmtd2WrongAssocEta",
1970  "Eta of tracks matched to TP with sim hit in MTD (2 hits), wrong track-MTD association;#eta_{RECO}",
1971  30,
1972  1.5,
1973  3.0);
1975  "ETLTrackMatchedTPmtd2WrongAssocPt",
1976  "Pt of tracks matched to TP with sim hit in MTD (2 hits) - wrong track-MTD association;track pt [GeV]",
1977  50,
1978  0.,
1979  10.);
1981  ibook.book1D("ETLTrackMatchedTPmtd2WrongAssocMVAQual",
1982  "MVA of tracks matched to TP with sim hit in MTD (2 hits) - wrong track-MTD association; MVA score",
1983  100,
1984  -1.,
1985  1.);
1987  ibook.book1D("ETLTrackMatchedTPmtd2WrongAssocTimeRes",
1988  "Time resolution of tracks matched to TP with sim hit in MTD (2 hits) - wrong track-MTD "
1989  "association; t_{rec} - t_{sim} [ns] ",
1990  120,
1991  -0.15,
1992  0.15);
1994  ibook.book1D("ETLTrackMatchedTPmtd2WrongAssocTimePull",
1995  "Time pull of tracks matched to TP with sim hit in MTD (2 hits) - wrong track-MTD association; "
1996  "(t_{rec}-t_{sim})/#sigma_{t}",
1997  50,
1998  -5.,
1999  5.);
2000 
2002  "ETLTrackMatchedTPmtd1NoAssocEta",
2003  "Eta of tracks matched to TP with sim hit in MTD (>= 1 hit), missing track-MTD association;#eta_{RECO}",
2004  30,
2005  1.5,
2006  3.0);
2008  "ETLTrackMatchedTPmtd1NoAssocPt",
2009  "Pt of tracks matched to TP with sim hit in MTD (>= 1 hit) - missing track-MTD association;track pt [GeV]",
2010  50,
2011  0.,
2012  10.);
2013 
2015  "ETLTrackMatchedTPmtd2NoAssocEta",
2016  "Eta of tracks matched to TP with sim hit in MTD (2 hits), missing track-MTD association;#eta_{RECO}",
2017  30,
2018  1.5,
2019  3.0);
2021  "ETLTrackMatchedTPmtd2NoAssocPt",
2022  "Pt of tracks matched to TP with sim hit in MTD (2 hits) - missing track-MTD association;track pt [GeV]",
2023  50,
2024  0.,
2025  10.);
2027  ibook.book1D("ETLTrackMatchedTPnomtdAssocEta",
2028  "Eta of tracks matched to TP w/o sim hit in MTD, with associated reco cluster;#eta_{RECO}",
2029  30,
2030  1.5,
2031  3.0);
2033  ibook.book1D("ETLTrackMatchedTPnomtdAssocPt",
2034  "Pt of tracks matched to TP w/o sim hit in MTD, with associated reco cluster;track pt [GeV]",
2035  50,
2036  0.,
2037  10.);
2039  ibook.book1D("ETLTrackMatchedTPnomtdAssocMVAQual",
2040  "MVA of tracks matched to TP w/o sim hit in MTD, with associated reco cluster; MVA score",
2041  100,
2042  -1.,
2043  1.);
2044  meETLTrackMatchedTPnomtdAssocTimeRes_ = ibook.book1D("ETLTrackMatchedTPnomtdAssocTimeRes",
2045  "Time resolution of tracks matched to TP w/o sim hit in MTD, "
2046  "with associated reco cluster; t_{rec} - t_{sim} [ns] ",
2047  120,
2048  -0.15,
2049  0.15);
2050  meETLTrackMatchedTPnomtdAssocTimePull_ = ibook.book1D("ETLTrackMatchedTPnomtdAssocTimePull",
2051  "Time pull of tracks matched to TP w/o sim hit in MTD, with "
2052  "associated reco cluster; (t_{rec}-t_{sim})/#sigma_{t}",
2053  50,
2054  -5.,
2055  5.);
2056 }
2057 
2058 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
2059 
2062 
2063  desc.add<std::string>("folder", "MTD/Tracks");
2064  desc.add<bool>("optionalPlots", false);
2065  desc.add<edm::InputTag>("inputTagG", edm::InputTag("generalTracks"));
2066  desc.add<edm::InputTag>("inputTagT", edm::InputTag("trackExtenderWithMTD"));
2067  desc.add<edm::InputTag>("inputTagV", edm::InputTag("offlinePrimaryVertices4D"));
2068  desc.add<edm::InputTag>("inputTagH", edm::InputTag("generatorSmeared"));
2069  desc.add<edm::InputTag>("SimTag", edm::InputTag("mix", "MergedTrackTruth"));
2070  desc.add<edm::InputTag>("TPtoRecoTrackAssoc", edm::InputTag("trackingParticleRecoTrackAsssociation"));
2071  desc.add<edm::InputTag>("tp2SimAssociationMapTag", edm::InputTag("mtdSimLayerClusterToTPAssociation"));
2072  desc.add<edm::InputTag>("r2sAssociationMapTag", edm::InputTag("mtdRecoClusterToSimLayerClusterAssociation"));
2073  desc.add<edm::InputTag>("btlRecHits", edm::InputTag("mtdRecHits", "FTLBarrel"));
2074  desc.add<edm::InputTag>("etlRecHits", edm::InputTag("mtdRecHits", "FTLEndcap"));
2075  desc.add<edm::InputTag>("recCluTagBTL", edm::InputTag("mtdClusters", "FTLBarrel"));
2076  desc.add<edm::InputTag>("recCluTagETL", edm::InputTag("mtdClusters", "FTLEndcap"));
2077  desc.add<edm::InputTag>("tmtd", edm::InputTag("trackExtenderWithMTD:generalTracktmtd"));
2078  desc.add<edm::InputTag>("sigmatmtd", edm::InputTag("trackExtenderWithMTD:generalTracksigmatmtd"));
2079  desc.add<edm::InputTag>("t0Src", edm::InputTag("trackExtenderWithMTD:generalTrackt0"));
2080  desc.add<edm::InputTag>("sigmat0Src", edm::InputTag("trackExtenderWithMTD:generalTracksigmat0"));
2081  desc.add<edm::InputTag>("trackAssocSrc", edm::InputTag("trackExtenderWithMTD:generalTrackassoc"))
2082  ->setComment("Association between General and MTD Extended tracks");
2083  desc.add<edm::InputTag>("pathLengthSrc", edm::InputTag("trackExtenderWithMTD:generalTrackPathLength"));
2084  desc.add<edm::InputTag>("t0SafePID", edm::InputTag("tofPID:t0safe"));
2085  desc.add<edm::InputTag>("sigmat0SafePID", edm::InputTag("tofPID:sigmat0safe"));
2086  desc.add<edm::InputTag>("sigmat0PID", edm::InputTag("tofPID:sigmat0"));
2087  desc.add<edm::InputTag>("t0PID", edm::InputTag("tofPID:t0"));
2088  desc.add<edm::InputTag>("sigmaTofPi", edm::InputTag("trackExtenderWithMTD:generalTrackSigmaTofPi"));
2089  desc.add<edm::InputTag>("sigmaTofK", edm::InputTag("trackExtenderWithMTD:generalTrackSigmaTofK"));
2090  desc.add<edm::InputTag>("sigmaTofP", edm::InputTag("trackExtenderWithMTD:generalTrackSigmaTofP"));
2091  desc.add<edm::InputTag>("trackMVAQual", edm::InputTag("mtdTrackQualityMVA:mtdQualMVA"));
2092  desc.add<edm::InputTag>("outermostHitPositionSrc",
2093  edm::InputTag("trackExtenderWithMTD:generalTrackOutermostHitPosition"));
2094  desc.add<double>("trackMaximumPt", 12.); // [GeV]
2095  desc.add<double>("trackMaximumBtlEta", 1.5);
2096  desc.add<double>("trackMinimumEtlEta", 1.6);
2097  desc.add<double>("trackMaximumEtlEta", 3.);
2098 
2099  descriptions.add("mtdTracksValid", desc);
2100 }
2101 
2103  bool match = (tp.status() != 1) ? false : true;
2104  return match;
2105 }
2106 
2108  bool match = false;
2109 
2110  auto x_pv = tp.parentVertex()->position().x();
2111  auto y_pv = tp.parentVertex()->position().y();
2112  auto z_pv = tp.parentVertex()->position().z();
2113 
2114  auto r_pv = std::sqrt(x_pv * x_pv + y_pv * y_pv);
2115 
2116  match = tp.charge() != 0 && std::abs(tp.eta()) < etacutGEN_ && tp.pt() > pTcutBTL_ && r_pv < rBTL_ &&
2117  std::abs(z_pv) < zETL_;
2118  return match;
2119 }
2120 
2122  bool match = false;
2123  match = std::abs(trk.eta()) <= etacutREC_ && trk.pt() > pTcutBTL_;
2124  return match;
2125 }
2126 
2128  bool match = false;
2129  match = std::abs(trk.eta()) <= etacutREC_ && trk.pt() > pTcutETL_ && trk.pt() < pTcutBTL_;
2130  return match;
2131 }
2132 
2134  auto found = r2s_->find(recoTrack);
2135 
2136  // reco track not matched to any TP
2137  if (found == r2s_->end())
2138  return nullptr;
2139 
2140  //matched TP equal to any TP associated to in time events
2141  for (const auto& tp : found->val) {
2142  if (tp.first->eventId().bunchCrossing() == 0)
2143  return &tp.first;
2144  }
2145 
2146  // reco track not matched to any TP from vertex
2147  return nullptr;
2148 }
2149 
2152  MonitorElement* me3,
2153  MonitorElement* me4,
2154  MonitorElement* me5,
2155  float var1,
2156  float var2,
2157  float var3,
2158  float var4,
2159  float var5,
2160  bool flag) {
2161  me1->Fill(var1);
2162  me2->Fill(var2);
2163  if (flag) {
2164  me3->Fill(var3);
2165  me4->Fill(var4);
2166  me5->Fill(var5);
2167  }
2168 }
2169 
MonitorElement * meBTLTrackMatchedTPmtdDirectCorrectAssocTimePull_
edm::EDGetTokenT< edm::ValueMap< int > > trackAssocToken_
static constexpr double etacutGEN_
MonitorElement * meETLTrackMatchedTPmtd2CorrectAssocEta_
Log< level::Info, true > LogVerbatim
MonitorElement * meBTLTrackMatchedTPPtResMtd_
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
MonitorElement * meETLTrackPt2Mtd_
edm::EDGetTokenT< edm::ValueMap< float > > trackMVAQualToken_
MonitorElement * meETLTrackEtaTotLowPt_[2]
edm::EDGetTokenT< edm::ValueMap< float > > pathLengthToken_
MonitorElement * meBTLTrackMatchedTPmtdOtherCorrectAssocEta_
MonitorElement * meETLTrackPtTot_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
MonitorElement * meETLTrackMatchedTPPtResvsPtMtd_
MonitorElement * meTrackNumHits_
MonitorElement * meTrackt0Pid_
MonitorElement * meExtraMTDfailExtenderEta_
MonitorElement * meETLTrackEta2MtdLowPt_[2]
const std::pair< bool, bool > checkAcceptance(const reco::Track &, const edm::Event &, const edm::EventSetup &, size_t &, float &, float &, float &, float &)
MonitorElement * meETLTrackMatchedTPmtd1NoAssocTimeRes_
MonitorElement * meETLTrackMatchedTP2DPtvsPtGen_
MonitorElement * meETLTrackRPTime_
MonitorElement * meBTLTrackMatchedTPmtdOtherCorrectAssocPt_
MonitorElement * meTrackPullTotvsMVAQual_
MonitorElement * meETLTrackMatchedTP2PtResMtd_
edm::EDGetTokenT< edm::ValueMap< float > > t0SafePidToken_
std::string folder_
edm::EDGetTokenT< edm::ValueMap< float > > t0SrcToken_
edm::EDGetTokenT< FTLClusterCollection > btlRecCluToken_
static constexpr double rBTL_
MonitorElement * meETLTrackMatchedTPmtd2CorrectAssocPt_
MonitorElement * meETLTrackMatchedTP2PtRatioMtd_
MonitorElement * meETLTrackMatchedTPmtd1NoAssocEta_
edm::ESGetToken< MTDTopology, MTDTopologyRcd > mtdtopoToken_
MonitorElement * meETLTrackMatchedTPmtd2NoAssocEta_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * meETLTrackMatchedTPmtd2WrongAssocTimePull_
const std::string folder_
MonitorElement * meBTLTrackMatchedTPmtdDirectNoAssocPt_
const bool trkRecSel(const reco::TrackBase &)
T z() const
Definition: PV3DBase.h:61
MonitorElement * meBTLTrackMatchedTPEtaMtd_
MonitorElement * meETLTrackMatchedTPmtd1WrongAssocPt_
MonitorElement * meBTLTrackMatchedTPmtdDirectCorrectAssocTimeRes_
static constexpr double pTcutETL_
virtual const Topology & topology() const
Definition: GeomDet.cc:67
MonitorElement * meETLTrackMatchedTPmtd2NoAssocPt_
MonitorElement * meETLTrackMatchedTPEta2Mtd_
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > builderToken_
MonitorElement * meETLTrackMatchedTPmtd1CorrectAssocPt_
MonitorElement * meBTLTrackMatchedTPmtdDirectEta_
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
virtual const PixelTopology & specificTopology() const
MonitorElement * meETLTrackMatchedTP2PtResvsPtMtd_
MonitorElement * meTrackResTotvsMVAQual_
MonitorElement * meBTLTrackMatchedTPmtdDirectWrongAssocPt_
MonitorElement * meETLTrackMatchedTPmtd2WrongAssocPt_
MonitorElement * meETLTrackMatchedTPmtd1WrongAssocTimePull_
static constexpr double etacutREC_
MonitorElement * meBTLTrackPtRes_
Trktree trk
Definition: Trktree.cc:2
FTLCluster const & mtdCluster() const
MonitorElement * meBTLTrackMatchedTPnomtdAssocTimeRes_
edm::EDGetTokenT< edm::ValueMap< float > > tmtdToken_
int mtdSubDetector() const
Definition: MTDDetId.h:56
MonitorElement * meBTLTrackMatchedTPmtdOtherNoAssocEta_
MonitorElement * meExtraBTLeneInCone_
MonitorElement * meETLTrackMatchedTPmtd1Pt_
MonitorElement * meETLTrackMatchedTPmtd1Eta_
MonitorElement * meETLTrackMatchedTPEtaMtd_
edm::EDGetTokenT< edm::ValueMap< float > > outermostHitPositionToken_
MonitorElement * meExtraMTDfailExtenderPt_
MonitorElement * meExtraEtaMtd_
MonitorElement * meETLTrackMatchedTPmtd2NoAssocMVAQual_
MonitorElement * meBTLTrackMatchedTPnomtdEta_
MonitorElement * meBTLTrackMatchedTPmtdOtherPt_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
const unsigned long int uniqueId(const uint32_t x, const EncodedEventId &y)
MonitorElement * meBTLTrackMatchedTPPtRatioMtd_
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
MonitorElement * meETLTrackMatchedTPEtaTot_
static constexpr double cluDRradius_
const reco::RecoToSimCollection * r2s_
const edm::Ref< std::vector< TrackingParticle > > * getMatchedTP(const reco::TrackBaseRef &)
const_iterator find(const key_type &k) const
find element with specified reference key
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
MonitorElement * meETLTrackMatchedTP2PtRatioGen_
MonitorElement * meETLTrackMatchedTPmtd2NoAssocTimePull_
MonitorElement * meETLTrackMatchedTPPtMtd_
edm::EDGetTokenT< reco::TrackCollection > GenRecTrackToken_
MonitorElement * meBTLTrackEtaMtd_
edm::EDGetTokenT< reco::TPToSimCollectionMtd > tp2SimAssociationMapToken_
MonitorElement * meETLTrackMatchedTPmtd2Pt_
MonitorElement * meTrackResTot_
const_iterator end() const
last iterator over the map (read only)
edm::EDGetTokenT< MtdRecoClusterToSimLayerClusterAssociationMap > r2sAssociationMapToken_
void Fill(long long x)
U second(std::pair< T, U > const &p)
MonitorElement * meBTLTrackMatchedTPmtdDirectWrongAssocTimePull_
MonitorElement * meBTLTrackMatchedTPmtdDirectWrongAssocEta_
MonitorElement * meETLTrackMatchedTPmtd2WrongAssocEta_
edm::EDGetTokenT< edm::ValueMap< float > > SigmaTofPToken_
edm::EDGetTokenT< reco::TrackCollection > RecTrackToken_
MonitorElement * meExtraEtaEtl2Mtd_
edm::ESGetToken< MTDDetLayerGeometry, MTDRecoGeometryRecord > mtdlayerToken_
MonitorElement * meETLTrackMatchedTPmtd2Eta_
const bool trkTPSelAll(const TrackingParticle &)
int iEvent
Definition: GenABIO.cc:224
MonitorElement * meBTLTrackMatchedTPnomtdAssocTimePull_
MonitorElement * meETLTrackMatchedTPnomtdEta_
GlobalPoint globalPosition() const
float localX(const float mpX) const override
MonitorElement * meETLTrackMatchedTPmtd1WrongAssocTimeRes_
edm::EDGetTokenT< FTLRecHitCollection > etlRecHitsToken_
MonitorElement * meBTLTrackMatchedTPmtdOtherWrongAssocTimePull_
MonitorElement * meBTLTrackRPTime_
MonitorElement * meBTLTrackMatchedTPDPtvsPtMtd_
static constexpr double depositBTLthreshold_
MonitorElement * meETLTrackPtRes_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:408
MonitorElement * meETLTrackEta2Mtd_
const bool trkTPSelLV(const TrackingParticle &)
MonitorElement * meETLTrackEtaMtd_
MonitorElement * meETLTrackMatchedTPDPtvsPtGen_
MonitorElement * meTrackt0SafePid_
MonitorElement * meETLTrackMatchedTPmtd2WrongAssocTimeRes_
T sqrt(T t)
Definition: SSEVec.h:23
MonitorElement * meBTLTrackMatchedTPmtdOtherWrongAssocMVAQual_
void fillTrackClusterMatchingHistograms(MonitorElement *me1, MonitorElement *me2, MonitorElement *me3, MonitorElement *me4, MonitorElement *me5, float var1, float var2, float var3, float var4, float var5, bool flag)
MonitorElement * meBTLTrackMatchedTPmtdDirectCorrectAssocMVAQual_
MonitorElement * meETLTrackMatchedTPDPtvsPtMtd_
MonitorElement * meTrackMatchedTPEtaTotLV_
MonitorElement * meBTLTrackMatchedTPmtdOtherWrongAssocTimeRes_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * meETLTrackMatchedTPmtd1NoAssocPt_
MonitorElement * meETLTrackMatchedTPmtd1WrongAssocEta_
MonitorElement * meBTLTrackMatchedTPmtdOtherWrongAssocEta_
MonitorElement * meBTLTrackPtMtd_
MonitorElement * meETLTrackMatchedTPnomtdAssocEta_
bool isETL(const double eta) const
MonitorElement * meETLTrackMatchedTPmtd2NoAssocTimeRes_
MonitorElement * meETLTrackPtMtd_
MonitorElement * meBTLTrackMatchedTPnomtdAssocPt_
double f[11][100]
bool isMatched(TrackingRecHit const &hit)
MonitorElement * meBTLTrackMatchedTPPtResvsPtMtd_
MonitorElement * meTrackSigmaTof_[3]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int nrows() const override
MonitorElement * meBTLTrackMatchedTPmtdOtherWrongAssocPt_
MonitorElement * meBTLTrackEtaTot_
MonitorElement * meETLTrackPhi2Mtd_
static constexpr double simUnit_
MonitorElement * meTrackOutermostHitZ_
MonitorElement * meETLTrackMatchedTPnomtdAssocTimeRes_
MonitorElement * meBTLTrackMatchedTPmtdOtherNoAssocPt_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::ValueMap< float > > t0PidToken_
edm::EDGetTokenT< FTLRecHitCollection > btlRecHitsToken_
MonitorElement * meETLTrackMatchedTPPtRatioMtd_
MonitorElement * meTrackMVAQual_
MonitorElement * meETLTrackMatchedTPPtTot_
MonitorElement * meETLTrackMatchedTPmtd2CorrectAssocTimeRes_
float localY(const float mpY) const override
MonitorElement * meBTLTrackMatchedTPmtdDirectWrongAssocMVAQual_
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
const std::vector< const DetLayer * > & allBTLLayers() const
return the BTL DetLayers (barrel), inside-out
edm::EDGetTokenT< edm::ValueMap< float > > SigmatmtdToken_
MonitorElement * meBTLTrackPhiTot_
const bool trkRecSelLowPt(const reco::TrackBase &)
MonitorElement * meETLTrackMatchedTPmtd2CorrectAssocMVAQual_
MonitorElement * meETLTrackMatchedTPnomtdAssocMVAQual_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * meTrackNumHitsNT_
edm::EDGetTokenT< edm::ValueMap< float > > SigmaTofPiToken_
MonitorElement * meETLTrackMatchedTPmtd1NoAssocMVAQual_
Log< level::Info, false > LogInfo
Definition: DetId.h:17
MonitorElement * meETLTrackMatchedTPmtd2WrongAssocMVAQual_
MonitorElement * meETLTrackMatchedTPmtd2CorrectAssocTimePull_
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoAssociationToken_
MonitorElement * meTrackOutermostHitR_
static constexpr double etaMatchCut_
static constexpr double zETL_
static constexpr double depositETLthreshold_
unsigned long long uint64_t
Definition: Time.h:13
MonitorElement * meETLTrackMatchedTPnomtdAssocTimePull_
MonitorElement * meETLTrackMatchedTPmtd1CorrectAssocMVAQual_
MonitorElement * meBTLTrackMatchedTPEtaTot_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MonitorElement * meBTLTrackMatchedTPmtdOtherCorrectAssocTimePull_
MonitorElement * meBTLTrackMatchedTPmtdDirectNoAssocEta_
MonitorElement * meBTLTrackMatchedTPDPtvsPtGen_
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * meTrackMatchedTPPtTotLV_
A 2D TrackerRecHit with time and time error information.
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
MonitorElement * meETLTrackMatchedTPPt2Mtd_
double b
Definition: hdecay.h:120
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * meTrackSigmat0SafePid_
MonitorElement * meBTLTrackMatchedTPnomtdAssocEta_
edm::EDGetTokenT< edm::ValueMap< float > > SigmaTofKToken_
int zside() const
Definition: MTDDetId.h:61
MonitorElement * meTrackSigmat0Pid_
MonitorElement * meTrackt0Src_
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0PidToken_
MonitorElement * meTracktmtd_
MonitorElement * meBTLTrackPhiMtd_
MonitorElement * meBTLTrackMatchedTPmtdOtherCorrectAssocTimeRes_
MonitorElement * meTrackPathLenghtvsEta_
MonitorElement * meETLTrackMatchedTPmtd1WrongAssocMVAQual_
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:16
HLT enums.
MonitorElement * meETLTrackMatchedTPPtResMtd_
int nDisc() const
Definition: ETLDetId.h:164
MonitorElement * meTrackPullTot_
MonitorElement * meBTLTrackMatchedTPPtTot_
double a
Definition: hdecay.h:121
MonitorElement * meBTLTrackMatchedTPmtdDirectCorrectAssocPt_
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19
MonitorElement * meETLTrackMatchedTPnomtdAssocPt_
MonitorElement * meETLTrackMatchedTPPtRatioGen_
MonitorElement * meETLTrackPhiTot_
MonitorElement * meExtraPtMtd_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:141
MonitorElement * meExtraPhiAtBTLmatched_
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimAssociationToken_
Monte Carlo truth information used for tracking validation.
MonitorElement * meBTLTrackMatchedTPPtRatioGen_
MonitorElement * meBTLTrackPtTot_
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0SrcToken_
MonitorElement * meBTLTrackMatchedTPmtdDirectCorrectAssocEta_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
MonitorElement * meExtraPtEtl2Mtd_
MonitorElement * meBTLTrackMatchedTPmtdOtherCorrectAssocMVAQual_
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)
edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > mtdgeoToken_
edm::EDGetTokenT< FTLClusterCollection > etlRecCluToken_
MonitorElement * meETLTrackMatchedTPmtd1CorrectAssocTimeRes_
Log< level::Warning, false > LogWarning
MonitorElement * meBTLTrackMatchedTPmtdDirectPt_
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:52
MonitorElement * meETLTrackMatchedTPmtd1NoAssocTimePull_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * meBTLTrackMatchedTPnomtdPt_
MonitorElement * meETLTrackMatchedTP2DPtvsPtMtd_
MonitorElement * meETLTrackEtaMtdLowPt_[2]
MonitorElement * meBTLTrackMatchedTPPtMtd_
MonitorElement * meETLTrackMatchedTPmtd1CorrectAssocEta_
MonitorElement * meETLTrackPhiMtd_
MonitorElement * meTrackSigmat0Src_
MonitorElement * meBTLTrackMatchedTPmtdOtherEta_
MonitorElement * meETLTrackEtaTot_
MonitorElement * meETLTrackMatchedTPnomtdPt_
const std::vector< const DetLayer * > & allETLLayers() const
return the ETL DetLayers (endcap), -Z to +Z
Definition: Run.h:45
static constexpr double pTcutBTL_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
MonitorElement * meTrackSigmaTofvsP_[3]
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0SafePidToken_
MtdTracksValidation(const edm::ParameterSet &)
MonitorElement * meBTLTrackMatchedTPnomtdAssocMVAQual_
#define LogDebug(id)
MonitorElement * meETLTrackMatchedTPmtd1CorrectAssocTimePull_
MonitorElement * meExtraPhiAtBTL_
MonitorElement * meBTLTrackMatchedTPmtdDirectWrongAssocTimeRes_