CMS 3D CMS Logo

MtdTracksValidation.cc
Go to the documentation of this file.
1 #include <string>
2 
8 
11 
17 
23 
27 
35 
42 
45 #include "HepMC/GenRanges.h"
46 #include "CLHEP/Units/PhysicalConstants.h"
47 #include "MTDHit.h"
48 
50 public:
51  explicit MtdTracksValidation(const edm::ParameterSet&);
52  ~MtdTracksValidation() override;
53 
54  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
55 
56 private:
57  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
58 
59  void analyze(const edm::Event&, const edm::EventSetup&) override;
60 
61  const bool mvaGenSel(const HepMC::GenParticle&, const float&);
62  const bool mvaTPSel(const TrackingParticle&);
63  const bool mvaRecSel(const reco::TrackBase&, const reco::Vertex&, const double&, const double&);
64  const bool mvaGenRecMatch(const HepMC::GenParticle&, const double&, const reco::TrackBase&, const bool&);
66  const bool tpWithMTD(const TrackingParticle&, const std::unordered_set<unsigned long int>&);
67 
68  const unsigned long int uniqueId(const uint32_t x, const EncodedEventId& y) {
69  const uint64_t a = static_cast<uint64_t>(x);
70  const uint64_t b = static_cast<uint64_t>(y.rawId());
71 
72  if (x < y.rawId())
73  return (b << 32) | a;
74  else
75  return (a << 32) | b;
76  }
77 
78  bool isETL(const double eta) const { return (std::abs(eta) > trackMinEtlEta_) && (std::abs(eta) < trackMaxEtlEta_); }
79 
80  // ------------ member data ------------
81 
83  const float trackMinPt_;
84  const float trackMaxBtlEta_;
85  const float trackMinEtlEta_;
86  const float trackMaxEtlEta_;
87 
88  static constexpr double etacutGEN_ = 4.; // |eta| < 4;
89  static constexpr double etacutREC_ = 3.; // |eta| < 3;
90  static constexpr double pTcut_ = 0.7; // PT > 0.7 GeV
91  static constexpr double deltaZcut_ = 0.1; // dz separation 1 mm
92  static constexpr double deltaPTcut_ = 0.05; // dPT < 5%
93  static constexpr double deltaDRcut_ = 0.03; // DeltaR separation
94  static constexpr double depositBTLthreshold_ = 1; // threshold for energy deposit in BTL cell [MeV]
95  static constexpr double depositETLthreshold_ = 0.001; // threshold for energy deposit in ETL cell [MeV]
96  static constexpr double rBTL_ = 110.0;
97  static constexpr double zETL_ = 290.0;
98  static constexpr double etaMatchCut_ = 0.05;
99 
101 
104 
108 
115 
118 
128 
132 
141 
153 
164 
184 
190 };
191 
192 // ------------ constructor and destructor --------------
194  : folder_(iConfig.getParameter<std::string>("folder")),
195  trackMinPt_(iConfig.getParameter<double>("trackMinimumPt")),
196  trackMaxBtlEta_(iConfig.getParameter<double>("trackMaximumBtlEta")),
197  trackMinEtlEta_(iConfig.getParameter<double>("trackMinimumEtlEta")),
198  trackMaxEtlEta_(iConfig.getParameter<double>("trackMaximumEtlEta")),
199  optionalPlots_(iConfig.getUntrackedParameter<bool>("optionalPlots")) {
200  GenRecTrackToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTagG"));
201  RecTrackToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTagT"));
202  RecVertexToken_ = consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("inputTagV"));
203  HepMCProductToken_ = consumes<edm::HepMCProduct>(iConfig.getParameter<edm::InputTag>("inputTagH"));
205  consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("SimTag"));
207  consumes<reco::SimToRecoCollection>(iConfig.getParameter<edm::InputTag>("TPtoRecoTrackAssoc"));
209  consumes<reco::RecoToSimCollection>(iConfig.getParameter<edm::InputTag>("TPtoRecoTrackAssoc"));
210  btlSimHitsToken_ = consumes<CrossingFrame<PSimHit>>(iConfig.getParameter<edm::InputTag>("btlSimHits"));
211  etlSimHitsToken_ = consumes<CrossingFrame<PSimHit>>(iConfig.getParameter<edm::InputTag>("etlSimHits"));
212  trackAssocToken_ = consumes<edm::ValueMap<int>>(iConfig.getParameter<edm::InputTag>("trackAssocSrc"));
213  pathLengthToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("pathLengthSrc"));
214  tmtdToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("tmtd"));
215  SigmatmtdToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmatmtd"));
216  t0SrcToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0Src"));
217  Sigmat0SrcToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0Src"));
218  t0PidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0PID"));
219  Sigmat0PidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0PID"));
220  t0SafePidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0SafePID"));
221  Sigmat0SafePidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0SafePID"));
222  trackMVAQualToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("trackMVAQual"));
223  mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>();
224  mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>();
225  particleTableToken_ = esConsumes<HepPDT::ParticleDataTable, edm::DefaultRecord>();
226 }
227 
229 
230 // ------------ method called for each event ------------
232  using namespace edm;
233  using namespace geant_units::operators;
234  using namespace std;
235 
236  auto geometryHandle = iSetup.getTransientHandle(mtdgeoToken_);
237  const MTDGeometry* geom = geometryHandle.product();
238  auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_);
239  const MTDTopology* topology = topologyHandle.product();
240 
241  bool topo1Dis = false;
242  bool topo2Dis = false;
244  topo1Dis = true;
245  } else {
246  topo2Dis = true;
247  }
248 
249  auto GenRecTrackHandle = makeValid(iEvent.getHandle(GenRecTrackToken_));
250  auto RecVertexHandle = makeValid(iEvent.getHandle(RecVertexToken_));
251 
252  std::unordered_map<uint32_t, MTDHit> m_btlHits;
253  std::unordered_map<uint32_t, MTDHit> m_etlHits;
254  std::unordered_map<uint32_t, std::set<unsigned long int>> m_btlTrkPerCell;
255  std::unordered_map<uint32_t, std::set<unsigned long int>> m_etlTrkPerCell;
256 
257  const auto& tMtd = iEvent.get(tmtdToken_);
258  const auto& SigmatMtd = iEvent.get(SigmatmtdToken_);
259  const auto& t0Src = iEvent.get(t0SrcToken_);
260  const auto& Sigmat0Src = iEvent.get(Sigmat0SrcToken_);
261  const auto& t0Pid = iEvent.get(t0PidToken_);
262  const auto& Sigmat0Pid = iEvent.get(Sigmat0PidToken_);
263  const auto& t0Safe = iEvent.get(t0SafePidToken_);
264  const auto& Sigmat0Safe = iEvent.get(Sigmat0SafePidToken_);
265  const auto& mtdQualMVA = iEvent.get(trackMVAQualToken_);
266  const auto& trackAssoc = iEvent.get(trackAssocToken_);
267  const auto& pathLength = iEvent.get(pathLengthToken_);
268 
269  const auto& primRecoVtx = *(RecVertexHandle.product()->begin());
270 
271  // generator level information (HepMC format)
272  auto GenEventHandle = makeValid(iEvent.getHandle(HepMCProductToken_));
273  const HepMC::GenEvent* mc = GenEventHandle->GetEvent();
274  double zsim = convertMmToCm((*(mc->vertices_begin()))->position().z());
275  double tsim = (*(mc->vertices_begin()))->position().t() * CLHEP::mm / CLHEP::c_light;
276 
277  auto pdt = iSetup.getHandle(particleTableToken_);
278  const HepPDT::ParticleDataTable* pdTable = pdt.product();
279 
280  auto simToRecoH = makeValid(iEvent.getHandle(simToRecoAssociationToken_));
281  s2r_ = simToRecoH.product();
282 
283  auto recoToSimH = makeValid(iEvent.getHandle(recoToSimAssociationToken_));
284  r2s_ = recoToSimH.product();
285 
286  // find all signal event trackId corresponding to an MTD simHit
287  std::unordered_set<unsigned long int> mtdTrackId;
288 
289  std::unordered_set<unsigned long int> tpTrackId;
290  auto tpHandle = makeValid(iEvent.getHandle(trackingParticleCollectionToken_));
291  TrackingParticleCollection tpColl = *(tpHandle.product());
292  for (const auto& tp : tpColl) {
293  if (tp.eventId().bunchCrossing() == 0 && tp.eventId().event() == 0) {
294  if (!mvaTPSel(tp))
295  continue;
296  if (optionalPlots_) {
297  if (std::abs(tp.eta()) < trackMaxBtlEta_) {
299  } else if ((std::abs(tp.eta()) < trackMaxEtlEta_) && (std::abs(tp.eta()) > trackMinEtlEta_)) {
301  }
302  }
303  for (const auto& simTrk : tp.g4Tracks()) {
304  auto const thisTId = uniqueId(simTrk.trackId(), simTrk.eventId());
305  tpTrackId.insert(thisTId);
306  LogDebug("MtdTracksValidation") << "TP simTrack id : " << thisTId;
307  }
308  }
309  }
310 
311  //Fill maps with simhits accumulated per DetId
312 
313  auto btlSimHitsHandle = makeValid(iEvent.getHandle(btlSimHitsToken_));
314  MixCollection<PSimHit> btlSimHits(btlSimHitsHandle.product());
315  for (auto const& simHit : btlSimHits) {
316  if (simHit.tof() < 0 || simHit.tof() > 25.)
317  continue;
318  DetId id = simHit.detUnitId();
319  auto const thisHId = uniqueId(simHit.trackId(), simHit.eventId());
320  m_btlTrkPerCell[id.rawId()].insert(thisHId);
321  auto simHitIt = m_btlHits.emplace(id.rawId(), MTDHit()).first;
322  // --- Accumulate the energy (in MeV) of SIM hits in the same detector cell
323  (simHitIt->second).energy += convertUnitsTo(0.001_MeV, simHit.energyLoss());
324  }
325 
326  uint32_t hcount(0);
327  for (auto const& cell : m_btlTrkPerCell) {
328  bool foundAssocTP = false;
329  auto detId_key = cell.first;
330  for (auto const& simtrack : cell.second) {
331  if (tpTrackId.find(simtrack) != tpTrackId.end()) {
332  foundAssocTP = true;
333  mtdTrackId.insert(simtrack);
334  }
335  }
336  if (foundAssocTP == false) {
337  meUnassCrysEnergy_->Fill(log10(m_btlHits[detId_key].energy));
338  if (m_btlHits[detId_key].energy > depositBTLthreshold_) {
339  hcount++;
340  }
341  }
342  }
343  meUnassociatedDetId_->Fill(0.5, hcount);
344 
345  auto etlSimHitsHandle = makeValid(iEvent.getHandle(etlSimHitsToken_));
346  MixCollection<PSimHit> etlSimHits(etlSimHitsHandle.product());
347  for (auto const& simHit : etlSimHits) {
348  if (simHit.tof() < 0 || simHit.tof() > 25.) {
349  continue;
350  }
351  DetId id = simHit.detUnitId();
352  auto const thisHId = uniqueId(simHit.trackId(), simHit.eventId());
353  m_etlTrkPerCell[id.rawId()].insert(thisHId);
354  auto simHitIt = m_etlHits.emplace(id.rawId(), MTDHit()).first;
355  // --- Accumulate the energy (in MeV) of SIM hits in the same detector cell
356  (simHitIt->second).energy += convertUnitsTo(0.001_MeV, simHit.energyLoss());
357  }
358 
359  hcount = 0;
360  for (auto const& cell : m_etlTrkPerCell) {
361  bool foundAssocTP = false;
362  auto detId_key = cell.first;
363  for (auto const& simtrack : cell.second) {
364  if (tpTrackId.find(simtrack) != tpTrackId.end()) {
365  foundAssocTP = true;
366  mtdTrackId.insert(simtrack);
367  }
368  }
369  if (foundAssocTP == false) {
370  meUnassLgadsEnergy_->Fill(log10(m_etlHits[detId_key].energy));
371  if (m_etlHits[detId_key].energy > depositETLthreshold_) {
372  hcount++;
373  }
374  }
375  }
376  meUnassociatedDetId_->Fill(1.5, hcount);
377 
378  // Search for TP without associated hits and unassociated DetIds above threshold
379  if (optionalPlots_) {
380  for (const auto& tp : tpColl) {
381  if (tp.eventId().bunchCrossing() == 0 && tp.eventId().event() == 0) {
382  if (!mvaTPSel(tp)) {
383  continue;
384  }
385 
386  // test BTL crystals for association
387 
388  if (std::abs(tp.eta()) < trackMaxBtlEta_) {
389  bool tpIsAssoc = false;
390  bool goodCell = false;
391  for (auto const& cell : m_btlTrkPerCell) {
392  auto detId_key = cell.first;
393  if (m_btlHits[detId_key].energy < depositBTLthreshold_) {
394  continue;
395  }
396 
397  BTLDetId detId(detId_key);
399  const MTDGeomDet* thedet = geom->idToDet(geoId);
400  if (thedet == nullptr)
401  throw cms::Exception("MtdTracksValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
402  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
403  const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology());
404  const RectangularMTDTopology& topo =
405  static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology());
406 
407  Local3DPoint local_point(convertMmToCm(m_btlHits[detId_key].x),
408  convertMmToCm(m_btlHits[detId_key].y),
409  convertMmToCm(m_btlHits[detId_key].z));
410 
411  local_point =
412  topo.pixelToModuleLocalPoint(local_point, detId.row(topo.nrows()), detId.column(topo.nrows()));
413  const auto& global_point = thedet->toGlobal(local_point);
414 
415  if (std::abs(tp.eta() - global_point.eta()) > etaMatchCut_) {
416  continue;
417  }
418  goodCell = true;
419  for (auto const& simtrack : cell.second) {
420  for (auto const& TPsimtrack : tp.g4Tracks()) {
421  auto const testId = uniqueId(TPsimtrack.trackId(), TPsimtrack.eventId());
422  if (simtrack == testId) {
423  tpIsAssoc = true;
424  break;
425  }
426  }
427  }
428  } //cell Loop
429  if (!tpIsAssoc && goodCell) {
430  meUnassDeposit_->Fill(0.5);
431  }
432 
433  } else {
434  // test ETL LGADs for association
435  bool tpIsAssoc = false;
436  bool goodCell = false;
437  for (auto const& cell : m_etlTrkPerCell) {
438  auto detId_key = cell.first;
439  if (m_etlHits[detId_key].energy < depositETLthreshold_) {
440  continue;
441  }
442 
443  ETLDetId detId(detId_key);
444  DetId geoId = detId.geographicalId();
445  const MTDGeomDet* thedet = geom->idToDet(geoId);
446  if (thedet == nullptr)
447  throw cms::Exception("MtdTracksValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " ("
448  << detId.rawId() << ") is invalid!" << std::dec << std::endl;
449 
450  Local3DPoint local_point(convertMmToCm(m_etlHits[detId_key].x),
451  convertMmToCm(m_etlHits[detId_key].y),
452  convertMmToCm(m_etlHits[detId_key].z));
453  const auto& global_point = thedet->toGlobal(local_point);
454 
455  if (std::abs(tp.eta() - global_point.eta()) > etaMatchCut_) {
456  continue;
457  }
458  goodCell = true;
459  for (auto const& simtrack : cell.second) {
460  for (auto const& TPsimtrack : tp.g4Tracks()) {
461  auto const testId = uniqueId(TPsimtrack.trackId(), TPsimtrack.eventId());
462  if (simtrack == testId) {
463  tpIsAssoc = true;
464  break;
465  }
466  }
467  }
468  } //cell Loop
469  if (!tpIsAssoc && goodCell) {
470  meUnassDeposit_->Fill(1.5);
471  }
472  } // tp BTL/ETL acceptance selection
473  }
474  } //tp Loop
475  } //optionalPlots
476 
477  unsigned int index = 0;
478 
479  // flag to select events with reco vertex close to true simulated primary vertex, or PV fake (particle guns)
480  const bool isGoodVtx = std::abs(primRecoVtx.z() - zsim) < deltaZcut_ || primRecoVtx.isFake();
481 
482  // --- Loop over all RECO tracks ---
483  for (const auto& trackGen : *GenRecTrackHandle) {
484  const reco::TrackRef trackref(iEvent.getHandle(GenRecTrackToken_), index);
485  index++;
486 
487  if (trackAssoc[trackref] == -1) {
488  LogInfo("mtdTracks") << "Extended track not associated";
489  continue;
490  }
491 
492  const reco::TrackRef mtdTrackref = reco::TrackRef(iEvent.getHandle(RecTrackToken_), trackAssoc[trackref]);
493  const reco::Track& track = *mtdTrackref;
494 
495  bool isBTL = false;
496  bool twoETLdiscs = false;
497 
498  if (track.pt() >= trackMinPt_ && std::abs(track.eta()) <= trackMaxEtlEta_) {
499  meTracktmtd_->Fill(tMtd[trackref]);
500  if (std::round(SigmatMtd[trackref] - Sigmat0Pid[trackref]) != 0) {
501  LogWarning("mtdTracks")
502  << "TimeError associated to refitted track is different from TimeError stored in tofPID "
503  "sigmat0 ValueMap: this should not happen";
504  }
505 
506  meTrackt0Src_->Fill(t0Src[trackref]);
507  meTrackSigmat0Src_->Fill(Sigmat0Src[trackref]);
508 
509  meTrackt0Pid_->Fill(t0Pid[trackref]);
510  meTrackSigmat0Pid_->Fill(Sigmat0Pid[trackref]);
511  meTrackt0SafePid_->Fill(t0Safe[trackref]);
512  meTrackSigmat0SafePid_->Fill(Sigmat0Safe[trackref]);
513  meTrackMVAQual_->Fill(mtdQualMVA[trackref]);
514 
515  meTrackPathLenghtvsEta_->Fill(std::abs(track.eta()), pathLength[trackref]);
516 
517  if (std::abs(track.eta()) < trackMaxBtlEta_) {
518  // --- all BTL tracks (with and without hit in MTD) ---
522 
523  bool MTDBtl = false;
524  int numMTDBtlvalidhits = 0;
525  for (const auto hit : track.recHits()) {
526  if (hit->isValid() == false)
527  continue;
528  MTDDetId Hit = hit->geographicalId();
529  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 1)) {
530  MTDBtl = true;
531  numMTDBtlvalidhits++;
532  }
533  }
534  meTrackNumHits_->Fill(numMTDBtlvalidhits);
535 
536  // --- keeping only tracks with last hit in MTD ---
537  if (MTDBtl == true) {
538  isBTL = true;
543  meBTLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
544  }
545  } //loop over (geometrical) BTL tracks
546 
547  else {
548  // --- all ETL tracks (with and without hit in MTD) ---
549  if ((track.eta() < -trackMinEtlEta_) && (track.eta() > -trackMaxEtlEta_)) {
550  meETLTrackEffEtaTot_[0]->Fill(track.eta());
551  meETLTrackEffPhiTot_[0]->Fill(track.phi());
552  meETLTrackEffPtTot_[0]->Fill(track.pt());
553  }
554 
555  if ((track.eta() > trackMinEtlEta_) && (track.eta() < trackMaxEtlEta_)) {
556  meETLTrackEffEtaTot_[1]->Fill(track.eta());
557  meETLTrackEffPhiTot_[1]->Fill(track.phi());
558  meETLTrackEffPtTot_[1]->Fill(track.pt());
559  }
560 
561  bool MTDEtlZnegD1 = false;
562  bool MTDEtlZnegD2 = false;
563  bool MTDEtlZposD1 = false;
564  bool MTDEtlZposD2 = false;
565  int numMTDEtlvalidhits = 0;
566  for (const auto hit : track.recHits()) {
567  if (hit->isValid() == false)
568  continue;
569  MTDDetId Hit = hit->geographicalId();
570  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 2)) {
571  ETLDetId ETLHit = hit->geographicalId();
572 
573  if (topo2Dis) {
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  if (topo1Dis) {
601  if (ETLHit.zside() == -1) {
602  MTDEtlZnegD1 = true;
604  numMTDEtlvalidhits++;
605  }
606  if (ETLHit.zside() == 1) {
607  MTDEtlZposD1 = true;
609  numMTDEtlvalidhits++;
610  }
611  }
612  }
613  }
614  meTrackNumHits_->Fill(-numMTDEtlvalidhits);
615 
616  // --- keeping only tracks with last hit in MTD ---
617  if ((track.eta() < -trackMinEtlEta_) && (track.eta() > -trackMaxEtlEta_)) {
618  twoETLdiscs = (MTDEtlZnegD1 == true) && (MTDEtlZnegD2 == true);
619  if ((MTDEtlZnegD1 == true) || (MTDEtlZnegD2 == true)) {
620  meETLTrackEffEtaMtd_[0]->Fill(track.eta());
621  meETLTrackEffPhiMtd_[0]->Fill(track.phi());
622  meETLTrackEffPtMtd_[0]->Fill(track.pt());
623  if (twoETLdiscs) {
624  meETLTrackEffEta2Mtd_[0]->Fill(track.eta());
625  meETLTrackEffPhi2Mtd_[0]->Fill(track.phi());
626  meETLTrackEffPt2Mtd_[0]->Fill(track.pt());
627  }
628  }
629  }
630  if ((track.eta() > trackMinEtlEta_) && (track.eta() < trackMaxEtlEta_)) {
631  twoETLdiscs = (MTDEtlZposD1 == true) && (MTDEtlZposD2 == true);
632  if ((MTDEtlZposD1 == true) || (MTDEtlZposD2 == true)) {
633  meETLTrackEffEtaMtd_[1]->Fill(track.eta());
634  meETLTrackEffPhiMtd_[1]->Fill(track.phi());
635  meETLTrackEffPtMtd_[1]->Fill(track.pt());
636  if (twoETLdiscs) {
637  meETLTrackEffEta2Mtd_[1]->Fill(track.eta());
638  meETLTrackEffPhi2Mtd_[1]->Fill(track.phi());
639  meETLTrackEffPt2Mtd_[1]->Fill(track.pt());
640  }
641  }
642  }
643  }
644  }
645 
646  if (isGoodVtx) {
647  bool noCrack = std::abs(trackGen.eta()) < trackMaxBtlEta_ || std::abs(trackGen.eta()) > trackMinEtlEta_;
648  const bool vtxFake = primRecoVtx.isFake();
649 
650  if (mvaRecSel(trackGen, primRecoVtx, t0Safe[trackref], Sigmat0Safe[trackref])) {
651  // reco-gen matching used for MVA quality flag
652 
653  if (noCrack) {
654  meMVATrackEffPtTot_->Fill(trackGen.pt());
655  }
656  meMVATrackEffEtaTot_->Fill(std::abs(trackGen.eta()));
657 
658  double dZ = trackGen.vz() - zsim;
659  double dT(-9999.);
660  double pullT(-9999.);
661  if (Sigmat0Safe[trackref] != -1.) {
662  dT = t0Safe[trackref] - tsim;
663  pullT = dT / Sigmat0Safe[trackref];
664  }
665  for (const auto& genP : mc->particle_range()) {
666  // select status 1 genParticles and match them to the reconstructed track
667 
668  float charge = pdTable->particle(HepPDT::ParticleID(genP->pdg_id())) != nullptr
669  ? pdTable->particle(HepPDT::ParticleID(genP->pdg_id()))->charge()
670  : 0.f;
671  if (mvaGenSel(*genP, charge)) {
672  if (mvaGenRecMatch(*genP, zsim, trackGen, vtxFake)) {
674  if (noCrack) {
675  meMVATrackMatchedEffPtTot_->Fill(trackGen.pt());
676  }
677  meMVATrackMatchedEffEtaTot_->Fill(std::abs(trackGen.eta()));
678  if (pullT > -9999.) {
679  meMVATrackResTot_->Fill(dT);
680  meMVATrackPullTot_->Fill(pullT);
681  if (noCrack) {
682  meMVATrackMatchedEffPtMtd_->Fill(trackGen.pt());
683  }
684  meMVATrackMatchedEffEtaMtd_->Fill(std::abs(trackGen.eta()));
685  }
686  break;
687  }
688  }
689  }
690 
691  // TrackingParticle based matching
692 
693  const reco::TrackBaseRef trkrefb(trackref);
694  auto tp_info = getMatchedTP(trkrefb, zsim);
695 
696  if (tp_info != nullptr && mvaTPSel(**tp_info)) {
697  const bool withMTD = tpWithMTD(**tp_info, mtdTrackId);
698  if (noCrack) {
699  meTrackMatchedTPEffPtTot_->Fill(trackGen.pt());
700  if (withMTD) {
701  meTrackMatchedTPmtdEffPtTot_->Fill(trackGen.pt());
702  }
703  }
704  meTrackMatchedTPEffEtaTot_->Fill(std::abs(trackGen.eta()));
705  if (withMTD) {
706  meTrackMatchedTPmtdEffEtaTot_->Fill(std::abs(trackGen.eta()));
707  }
708  if (pullT > -9999.) {
709  if (noCrack) {
710  meTrackMatchedTPEffPtMtd_->Fill(trackGen.pt());
711  if (isBTL || twoETLdiscs) {
712  meTrackMatchedTPEffPtEtl2Mtd_->Fill(trackGen.pt());
713  }
714  if (withMTD) {
715  meTrackMatchedTPmtdEffPtMtd_->Fill(trackGen.pt());
716  }
717  }
718  meTrackMatchedTPEffEtaMtd_->Fill(std::abs(trackGen.eta()));
719  if (isBTL || twoETLdiscs) {
720  meTrackMatchedTPEffEtaEtl2Mtd_->Fill(std::abs(trackGen.eta()));
721  }
722  if (withMTD) {
723  meTrackMatchedTPmtdEffEtaMtd_->Fill(std::abs(trackGen.eta()));
724  }
725  }
726  }
727  }
728  } // MC truth matich analysis for good PV
729  } //RECO tracks loop
730 }
731 
732 // ------------ method for histogram booking ------------
734  ibook.setCurrentFolder(folder_);
735 
736  // histogram booking
737  meBTLTrackRPTime_ = ibook.book1D("TrackBTLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3);
738  meBTLTrackEffEtaTot_ = ibook.book1D("TrackBTLEffEtaTot", "Track efficiency vs eta (Tot);#eta_{RECO}", 100, -1.6, 1.6);
740  ibook.book1D("TrackBTLEffPhiTot", "Track efficiency vs phi (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2);
741  meBTLTrackEffPtTot_ = ibook.book1D("TrackBTLEffPtTot", "Track efficiency vs pt (Tot);pt_{RECO} [GeV]", 50, 0, 10);
742  meBTLTrackEffEtaMtd_ = ibook.book1D("TrackBTLEffEtaMtd", "Track efficiency vs eta (Mtd);#eta_{RECO}", 100, -1.6, 1.6);
744  ibook.book1D("TrackBTLEffPhiMtd", "Track efficiency vs phi (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2);
745  meBTLTrackEffPtMtd_ = ibook.book1D("TrackBTLEffPtMtd", "Track efficiency vs pt (Mtd);pt_{RECO} [GeV]", 50, 0, 10);
747  ibook.book1D("TrackBTLPtRes", "Track pT resolution ;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
748  meETLTrackRPTime_ = ibook.book1D("TrackETLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3);
750  ibook.book1D("TrackETLEffEtaTotZneg", "Track efficiency vs eta (Tot) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
752  ibook.book1D("TrackETLEffEtaTotZpos", "Track efficiency vs eta (Tot) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
754  ibook.book1D("TrackETLEffPhiTotZneg", "Track efficiency vs phi (Tot) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
756  ibook.book1D("TrackETLEffPhiTotZpos", "Track efficiency vs phi (Tot) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
758  ibook.book1D("TrackETLEffPtTotZneg", "Track efficiency vs pt (Tot) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
760  ibook.book1D("TrackETLEffPtTotZpos", "Track efficiency vs pt (Tot) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
762  ibook.book1D("TrackETLEffEtaMtdZneg", "Track efficiency vs eta (Mtd) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
764  ibook.book1D("TrackETLEffEtaMtdZpos", "Track efficiency vs eta (Mtd) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
766  ibook.book1D("TrackETLEffPhiMtdZneg", "Track efficiency vs phi (Mtd) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
768  ibook.book1D("TrackETLEffPhiMtdZpos", "Track efficiency vs phi (Mtd) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
770  ibook.book1D("TrackETLEffPtMtdZneg", "Track efficiency vs pt (Mtd) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
772  ibook.book1D("TrackETLEffPtMtdZpos", "Track efficiency vs pt (Mtd) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
774  ibook.book1D("TrackETLEffEta2MtdZneg", "Track efficiency vs eta (Mtd 2 hit) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
776  ibook.book1D("TrackETLEffEta2MtdZpos", "Track efficiency vs eta (Mtd 2 hit) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
777  meETLTrackEffPhi2Mtd_[0] = ibook.book1D(
778  "TrackETLEffPhi2MtdZneg", "Track efficiency vs phi (Mtd 2 hit) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
779  meETLTrackEffPhi2Mtd_[1] = ibook.book1D(
780  "TrackETLEffPhi2MtdZpos", "Track efficiency vs phi (Mtd 2 hit) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
782  ibook.book1D("TrackETLEffPt2MtdZneg", "Track efficiency vs pt (Mtd 2 hit) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
784  ibook.book1D("TrackETLEffPt2MtdZpos", "Track efficiency vs pt (Mtd 2 hit) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
786  ibook.book1D("TrackETLPtRes", "Track pT resolution;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
787 
788  meTracktmtd_ = ibook.book1D("Tracktmtd", "Track time from TrackExtenderWithMTD;tmtd [ns]", 150, 1, 16);
789  meTrackt0Src_ = ibook.book1D("Trackt0Src", "Track time from TrackExtenderWithMTD;t0Src [ns]", 100, -1.5, 1.5);
791  ibook.book1D("TrackSigmat0Src", "Time Error from TrackExtenderWithMTD; #sigma_{t0Src} [ns]", 100, 0, 0.1);
792 
793  meTrackt0Pid_ = ibook.book1D("Trackt0Pid", "Track t0 as stored in TofPid;t0 [ns]", 100, -1, 1);
794  meTrackSigmat0Pid_ = ibook.book1D("TrackSigmat0Pid", "Sigmat0 as stored in TofPid; #sigma_{t0} [ns]", 100, 0, 0.1);
795  meTrackt0SafePid_ = ibook.book1D("Trackt0SafePID", "Track t0 Safe as stored in TofPid;t0 [ns]", 100, -1, 1);
797  ibook.book1D("TrackSigmat0SafePID", "Sigmat0 Safe as stored in TofPid; #sigma_{t0} [ns]", 100, 0, 0.1);
798  meTrackNumHits_ = ibook.book1D("TrackNumHits", "Number of valid MTD hits per track ; Number of hits", 10, -5, 5);
799  meTrackMVAQual_ = ibook.book1D("TrackMVAQual", "Track MVA Quality as stored in Value Map ; MVAQual", 100, 0, 1);
801  "TrackPathLenghtvsEta", "MTD Track pathlength vs MTD track Eta;|#eta|;Pathlength", 100, 0, 3.2, 100.0, 400.0, "S");
802 
803  meMVATrackEffPtTot_ = ibook.book1D("MVAEffPtTot", "Pt of tracks associated to LV; track pt [GeV] ", 110, 0., 11.);
805  ibook.book1D("MVAMatchedEffPtTot", "Pt of tracks associated to LV matched to GEN; track pt [GeV] ", 110, 0., 11.);
807  "MVAMatchedEffPtMtd", "Pt of tracks associated to LV matched to GEN with time; track pt [GeV] ", 110, 0., 11.);
808 
810  ibook.book1D("MatchedTPEffPtTot", "Pt of tracks associated to LV matched to TP; track pt [GeV] ", 110, 0., 11.);
812  "MatchedTPEffPtMtd", "Pt of tracks associated to LV matched to TP with time; track pt [GeV] ", 110, 0., 11.);
814  ibook.book1D("MatchedTPEffPtEtl2Mtd",
815  "Pt of tracks associated to LV matched to TP with time, 2 ETL hits; track pt [GeV] ",
816  110,
817  0.,
818  11.);
819 
821  "MatchedTPmtdEffPtTot", "Pt of tracks associated to LV matched to TP-mtd hit; track pt [GeV] ", 110, 0., 11.);
823  ibook.book1D("MatchedTPmtdEffPtMtd",
824  "Pt of tracks associated to LV matched to TP-mtd hit with time; track pt [GeV] ",
825  110,
826  0.,
827  11.);
828 
829  meMVATrackEffEtaTot_ = ibook.book1D("MVAEffEtaTot", "Eta of tracks associated to LV; track eta ", 66, 0., 3.3);
831  ibook.book1D("MVAMatchedEffEtaTot", "Eta of tracks associated to LV matched to GEN; track eta ", 66, 0., 3.3);
833  "MVAMatchedEffEtaMtd", "Eta of tracks associated to LV matched to GEN with time; track eta ", 66, 0., 3.3);
834 
836  ibook.book1D("MatchedTPEffEtaTot", "Eta of tracks associated to LV matched to TP; track eta ", 66, 0., 3.3);
838  "MatchedTPEffEtaMtd", "Eta of tracks associated to LV matched to TP with time; track eta ", 66, 0., 3.3);
840  ibook.book1D("MatchedTPEffEtaEtl2Mtd",
841  "Eta of tracks associated to LV matched to TP with time, 2 ETL hits; track eta ",
842  66,
843  0.,
844  3.3);
845 
847  "MatchedTPmtdEffEtaTot", "Eta of tracks associated to LV matched to TP-mtd hit; track eta ", 66, 0., 3.3);
849  ibook.book1D("MatchedTPmtdEffEtaMtd",
850  "Eta of tracks associated to LV matched to TP-mtd hit with time; track eta ",
851  66,
852  0.,
853  3.3);
854 
855  meMVATrackResTot_ = ibook.book1D(
856  "MVATrackRes", "t_{rec} - t_{sim} for LV associated tracks; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15);
858  ibook.book1D("MVATrackPull", "Pull for associated tracks; (t_{rec}-t_{sim})/#sigma_{t}", 50, -5., 5.);
860  "MVATrackZposResTot", "Z_{PCA} - Z_{sim} for associated tracks;Z_{PCA} - Z_{sim} [cm] ", 100, -0.1, 0.1);
861 
863  "UnassociatedDetId", "Number of MTD cell not associated to any TP per event", 2, 0., 2., 0., 100000., "S");
864  meNTrackingParticles_ = ibook.book1D("NTrackingParticles", "Total #Tracking particles", 2, 0, 2);
866  ibook.book1D("UnassDeposit",
867  "#Tracking particles with deposit over threshold in MTD cell, but with no cell associated to TP;",
868  2,
869  0,
870  2);
872  ibook.book1D("UnassCrysEnergy",
873  "Energy deposit in BTL crystal with no associated SimTracks;log_{10}(Energy [MeV]) ",
874  100,
875  -3.5,
876  1.5);
877  meUnassLgadsEnergy_ = ibook.book1D("UnassLgadsEnergy",
878  "Energy deposit in ETL LGADs with no associated SimTracks;log_{10}(Energy [MeV]) ",
879  100,
880  -3.5,
881  1.5);
882 }
883 
884 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
885 
888 
889  desc.add<std::string>("folder", "MTD/Tracks");
890  desc.add<edm::InputTag>("inputTagG", edm::InputTag("generalTracks"));
891  desc.add<edm::InputTag>("inputTagT", edm::InputTag("trackExtenderWithMTD"));
892  desc.add<edm::InputTag>("inputTagV", edm::InputTag("offlinePrimaryVertices4D"));
893  desc.add<edm::InputTag>("inputTagH", edm::InputTag("generatorSmeared"));
894  desc.add<edm::InputTag>("SimTag", edm::InputTag("mix", "MergedTrackTruth"));
895  desc.add<edm::InputTag>("TPtoRecoTrackAssoc", edm::InputTag("trackingParticleRecoTrackAsssociation"));
896  desc.add<edm::InputTag>("btlSimHits", edm::InputTag("mix", "g4SimHitsFastTimerHitsBarrel"));
897  desc.add<edm::InputTag>("etlSimHits", edm::InputTag("mix", "g4SimHitsFastTimerHitsEndcap"));
898  desc.add<edm::InputTag>("tmtd", edm::InputTag("trackExtenderWithMTD:generalTracktmtd"));
899  desc.add<edm::InputTag>("sigmatmtd", edm::InputTag("trackExtenderWithMTD:generalTracksigmatmtd"));
900  desc.add<edm::InputTag>("t0Src", edm::InputTag("trackExtenderWithMTD:generalTrackt0"));
901  desc.add<edm::InputTag>("sigmat0Src", edm::InputTag("trackExtenderWithMTD:generalTracksigmat0"));
902  desc.add<edm::InputTag>("trackAssocSrc", edm::InputTag("trackExtenderWithMTD:generalTrackassoc"))
903  ->setComment("Association between General and MTD Extended tracks");
904  desc.add<edm::InputTag>("pathLengthSrc", edm::InputTag("trackExtenderWithMTD:generalTrackPathLength"));
905  desc.add<edm::InputTag>("t0SafePID", edm::InputTag("tofPID:t0safe"));
906  desc.add<edm::InputTag>("sigmat0SafePID", edm::InputTag("tofPID:sigmat0safe"));
907  desc.add<edm::InputTag>("sigmat0PID", edm::InputTag("tofPID:sigmat0"));
908  desc.add<edm::InputTag>("t0PID", edm::InputTag("tofPID:t0"));
909  desc.add<edm::InputTag>("trackMVAQual", edm::InputTag("mtdTrackQualityMVA:mtdQualMVA"));
910  desc.add<double>("trackMinimumPt", 0.7); // [GeV]
911  desc.add<double>("trackMaximumBtlEta", 1.5);
912  desc.add<double>("trackMinimumEtlEta", 1.6);
913  desc.add<double>("trackMaximumEtlEta", 3.);
914  desc.addUntracked<bool>("optionalPlots", true);
915 
916  descriptions.add("mtdTracksValid", desc);
917 }
918 
919 const bool MtdTracksValidation::mvaGenSel(const HepMC::GenParticle& gp, const float& charge) {
920  bool match = false;
921  if (gp.status() != 1) {
922  return match;
923  }
924  match = charge != 0.f && gp.momentum().perp() > pTcut_ && std::abs(gp.momentum().eta()) < etacutGEN_;
925  return match;
926 }
927 
929  bool match = false;
930  if (tp.status() != 1) {
931  return match;
932  }
933  auto x_pv = tp.parentVertex()->position().x();
934  auto y_pv = tp.parentVertex()->position().y();
935  auto z_pv = tp.parentVertex()->position().z();
936 
937  auto r_pv = std::sqrt(x_pv * x_pv + y_pv * y_pv);
938 
939  match = tp.charge() != 0 && tp.pt() > pTcut_ && std::abs(tp.eta()) < etacutGEN_ && r_pv < rBTL_ && z_pv < zETL_;
940  return match;
941 }
942 
944  const reco::Vertex& vtx,
945  const double& t0,
946  const double& st0) {
947  bool match = false;
948  match = trk.pt() > pTcut_ && std::abs(trk.eta()) < etacutREC_ &&
949  (std::abs(trk.vz() - vtx.z()) <= deltaZcut_ || vtx.isFake());
950  if (st0 > 0.) {
951  match = match && std::abs(t0 - vtx.t()) < 3. * st0;
952  }
953  return match;
954 }
955 
957  const double& zsim,
958  const reco::TrackBase& trk,
959  const bool& vtxFake) {
960  bool match = false;
961  double dR = reco::deltaR(genP.momentum(), trk.momentum());
962  double genPT = genP.momentum().perp();
963  match = std::abs(genPT - trk.pt()) < trk.pt() * deltaPTcut_ && dR < deltaDRcut_ &&
964  (std::abs(trk.vz() - zsim) < deltaZcut_ || vtxFake);
965  return match;
966 }
967 
969  const double& zsim) {
970  auto found = r2s_->find(recoTrack);
971 
972  // reco track not matched to any TP
973  if (found == r2s_->end())
974  return nullptr;
975 
976  //matched TP equal to any TP associated to signal sim vertex
977  for (const auto& tp : found->val) {
978  if (tp.first->eventId().bunchCrossing() == 0 && tp.first->eventId().event() == 0 &&
979  std::abs(tp.first->parentVertex()->position().z() - zsim) < deltaZcut_) {
980  return &tp.first;
981  }
982  }
983 
984  // reco track not matched to any TP from vertex
985  return nullptr;
986 }
987 
989  const std::unordered_set<unsigned long int>& trkList) {
990  for (const auto& simTrk : tp.g4Tracks()) {
991  for (const auto& mtdTrk : trkList) {
992  if (uniqueId(simTrk.trackId(), simTrk.eventId()) == mtdTrk) {
993  return true;
994  }
995  }
996  }
997  return false;
998 }
999 
MonitorElement * meETLTrackEffEtaTot_[2]
uint8_t geoId(const VFATFrame &frame)
retrieve the GEO information for this channel
edm::EDGetTokenT< edm::ValueMap< int > > trackAssocToken_
static constexpr double etacutGEN_
MonitorElement * meTrackMatchedTPEffEtaMtd_
MonitorElement * meBTLTrackEffPhiMtd_
int getMTDTopologyMode() const
Definition: MTDTopology.h:27
edm::EDGetTokenT< edm::ValueMap< float > > trackMVAQualToken_
edm::EDGetTokenT< edm::ValueMap< float > > pathLengthToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * meMVATrackResTot_
MonitorElement * meTrackNumHits_
MonitorElement * meTrackt0Pid_
int row(unsigned nrows=kCrystalsPerModuleV2) const
Definition: BTLDetId.h:93
static constexpr double pTcut_
MonitorElement * meETLTrackRPTime_
edm::EDGetTokenT< edm::ValueMap< float > > t0SafePidToken_
std::string folder_
edm::EDGetTokenT< edm::ValueMap< float > > t0SrcToken_
static constexpr double rBTL_
MonitorElement * meUnassociatedDetId_
edm::ESGetToken< MTDTopology, MTDTopologyRcd > mtdtopoToken_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
const std::string folder_
edm::EDGetTokenT< edm::HepMCProduct > HepMCProductToken_
HepPDT::ParticleDataTable ParticleDataTable
MonitorElement * meMVATrackMatchedEffEtaMtd_
const bool mvaRecSel(const reco::TrackBase &, const reco::Vertex &, const double &, const double &)
virtual const Topology & topology() const
Definition: GeomDet.cc:67
virtual const PixelTopology & specificTopology() const
MonitorElement * meNTrackingParticles_
static constexpr double etacutREC_
static constexpr double deltaPTcut_
MonitorElement * meBTLTrackPtRes_
edm::EDGetTokenT< std::vector< reco::Vertex > > RecVertexToken_
MonitorElement * meETLTrackEffPtTot_[2]
MonitorElement * meBTLTrackEffEtaMtd_
MonitorElement * meETLTrackEffPhi2Mtd_[2]
Definition: MTDHit.h:4
edm::EDGetTokenT< edm::ValueMap< float > > tmtdToken_
MonitorElement * meMVATrackMatchedEffPtTot_
MonitorElement * meMVATrackEffPtTot_
MonitorElement * meMVATrackEffEtaTot_
const reco::SimToRecoCollection * s2r_
ETLDetId geographicalId() const
Definition: ETLDetId.h:110
const unsigned long int uniqueId(const uint32_t x, const EncodedEventId &y)
LocalPoint pixelToModuleLocalPoint(const LocalPoint &plp, int row, int col) const
MonitorElement * meTrackMatchedTPmtdEffEtaTot_
const reco::RecoToSimCollection * r2s_
const_iterator find(const key_type &k) const
find element with specified reference key
const bool mvaGenSel(const HepMC::GenParticle &, const float &)
const edm::Ref< std::vector< TrackingParticle > > * getMatchedTP(const reco::TrackBaseRef &, const double &)
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
const bool mvaTPSel(const TrackingParticle &)
constexpr NumType convertUnitsTo(double desiredUnits, NumType val)
Definition: GeantUnits.h:73
edm::EDGetTokenT< reco::TrackCollection > GenRecTrackToken_
MonitorElement * meETLTrackEffPhiMtd_[2]
const_iterator end() const
last iterator over the map (read only)
void Fill(long long x)
double pt() const
track transverse momentum
Definition: TrackBase.h:637
edm::EDGetTokenT< reco::TrackCollection > RecTrackToken_
MonitorElement * meBTLTrackEffPhiTot_
int iEvent
Definition: GenABIO.cc:224
MonitorElement * meTrackMatchedTPmtdEffEtaMtd_
MonitorElement * meTrackMatchedTPEffEtaTot_
MonitorElement * meBTLTrackRPTime_
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:661
MonitorElement * meETLTrackEffEta2Mtd_[2]
static constexpr double depositBTLthreshold_
MonitorElement * meETLTrackPtRes_
MonitorElement * meETLTrackEffPt2Mtd_[2]
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:399
MonitorElement * meTrackt0SafePid_
T sqrt(T t)
Definition: SSEVec.h:19
MonitorElement * meBTLTrackEffEtaTot_
static constexpr double deltaZcut_
MonitorElement * meUnassLgadsEnergy_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isETL(const double eta) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int nrows() const override
MonitorElement * meMVATrackMatchedEffEtaTot_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::ValueMap< float > > t0PidToken_
MonitorElement * meTrackMatchedTPEffPtEtl2Mtd_
MonitorElement * meTrackMatchedTPmtdEffPtMtd_
MonitorElement * meTrackMVAQual_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
MonitorElement * meETLTrackEffPhiTot_[2]
int column(unsigned nrows=kCrystalsPerModuleV2) const
Definition: BTLDetId.h:98
ETLDetId::EtlLayout etlLayoutFromTopoMode(const int &topoMode)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
edm::EDGetTokenT< edm::ValueMap< float > > SigmatmtdToken_
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)
Log< level::Info, false > LogInfo
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
Definition: DetId.h:17
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoAssociationToken_
static constexpr double etaMatchCut_
static constexpr double zETL_
static constexpr double depositETLthreshold_
MonitorElement * meTrackMatchedTPEffEtaEtl2Mtd_
unsigned long long uint64_t
Definition: Time.h:13
MonitorElement * meMVATrackPullTot_
MonitorElement * meTrackMatchedTPEffPtMtd_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
double b
Definition: hdecay.h:118
edm::EDGetTokenT< CrossingFrame< PSimHit > > etlSimHitsToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * meTrackSigmat0SafePid_
MonitorElement * meETLTrackEffEtaMtd_[2]
int zside() const
Definition: MTDDetId.h:61
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
MonitorElement * meTrackSigmat0Pid_
edm::EDGetTokenT< CrossingFrame< PSimHit > > btlSimHitsToken_
MonitorElement * meTrackMatchedTPmtdEffPtTot_
MonitorElement * meBTLTrackEffPtMtd_
MonitorElement * meTrackt0Src_
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0PidToken_
static constexpr double deltaDRcut_
MonitorElement * meTracktmtd_
MonitorElement * meBTLTrackEffPtTot_
MonitorElement * meTrackPathLenghtvsEta_
MonitorElement * meTrackMatchedTPEffPtTot_
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
MonitorElement * meUnassDeposit_
HLT enums.
int nDisc() const
Definition: ETLDetId.h:124
double a
Definition: hdecay.h:119
const bool mvaGenRecMatch(const HepMC::GenParticle &, const double &, const reco::TrackBase &, const bool &)
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19
MonitorElement * meUnassCrysEnergy_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:141
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimAssociationToken_
Monte Carlo truth information used for tracking validation.
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0SrcToken_
MonitorElement * meETLTrackEffPtMtd_[2]
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
BTLDetId::CrysLayout crysLayoutFromTopoMode(const int &topoMode)
edm::ESGetToken< MTDGeometry, MTDDigiGeometryRecord > mtdgeoToken_
const bool tpWithMTD(const TrackingParticle &, const std::unordered_set< unsigned long int > &)
std::vector< TrackingParticle > TrackingParticleCollection
MonitorElement * meMVATrackZposResTot_
Log< level::Warning, false > LogWarning
auto makeValid(const U &iOtherHandleType) noexcept(false)
Definition: ValidHandle.h:52
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 * meMVATrackMatchedEffPtMtd_
MonitorElement * meTrackSigmat0Src_
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:3
Definition: Run.h:45
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0SafePidToken_
MtdTracksValidation(const edm::ParameterSet &)
#define LogDebug(id)
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > particleTableToken_