CMS 3D CMS Logo

MtdTracksValidation.cc
Go to the documentation of this file.
1 #include <string>
2 
8 
11 
17 
23 
27 
35 
38 #include "HepMC/GenRanges.h"
39 #include "CLHEP/Units/PhysicalConstants.h"
40 
42 public:
43  explicit MtdTracksValidation(const edm::ParameterSet&);
44  ~MtdTracksValidation() override;
45 
46  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
47 
48 private:
49  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
50 
51  void analyze(const edm::Event&, const edm::EventSetup&) override;
52 
53  const bool mvaGenSel(const HepMC::GenParticle&, const float&);
54  const bool mvaRecSel(const reco::TrackBase&, const reco::Vertex&, const double&, const double&);
55  const bool mvaGenRecMatch(const HepMC::GenParticle&, const double&, const reco::TrackBase&);
56 
57  // ------------ member data ------------
58 
60  const float trackMinPt_;
61  const float trackMaxBtlEta_;
62  const float trackMinEtlEta_;
63  const float trackMaxEtlEta_;
64 
65  static constexpr double etacutGEN_ = 4.; // |eta| < 4;
66  static constexpr double etacutREC_ = 3.; // |eta| < 3;
67  static constexpr double pTcut_ = 0.7; // PT > 0.7 GeV
68  static constexpr double deltaZcut_ = 0.1; // dz separation 1 mm
69  static constexpr double deltaPTcut_ = 0.05; // dPT < 5%
70  static constexpr double deltaDRcut_ = 0.03; // DeltaR separation
71 
75 
77 
80 
90 
93 
102 
111 
122 
132 };
133 
134 // ------------ constructor and destructor --------------
136  : folder_(iConfig.getParameter<std::string>("folder")),
137  trackMinPt_(iConfig.getParameter<double>("trackMinimumPt")),
138  trackMaxBtlEta_(iConfig.getParameter<double>("trackMaximumBtlEta")),
139  trackMinEtlEta_(iConfig.getParameter<double>("trackMinimumEtlEta")),
140  trackMaxEtlEta_(iConfig.getParameter<double>("trackMaximumEtlEta")) {
141  GenRecTrackToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTagG"));
142  RecTrackToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputTagT"));
143  RecVertexToken_ = consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("inputTagV"));
144  HepMCProductToken_ = consumes<edm::HepMCProduct>(iConfig.getParameter<edm::InputTag>("inputTagH"));
145  trackAssocToken_ = consumes<edm::ValueMap<int>>(iConfig.getParameter<edm::InputTag>("trackAssocSrc"));
146  pathLengthToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("pathLengthSrc"));
147  tmtdToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("tmtd"));
148  SigmatmtdToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmatmtd"));
149  t0SrcToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0Src"));
150  Sigmat0SrcToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0Src"));
151  t0PidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0PID"));
152  Sigmat0PidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0PID"));
153  t0SafePidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("t0SafePID"));
154  Sigmat0SafePidToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("sigmat0SafePID"));
155  trackMVAQualToken_ = consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("trackMVAQual"));
156  mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>();
157  particleTableToken_ = esConsumes<HepPDT::ParticleDataTable, edm::DefaultRecord>();
158 }
159 
161 
162 // ------------ method called for each event ------------
164  using namespace edm;
165  using namespace geant_units::operators;
166  using namespace std;
167 
168  auto topologyHandle = iSetup.getTransientHandle(mtdtopoToken_);
169  const MTDTopology* topology = topologyHandle.product();
170 
171  bool topo1Dis = false;
172  bool topo2Dis = false;
173  if (topology->getMTDTopologyMode() <= static_cast<int>(MTDTopologyMode::Mode::barphiflat)) {
174  topo1Dis = true;
175  }
176  if (topology->getMTDTopologyMode() > static_cast<int>(MTDTopologyMode::Mode::barphiflat)) {
177  topo2Dis = true;
178  }
179 
180  auto GenRecTrackHandle = makeValid(iEvent.getHandle(GenRecTrackToken_));
181  auto RecVertexHandle = makeValid(iEvent.getHandle(RecVertexToken_));
182 
183  const auto& tMtd = iEvent.get(tmtdToken_);
184  const auto& SigmatMtd = iEvent.get(SigmatmtdToken_);
185  const auto& t0Src = iEvent.get(t0SrcToken_);
186  const auto& Sigmat0Src = iEvent.get(Sigmat0SrcToken_);
187  const auto& t0Pid = iEvent.get(t0PidToken_);
188  const auto& Sigmat0Pid = iEvent.get(Sigmat0PidToken_);
189  const auto& t0Safe = iEvent.get(t0SafePidToken_);
190  const auto& Sigmat0Safe = iEvent.get(Sigmat0SafePidToken_);
191  const auto& mtdQualMVA = iEvent.get(trackMVAQualToken_);
192  const auto& trackAssoc = iEvent.get(trackAssocToken_);
193  const auto& pathLength = iEvent.get(pathLengthToken_);
194 
195  unsigned int index = 0;
196  // --- Loop over all RECO tracks ---
197  for (const auto& trackGen : *GenRecTrackHandle) {
198  const reco::TrackRef trackref(iEvent.getHandle(GenRecTrackToken_), index);
199  index++;
200 
201  if (trackAssoc[trackref] == -1) {
202  LogInfo("mtdTracks") << "Extended track not associated";
203  continue;
204  }
205 
206  const reco::TrackRef mtdTrackref = reco::TrackRef(iEvent.getHandle(RecTrackToken_), trackAssoc[trackref]);
207  const reco::Track track = *mtdTrackref;
208 
209  if (track.pt() < trackMinPt_ || std::abs(track.eta()) > trackMaxEtlEta_)
210  continue;
211 
212  meTracktmtd_->Fill(tMtd[trackref]);
213  if (std::round(SigmatMtd[trackref] - Sigmat0Pid[trackref]) != 0) {
214  LogWarning("mtdTracks") << "TimeError associated to refitted track is different from TimeError stored in tofPID "
215  "sigmat0 ValueMap: this should not happen";
216  }
217 
218  meTrackt0Src_->Fill(t0Src[trackref]);
219  meTrackSigmat0Src_->Fill(Sigmat0Src[trackref]);
220 
221  meTrackt0Pid_->Fill(t0Pid[trackref]);
222  meTrackSigmat0Pid_->Fill(Sigmat0Pid[trackref]);
223  meTrackt0SafePid_->Fill(t0Safe[trackref]);
224  meTrackSigmat0SafePid_->Fill(Sigmat0Safe[trackref]);
225  meTrackMVAQual_->Fill(mtdQualMVA[trackref]);
226 
227  meTrackPathLenghtvsEta_->Fill(std::abs(track.eta()), pathLength[trackref]);
228 
229  if (std::abs(track.eta()) < trackMaxBtlEta_) {
230  // --- all BTL tracks (with and without hit in MTD) ---
234 
235  bool MTDBtl = false;
236  int numMTDBtlvalidhits = 0;
237  for (const auto hit : track.recHits()) {
238  if (hit->isValid() == false)
239  continue;
240  MTDDetId Hit = hit->geographicalId();
241  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 1)) {
242  MTDBtl = true;
243  numMTDBtlvalidhits++;
244  }
245  }
246  meTrackNumHits_->Fill(numMTDBtlvalidhits);
247 
248  // --- keeping only tracks with last hit in MTD ---
249  if (MTDBtl == true) {
254  meBTLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
255  }
256  } //loop over (geometrical) BTL tracks
257 
258  else {
259  // --- all ETL tracks (with and without hit in MTD) ---
260  if ((track.eta() < -trackMinEtlEta_) && (track.eta() > -trackMaxEtlEta_)) {
261  meETLTrackEffEtaTot_[0]->Fill(track.eta());
262  meETLTrackEffPhiTot_[0]->Fill(track.phi());
263  meETLTrackEffPtTot_[0]->Fill(track.pt());
264  }
265 
266  if ((track.eta() > trackMinEtlEta_) && (track.eta() < trackMaxEtlEta_)) {
267  meETLTrackEffEtaTot_[1]->Fill(track.eta());
268  meETLTrackEffPhiTot_[1]->Fill(track.phi());
269  meETLTrackEffPtTot_[1]->Fill(track.pt());
270  }
271 
272  bool MTDEtlZnegD1 = false;
273  bool MTDEtlZnegD2 = false;
274  bool MTDEtlZposD1 = false;
275  bool MTDEtlZposD2 = false;
276  int numMTDEtlvalidhits = 0;
277  for (const auto hit : track.recHits()) {
278  if (hit->isValid() == false)
279  continue;
280  MTDDetId Hit = hit->geographicalId();
281  if ((Hit.det() == 6) && (Hit.subdetId() == 1) && (Hit.mtdSubDetector() == 2)) {
282  ETLDetId ETLHit = hit->geographicalId();
283 
284  if (topo2Dis) {
285  if ((ETLHit.zside() == -1) && (ETLHit.nDisc() == 1)) {
286  MTDEtlZnegD1 = true;
288  meETLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
289  numMTDEtlvalidhits++;
290  }
291  if ((ETLHit.zside() == -1) && (ETLHit.nDisc() == 2)) {
292  MTDEtlZnegD2 = true;
294  meETLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
295  numMTDEtlvalidhits++;
296  }
297  if ((ETLHit.zside() == 1) && (ETLHit.nDisc() == 1)) {
298  MTDEtlZposD1 = true;
300  meETLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
301  numMTDEtlvalidhits++;
302  }
303  if ((ETLHit.zside() == 1) && (ETLHit.nDisc() == 2)) {
304  MTDEtlZposD2 = true;
306  meETLTrackPtRes_->Fill((trackGen.pt() - track.pt()) / trackGen.pt());
307  numMTDEtlvalidhits++;
308  }
309  }
310 
311  if (topo1Dis) {
312  if (ETLHit.zside() == -1) {
313  MTDEtlZnegD1 = true;
315  numMTDEtlvalidhits++;
316  }
317  if (ETLHit.zside() == 1) {
318  MTDEtlZposD1 = true;
320  numMTDEtlvalidhits++;
321  }
322  }
323  }
324  }
325  meTrackNumHits_->Fill(-numMTDEtlvalidhits);
326 
327  // --- keeping only tracks with last hit in MTD ---
328  if ((track.eta() < -trackMinEtlEta_) && (track.eta() > -trackMaxEtlEta_)) {
329  if ((MTDEtlZnegD1 == true) || (MTDEtlZnegD2 == true)) {
330  meETLTrackEffEtaMtd_[0]->Fill(track.eta());
331  meETLTrackEffPhiMtd_[0]->Fill(track.phi());
332  meETLTrackEffPtMtd_[0]->Fill(track.pt());
333  }
334  }
335  if ((track.eta() > trackMinEtlEta_) && (track.eta() < trackMaxEtlEta_)) {
336  if ((MTDEtlZposD1 == true) || (MTDEtlZposD2 == true)) {
337  meETLTrackEffEtaMtd_[1]->Fill(track.eta());
338  meETLTrackEffPhiMtd_[1]->Fill(track.phi());
339  meETLTrackEffPtMtd_[1]->Fill(track.pt());
340  }
341  }
342  }
343  } //RECO tracks loop
344 
345  const auto& primRecoVtx = *(RecVertexHandle.product()->begin());
346 
347  // generator level information (HepMC format)
348  auto GenEventHandle = makeValid(iEvent.getHandle(HepMCProductToken_));
349  const HepMC::GenEvent* mc = GenEventHandle->GetEvent();
350  double zsim = convertMmToCm((*(mc->vertices_begin()))->position().z());
351  double tsim = (*(mc->vertices_begin()))->position().t() * CLHEP::mm / CLHEP::c_light;
352 
353  auto pdt = iSetup.getHandle(particleTableToken_);
354  const HepPDT::ParticleDataTable* pdTable = pdt.product();
355 
356  // select events with reco vertex close to true simulated primary vertex
357  if (std::abs(primRecoVtx.z() - zsim) < deltaZcut_) {
358  index = 0;
359  for (const auto& trackGen : *GenRecTrackHandle) {
360  const reco::TrackRef trackref(iEvent.getHandle(GenRecTrackToken_), index);
361  index++;
362 
363  // select the reconstructed track
364 
365  if (trackAssoc[trackref] == -1) {
366  continue;
367  }
368 
369  bool noCrack = std::abs(trackGen.eta()) < trackMaxBtlEta_ || std::abs(trackGen.eta()) > trackMinEtlEta_;
370 
371  // reco-gen matching used for MVA quality flag
372  if (mvaRecSel(trackGen, primRecoVtx, t0Safe[trackref], Sigmat0Safe[trackref])) {
373  if (noCrack) {
374  meMVATrackEffPtTot_->Fill(trackGen.pt());
375  }
376  meMVATrackEffEtaTot_->Fill(std::abs(trackGen.eta()));
377 
378  double dZ = trackGen.vz() - zsim;
379  double dT(-9999.);
380  double pullT(-9999.);
381  if (Sigmat0Safe[trackref] != -1.) {
382  dT = t0Safe[trackref] - tsim;
383  pullT = dT / Sigmat0Safe[trackref];
384  }
385  for (const auto& genP : mc->particle_range()) {
386  // select status 1 genParticles and match them to the reconstructed track
387 
388  float charge = pdTable->particle(HepPDT::ParticleID(genP->pdg_id())) != nullptr
389  ? pdTable->particle(HepPDT::ParticleID(genP->pdg_id()))->charge()
390  : 0.f;
391  if (mvaGenSel(*genP, charge)) {
392  if (mvaGenRecMatch(*genP, zsim, trackGen)) {
394  if (noCrack) {
395  meMVATrackMatchedEffPtTot_->Fill(trackGen.pt());
396  }
397  meMVATrackMatchedEffEtaTot_->Fill(std::abs(trackGen.eta()));
398  if (pullT > -9999.) {
399  meMVATrackResTot_->Fill(dT);
400  meMVATrackPullTot_->Fill(pullT);
401  if (noCrack) {
402  meMVATrackMatchedEffPtMtd_->Fill(trackGen.pt());
403  }
404  meMVATrackMatchedEffEtaMtd_->Fill(std::abs(trackGen.eta()));
405  }
406  break;
407  }
408  }
409  }
410  }
411  }
412  }
413 }
414 
415 // ------------ method for histogram booking ------------
417  ibook.setCurrentFolder(folder_);
418 
419  // histogram booking
420  meBTLTrackRPTime_ = ibook.book1D("TrackBTLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3);
421  meBTLTrackEffEtaTot_ = ibook.book1D("TrackBTLEffEtaTot", "Track efficiency vs eta (Tot);#eta_{RECO}", 100, -1.6, 1.6);
423  ibook.book1D("TrackBTLEffPhiTot", "Track efficiency vs phi (Tot);#phi_{RECO} [rad]", 100, -3.2, 3.2);
424  meBTLTrackEffPtTot_ = ibook.book1D("TrackBTLEffPtTot", "Track efficiency vs pt (Tot);pt_{RECO} [GeV]", 50, 0, 10);
425  meBTLTrackEffEtaMtd_ = ibook.book1D("TrackBTLEffEtaMtd", "Track efficiency vs eta (Mtd);#eta_{RECO}", 100, -1.6, 1.6);
427  ibook.book1D("TrackBTLEffPhiMtd", "Track efficiency vs phi (Mtd);#phi_{RECO} [rad]", 100, -3.2, 3.2);
428  meBTLTrackEffPtMtd_ = ibook.book1D("TrackBTLEffPtMtd", "Track efficiency vs pt (Mtd);pt_{RECO} [GeV]", 50, 0, 10);
430  ibook.book1D("TrackBTLPtRes", "Track pT resolution ;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
431  meETLTrackRPTime_ = ibook.book1D("TrackETLRPTime", "Track t0 with respect to R.P.;t0 [ns]", 100, -1, 3);
433  ibook.book1D("TrackETLEffEtaTotZneg", "Track efficiency vs eta (Tot) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
435  ibook.book1D("TrackETLEffEtaTotZpos", "Track efficiency vs eta (Tot) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
437  ibook.book1D("TrackETLEffPhiTotZneg", "Track efficiency vs phi (Tot) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
439  ibook.book1D("TrackETLEffPhiTotZpos", "Track efficiency vs phi (Tot) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
441  ibook.book1D("TrackETLEffPtTotZneg", "Track efficiency vs pt (Tot) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
443  ibook.book1D("TrackETLEffPtTotZpos", "Track efficiency vs pt (Tot) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
445  ibook.book1D("TrackETLEffEtaMtdZneg", "Track efficiency vs eta (Mtd) (-Z);#eta_{RECO}", 100, -3.2, -1.4);
447  ibook.book1D("TrackETLEffEtaMtdZpos", "Track efficiency vs eta (Mtd) (+Z);#eta_{RECO}", 100, 1.4, 3.2);
449  ibook.book1D("TrackETLEffPhiMtdZneg", "Track efficiency vs phi (Mtd) (-Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
451  ibook.book1D("TrackETLEffPhiMtdZpos", "Track efficiency vs phi (Mtd) (+Z);#phi_{RECO} [rad]", 100, -3.2, 3.2);
453  ibook.book1D("TrackETLEffPtMtdZneg", "Track efficiency vs pt (Mtd) (-Z);pt_{RECO} [GeV]", 50, 0, 10);
455  ibook.book1D("TrackETLEffPtMtdZpos", "Track efficiency vs pt (Mtd) (+Z);pt_{RECO} [GeV]", 50, 0, 10);
457  ibook.book1D("TrackETLPtRes", "Track pT resolution;pT_{Gentrack}-pT_{MTDtrack}/pT_{Gentrack} ", 100, -0.1, 0.1);
458 
459  meTracktmtd_ = ibook.book1D("Tracktmtd", "Track time from TrackExtenderWithMTD;tmtd [ns]", 150, 1, 16);
460  meTrackt0Src_ = ibook.book1D("Trackt0Src", "Track time from TrackExtenderWithMTD;t0Src [ns]", 100, -1.5, 1.5);
462  ibook.book1D("TrackSigmat0Src", "Time Error from TrackExtenderWithMTD; #sigma_{t0Src} [ns]", 100, 0, 0.1);
463 
464  meTrackt0Pid_ = ibook.book1D("Trackt0Pid", "Track t0 as stored in TofPid;t0 [ns]", 100, -1, 1);
465  meTrackSigmat0Pid_ = ibook.book1D("TrackSigmat0Pid", "Sigmat0 as stored in TofPid; #sigma_{t0} [ns]", 100, 0, 0.1);
466  meTrackt0SafePid_ = ibook.book1D("Trackt0SafePID", "Track t0 Safe as stored in TofPid;t0 [ns]", 100, -1, 1);
468  ibook.book1D("TrackSigmat0SafePID", "Sigmat0 Safe as stored in TofPid; #sigma_{t0} [ns]", 100, 0, 0.1);
469  meTrackNumHits_ = ibook.book1D("TrackNumHits", "Number of valid MTD hits per track ; Number of hits", 10, -5, 5);
470  meTrackMVAQual_ = ibook.book1D("TrackMVAQual", "Track MVA Quality as stored in Value Map ; MVAQual", 100, 0, 1);
472  "TrackPathLenghtvsEta", "MTD Track pathlength vs MTD track Eta;|#eta|;Pathlength", 100, 0, 3.2, 100.0, 400.0, "S");
473  meMVATrackEffPtTot_ = ibook.book1D("MVAEffPtTot", "Pt of tracks associated to LV; track pt [GeV] ", 110, 0., 11.);
475  ibook.book1D("MVAMatchedEffPtTot", "Pt of tracks associated to LV matched to GEN; track pt [GeV] ", 110, 0., 11.);
477  "MVAMatchedEffPtMtd", "Pt of tracks associated to LV matched to GEN with time; track pt [GeV] ", 110, 0., 11.);
478  meMVATrackEffEtaTot_ = ibook.book1D("MVAEffEtaTot", "Pt of tracks associated to LV; track eta ", 66, 0., 3.3);
480  ibook.book1D("MVAMatchedEffEtaTot", "Pt of tracks associated to LV matched to GEN; track eta ", 66, 0., 3.3);
482  "MVAMatchedEffEtaMtd", "Pt of tracks associated to LV matched to GEN with time; track eta ", 66, 0., 3.3);
483  meMVATrackResTot_ = ibook.book1D(
484  "MVATrackRes", "t_{rec} - t_{sim} for LV associated tracks; t_{rec} - t_{sim} [ns] ", 120, -0.15, 0.15);
486  ibook.book1D("MVATrackPull", "Pull for associated tracks; (t_{rec}-t_{sim})/#sigma_{t}", 50, -5., 5.);
488  "MVATrackZposResTot", "Z_{PCA} - Z_{sim} for associated tracks;Z_{PCA} - Z_{sim} [cm] ", 100, -0.1, 0.1);
489 }
490 
491 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
492 
495 
496  desc.add<std::string>("folder", "MTD/Tracks");
497  desc.add<edm::InputTag>("inputTagG", edm::InputTag("generalTracks"));
498  desc.add<edm::InputTag>("inputTagT", edm::InputTag("trackExtenderWithMTD"));
499  desc.add<edm::InputTag>("inputTagV", edm::InputTag("offlinePrimaryVertices4D"));
500  desc.add<edm::InputTag>("inputTagH", edm::InputTag("generatorSmeared"));
501  desc.add<edm::InputTag>("tmtd", edm::InputTag("trackExtenderWithMTD:generalTracktmtd"));
502  desc.add<edm::InputTag>("sigmatmtd", edm::InputTag("trackExtenderWithMTD:generalTracksigmatmtd"));
503  desc.add<edm::InputTag>("t0Src", edm::InputTag("trackExtenderWithMTD:generalTrackt0"));
504  desc.add<edm::InputTag>("sigmat0Src", edm::InputTag("trackExtenderWithMTD:generalTracksigmat0"));
505  desc.add<edm::InputTag>("trackAssocSrc", edm::InputTag("trackExtenderWithMTD:generalTrackassoc"))
506  ->setComment("Association between General and MTD Extended tracks");
507  desc.add<edm::InputTag>("pathLengthSrc", edm::InputTag("trackExtenderWithMTD:generalTrackPathLength"));
508  desc.add<edm::InputTag>("t0SafePID", edm::InputTag("tofPID:t0safe"));
509  desc.add<edm::InputTag>("sigmat0SafePID", edm::InputTag("tofPID:sigmat0safe"));
510  desc.add<edm::InputTag>("sigmat0PID", edm::InputTag("tofPID:sigmat0"));
511  desc.add<edm::InputTag>("t0PID", edm::InputTag("tofPID:t0"));
512  desc.add<edm::InputTag>("trackMVAQual", edm::InputTag("mtdTrackQualityMVA:mtdQualMVA"));
513  desc.add<double>("trackMinimumPt", 0.7); // [GeV]
514  desc.add<double>("trackMaximumBtlEta", 1.5);
515  desc.add<double>("trackMinimumEtlEta", 1.6);
516  desc.add<double>("trackMaximumEtlEta", 3.);
517 
518  descriptions.add("mtdTracksValid", desc);
519 }
520 
521 const bool MtdTracksValidation::mvaGenSel(const HepMC::GenParticle& gp, const float& charge) {
522  bool match = false;
523  if (gp.status() != 1) {
524  return match;
525  }
526  match = charge != 0.f && gp.momentum().perp() > pTcut_ && std::abs(gp.momentum().eta()) < etacutGEN_;
527  return match;
528 }
529 
531  const reco::Vertex& vtx,
532  const double& t0,
533  const double& st0) {
534  bool match = false;
535  match = trk.pt() > pTcut_ && std::abs(trk.eta()) < etacutREC_ && std::abs(trk.vz() - vtx.z()) <= deltaZcut_;
536  if (st0 > 0.) {
537  match = match && std::abs(t0 - vtx.t()) < 3. * st0;
538  }
539  return match;
540 }
541 
543  const double& zsim,
544  const reco::TrackBase& trk) {
545  bool match = false;
546  double dR = reco::deltaR(genP.momentum(), trk.momentum());
547  double genPT = genP.momentum().perp();
548  match =
549  std::abs(genPT - trk.pt()) < trk.pt() * deltaPTcut_ && dR < deltaDRcut_ && std::abs(trk.vz() - zsim) < deltaZcut_;
550  return match;
551 }
552 
MonitorElement * meETLTrackEffEtaTot_[2]
edm::EDGetTokenT< edm::ValueMap< int > > trackAssocToken_
static constexpr double etacutGEN_
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_
static constexpr double pTcut_
MonitorElement * meETLTrackRPTime_
edm::EDGetTokenT< edm::ValueMap< float > > t0SafePidToken_
std::string folder_
edm::EDGetTokenT< edm::ValueMap< float > > t0SrcToken_
edm::ESGetToken< MTDTopology, MTDTopologyRcd > mtdtopoToken_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
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 &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
static constexpr double etacutREC_
static constexpr double deltaPTcut_
MonitorElement * meBTLTrackPtRes_
edm::EDGetTokenT< std::vector< reco::Vertex > > RecVertexToken_
MonitorElement * meETLTrackEffPtTot_[2]
MonitorElement * meBTLTrackEffEtaMtd_
edm::EDGetTokenT< edm::ValueMap< float > > tmtdToken_
MonitorElement * meMVATrackMatchedEffPtTot_
MonitorElement * meMVATrackEffPtTot_
MonitorElement * meMVATrackEffEtaTot_
const bool mvaGenSel(const HepMC::GenParticle &, const float &)
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
edm::EDGetTokenT< reco::TrackCollection > GenRecTrackToken_
MonitorElement * meETLTrackEffPhiMtd_[2]
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 * meBTLTrackRPTime_
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:661
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:399
MonitorElement * meTrackt0SafePid_
MonitorElement * meBTLTrackEffEtaTot_
static constexpr double deltaZcut_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * meMVATrackMatchedEffEtaTot_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< edm::ValueMap< float > > t0PidToken_
MonitorElement * meTrackMVAQual_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
MonitorElement * meETLTrackEffPhiTot_[2]
edm::EDGetTokenT< edm::ValueMap< float > > SigmatmtdToken_
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Info, false > LogInfo
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
MonitorElement * meMVATrackPullTot_
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
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_
MonitorElement * meBTLTrackEffPtMtd_
MonitorElement * meTrackt0Src_
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0PidToken_
static constexpr double deltaDRcut_
MonitorElement * meTracktmtd_
MonitorElement * meBTLTrackEffPtTot_
MonitorElement * meTrackPathLenghtvsEta_
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
HLT enums.
int nDisc() const
Definition: ETLDetId.h:122
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:162
const bool mvaGenRecMatch(const HepMC::GenParticle &, const double &, const reco::TrackBase &)
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
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_
Definition: Run.h:45
edm::EDGetTokenT< edm::ValueMap< float > > Sigmat0SafePidToken_
MtdTracksValidation(const edm::ParameterSet &)
edm::ESGetToken< HepPDT::ParticleDataTable, edm::DefaultRecord > particleTableToken_