CMS 3D CMS Logo

MTVHistoProducerAlgoForTracker.cc
Go to the documentation of this file.
4 
9 
11 
12 #include "TMath.h"
13 #include <TF1.h>
14 #include <cassert>
15 
16 using namespace std;
17 
18 namespace {
20 
21  void BinLogX(TH1* h) {
22  TAxis* axis = h->GetXaxis();
23  int bins = axis->GetNbins();
24 
25  float from = axis->GetXmin();
26  float to = axis->GetXmax();
27  float width = (to - from) / bins;
28  std::vector<float> new_bins(bins + 1, 0);
29 
30  for (int i = 0; i <= bins; i++) {
31  new_bins[i] = TMath::Power(10, from + i * width);
32  }
33  axis->Set(bins, new_bins.data());
34  }
35 
36  void BinLogY(TH1* h) {
37  TAxis* axis = h->GetYaxis();
38  int bins = axis->GetNbins();
39 
40  float from = axis->GetXmin();
41  float to = axis->GetXmax();
42  float width = (to - from) / bins;
43  std::vector<float> new_bins(bins + 1, 0);
44 
45  for (int i = 0; i <= bins; i++) {
46  new_bins[i] = TMath::Power(10, from + i * width);
47  }
48  axis->Set(bins, new_bins.data());
49  }
50 
51  template <typename... Args>
52  dqm::reco::MonitorElement* make1DIfLogX(DQMStore::IBooker& ibook, bool logx, Args&&... args) {
53  auto h = std::make_unique<TH1F>(std::forward<Args>(args)...);
54  if (logx)
55  BinLogX(h.get());
56  const auto& name = h->GetName();
57  return ibook.book1D(name, h.release());
58  }
59 
60  template <typename... Args>
61  dqm::reco::MonitorElement* makeProfileIfLogX(DQMStore::IBooker& ibook, bool logx, Args&&... args) {
62  auto h = std::make_unique<TProfile>(std::forward<Args>(args)...);
63  if (logx)
64  BinLogX(h.get());
65  const auto& name = h->GetName();
66  return ibook.bookProfile(name, h.release());
67  }
68 
69  template <typename... Args>
70  dqm::reco::MonitorElement* make2DIfLogX(DQMStore::IBooker& ibook, bool logx, Args&&... args) {
71  auto h = std::make_unique<TH2F>(std::forward<Args>(args)...);
72  if (logx)
73  BinLogX(h.get());
74  const auto& name = h->GetName();
75  return ibook.book2D(name, h.release());
76  }
77 
78  template <typename... Args>
79  dqm::reco::MonitorElement* make2DIfLogY(DQMStore::IBooker& ibook, bool logy, Args&&... args) {
80  auto h = std::make_unique<TH2F>(std::forward<Args>(args)...);
81  if (logy)
82  BinLogY(h.get());
83  const auto& name = h->GetName();
84  return ibook.book2D(name, h.release());
85  }
86 
87  void setBinLabels(dqm::reco::MonitorElement*& h, const std::vector<std::string>& labels) {
88  for (size_t i = 0; i < labels.size(); ++i) {
89  h->setBinLabel(i + 1, labels[i]);
90  }
91  h->disableAlphanumeric();
92  }
93 
94  void setBinLabelsAlgo(dqm::reco::MonitorElement*& h, int axis = 1) {
95  for (size_t i = 0; i < reco::TrackBase::algoSize; ++i) {
96  h->setBinLabel(i + 1, reco::TrackBase::algoName(static_cast<reco::TrackBase::TrackAlgorithm>(i)), axis);
97  }
98  h->disableAlphanumeric();
99  }
100 
101  void fillMVAHistos(const std::vector<dqm::reco::MonitorElement*>& h_mva,
102  const std::vector<dqm::reco::MonitorElement*>& h_mvacut,
103  const std::vector<dqm::reco::MonitorElement*>& h_mva_hp,
104  const std::vector<dqm::reco::MonitorElement*>& h_mvacut_hp,
105  const std::vector<float>& mvas,
106  unsigned int selectsLoose,
107  unsigned int selectsHP) {
108  // Fill MVA1 histos with all tracks, MVA2 histos only with tracks
109  // not selected by MVA1, etc.
110  for (size_t i = 0; i < mvas.size(); ++i) {
111  if (i <= selectsLoose) {
112  h_mva[i]->Fill(mvas[i]);
113  h_mvacut[i]->Fill(mvas[i]);
114  }
115  if (i >= 1 && i <= selectsHP) {
116  h_mva_hp[i]->Fill(mvas[i]);
117  h_mvacut_hp[i]->Fill(mvas[i]);
118  }
119  }
120  }
121 
122  void fillMVAHistos(double xval,
123  const std::vector<dqm::reco::MonitorElement*>& h_mva,
124  const std::vector<dqm::reco::MonitorElement*>& h_mva_hp,
125  const std::vector<float>& mvas,
126  unsigned int selectsLoose,
127  unsigned int selectsHP) {
128  // Fill MVA1 histos with all tracks, MVA2 histos only with tracks
129  // not selected by MVA1, etc.
130  for (size_t i = 0; i < mvas.size(); ++i) {
131  if (i <= selectsLoose) {
132  h_mva[i]->Fill(xval, mvas[i]);
133  }
134  if (i >= 1 && i <= selectsHP) {
135  h_mva_hp[i]->Fill(xval, mvas[i]);
136  }
137  }
138  }
139 } // namespace
140 
142  : doSeedPlots_(doSeedPlots),
143  doMTDPlots_(pset.getUntrackedParameter<bool>("doMTDPlots")),
144  doDzPVcutPlots_(pset.getUntrackedParameter<bool>("doDzPVcutPlots")) {
145  //parameters for _vs_eta plots
146  minEta = pset.getParameter<double>("minEta");
147  maxEta = pset.getParameter<double>("maxEta");
148  nintEta = pset.getParameter<int>("nintEta");
149  useFabsEta = pset.getParameter<bool>("useFabsEta");
150 
151  //parameters for _vs_pt plots
152  minPt = pset.getParameter<double>("minPt");
153  maxPt = pset.getParameter<double>("maxPt");
154  nintPt = pset.getParameter<int>("nintPt");
155  useInvPt = pset.getParameter<bool>("useInvPt");
156  useLogPt = pset.getUntrackedParameter<bool>("useLogPt", false);
157 
158  //parameters for _vs_Hit plots
159  minHit = pset.getParameter<double>("minHit");
160  maxHit = pset.getParameter<double>("maxHit");
161  nintHit = pset.getParameter<int>("nintHit");
162 
163  //parameters for _vs_Pu plots
164  minPu = pset.getParameter<double>("minPu");
165  maxPu = pset.getParameter<double>("maxPu");
166  nintPu = pset.getParameter<int>("nintPu");
167 
168  //parameters for _vs_Layer plots
169  minLayers = pset.getParameter<double>("minLayers");
170  maxLayers = pset.getParameter<double>("maxLayers");
171  nintLayers = pset.getParameter<int>("nintLayers");
172 
173  //parameters for _vs_phi plots
174  minPhi = pset.getParameter<double>("minPhi");
175  maxPhi = pset.getParameter<double>("maxPhi");
176  nintPhi = pset.getParameter<int>("nintPhi");
177 
178  //parameters for _vs_Dxy plots
179  minDxy = pset.getParameter<double>("minDxy");
180  maxDxy = pset.getParameter<double>("maxDxy");
181  nintDxy = pset.getParameter<int>("nintDxy");
182 
183  //parameters for _vs_Dz plots
184  minDz = pset.getParameter<double>("minDz");
185  maxDz = pset.getParameter<double>("maxDz");
186  nintDz = pset.getParameter<int>("nintDz");
187 
188  dxyDzZoom = pset.getParameter<double>("dxyDzZoom");
189 
190  //parameters for _vs_ProductionVertexTransvPosition plots
191  minVertpos = pset.getParameter<double>("minVertpos");
192  maxVertpos = pset.getParameter<double>("maxVertpos");
193  nintVertpos = pset.getParameter<int>("nintVertpos");
194  useLogVertpos = pset.getUntrackedParameter<bool>("useLogVertpos");
195 
196  //parameters for _vs_ProductionVertexZPosition plots
197  minZpos = pset.getParameter<double>("minZpos");
198  maxZpos = pset.getParameter<double>("maxZpos");
199  nintZpos = pset.getParameter<int>("nintZpos");
200 
201  //parameters for _vs_dR plots
202  mindr = pset.getParameter<double>("mindr");
203  maxdr = pset.getParameter<double>("maxdr");
204  nintdr = pset.getParameter<int>("nintdr");
205 
206  //parameters for _vs_dR_jet plots
207  mindrj = pset.getParameter<double>("mindrj");
208  maxdrj = pset.getParameter<double>("maxdrj");
209  nintdrj = pset.getParameter<int>("nintdrj");
210 
211  // paramers for _vs_chi2 plots
212  minChi2 = pset.getParameter<double>("minChi2");
213  maxChi2 = pset.getParameter<double>("maxChi2");
214  nintChi2 = pset.getParameter<int>("nintChi2");
215 
216  //parameters for dE/dx plots
217  minDeDx = pset.getParameter<double>("minDeDx");
218  maxDeDx = pset.getParameter<double>("maxDeDx");
219  nintDeDx = pset.getParameter<int>("nintDeDx");
220 
221  //parameters for Pileup plots
222  minVertcount = pset.getParameter<double>("minVertcount");
223  maxVertcount = pset.getParameter<double>("maxVertcount");
224  nintVertcount = pset.getParameter<int>("nintVertcount");
225 
226  //parameters for number of tracks plots
227  minTracks = pset.getParameter<double>("minTracks");
228  maxTracks = pset.getParameter<double>("maxTracks");
229  nintTracks = pset.getParameter<int>("nintTracks");
230 
231  //parameters for vs. PV z plots
232  minPVz = pset.getParameter<double>("minPVz");
233  maxPVz = pset.getParameter<double>("maxPVz");
234  nintPVz = pset.getParameter<int>("nintPVz");
235 
236  //parameters for vs. MVA plots
237  minMVA = pset.getParameter<double>("minMVA");
238  maxMVA = pset.getParameter<double>("maxMVA");
239  nintMVA = pset.getParameter<int>("nintMVA");
240 
241  //parameters for resolution plots
242  ptRes_rangeMin = pset.getParameter<double>("ptRes_rangeMin");
243  ptRes_rangeMax = pset.getParameter<double>("ptRes_rangeMax");
244  ptRes_nbin = pset.getParameter<int>("ptRes_nbin");
245 
246  phiRes_rangeMin = pset.getParameter<double>("phiRes_rangeMin");
247  phiRes_rangeMax = pset.getParameter<double>("phiRes_rangeMax");
248  phiRes_nbin = pset.getParameter<int>("phiRes_nbin");
249 
250  cotThetaRes_rangeMin = pset.getParameter<double>("cotThetaRes_rangeMin");
251  cotThetaRes_rangeMax = pset.getParameter<double>("cotThetaRes_rangeMax");
252  cotThetaRes_nbin = pset.getParameter<int>("cotThetaRes_nbin");
253 
254  dxyRes_rangeMin = pset.getParameter<double>("dxyRes_rangeMin");
255  dxyRes_rangeMax = pset.getParameter<double>("dxyRes_rangeMax");
256  dxyRes_nbin = pset.getParameter<int>("dxyRes_nbin");
257 
258  dzRes_rangeMin = pset.getParameter<double>("dzRes_rangeMin");
259  dzRes_rangeMax = pset.getParameter<double>("dzRes_rangeMax");
260  dzRes_nbin = pset.getParameter<int>("dzRes_nbin");
261 
262  maxDzpvCum = pset.getParameter<double>("maxDzpvCumulative");
263  nintDzpvCum = pset.getParameter<int>("nintDzpvCumulative");
264 
265  //--- tracking particle selectors for efficiency measurements
266  using namespace edm;
267  using namespace reco::modules;
268  auto initTPselector = [&](auto& sel, auto& name) {
269  sel = std::make_unique<TrackingParticleSelector>(
271  };
272  auto initTrackSelector = [&](auto& sel, auto& name) {
274  };
275  auto initGPselector = [&](auto& sel, auto& name) {
276  sel = std::make_unique<GenParticleCustomSelector>(
278  };
279 
280  initTPselector(generalTpSelector, "generalTpSelector");
281  initTPselector(TpSelectorForEfficiencyVsEta, "TpSelectorForEfficiencyVsEta");
282  initTPselector(TpSelectorForEfficiencyVsPhi, "TpSelectorForEfficiencyVsPhi");
283  initTPselector(TpSelectorForEfficiencyVsPt, "TpSelectorForEfficiencyVsPt");
284  initTPselector(TpSelectorForEfficiencyVsVTXR, "TpSelectorForEfficiencyVsVTXR");
285  initTPselector(TpSelectorForEfficiencyVsVTXZ, "TpSelectorForEfficiencyVsVTXZ");
286 
287  initTrackSelector(trackSelectorVsEta, "TpSelectorForEfficiencyVsEta");
288  initTrackSelector(trackSelectorVsPhi, "TpSelectorForEfficiencyVsPhi");
289  initTrackSelector(trackSelectorVsPt, "TpSelectorForEfficiencyVsPt");
290 
291  initGPselector(generalGpSelector, "generalGpSelector");
292  initGPselector(GpSelectorForEfficiencyVsEta, "GpSelectorForEfficiencyVsEta");
293  initGPselector(GpSelectorForEfficiencyVsPhi, "GpSelectorForEfficiencyVsPhi");
294  initGPselector(GpSelectorForEfficiencyVsPt, "GpSelectorForEfficiencyVsPt");
295  initGPselector(GpSelectorForEfficiencyVsVTXR, "GpSelectorForEfficiencyVsVTXR");
296  initGPselector(GpSelectorForEfficiencyVsVTXZ, "GpSelectorForEfficiencyVsVTXZ");
297 
298  // SeedingLayerSets
299  // If enabled, use last bin to denote other or unknown cases
300  seedingLayerSetNames = pset.getParameter<std::vector<std::string>>("seedingLayerSets");
301  std::vector<std::pair<SeedingLayerSetId, std::string>> stripPairSets;
302  if (!seedingLayerSetNames.empty()) {
303  std::vector<std::vector<std::string>> layerSets = SeedingLayerSetsBuilder::layerNamesInSets(seedingLayerSetNames);
304  for (size_t i = 0; i < layerSets.size(); ++i) {
305  const auto& layerSet = layerSets[i];
306  if (layerSet.size() > std::tuple_size<SeedingLayerSetId>::value) {
307  throw cms::Exception("Configuration")
308  << "Got seedingLayerSet " << seedingLayerSetNames[i] << " with " << layerSet.size()
309  << " elements, but I have a hard-coded maximum of " << std::tuple_size<SeedingLayerSetId>::value
310  << ". Please increase the maximum in MTVHistoProducerAlgoForTracker.h";
311  }
312  SeedingLayerSetId setId;
313  for (size_t j = 0; j < layerSet.size(); ++j) {
314  // SeedingLayerSetsBuilder::fillDescriptions() kind-of
315  // suggests that the 'M' prefix stands for strip mono hits
316  // (maybe it should force), so making the assumption here is
317  // (still) a bit ugly. But, this is the easiest way.
318  bool isStripMono = !layerSet[j].empty() && layerSet[j][0] == 'M';
319  setId[j] = std::make_tuple(SeedingLayerSetsBuilder::nameToEnumId(layerSet[j]), isStripMono);
320  }
321  // Account for the fact that strip triplet seeding may give pairs
322  if (layerSet.size() == 3 && isTrackerStrip(std::get<GeomDetEnumerators::SubDetector>(std::get<0>(setId[0])))) {
323  SeedingLayerSetId pairId;
324  pairId[0] = setId[0];
325  pairId[1] = setId[1];
326  stripPairSets.emplace_back(pairId, layerSet[0] + "+" + layerSet[1]);
327  }
328 
329  auto inserted = seedingLayerSetToBin.insert(std::make_pair(setId, i));
330  if (!inserted.second)
331  throw cms::Exception("Configuration") << "SeedingLayerSet " << seedingLayerSetNames[i]
332  << " is specified twice, while the set list should be unique.";
333  }
334 
335  // Add the "strip pairs from strip triplets" if they don't otherwise exist
336  for (const auto& setIdName : stripPairSets) {
337  auto inserted = seedingLayerSetToBin.insert(std::make_pair(setIdName.first, seedingLayerSetNames.size()));
338  if (inserted.second)
339  seedingLayerSetNames.push_back(setIdName.second);
340  }
341 
342  seedingLayerSetNames.emplace_back("Other/Unknown");
343  }
344 
345  // fix for the LogScale by Ryan
346  if (useLogPt) {
347  maxPt = log10(maxPt);
348  if (minPt > 0) {
349  minPt = log10(minPt);
350  } else {
351  edm::LogWarning("MultiTrackValidator")
352  << "minPt = " << minPt << " <= 0 out of range while requesting log scale. Using minPt = 0.1.";
353  minPt = log10(0.1);
354  }
355  }
356  if (useLogVertpos) {
357  maxVertpos = std::log10(maxVertpos);
358  if (minVertpos > 0) {
359  minVertpos = std::log10(minVertpos);
360  } else {
361  edm::LogWarning("MultiTrackValidator")
362  << "minVertpos = " << minVertpos << " <= 0 out of range while requesting log scale. Using minVertpos = 0.1.";
363  minVertpos = -1;
364  }
365  }
366 }
367 
369 
371  const edm::ParameterSet& pset) {
372  edm::ParameterSet psetTrack;
373  psetTrack.copyForModify(pset);
374  psetTrack.eraseSimpleParameter("minHit");
375  psetTrack.eraseSimpleParameter("signalOnly");
376  psetTrack.eraseSimpleParameter("intimeOnly");
377  psetTrack.eraseSimpleParameter("chargedOnly");
378  psetTrack.eraseSimpleParameter("stableOnly");
379  psetTrack.addParameter("maxChi2", 1e10);
380  psetTrack.addParameter("minHit", 0);
381  psetTrack.addParameter("minPixelHit", 0);
382  psetTrack.addParameter("minLayer", 0);
383  psetTrack.addParameter("min3DLayer", 0);
384  psetTrack.addParameter("quality", std::vector<std::string>{});
385  psetTrack.addParameter("algorithm", std::vector<std::string>{});
386  psetTrack.addParameter("originalAlgorithm", std::vector<std::string>{});
387  psetTrack.addParameter("algorithmMaskContains", std::vector<std::string>{});
388  psetTrack.addParameter("invertRapidityCut", false);
389  psetTrack.addParameter("minPhi", -3.2);
390  psetTrack.addParameter("maxPhi", 3.2);
391  return std::make_unique<RecoTrackSelectorBase>(psetTrack);
392 }
393 
395  histograms.h_ptSIM = make1DIfLogX(ibook, useLogPt, "ptSIM", "generated p_{t}", nintPt, minPt, maxPt);
396  histograms.h_etaSIM = ibook.book1D("etaSIM", "generated pseudorapidity", nintEta, minEta, maxEta);
397  histograms.h_phiSIM = ibook.book1D("phiSIM", "generated phi", nintPhi, minPhi, maxPhi);
398  histograms.h_tracksSIM =
399  ibook.book1D("tracksSIM", "number of simulated tracks", nintTracks, minTracks, maxTracks * 10);
400  histograms.h_vertposSIM =
401  ibook.book1D("vertposSIM", "Transverse position of sim vertices", nintVertpos, minVertpos, maxVertpos);
402  histograms.h_bunchxSIM = ibook.book1D("bunchxSIM", "bunch crossing", 21, -15.5, 5.5);
403 }
404 
407  bool doResolutionPlots) {
408  histograms.h_assoceta.push_back(
409  ibook.book1D("num_assoc(simToReco)_eta", "N of associated tracks (simToReco) vs eta", nintEta, minEta, maxEta));
410  histograms.h_simuleta.push_back(
411  ibook.book1D("num_simul_eta", "N of simulated tracks vs eta", nintEta, minEta, maxEta));
412 
413  histograms.h_assocpT.push_back(make1DIfLogX(
414  ibook, useLogPt, "num_assoc(simToReco)_pT", "N of associated tracks (simToReco) vs pT", nintPt, minPt, maxPt));
415  histograms.h_simulpT.push_back(
416  make1DIfLogX(ibook, useLogPt, "num_simul_pT", "N of simulated tracks vs pT", nintPt, minPt, maxPt));
417 
418  histograms.h_assocpTvseta.push_back(make2DIfLogY(ibook,
419  useLogPt,
420  "num_assoc(simToReco)_pTvseta",
421  "N of associated tracks (simToReco) in (pT-eta) please",
422  nintEta,
423  minEta,
424  maxEta,
425  nintPt,
426  minPt,
427  maxPt));
428  histograms.h_simulpTvseta.push_back(make2DIfLogY(ibook,
429  useLogPt,
430  "num_simul_pTvseta",
431  "N of simulated tracks in (pT-eta) plane",
432  nintEta,
433  minEta,
434  maxEta,
435  nintPt,
436  minPt,
437  maxPt));
438 
439  histograms.h_assochit.push_back(
440  ibook.book1D("num_assoc(simToReco)_hit", "N of associated tracks (simToReco) vs hit", nintHit, minHit, maxHit));
441  histograms.h_simulhit.push_back(
442  ibook.book1D("num_simul_hit", "N of simulated tracks vs hit", nintHit, minHit, maxHit));
443 
444  histograms.h_assoclayer.push_back(ibook.book1D(
445  "num_assoc(simToReco)_layer", "N of associated tracks (simToReco) vs layer", nintLayers, minLayers, maxLayers));
446  histograms.h_simullayer.push_back(
447  ibook.book1D("num_simul_layer", "N of simulated tracks vs layer", nintLayers, minLayers, maxLayers));
448 
449  histograms.h_assocpixellayer.push_back(ibook.book1D("num_assoc(simToReco)_pixellayer",
450  "N of associated tracks (simToReco) vs pixel layer",
451  nintLayers,
452  minLayers,
453  maxLayers));
454  histograms.h_simulpixellayer.push_back(
455  ibook.book1D("num_simul_pixellayer", "N of simulated tracks vs pixel layer", nintLayers, minLayers, maxLayers));
456 
457  histograms.h_assoc3Dlayer.push_back(ibook.book1D("num_assoc(simToReco)_3Dlayer",
458  "N of associated tracks (simToReco) vs 3D layer",
459  nintLayers,
460  minLayers,
461  maxLayers));
462  histograms.h_simul3Dlayer.push_back(
463  ibook.book1D("num_simul_3Dlayer", "N of simulated tracks vs 3D layer", nintLayers, minLayers, maxLayers));
464 
465  histograms.h_assocpu.push_back(
466  ibook.book1D("num_assoc(simToReco)_pu", "N of associated tracks (simToReco) vs pu", nintPu, minPu, maxPu));
467  histograms.h_simulpu.push_back(ibook.book1D("num_simul_pu", "N of simulated tracks vs pu", nintPu, minPu, maxPu));
468 
469  histograms.h_assocphi.push_back(
470  ibook.book1D("num_assoc(simToReco)_phi", "N of associated tracks (simToReco) vs phi", nintPhi, minPhi, maxPhi));
471  histograms.h_simulphi.push_back(
472  ibook.book1D("num_simul_phi", "N of simulated tracks vs phi", nintPhi, minPhi, maxPhi));
473 
474  histograms.h_assocdxy.push_back(
475  ibook.book1D("num_assoc(simToReco)_dxy", "N of associated tracks (simToReco) vs dxy", nintDxy, minDxy, maxDxy));
476  histograms.h_simuldxy.push_back(
477  ibook.book1D("num_simul_dxy", "N of simulated tracks vs dxy", nintDxy, minDxy, maxDxy));
478 
479  histograms.h_assocdz.push_back(
480  ibook.book1D("num_assoc(simToReco)_dz", "N of associated tracks (simToReco) vs dz", nintDz, minDz, maxDz));
481  histograms.h_simuldz.push_back(ibook.book1D("num_simul_dz", "N of simulated tracks vs dz", nintDz, minDz, maxDz));
482 
483  histograms.h_assocvertpos.push_back(make1DIfLogX(ibook,
485  "num_assoc(simToReco)_vertpos",
486  "N of associated tracks (simToReco) vs transverse vert position",
487  nintVertpos,
488  minVertpos,
489  maxVertpos));
490  histograms.h_simulvertpos.push_back(make1DIfLogX(ibook,
492  "num_simul_vertpos",
493  "N of simulated tracks vs transverse vert position",
494  nintVertpos,
495  minVertpos,
496  maxVertpos));
497 
498  histograms.h_assoczpos.push_back(ibook.book1D(
499  "num_assoc(simToReco)_zpos", "N of associated tracks (simToReco) vs z vert position", nintZpos, minZpos, maxZpos));
500  histograms.h_simulzpos.push_back(
501  ibook.book1D("num_simul_zpos", "N of simulated tracks vs z vert position", nintZpos, minZpos, maxZpos));
502 
503  histograms.h_assocdr.push_back(make1DIfLogX(ibook,
504  true,
505  "num_assoc(simToReco)_dr",
506  "N of associated tracks (simToReco) vs dR",
507  nintdr,
508  log10(mindr),
509  log10(maxdr)));
510  histograms.h_simuldr.push_back(
511  make1DIfLogX(ibook, true, "num_simul_dr", "N of simulated tracks vs dR", nintdr, log10(mindr), log10(maxdr)));
512 
513  histograms.h_assocdrj.push_back(make1DIfLogX(ibook,
514  true,
515  "num_assoc(simToReco)_drj",
516  "N of associated tracks (simToReco) vs dR(TP,jet)",
517  nintdrj,
518  log10(mindrj),
519  log10(maxdrj)));
520  histograms.h_simuldrj.push_back(make1DIfLogX(
521  ibook, true, "num_simul_drj", "N of simulated tracks vs dR(TP,jet)", nintdrj, log10(mindrj), log10(maxdrj)));
522 
523  histograms.h_simul_simpvz.push_back(
524  ibook.book1D("num_simul_simpvz", "N of simulated tracks vs. sim PV z", nintPVz, minPVz, maxPVz));
525  histograms.h_assoc_simpvz.push_back(ibook.book1D(
526  "num_assoc(simToReco)_simpvz", "N of associated tracks (simToReco) vs. sim PV z", nintPVz, minPVz, maxPVz));
527 
528  histograms.nrecHit_vs_nsimHit_sim2rec.push_back(doResolutionPlots ? ibook.book2D("nrecHit_vs_nsimHit_sim2rec",
529  "nrecHit vs nsimHit (Sim2RecAssoc)",
530  nintHit,
531  minHit,
532  maxHit,
533  nintHit,
534  minHit,
535  maxHit)
536  : nullptr);
537 
538  // TODO: use the dynamic track algo priority order also here
539  constexpr auto nalgos = reco::TrackBase::algoSize;
540  histograms.h_duplicates_oriAlgo_vs_oriAlgo.push_back(ibook.book2D("duplicates_oriAlgo_vs_oriAlgo",
541  "Duplicate tracks: originalAlgo vs originalAlgo",
542  nalgos,
543  0,
544  nalgos,
545  nalgos,
546  0,
547  nalgos));
548  setBinLabelsAlgo(histograms.h_duplicates_oriAlgo_vs_oriAlgo.back(), 1);
549  setBinLabelsAlgo(histograms.h_duplicates_oriAlgo_vs_oriAlgo.back(), 2);
550 }
551 
553  histograms.h_assocdxypv.push_back(ibook.book1D(
554  "num_assoc(simToReco)_dxypv", "N of associated tracks (simToReco) vs dxy(PV)", nintDxy, minDxy, maxDxy));
555  histograms.h_simuldxypv.push_back(
556  ibook.book1D("num_simul_dxypv", "N of simulated tracks vs dxy(PV)", nintDxy, minDxy, maxDxy));
557 
558  histograms.h_assocdzpv.push_back(
559  ibook.book1D("num_assoc(simToReco)_dzpv", "N of associated tracks (simToReco) vs dz(PV)", nintDz, minDz, maxDz));
560  histograms.h_simuldzpv.push_back(
561  ibook.book1D("num_simul_dzpv", "N of simulated tracks vs dz(PV)", nintDz, minDz, maxDz));
562 
563  histograms.h_assocdxypvzoomed.push_back(ibook.book1D("num_assoc(simToReco)_dxypv_zoomed",
564  "N of associated tracks (simToReco) vs dxy(PV)",
565  nintDxy,
566  minDxy / dxyDzZoom,
567  maxDxy / dxyDzZoom));
568  histograms.h_simuldxypvzoomed.push_back(ibook.book1D(
569  "num_simul_dxypv_zoomed", "N of simulated tracks vs dxy(PV)", nintDxy, minDxy / dxyDzZoom, maxDxy / dxyDzZoom));
570 
571  histograms.h_assocdzpvzoomed.push_back(ibook.book1D("num_assoc(simToReco)_dzpv_zoomed",
572  "N of associated tracks (simToReco) vs dz(PV)",
573  nintDz,
574  minDz / dxyDzZoom,
575  maxDz / dxyDzZoom));
576  histograms.h_simuldzpvzoomed.push_back(ibook.book1D(
577  "num_simul_dzpv_zoomed", "N of simulated tracks vs dz(PV)", nintDz, minDz / dxyDzZoom, maxDz / dxyDzZoom));
578 
579  if (doDzPVcutPlots_) {
580  histograms.h_assoc_dzpvcut.push_back(ibook.book1D(
581  "num_assoc(simToReco)_dzpvcut", "N of associated tracks (simToReco) vs dz(PV)", nintDzpvCum, 0, maxDzpvCum));
582  histograms.h_simul_dzpvcut.push_back(
583  ibook.book1D("num_simul_dzpvcut", "N of simulated tracks from sim PV", nintDzpvCum, 0, maxDzpvCum));
584  histograms.h_simul2_dzpvcut.push_back(ibook.book1D("num_simul2_dzpvcut",
585  "N of simulated tracks (associated to any track) from sim PV",
586  nintDzpvCum,
587  0,
588  maxDzpvCum));
589  }
590 }
591 
594  bool doResolutionPlots) {
595  histograms.h_tracks.push_back(
596  ibook.book1D("tracks", "number of reconstructed tracks", nintTracks, minTracks, maxTracks));
597  histograms.h_fakes.push_back(ibook.book1D("fakes", "number of fake reco tracks", nintTracks, minTracks, maxTracks));
598  histograms.h_charge.push_back(ibook.book1D("charge", "charge", 3, -1.5, 1.5));
599 
600  histograms.h_hits.push_back(ibook.book1D("hits", "number of hits per track", nintHit, minHit, maxHit));
601  histograms.h_losthits.push_back(ibook.book1D("losthits", "number of lost hits per track", nintHit, minHit, maxHit));
602  histograms.h_nchi2.push_back(ibook.book1D("chi2", "normalized #chi^{2}", 200, 0, 20));
603  histograms.h_nchi2_prob.push_back(ibook.book1D("chi2_prob", "normalized #chi^{2} probability", 100, 0, 1));
604 
605  histograms.h_nmisslayers_inner.push_back(
606  ibook.book1D("missing_inner_layers", "number of missing inner layers", nintLayers, minLayers, maxLayers));
607  histograms.h_nmisslayers_outer.push_back(
608  ibook.book1D("missing_outer_layers", "number of missing outer layers", nintLayers, minLayers, maxLayers));
609 
610  histograms.h_algo.push_back(
611  ibook.book1D("h_algo", "Tracks by algo", reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize)));
612  for (size_t ibin = 0; ibin < reco::TrackBase::algoSize - 1; ibin++)
613  histograms.h_algo.back()->setBinLabel(ibin + 1, reco::TrackBase::algoNames[ibin]);
614  histograms.h_algo.back()->disableAlphanumeric();
615 
617  histograms.h_recoeta.push_back(ibook.book1D("num_reco_eta", "N of reco track vs eta", nintEta, minEta, maxEta));
618  histograms.h_reco2eta.push_back(
619  ibook.book1D("num_reco2_eta", "N of selected reco track vs eta", nintEta, minEta, maxEta));
620  histograms.h_assoc2eta.push_back(
621  ibook.book1D("num_assoc(recoToSim)_eta", "N of associated (recoToSim) tracks vs eta", nintEta, minEta, maxEta));
622  histograms.h_loopereta.push_back(ibook.book1D(
623  "num_duplicate_eta", "N of associated (recoToSim) duplicate tracks vs eta", nintEta, minEta, maxEta));
624  if (!doSeedPlots_)
625  histograms.h_misideta.push_back(ibook.book1D(
626  "num_chargemisid_eta", "N of associated (recoToSim) charge misIDed tracks vs eta", nintEta, minEta, maxEta));
627  histograms.h_pileupeta.push_back(
628  ibook.book1D("num_pileup_eta", "N of associated (recoToSim) pileup tracks vs eta", nintEta, minEta, maxEta));
629  //
630  histograms.h_recopT.push_back(
631  make1DIfLogX(ibook, useLogPt, "num_reco_pT", "N of reco track vs pT", nintPt, minPt, maxPt));
632  histograms.h_reco2pT.push_back(
633  make1DIfLogX(ibook, useLogPt, "num_reco2_pT", "N of selected reco track vs pT", nintPt, minPt, maxPt));
634  histograms.h_assoc2pT.push_back(make1DIfLogX(
635  ibook, useLogPt, "num_assoc(recoToSim)_pT", "N of associated (recoToSim) tracks vs pT", nintPt, minPt, maxPt));
636  histograms.h_looperpT.push_back(make1DIfLogX(
637  ibook, useLogPt, "num_duplicate_pT", "N of associated (recoToSim) duplicate tracks vs pT", nintPt, minPt, maxPt));
638  if (!doSeedPlots_)
639  histograms.h_misidpT.push_back(make1DIfLogX(ibook,
640  useLogPt,
641  "num_chargemisid_pT",
642  "N of associated (recoToSim) charge misIDed tracks vs pT",
643  nintPt,
644  minPt,
645  maxPt));
646  histograms.h_pileuppT.push_back(make1DIfLogX(
647  ibook, useLogPt, "num_pileup_pT", "N of associated (recoToSim) pileup tracks vs pT", nintPt, minPt, maxPt));
648  //
649  histograms.h_recopTvseta.push_back(make2DIfLogY(ibook,
650  useLogPt,
651  "num_reco_pTvseta",
652  "N of reco track in (pT-eta) plane",
653  nintEta,
654  minEta,
655  maxEta,
656  nintPt,
657  minPt,
658  maxPt));
659  histograms.h_reco2pTvseta.push_back(make2DIfLogY(ibook,
660  useLogPt,
661  "num_reco2_pTvseta",
662  "N of selected reco track in (pT-eta) plane",
663  nintEta,
664  minEta,
665  maxEta,
666  nintPt,
667  minPt,
668  maxPt));
669  histograms.h_assoc2pTvseta.push_back(make2DIfLogY(ibook,
670  useLogPt,
671  "num_assoc(recoToSim)_pTvseta",
672  "N of associated (recoToSim) tracks in (pT-eta) plane",
673  nintEta,
674  minEta,
675  maxEta,
676  nintPt,
677  minPt,
678  maxPt));
679  histograms.h_looperpTvseta.push_back(make2DIfLogY(ibook,
680  useLogPt,
681  "num_duplicate_pTvseta",
682  "N of associated (recoToSim) duplicate tracks in (pT-eta) plane",
683  nintEta,
684  minEta,
685  maxEta,
686  nintPt,
687  minPt,
688  maxPt));
689  if (!doSeedPlots_)
690  histograms.h_misidpTvseta.push_back(
691  make2DIfLogY(ibook,
692  useLogPt,
693  "num_chargemisid_pTvseta",
694  "N of associated (recoToSim) charge misIDed tracks in (pT-eta) plane",
695  nintEta,
696  minEta,
697  maxEta,
698  nintPt,
699  minPt,
700  maxPt));
701  histograms.h_pileuppTvseta.push_back(make2DIfLogY(ibook,
702  useLogPt,
703  "num_pileup_pTvseta",
704  "N of associated (recoToSim) pileup tracks in (pT-eta) plane",
705  nintEta,
706  minEta,
707  maxEta,
708  nintPt,
709  minPt,
710  maxPt));
711  //
712  histograms.h_recohit.push_back(ibook.book1D("num_reco_hit", "N of reco track vs hit", nintHit, minHit, maxHit));
713  histograms.h_assoc2hit.push_back(
714  ibook.book1D("num_assoc(recoToSim)_hit", "N of associated (recoToSim) tracks vs hit", nintHit, minHit, maxHit));
715  histograms.h_looperhit.push_back(ibook.book1D(
716  "num_duplicate_hit", "N of associated (recoToSim) duplicate tracks vs hit", nintHit, minHit, maxHit));
717  if (!doSeedPlots_)
718  histograms.h_misidhit.push_back(ibook.book1D(
719  "num_chargemisid_hit", "N of associated (recoToSim) charge misIDed tracks vs hit", nintHit, minHit, maxHit));
720  histograms.h_pileuphit.push_back(
721  ibook.book1D("num_pileup_hit", "N of associated (recoToSim) pileup tracks vs hit", nintHit, minHit, maxHit));
722  //
723  histograms.h_recolayer.push_back(
724  ibook.book1D("num_reco_layer", "N of reco track vs layer", nintLayers, minLayers, maxLayers));
725  histograms.h_assoc2layer.push_back(ibook.book1D(
726  "num_assoc(recoToSim)_layer", "N of associated (recoToSim) tracks vs layer", nintLayers, minLayers, maxLayers));
727  histograms.h_looperlayer.push_back(ibook.book1D(
728  "num_duplicate_layer", "N of associated (recoToSim) duplicate tracks vs layer", nintLayers, minLayers, maxLayers));
729  if (!doSeedPlots_)
730  histograms.h_misidlayer.push_back(ibook.book1D("num_chargemisid_layer",
731  "N of associated (recoToSim) charge misIDed tracks vs layer",
732  nintLayers,
733  minLayers,
734  maxLayers));
735  histograms.h_pileuplayer.push_back(ibook.book1D(
736  "num_pileup_layer", "N of associated (recoToSim) pileup tracks vs layer", nintLayers, minLayers, maxLayers));
737  //
738  histograms.h_recopixellayer.push_back(
739  ibook.book1D("num_reco_pixellayer", "N of reco track vs pixellayer", nintLayers, minLayers, maxLayers));
740  histograms.h_assoc2pixellayer.push_back(ibook.book1D("num_assoc(recoToSim)_pixellayer",
741  "N of associated (recoToSim) tracks vs pixellayer",
742  nintLayers,
743  minLayers,
744  maxLayers));
745  histograms.h_looperpixellayer.push_back(ibook.book1D("num_duplicate_pixellayer",
746  "N of associated (recoToSim) duplicate tracks vs pixellayer",
747  nintLayers,
748  minLayers,
749  maxLayers));
750  if (!doSeedPlots_)
751  histograms.h_misidpixellayer.push_back(
752  ibook.book1D("num_chargemisid_pixellayer",
753  "N of associated (recoToSim) charge misIDed tracks vs pixellayer",
754  nintLayers,
755  minLayers,
756  maxLayers));
757  histograms.h_pileuppixellayer.push_back(ibook.book1D("num_pileup_pixellayer",
758  "N of associated (recoToSim) pileup tracks vs pixellayer",
759  nintLayers,
760  minLayers,
761  maxLayers));
762  //
763  histograms.h_reco3Dlayer.push_back(
764  ibook.book1D("num_reco_3Dlayer", "N of reco track vs 3D layer", nintLayers, minLayers, maxLayers));
765  histograms.h_assoc23Dlayer.push_back(ibook.book1D("num_assoc(recoToSim)_3Dlayer",
766  "N of associated (recoToSim) tracks vs 3D layer",
767  nintLayers,
768  minLayers,
769  maxLayers));
770  histograms.h_looper3Dlayer.push_back(ibook.book1D("num_duplicate_3Dlayer",
771  "N of associated (recoToSim) duplicate tracks vs 3D layer",
772  nintLayers,
773  minLayers,
774  maxLayers));
775  if (!doSeedPlots_)
776  histograms.h_misid3Dlayer.push_back(ibook.book1D("num_chargemisid_3Dlayer",
777  "N of associated (recoToSim) charge misIDed tracks vs 3D layer",
778  nintLayers,
779  minLayers,
780  maxLayers));
781  histograms.h_pileup3Dlayer.push_back(ibook.book1D(
782  "num_pileup_3Dlayer", "N of associated (recoToSim) pileup tracks vs 3D layer", nintLayers, minLayers, maxLayers));
783  //
784  histograms.h_recopu.push_back(ibook.book1D("num_reco_pu", "N of reco track vs pu", nintPu, minPu, maxPu));
785  histograms.h_reco2pu.push_back(ibook.book1D("num_reco2_pu", "N of selected reco track vs pu", nintPu, minPu, maxPu));
786  histograms.h_assoc2pu.push_back(
787  ibook.book1D("num_assoc(recoToSim)_pu", "N of associated (recoToSim) tracks vs pu", nintPu, minPu, maxPu));
788  histograms.h_looperpu.push_back(
789  ibook.book1D("num_duplicate_pu", "N of associated (recoToSim) duplicate tracks vs pu", nintPu, minPu, maxPu));
790  if (!doSeedPlots_)
791  histograms.h_misidpu.push_back(ibook.book1D(
792  "num_chargemisid_pu", "N of associated (recoToSim) charge misIDed tracks vs pu", nintPu, minPu, maxPu));
793  histograms.h_pileuppu.push_back(
794  ibook.book1D("num_pileup_pu", "N of associated (recoToSim) pileup tracks vs pu", nintPu, minPu, maxPu));
795  //
796  histograms.h_recophi.push_back(ibook.book1D("num_reco_phi", "N of reco track vs phi", nintPhi, minPhi, maxPhi));
797  histograms.h_assoc2phi.push_back(
798  ibook.book1D("num_assoc(recoToSim)_phi", "N of associated (recoToSim) tracks vs phi", nintPhi, minPhi, maxPhi));
799  histograms.h_looperphi.push_back(ibook.book1D(
800  "num_duplicate_phi", "N of associated (recoToSim) duplicate tracks vs phi", nintPhi, minPhi, maxPhi));
801  if (!doSeedPlots_)
802  histograms.h_misidphi.push_back(ibook.book1D(
803  "num_chargemisid_phi", "N of associated (recoToSim) charge misIDed tracks vs phi", nintPhi, minPhi, maxPhi));
804  histograms.h_pileupphi.push_back(
805  ibook.book1D("num_pileup_phi", "N of associated (recoToSim) pileup tracks vs phi", nintPhi, minPhi, maxPhi));
806 
807  histograms.h_recodxy.push_back(ibook.book1D("num_reco_dxy", "N of reco track vs dxy", nintDxy, minDxy, maxDxy));
808  histograms.h_assoc2dxy.push_back(
809  ibook.book1D("num_assoc(recoToSim)_dxy", "N of associated (recoToSim) tracks vs dxy", nintDxy, minDxy, maxDxy));
810  histograms.h_looperdxy.push_back(
811  ibook.book1D("num_duplicate_dxy", "N of associated (recoToSim) looper tracks vs dxy", nintDxy, minDxy, maxDxy));
812  if (!doSeedPlots_)
813  histograms.h_misiddxy.push_back(ibook.book1D(
814  "num_chargemisid_dxy", "N of associated (recoToSim) charge misIDed tracks vs dxy", nintDxy, minDxy, maxDxy));
815  histograms.h_pileupdxy.push_back(
816  ibook.book1D("num_pileup_dxy", "N of associated (recoToSim) pileup tracks vs dxy", nintDxy, minDxy, maxDxy));
817 
818  histograms.h_recodz.push_back(ibook.book1D("num_reco_dz", "N of reco track vs dz", nintDz, minDz, maxDz));
819  histograms.h_assoc2dz.push_back(
820  ibook.book1D("num_assoc(recoToSim)_dz", "N of associated (recoToSim) tracks vs dz", nintDz, minDz, maxDz));
821  histograms.h_looperdz.push_back(
822  ibook.book1D("num_duplicate_dz", "N of associated (recoToSim) looper tracks vs dz", nintDz, minDz, maxDz));
823  if (!doSeedPlots_)
824  histograms.h_misiddz.push_back(ibook.book1D(
825  "num_chargemisid_versus_dz", "N of associated (recoToSim) charge misIDed tracks vs dz", nintDz, minDz, maxDz));
826  histograms.h_pileupdz.push_back(
827  ibook.book1D("num_pileup_dz", "N of associated (recoToSim) pileup tracks vs dz", nintDz, minDz, maxDz));
828 
829  histograms.h_recovertpos.push_back(make1DIfLogX(ibook,
831  "num_reco_vertpos",
832  "N of reconstructed tracks vs transverse ref point position",
833  nintVertpos,
834  minVertpos,
835  maxVertpos));
836  histograms.h_assoc2vertpos.push_back(
837  make1DIfLogX(ibook,
839  "num_assoc(recoToSim)_vertpos",
840  "N of associated (recoToSim) tracks vs transverse ref point position",
841  nintVertpos,
842  minVertpos,
843  maxVertpos));
844  histograms.h_loopervertpos.push_back(
845  make1DIfLogX(ibook,
847  "num_duplicate_vertpos",
848  "N of associated (recoToSim) looper tracks vs transverse ref point position",
849  nintVertpos,
850  minVertpos,
851  maxVertpos));
852  histograms.h_pileupvertpos.push_back(
853  make1DIfLogX(ibook,
855  "num_pileup_vertpos",
856  "N of associated (recoToSim) pileup tracks vs transverse ref point position",
857  nintVertpos,
858  minVertpos,
859  maxVertpos));
860 
861  histograms.h_recozpos.push_back(ibook.book1D(
862  "num_reco_zpos", "N of reconstructed tracks vs transverse ref point position", nintZpos, minZpos, maxZpos));
863  histograms.h_assoc2zpos.push_back(ibook.book1D("num_assoc(recoToSim)_zpos",
864  "N of associated (recoToSim) tracks vs transverse ref point position",
865  nintZpos,
866  minZpos,
867  maxZpos));
868  histograms.h_looperzpos.push_back(
869  ibook.book1D("num_duplicate_zpos",
870  "N of associated (recoToSim) looper tracks vs transverse ref point position",
871  nintZpos,
872  minZpos,
873  maxZpos));
874  histograms.h_pileupzpos.push_back(
875  ibook.book1D("num_pileup_zpos",
876  "N of associated (recoToSim) pileup tracks vs transverse ref point position",
877  nintZpos,
878  minZpos,
879  maxZpos));
880 
881  histograms.h_recodr.push_back(
882  make1DIfLogX(ibook, true, "num_reco_dr", "N of reconstructed tracks vs dR", nintdr, log10(mindr), log10(maxdr)));
883  histograms.h_assoc2dr.push_back(make1DIfLogX(ibook,
884  true,
885  "num_assoc(recoToSim)_dr",
886  "N of associated tracks (recoToSim) vs dR",
887  nintdr,
888  log10(mindr),
889  log10(maxdr)));
890  histograms.h_looperdr.push_back(make1DIfLogX(ibook,
891  true,
892  "num_duplicate_dr",
893  "N of associated (recoToSim) looper tracks vs dR",
894  nintdr,
895  log10(mindr),
896  log10(maxdr)));
897  histograms.h_pileupdr.push_back(make1DIfLogX(ibook,
898  true,
899  "num_pileup_dr",
900  "N of associated (recoToSim) pileup tracks vs dR",
901  nintdr,
902  log10(mindr),
903  log10(maxdr)));
904 
905  histograms.h_recodrj.push_back(make1DIfLogX(
906  ibook, true, "num_reco_drj", "N of reconstructed tracks vs dR(track,jet)", nintdrj, log10(mindrj), log10(maxdrj)));
907  histograms.h_assoc2drj.push_back(make1DIfLogX(ibook,
908  true,
909  "num_assoc(recoToSim)_drj",
910  "N of associated tracks (recoToSim) vs dR(track,jet)",
911  nintdrj,
912  log10(mindrj),
913  log10(maxdrj)));
914  histograms.h_looperdrj.push_back(make1DIfLogX(ibook,
915  true,
916  "num_duplicate_drj",
917  "N of associated (recoToSim) looper tracks vs dR(track,jet)",
918  nintdrj,
919  log10(mindrj),
920  log10(maxdrj)));
921  histograms.h_pileupdrj.push_back(make1DIfLogX(ibook,
922  true,
923  "num_pileup_drj",
924  "N of associated (recoToSim) pileup tracks vs dR(track,jet)",
925  nintdrj,
926  log10(mindrj),
927  log10(maxdrj)));
928 
929  histograms.h_reco_simpvz.push_back(
930  ibook.book1D("num_reco_simpvz", "N of reco track vs. sim PV z", nintPVz, minPVz, maxPVz));
931  histograms.h_assoc2_simpvz.push_back(ibook.book1D(
932  "num_assoc(recoToSim)_simpvz", "N of associated tracks (recoToSim) vs. sim PV z", nintPVz, minPVz, maxPVz));
933  histograms.h_looper_simpvz.push_back(ibook.book1D(
934  "num_duplicate_simpvz", "N of associated (recoToSim) looper tracks vs. sim PV z", nintPVz, minPVz, maxPVz));
935  histograms.h_pileup_simpvz.push_back(ibook.book1D(
936  "num_pileup_simpvz", "N of associated (recoToSim) pileup tracks vs. sim PV z", nintPVz, minPVz, maxPVz));
937 
938  histograms.h_recochi2.push_back(
939  ibook.book1D("num_reco_chi2", "N of reco track vs normalized #chi^{2}", nintChi2, minChi2, maxChi2));
940  histograms.h_assoc2chi2.push_back(ibook.book1D("num_assoc(recoToSim)_chi2",
941  "N of associated (recoToSim) tracks vs normalized #chi^{2}",
942  nintChi2,
943  minChi2,
944  maxChi2));
945  histograms.h_looperchi2.push_back(ibook.book1D("num_duplicate_chi2",
946  "N of associated (recoToSim) looper tracks vs normalized #chi^{2}",
947  nintChi2,
948  minChi2,
949  maxChi2));
950  if (!doSeedPlots_)
951  histograms.h_misidchi2.push_back(
952  ibook.book1D("num_chargemisid_chi2",
953  "N of associated (recoToSim) charge misIDed tracks vs normalized #chi^{2}",
954  nintChi2,
955  minChi2,
956  maxChi2));
957  histograms.h_pileupchi2.push_back(ibook.book1D("num_pileup_chi2",
958  "N of associated (recoToSim) pileup tracks vs normalized #chi^{2}",
959  nintChi2,
960  minChi2,
961  maxChi2));
962 
963  histograms.h_recochi2prob.push_back(
964  ibook.book1D("num_reco_chi2prob", "N of reco track vs normalized #chi^{2}", 100, 0., 1.));
965  histograms.h_assoc2chi2prob.push_back(ibook.book1D(
966  "num_assoc(recoToSim)_chi2prob", "N of associated (recoToSim) tracks vs normalized #chi^{2}", 100, 0., 1.));
967  histograms.h_looperchi2prob.push_back(ibook.book1D(
968  "num_duplicate_chi2prob", "N of associated (recoToSim) looper tracks vs normalized #chi^{2}", 100, 0., 1.));
969  if (!doSeedPlots_)
970  histograms.h_misidchi2prob.push_back(
971  ibook.book1D("num_chargemisid_chi2prob",
972  "N of associated (recoToSim) charge misIDed tracks vs normalized #chi^{2}",
973  100,
974  0.,
975  1.));
976  histograms.h_pileupchi2prob.push_back(ibook.book1D(
977  "num_pileup_chi2prob", "N of associated (recoToSim) pileup tracks vs normalized #chi^{2}", 100, 0., 1.));
978 
979  if (!seedingLayerSetNames.empty()) {
980  const auto size = seedingLayerSetNames.size();
981  histograms.h_reco_seedingLayerSet.push_back(
982  ibook.book1D("num_reco_seedingLayerSet", "N of reco track vs. seedingLayerSet", size, 0, size));
983  histograms.h_assoc2_seedingLayerSet.push_back(
984  ibook.book1D("num_assoc(recoToSim)_seedingLayerSet",
985  "N of associated track (recoToSim) tracks vs. seedingLayerSet",
986  size,
987  0,
988  size));
989  histograms.h_looper_seedingLayerSet.push_back(ibook.book1D(
990  "num_duplicate_seedingLayerSet", "N of reco associated (recoToSim) looper vs. seedingLayerSet", size, 0, size));
991  histograms.h_pileup_seedingLayerSet.push_back(ibook.book1D(
992  "num_pileup_seedingLayerSet", "N of reco associated (recoToSim) pileup vs. seedingLayerSet", size, 0, size));
993 
994  setBinLabels(histograms.h_reco_seedingLayerSet.back(), seedingLayerSetNames);
995  setBinLabels(histograms.h_assoc2_seedingLayerSet.back(), seedingLayerSetNames);
996  setBinLabels(histograms.h_looper_seedingLayerSet.back(), seedingLayerSetNames);
997  setBinLabels(histograms.h_pileup_seedingLayerSet.back(), seedingLayerSetNames);
998  }
999 
1001 
1002  auto bookResolutionPlots1D = [&](std::vector<dqm::reco::MonitorElement*>& vec, auto&&... params) {
1003  vec.push_back(doResolutionPlots ? ibook.book1D(std::forward<decltype(params)>(params)...) : nullptr);
1004  };
1005  auto bookResolutionPlots2D = [&](std::vector<dqm::reco::MonitorElement*>& vec, bool logx, auto&&... params) {
1006  vec.push_back(doResolutionPlots ? make2DIfLogX(ibook, logx, std::forward<decltype(params)>(params)...) : nullptr);
1007  };
1008  auto bookResolutionPlotsProfile2D = [&](std::vector<dqm::reco::MonitorElement*>& vec, auto&&... params) {
1009  vec.push_back(doResolutionPlots ? ibook.bookProfile2D(std::forward<decltype(params)>(params)...) : nullptr);
1010  };
1011 
1012  bookResolutionPlots1D(histograms.h_eta, "eta", "pseudorapidity residue", 1000, -0.1, 0.1);
1013  bookResolutionPlots1D(histograms.h_pt, "pullPt", "pull of p_{t}", 100, -10, 10);
1014  bookResolutionPlots1D(histograms.h_pullTheta, "pullTheta", "pull of #theta parameter", 250, -25, 25);
1015  bookResolutionPlots1D(histograms.h_pullPhi, "pullPhi", "pull of #phi parameter", 250, -25, 25);
1016  bookResolutionPlots1D(histograms.h_pullDxy, "pullDxy", "pull of dxy parameter", 250, -25, 25);
1017  bookResolutionPlots1D(histograms.h_pullDz, "pullDz", "pull of dz parameter", 250, -25, 25);
1018  bookResolutionPlots1D(histograms.h_pullQoverp, "pullQoverp", "pull of qoverp parameter", 250, -25, 25);
1019 
1020  /* TO BE FIXED -----------
1021  if (associators[ww]=="TrackAssociatorByChi2"){
1022  histograms.h_assochi2.push_back( ibook.book1D("assocChi2","track association #chi^{2}",1000000,0,100000) );
1023  histograms.h_assochi2_prob.push_back(ibook.book1D("assocChi2_prob","probability of association #chi^{2}",100,0,1));
1024  } else if (associators[ww]=="quickTrackAssociatorByHits"){
1025  histograms.h_assocFraction.push_back( ibook.book1D("assocFraction","fraction of shared hits",200,0,2) );
1026  histograms.h_assocSharedHit.push_back(ibook.book1D("assocSharedHit","number of shared hits",20,0,20));
1027  }
1028  */
1029  histograms.h_assocFraction.push_back(ibook.book1D("assocFraction", "fraction of shared hits", 200, 0, 2));
1030  histograms.h_assocSharedHit.push_back(ibook.book1D("assocSharedHit", "number of shared hits", 41, -0.5, 40.5));
1031  // ----------------------
1032 
1033  // use the standard error of the mean as the errors in the profile
1034  histograms.chi2_vs_nhits.push_back(
1035  ibook.bookProfile("chi2mean_vs_nhits", "mean #chi^{2} vs nhits", nintHit, minHit, maxHit, 100, 0, 10, " "));
1036 
1037  bookResolutionPlots2D(
1038  histograms.etares_vs_eta, false, "etares_vs_eta", "etaresidue vs eta", nintEta, minEta, maxEta, 200, -0.1, 0.1);
1039  bookResolutionPlots2D(
1040  histograms.nrec_vs_nsim,
1041  false,
1042  "nrec_vs_nsim",
1043  "Number of selected reco tracks vs. number of selected sim tracks;TrackingParticles;Reco tracks",
1044  nintTracks,
1045  minTracks,
1046  maxTracks,
1047  nintTracks,
1048  minTracks,
1049  maxTracks);
1050 
1051  histograms.chi2_vs_eta.push_back(
1052  ibook.bookProfile("chi2mean", "mean #chi^{2} vs #eta", nintEta, minEta, maxEta, 200, 0, 20, " "));
1053  histograms.chi2_vs_phi.push_back(
1054  ibook.bookProfile("chi2mean_vs_phi", "mean #chi^{2} vs #phi", nintPhi, minPhi, maxPhi, 200, 0, 20, " "));
1055  histograms.chi2_vs_pt.push_back(
1056  makeProfileIfLogX(ibook, useLogPt, "chi2mean_vs_pt", "mean #chi^{2} vs p_{T}", nintPt, minPt, maxPt, 0, 20));
1057  histograms.chi2_vs_drj.push_back(makeProfileIfLogX(
1058  ibook, true, "chi2mean_vs_drj", "mean #chi^{2} vs dR(track,jet)", nintdrj, log10(mindrj), log10(maxdrj), 0, 20));
1059 
1060  histograms.assoc_chi2_vs_eta.push_back(
1061  ibook.bookProfile("assoc_chi2mean", "mean #chi^{2} vs #eta", nintEta, minEta, maxEta, 200, 0., 20., " "));
1062  histograms.assoc_chi2prob_vs_eta.push_back(ibook.bookProfile(
1063  "assoc_chi2prob_vs_eta", "mean #chi^{2} probability vs #eta", nintEta, minEta, maxEta, 100, 0., 1., " "));
1064  histograms.assoc_chi2_vs_pt.push_back(makeProfileIfLogX(
1065  ibook, useLogPt, "assoc_chi2mean_vs_pt", "mean #chi^{2} vs p_{T}", nintPt, minPt, maxPt, 0., 20.));
1066  histograms.assoc_chi2prob_vs_pt.push_back(makeProfileIfLogX(
1067  ibook, useLogPt, "assoc_chi2prob_vs_pt", "mean #chi^{2} probability vs p_{T}", nintPt, minPt, maxPt, 0., 1.));
1068  histograms.assoc_chi2_vs_drj.push_back(makeProfileIfLogX(ibook,
1069  true,
1070  "assoc_chi2mean_vs_drj",
1071  "mean #chi^{2} vs dR(track,jet)",
1072  nintdrj,
1073  log10(mindrj),
1074  log10(maxdrj),
1075  0.,
1076  20));
1077  histograms.assoc_chi2prob_vs_drj.push_back(makeProfileIfLogX(ibook,
1078  true,
1079  "assoc_chi2prob_vs_drj",
1080  "mean #chi^{2} probability vs dR(track,jet)",
1081  nintdrj,
1082  log10(mindrj),
1083  log10(maxdrj),
1084  0.,
1085  1.));
1086 
1087  histograms.nhits_vs_eta.push_back(
1088  ibook.bookProfile("hits_eta", "mean hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1089  histograms.nPXBhits_vs_eta.push_back(ibook.bookProfile(
1090  "PXBhits_vs_eta", "mean # PXB its vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1091  histograms.nPXFhits_vs_eta.push_back(ibook.bookProfile(
1092  "PXFhits_vs_eta", "mean # PXF hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1093  histograms.nPXLhits_vs_eta.push_back(ibook.bookProfile(
1094  "PXLhits_vs_eta", "mean # PXL hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1095  histograms.nTIBhits_vs_eta.push_back(ibook.bookProfile(
1096  "TIBhits_vs_eta", "mean # TIB hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1097  histograms.nTIDhits_vs_eta.push_back(ibook.bookProfile(
1098  "TIDhits_vs_eta", "mean # TID hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1099  histograms.nTOBhits_vs_eta.push_back(ibook.bookProfile(
1100  "TOBhits_vs_eta", "mean # TOB hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1101  histograms.nTEChits_vs_eta.push_back(ibook.bookProfile(
1102  "TEChits_vs_eta", "mean # TEC hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1103  histograms.nSTRIPhits_vs_eta.push_back(ibook.bookProfile(
1104  "STRIPhits_vs_eta", "mean # STRIP hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1105 
1106  histograms.nLayersWithMeas_vs_eta.push_back(ibook.bookProfile("LayersWithMeas_eta",
1107  "mean # Layers with measurement vs eta",
1108  nintEta,
1109  minEta,
1110  maxEta,
1111  nintLayers,
1112  minLayers,
1113  maxLayers,
1114  " "));
1115  histograms.nPXLlayersWithMeas_vs_eta.push_back(ibook.bookProfile("PXLlayersWithMeas_vs_eta",
1116  "mean # PXL Layers with measurement vs eta",
1117  nintEta,
1118  minEta,
1119  maxEta,
1120  nintLayers,
1121  minLayers,
1122  maxLayers,
1123  " "));
1124  histograms.nSTRIPlayersWithMeas_vs_eta.push_back(ibook.bookProfile("STRIPlayersWithMeas_vs_eta",
1125  "mean # STRIP Layers with measurement vs eta",
1126  nintEta,
1127  minEta,
1128  maxEta,
1129  nintLayers,
1130  minLayers,
1131  maxLayers,
1132  " "));
1133  histograms.nSTRIPlayersWith1dMeas_vs_eta.push_back(ibook.bookProfile("STRIPlayersWith1dMeas_vs_eta",
1134  "mean # STRIP Layers with 1D measurement vs eta",
1135  nintEta,
1136  minEta,
1137  maxEta,
1138  nintLayers,
1139  minLayers,
1140  maxLayers,
1141  " "));
1142  histograms.nSTRIPlayersWith2dMeas_vs_eta.push_back(ibook.bookProfile("STRIPlayersWith2dMeas_vs_eta",
1143  "mean # STRIP Layers with 2D measurement vs eta",
1144  nintEta,
1145  minEta,
1146  maxEta,
1147  nintLayers,
1148  minLayers,
1149  maxLayers,
1150  " "));
1151 
1152  if (doMTDPlots_) {
1153  histograms.nMTDhits_vs_eta.push_back(ibook.bookProfile(
1154  "MTDhits_vs_eta", "mean # MTD hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1155 
1156  histograms.nBTLhits_vs_eta.push_back(ibook.bookProfile(
1157  "BTLhits_vs_eta", "mean # BTL hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1158 
1159  histograms.nETLhits_vs_eta.push_back(ibook.bookProfile(
1160  "ETLhits_vs_eta", "mean # ETL hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1161  }
1162 
1163  histograms.nhits_vs_phi.push_back(
1164  ibook.bookProfile("hits_phi", "mean # hits vs #phi", nintPhi, minPhi, maxPhi, nintHit, minHit, maxHit, " "));
1165 
1166  histograms.nlosthits_vs_eta.push_back(ibook.bookProfile(
1167  "losthits_vs_eta", "mean # lost hits vs eta", nintEta, minEta, maxEta, nintHit, minHit, maxHit, " "));
1168 
1169  //resolution of track parameters
1170  // dPt/Pt cotTheta Phi TIP LIP
1171  // log10(pt)<0.5 100,0.1 240,0.08 100,0.015 100,0.1000 150,0.3000
1172  // 0.5<log10(pt)<1.5 100,0.1 120,0.01 100,0.003 100,0.0100 150,0.0500
1173  // >1.5 100,0.3 100,0.005 100,0.0008 100,0.0060 120,0.0300
1174 
1175  bookResolutionPlots2D(histograms.ptres_vs_eta,
1176  false,
1177  "ptres_vs_eta",
1178  "ptres_vs_eta",
1179  nintEta,
1180  minEta,
1181  maxEta,
1182  ptRes_nbin,
1184  ptRes_rangeMax);
1185 
1186  bookResolutionPlots2D(histograms.ptres_vs_phi,
1187  false,
1188  "ptres_vs_phi",
1189  "p_{t} res vs #phi",
1190  nintPhi,
1191  minPhi,
1192  maxPhi,
1193  ptRes_nbin,
1195  ptRes_rangeMax);
1196 
1197  bookResolutionPlots2D(histograms.ptres_vs_pt,
1198  useLogPt,
1199  "ptres_vs_pt",
1200  "ptres_vs_pt",
1201  nintPt,
1202  minPt,
1203  maxPt,
1204  ptRes_nbin,
1206  ptRes_rangeMax);
1207 
1208  bookResolutionPlots2D(histograms.cotThetares_vs_eta,
1209  false,
1210  "cotThetares_vs_eta",
1211  "cotThetares_vs_eta",
1212  nintEta,
1213  minEta,
1214  maxEta,
1218 
1219  bookResolutionPlots2D(histograms.cotThetares_vs_pt,
1220  useLogPt,
1221  "cotThetares_vs_pt",
1222  "cotThetares_vs_pt",
1223  nintPt,
1224  minPt,
1225  maxPt,
1229 
1230  bookResolutionPlots2D(histograms.phires_vs_eta,
1231  false,
1232  "phires_vs_eta",
1233  "phires_vs_eta",
1234  nintEta,
1235  minEta,
1236  maxEta,
1237  phiRes_nbin,
1239  phiRes_rangeMax);
1240 
1241  bookResolutionPlots2D(histograms.phires_vs_pt,
1242  useLogPt,
1243  "phires_vs_pt",
1244  "phires_vs_pt",
1245  nintPt,
1246  minPt,
1247  maxPt,
1248  phiRes_nbin,
1250  phiRes_rangeMax);
1251 
1252  bookResolutionPlots2D(histograms.phires_vs_phi,
1253  false,
1254  "phires_vs_phi",
1255  "#phi res vs #phi",
1256  nintPhi,
1257  minPhi,
1258  maxPhi,
1259  phiRes_nbin,
1261  phiRes_rangeMax);
1262 
1263  bookResolutionPlots2D(histograms.dxyres_vs_eta,
1264  false,
1265  "dxyres_vs_eta",
1266  "dxyres_vs_eta",
1267  nintEta,
1268  minEta,
1269  maxEta,
1270  dxyRes_nbin,
1272  dxyRes_rangeMax);
1273 
1274  bookResolutionPlots2D(histograms.dxyres_vs_pt,
1275  useLogPt,
1276  "dxyres_vs_pt",
1277  "dxyres_vs_pt",
1278  nintPt,
1279  minPt,
1280  maxPt,
1281  dxyRes_nbin,
1283  dxyRes_rangeMax);
1284 
1285  bookResolutionPlots2D(histograms.dxyres_vs_phi,
1286  false,
1287  "dxyres_vs_phi",
1288  "dxyres_vs_phi",
1289  nintPhi,
1290  minPhi,
1291  maxPhi,
1292  dxyRes_nbin,
1294  dxyRes_rangeMax);
1295 
1296  bookResolutionPlots2D(histograms.dzres_vs_eta,
1297  false,
1298  "dzres_vs_eta",
1299  "dzres_vs_eta",
1300  nintEta,
1301  minEta,
1302  maxEta,
1303  dzRes_nbin,
1305  dzRes_rangeMax);
1306 
1307  bookResolutionPlots2D(histograms.dzres_vs_pt,
1308  useLogPt,
1309  "dzres_vs_pt",
1310  "dzres_vs_pt",
1311  nintPt,
1312  minPt,
1313  maxPt,
1314  dzRes_nbin,
1316  dzRes_rangeMax);
1317 
1318  bookResolutionPlots2D(histograms.dzres_vs_phi,
1319  false,
1320  "dzres_vs_phi",
1321  "dzres_vs_phi",
1322  nintPhi,
1323  minPhi,
1324  maxPhi,
1325  dzRes_nbin,
1327  dzRes_rangeMax);
1328 
1329  bookResolutionPlotsProfile2D(histograms.ptmean_vs_eta_phi,
1330  "ptmean_vs_eta_phi",
1331  "mean p_{t} vs #eta and #phi",
1332  nintPhi,
1333  minPhi,
1334  maxPhi,
1335  nintEta,
1336  minEta,
1337  maxEta,
1338  1000,
1339  0,
1340  1000);
1341  bookResolutionPlotsProfile2D(histograms.phimean_vs_eta_phi,
1342  "phimean_vs_eta_phi",
1343  "mean #phi vs #eta and #phi",
1344  nintPhi,
1345  minPhi,
1346  maxPhi,
1347  nintEta,
1348  minEta,
1349  maxEta,
1350  nintPhi,
1351  minPhi,
1352  maxPhi);
1353 
1354  //pulls of track params vs eta: to be used with fitslicesytool
1355  bookResolutionPlots2D(
1356  histograms.dxypull_vs_eta, false, "dxypull_vs_eta", "dxypull_vs_eta", nintEta, minEta, maxEta, 100, -10, 10);
1357  bookResolutionPlots2D(
1358  histograms.ptpull_vs_eta, false, "ptpull_vs_eta", "ptpull_vs_eta", nintEta, minEta, maxEta, 100, -10, 10);
1359  bookResolutionPlots2D(
1360  histograms.dzpull_vs_eta, false, "dzpull_vs_eta", "dzpull_vs_eta", nintEta, minEta, maxEta, 100, -10, 10);
1361  bookResolutionPlots2D(
1362  histograms.phipull_vs_eta, false, "phipull_vs_eta", "phipull_vs_eta", nintEta, minEta, maxEta, 100, -10, 10);
1363  bookResolutionPlots2D(
1364  histograms.thetapull_vs_eta, false, "thetapull_vs_eta", "thetapull_vs_eta", nintEta, minEta, maxEta, 100, -10, 10);
1365  bookResolutionPlots2D(
1366  histograms.dxypull_vs_pt, useLogPt, "dxypull_vs_pt", "dxypull_vs_pt", nintPt, minPt, maxPt, 100, -10, 10);
1367  bookResolutionPlots2D(
1368  histograms.ptpull_vs_pt, useLogPt, "ptpull_vs_pt", "ptpull_vs_pt", nintPt, minPt, maxPt, 100, -10, 10);
1369  bookResolutionPlots2D(
1370  histograms.dzpull_vs_pt, useLogPt, "dzpull_vs_pt", "dzpull_vs_pt", nintPt, minPt, maxPt, 100, -10, 10);
1371  bookResolutionPlots2D(
1372  histograms.phipull_vs_pt, useLogPt, "phipull_vs_pt", "phipull_vs_pt", nintPt, minPt, maxPt, 100, -10, 10);
1373  bookResolutionPlots2D(
1374  histograms.thetapull_vs_pt, useLogPt, "thetapull_vs_pt", "thetapull_vs_pt", nintPt, minPt, maxPt, 100, -10, 10);
1375 
1376  // histograms.h_ptshiftetamean.push_back( ibook.book1D("h_ptshifteta_Mean","<#deltapT/pT>[%] vs #eta",nintEta,minEta,maxEta) );
1377 
1378  //pulls of track params vs phi
1379  bookResolutionPlots2D(
1380  histograms.ptpull_vs_phi, false, "ptpull_vs_phi", "p_{t} pull vs #phi", nintPhi, minPhi, maxPhi, 100, -10, 10);
1381  bookResolutionPlots2D(
1382  histograms.phipull_vs_phi, false, "phipull_vs_phi", "#phi pull vs #phi", nintPhi, minPhi, maxPhi, 100, -10, 10);
1383  bookResolutionPlots2D(histograms.thetapull_vs_phi,
1384  false,
1385  "thetapull_vs_phi",
1386  "#theta pull vs #phi",
1387  nintPhi,
1388  minPhi,
1389  maxPhi,
1390  100,
1391  -10,
1392  10);
1393 
1394  bookResolutionPlots2D(histograms.nrecHit_vs_nsimHit_rec2sim,
1395  false,
1396  "nrecHit_vs_nsimHit_rec2sim",
1397  "nrecHit vs nsimHit (Rec2simAssoc)",
1398  nintHit,
1399  minHit,
1400  maxHit,
1401  nintHit,
1402  minHit,
1403  maxHit);
1404 }
1405 
1407  histograms.h_recodxypv.push_back(
1408  ibook.book1D("num_reco_dxypv", "N of reco track vs dxy(PV)", nintDxy, minDxy, maxDxy));
1409  histograms.h_assoc2dxypv.push_back(ibook.book1D(
1410  "num_assoc(recoToSim)_dxypv", "N of associated (recoToSim) tracks vs dxy(PV)", nintDxy, minDxy, maxDxy));
1411  histograms.h_looperdxypv.push_back(ibook.book1D(
1412  "num_duplicate_dxypv", "N of associated (recoToSim) looper tracks vs dxy(PV)", nintDxy, minDxy, maxDxy));
1413  if (!doSeedPlots_)
1414  histograms.h_misiddxypv.push_back(ibook.book1D("num_chargemisid_dxypv",
1415  "N of associated (recoToSim) charge misIDed tracks vs dxy(PV)",
1416  nintDxy,
1417  minDxy,
1418  maxDxy));
1419  histograms.h_pileupdxypv.push_back(ibook.book1D(
1420  "num_pileup_dxypv", "N of associated (recoToSim) pileup tracks vs dxy(PV)", nintDxy, minDxy, maxDxy));
1421 
1422  histograms.h_recodzpv.push_back(ibook.book1D("num_reco_dzpv", "N of reco track vs dz(PV)", nintDz, minDz, maxDz));
1423  histograms.h_assoc2dzpv.push_back(
1424  ibook.book1D("num_assoc(recoToSim)_dzpv", "N of associated (recoToSim) tracks vs dz(PV)", nintDz, minDz, maxDz));
1425  histograms.h_looperdzpv.push_back(
1426  ibook.book1D("num_duplicate_dzpv", "N of associated (recoToSim) looper tracks vs dz(PV)", nintDz, minDz, maxDz));
1427  if (!doSeedPlots_)
1428  histograms.h_misiddzpv.push_back(ibook.book1D("num_chargemisid_versus_dzpv",
1429  "N of associated (recoToSim) charge misIDed tracks vs dz(PV)",
1430  nintDz,
1431  minDz,
1432  maxDz));
1433  histograms.h_pileupdzpv.push_back(
1434  ibook.book1D("num_pileup_dzpv", "N of associated (recoToSim) pileup tracks vs dz(PV)", nintDz, minDz, maxDz));
1435 
1436  histograms.h_recodxypvzoomed.push_back(ibook.book1D(
1437  "num_reco_dxypv_zoomed", "N of reco track vs dxy(PV)", nintDxy, minDxy / dxyDzZoom, maxDxy / dxyDzZoom));
1438  histograms.h_assoc2dxypvzoomed.push_back(ibook.book1D("num_assoc(recoToSim)_dxypv_zoomed",
1439  "N of associated (recoToSim) tracks vs dxy(PV)",
1440  nintDxy,
1441  minDxy / dxyDzZoom,
1442  maxDxy / dxyDzZoom));
1443  histograms.h_looperdxypvzoomed.push_back(ibook.book1D("num_duplicate_dxypv_zoomed",
1444  "N of associated (recoToSim) looper tracks vs dxy(PV)",
1445  nintDxy,
1446  minDxy / dxyDzZoom,
1447  maxDxy / dxyDzZoom));
1448  if (!doSeedPlots_)
1449  histograms.h_misiddxypvzoomed.push_back(ibook.book1D("num_chargemisid_dxypv_zoomed",
1450  "N of associated (recoToSim) charge misIDed tracks vs dxy(PV)",
1451  nintDxy,
1452  minDxy / dxyDzZoom,
1453  maxDxy / dxyDzZoom));
1454  histograms.h_pileupdxypvzoomed.push_back(ibook.book1D("num_pileup_dxypv_zoomed",
1455  "N of associated (recoToSim) pileup tracks vs dxy(PV)",
1456  nintDxy,
1457  minDxy / dxyDzZoom,
1458  maxDxy / dxyDzZoom));
1459 
1460  histograms.h_recodzpvzoomed.push_back(
1461  ibook.book1D("num_reco_dzpv_zoomed", "N of reco track vs dz(PV)", nintDz, minDz / dxyDzZoom, maxDz / dxyDzZoom));
1462  histograms.h_assoc2dzpvzoomed.push_back(ibook.book1D("num_assoc(recoToSim)_dzpv_zoomed",
1463  "N of associated (recoToSim) tracks vs dz(PV)",
1464  nintDz,
1465  minDz / dxyDzZoom,
1466  maxDz / dxyDzZoom));
1467  histograms.h_looperdzpvzoomed.push_back(ibook.book1D("num_duplicate_dzpv_zoomed",
1468  "N of associated (recoToSim) looper tracks vs dz(PV)",
1469  nintDz,
1470  minDz / dxyDzZoom,
1471  maxDz / dxyDzZoom));
1472  if (!doSeedPlots_)
1473  histograms.h_misiddzpvzoomed.push_back(ibook.book1D("num_chargemisid_versus_dzpv_zoomed",
1474  "N of associated (recoToSim) charge misIDed tracks vs dz(PV)",
1475  nintDz,
1476  minDz / dxyDzZoom,
1477  maxDz / dxyDzZoom));
1478  histograms.h_pileupdzpvzoomed.push_back(ibook.book1D("num_pileup_dzpv_zoomed",
1479  "N of associated (recoToSim) pileup tracks vs dz(PV)",
1480  nintDz,
1481  minDz / dxyDzZoom,
1482  maxDz / dxyDzZoom));
1483 
1484  if (doDzPVcutPlots_) {
1485  histograms.h_reco_dzpvcut.push_back(
1486  ibook.book1D("num_reco_dzpvcut", "N of reco track vs dz(PV)", nintDzpvCum, 0, maxDzpvCum));
1487 
1488  histograms.h_assoc2_dzpvcut.push_back(ibook.book1D(
1489  "num_assoc(recoToSim)_dzpvcut", "N of associated (recoToSim) tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum));
1490 
1491  histograms.h_pileup_dzpvcut.push_back(ibook.book1D(
1492  "num_pileup_dzpvcut", "N of associated (recoToSim) pileup tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum));
1493  }
1494 }
1495 
1497  // dE/dx stuff
1498  histograms.h_dedx_estim.emplace_back();
1499  histograms.h_dedx_estim.back().push_back(
1500  ibook.book1D("h_dedx_estim1", "dE/dx estimator 1", nintDeDx, minDeDx, maxDeDx));
1501  histograms.h_dedx_estim.back().push_back(
1502  ibook.book1D("h_dedx_estim2", "dE/dx estimator 2", nintDeDx, minDeDx, maxDeDx));
1503 
1504  histograms.h_dedx_nom.emplace_back();
1505  histograms.h_dedx_nom.back().push_back(
1506  ibook.book1D("h_dedx_nom1", "dE/dx number of measurements", nintHit, minHit, maxHit));
1507  histograms.h_dedx_nom.back().push_back(
1508  ibook.book1D("h_dedx_nom2", "dE/dx number of measurements", nintHit, minHit, maxHit));
1509 
1510  histograms.h_dedx_sat.emplace_back();
1511  histograms.h_dedx_sat.back().push_back(
1512  ibook.book1D("h_dedx_sat1", "dE/dx number of measurements with saturation", nintHit, minHit, maxHit));
1513  histograms.h_dedx_sat.back().push_back(
1514  ibook.book1D("h_dedx_sat2", "dE/dx number of measurements with saturation", nintHit, minHit, maxHit));
1515 }
1516 
1518  histograms.h_seedsFitFailed.push_back(
1519  ibook.book1D("seeds_fitFailed", "Number of seeds for which the fit failed", nintTracks, minTracks, maxTracks));
1520  histograms.h_seedsFitFailedFraction.push_back(
1521  ibook.book1D("seeds_fitFailedFraction", "Fraction of seeds for which the fit failed", 100, 0, 1));
1522 }
1523 
1525  histograms.h_reco_mva.emplace_back();
1526  histograms.h_assoc2_mva.emplace_back();
1527 
1528  histograms.h_reco_mvacut.emplace_back();
1529  histograms.h_assoc_mvacut.emplace_back();
1530  histograms.h_assoc2_mvacut.emplace_back();
1531  histograms.h_simul2_mvacut.emplace_back();
1532 
1533  histograms.h_reco_mva_hp.emplace_back();
1534  histograms.h_assoc2_mva_hp.emplace_back();
1535 
1536  histograms.h_reco_mvacut_hp.emplace_back();
1537  histograms.h_assoc_mvacut_hp.emplace_back();
1538  histograms.h_assoc2_mvacut_hp.emplace_back();
1539  histograms.h_simul2_mvacut_hp.emplace_back();
1540 
1541  histograms.h_assoc2_mva_vs_pt.emplace_back();
1542  histograms.h_fake_mva_vs_pt.emplace_back();
1543  histograms.h_assoc2_mva_vs_pt_hp.emplace_back();
1544  histograms.h_fake_mva_vs_pt_hp.emplace_back();
1545  histograms.h_assoc2_mva_vs_eta.emplace_back();
1546  histograms.h_fake_mva_vs_eta.emplace_back();
1547  histograms.h_assoc2_mva_vs_eta_hp.emplace_back();
1548  histograms.h_fake_mva_vs_eta_hp.emplace_back();
1549 
1550  for (size_t i = 1; i <= nMVAs; ++i) {
1551  auto istr = std::to_string(i);
1552  std::string pfix;
1553 
1554  if (i == 1) {
1555  histograms.h_reco_mva_hp.back().emplace_back();
1556  histograms.h_assoc2_mva_hp.back().emplace_back();
1557 
1558  histograms.h_reco_mvacut_hp.back().emplace_back();
1559  histograms.h_assoc_mvacut_hp.back().emplace_back();
1560  histograms.h_assoc2_mvacut_hp.back().emplace_back();
1561  histograms.h_simul2_mvacut_hp.back().emplace_back();
1562 
1563  histograms.h_assoc2_mva_vs_pt_hp.back().emplace_back();
1564  histograms.h_fake_mva_vs_pt_hp.back().emplace_back();
1565  histograms.h_assoc2_mva_vs_eta_hp.back().emplace_back();
1566  histograms.h_fake_mva_vs_eta_hp.back().emplace_back();
1567  } else {
1568  pfix = " (not loose-selected)";
1569  std::string pfix2 = " (not HP-selected)";
1570 
1571  histograms.h_reco_mva_hp.back().push_back(ibook.book1D(
1572  "num_reco_mva" + istr + "_hp", "N of reco track after vs MVA" + istr + pfix2, nintMVA, minMVA, maxMVA));
1573  histograms.h_assoc2_mva_hp.back().push_back(
1574  ibook.book1D("num_assoc(recoToSim)_mva" + istr + "_hp",
1575  "N of associated tracks (recoToSim) vs MVA" + istr + pfix2,
1576  nintMVA,
1577  minMVA,
1578  maxMVA));
1579 
1580  histograms.h_reco_mvacut_hp.back().push_back(ibook.book1D("num_reco_mva" + istr + "cut" + "_hp",
1581  "N of reco track vs cut on MVA" + istr + pfix2,
1582  nintMVA,
1583  minMVA,
1584  maxMVA));
1585  histograms.h_assoc_mvacut_hp.back().push_back(
1586  ibook.book1D("num_assoc(simToReco)_mva" + istr + "cut_hp",
1587  "N of associated tracks (simToReco) vs cut on MVA" + istr + pfix2,
1588  nintMVA,
1589  minMVA,
1590  maxMVA));
1591  histograms.h_assoc2_mvacut_hp.back().push_back(
1592  ibook.book1D("num_assoc(recoToSim)_mva" + istr + "cut_hp",
1593  "N of associated tracks (recoToSim) vs cut on MVA" + istr + pfix2,
1594  nintMVA,
1595  minMVA,
1596  maxMVA));
1597  histograms.h_simul2_mvacut_hp.back().push_back(
1598  ibook.book1D("num_simul2_mva" + istr + "cut_hp",
1599  "N of simulated tracks (associated to any track) vs cut on MVA" + istr + pfix2,
1600  nintMVA,
1601  minMVA,
1602  maxMVA));
1603 
1604  histograms.h_assoc2_mva_vs_pt_hp.back().push_back(
1605  makeProfileIfLogX(ibook,
1606  useLogPt,
1607  ("mva_assoc(recoToSim)_mva" + istr + "_pT_hp").c_str(),
1608  ("MVA" + istr + " of associated tracks (recoToSim) vs. track p_{T}" + pfix2).c_str(),
1609  nintPt,
1610  minPt,
1611  maxPt,
1612  minMVA,
1613  maxMVA));
1614  histograms.h_fake_mva_vs_pt_hp.back().push_back(
1615  makeProfileIfLogX(ibook,
1616  useLogPt,
1617  ("mva_fake_mva" + istr + "pT_hp").c_str(),
1618  ("MVA" + istr + " of non-associated tracks (recoToSim) vs. track p_{T}" + pfix2).c_str(),
1619  nintPt,
1620  minPt,
1621  maxPt,
1622  minMVA,
1623  maxMVA));
1624  histograms.h_assoc2_mva_vs_eta_hp.back().push_back(
1625  ibook.bookProfile("mva_assoc(recoToSim)_mva" + istr + "_eta_hp",
1626  "MVA" + istr + " of associated tracks (recoToSim) vs. track #eta" + pfix2,
1627  nintEta,
1628  minEta,
1629  maxEta,
1630  nintMVA,
1631  minMVA,
1632  maxMVA));
1633  histograms.h_fake_mva_vs_eta_hp.back().push_back(
1634  ibook.bookProfile("mva_fake_mva" + istr + "eta_hp",
1635  "MVA" + istr + " of non-associated tracks (recoToSim) vs. track #eta" + pfix2,
1636  nintEta,
1637  minEta,
1638  maxEta,
1639  nintMVA,
1640  minMVA,
1641  maxMVA));
1642  }
1643 
1644  histograms.h_reco_mva.back().push_back(
1645  ibook.book1D("num_reco_mva" + istr, "N of reco track vs MVA" + istr + pfix, nintMVA, minMVA, maxMVA));
1646  histograms.h_assoc2_mva.back().push_back(ibook.book1D("num_assoc(recoToSim)_mva" + istr,
1647  "N of associated tracks (recoToSim) vs MVA" + istr + pfix,
1648  nintMVA,
1649  minMVA,
1650  maxMVA));
1651 
1652  histograms.h_reco_mvacut.back().push_back(ibook.book1D(
1653  "num_reco_mva" + istr + "cut", "N of reco track vs cut on MVA" + istr + pfix, nintMVA, minMVA, maxMVA));
1654  histograms.h_assoc_mvacut.back().push_back(
1655  ibook.book1D("num_assoc(simToReco)_mva" + istr + "cut",
1656  "N of associated tracks (simToReco) vs cut on MVA" + istr + pfix,
1657  nintMVA,
1658  minMVA,
1659  maxMVA));
1660  histograms.h_assoc2_mvacut.back().push_back(
1661  ibook.book1D("num_assoc(recoToSim)_mva" + istr + "cut",
1662  "N of associated tracks (recoToSim) vs cut on MVA" + istr + pfix,
1663  nintMVA,
1664  minMVA,
1665  maxMVA));
1666  histograms.h_simul2_mvacut.back().push_back(
1667  ibook.book1D("num_simul2_mva" + istr + "cut",
1668  "N of simulated tracks (associated to any track) vs cut on MVA" + istr + pfix,
1669  nintMVA,
1670  minMVA,
1671  maxMVA));
1672 
1673  histograms.h_assoc2_mva_vs_pt.back().push_back(
1674  makeProfileIfLogX(ibook,
1675  useLogPt,
1676  ("mva_assoc(recoToSim)_mva" + istr + "_pT").c_str(),
1677  ("MVA" + istr + " of associated tracks (recoToSim) vs. track p_{T}" + pfix).c_str(),
1678  nintPt,
1679  minPt,
1680  maxPt,
1681  minMVA,
1682  maxMVA));
1683  histograms.h_fake_mva_vs_pt.back().push_back(
1684  makeProfileIfLogX(ibook,
1685  useLogPt,
1686  ("mva_fake_mva" + istr + "_pT").c_str(),
1687  ("MVA" + istr + " of non-associated tracks (recoToSim) vs. track p_{T}" + pfix).c_str(),
1688  nintPt,
1689  minPt,
1690  maxPt,
1691  minMVA,
1692  maxMVA));
1693  histograms.h_assoc2_mva_vs_eta.back().push_back(
1694  ibook.bookProfile("mva_assoc(recoToSim)_mva" + istr + "_eta",
1695  "MVA" + istr + " of associated tracks (recoToSim) vs. track #eta" + pfix,
1696  nintEta,
1697  minEta,
1698  maxEta,
1699  nintMVA,
1700  minMVA,
1701  maxMVA));
1702  histograms.h_fake_mva_vs_eta.back().push_back(
1703  ibook.bookProfile("mva_fake_mva" + istr + "_eta",
1704  "MVA" + istr + " of non-associated tracks (recoToSim) vs. track #eta" + pfix,
1705  nintEta,
1706  minEta,
1707  maxEta,
1708  nintMVA,
1709  minMVA,
1710  maxMVA));
1711  }
1712 }
1713 
1715  const TrackingParticle::Vector& momentumTP,
1716  const TrackingParticle::Point& vertexTP,
1717  int bx) const {
1718  if (bx == 0) {
1719  histograms.h_ptSIM->Fill(sqrt(momentumTP.perp2()));
1720  histograms.h_etaSIM->Fill(momentumTP.eta());
1721  histograms.h_phiSIM->Fill(momentumTP.phi());
1722  histograms.h_vertposSIM->Fill(sqrt(vertexTP.perp2()));
1723  }
1724  histograms.h_bunchxSIM->Fill(bx);
1725 }
1726 
1728  const Histograms& histograms,
1729  int count,
1730  const TrackingParticle& tp,
1731  const TrackingParticle::Vector& momentumTP,
1732  const TrackingParticle::Point& vertexTP,
1733  double dxySim,
1734  double dzSim,
1735  double dxyPVSim,
1736  double dzPVSim,
1737  int nSimHits,
1738  int nSimLayers,
1739  int nSimPixelLayers,
1740  int nSimStripMonoAndStereoLayers,
1741  const reco::Track* track,
1742  int numVertices,
1743  double dR,
1744  double dRJet,
1745  const math::XYZPoint* pvPosition,
1746  const TrackingVertex::LorentzVector* simPVPosition,
1747  const math::XYZPoint& bsPosition,
1748  const std::vector<float>& mvas,
1749  unsigned int selectsLoose,
1750  unsigned int selectsHP) const {
1751  bool isMatched = track;
1752  const auto eta = getEta(momentumTP.eta());
1753  const auto phi = momentumTP.phi();
1754  const auto pt = getPt(sqrt(momentumTP.perp2()));
1755  const auto nSim3DLayers = nSimPixelLayers + nSimStripMonoAndStereoLayers;
1756 
1757  const auto vertexTPwrtBS = vertexTP - bsPosition;
1758  const auto vertxy = std::sqrt(vertexTPwrtBS.perp2());
1759  const auto vertz = vertexTPwrtBS.z();
1760 
1761  //efficiency vs. cut on MVA
1762  //
1763  // Note that this includes also pileup TPs, as "signalOnly"
1764  // selection is applied only in the TpSelector*. Have to think if
1765  // this is really what we want.
1766  if (isMatched) {
1767  for (size_t i = 0; i < mvas.size(); ++i) {
1768  if (i <= selectsLoose) {
1769  histograms.h_simul2_mvacut[count][i]->Fill(maxMVA);
1770  histograms.h_assoc_mvacut[count][i]->Fill(mvas[i]);
1771  }
1772  if (i >= 1 && i <= selectsHP) {
1773  histograms.h_simul2_mvacut_hp[count][i]->Fill(maxMVA);
1774  histograms.h_assoc_mvacut_hp[count][i]->Fill(mvas[i]);
1775  }
1776  }
1777  }
1778 
1779  if ((*TpSelectorForEfficiencyVsEta)(tp)) {
1780  //effic vs eta
1781  histograms.h_simuleta[count]->Fill(eta);
1782  if (isMatched)
1783  histograms.h_assoceta[count]->Fill(eta);
1784  }
1785 
1786  if ((*TpSelectorForEfficiencyVsPhi)(tp)) {
1787  histograms.h_simulphi[count]->Fill(phi);
1788  if (isMatched)
1789  histograms.h_assocphi[count]->Fill(phi);
1790  //effic vs hits
1791  histograms.h_simulhit[count]->Fill(nSimHits);
1792  histograms.h_simullayer[count]->Fill(nSimLayers);
1793  histograms.h_simulpixellayer[count]->Fill(nSimPixelLayers);
1794  histograms.h_simul3Dlayer[count]->Fill(nSim3DLayers);
1795  if (isMatched) {
1796  histograms.h_assochit[count]->Fill(nSimHits);
1797  histograms.h_assoclayer[count]->Fill(nSimLayers);
1798  histograms.h_assocpixellayer[count]->Fill(nSimPixelLayers);
1799  histograms.h_assoc3Dlayer[count]->Fill(nSim3DLayers);
1800  if (histograms.nrecHit_vs_nsimHit_sim2rec[count])
1801  histograms.nrecHit_vs_nsimHit_sim2rec[count]->Fill(track->numberOfValidHits(), nSimHits);
1802  }
1803  //effic vs pu
1804  histograms.h_simulpu[count]->Fill(numVertices);
1805  if (isMatched)
1806  histograms.h_assocpu[count]->Fill(numVertices);
1807  //efficiency vs dR
1808  histograms.h_simuldr[count]->Fill(dR);
1809  if (isMatched)
1810  histograms.h_assocdr[count]->Fill(dR);
1811  //efficiency vs dR jet
1812  histograms.h_simuldrj[count]->Fill(dRJet);
1813  if (isMatched)
1814  histograms.h_assocdrj[count]->Fill(dRJet);
1815  }
1816 
1817  if ((*TpSelectorForEfficiencyVsPt)(tp)) {
1818  histograms.h_simulpT[count]->Fill(pt);
1819  if (isMatched)
1820  histograms.h_assocpT[count]->Fill(pt);
1821  }
1822 
1824  histograms.h_simuldxy[count]->Fill(dxySim);
1825  if (isMatched)
1826  histograms.h_assocdxy[count]->Fill(dxySim);
1827  if (pvPosition) {
1828  histograms.h_simuldxypv[count]->Fill(dxyPVSim);
1829  histograms.h_simuldxypvzoomed[count]->Fill(dxyPVSim);
1830  if (isMatched) {
1831  histograms.h_assocdxypv[count]->Fill(dxyPVSim);
1832  histograms.h_assocdxypvzoomed[count]->Fill(dxyPVSim);
1833  }
1834  }
1835 
1836  histograms.h_simulvertpos[count]->Fill(vertxy);
1837  if (isMatched)
1838  histograms.h_assocvertpos[count]->Fill(vertxy);
1839  }
1840 
1842  histograms.h_simuldz[count]->Fill(dzSim);
1843  if (isMatched)
1844  histograms.h_assocdz[count]->Fill(dzSim);
1845 
1846  histograms.h_simulzpos[count]->Fill(vertz);
1847  if (isMatched)
1848  histograms.h_assoczpos[count]->Fill(vertz);
1849 
1850  if (pvPosition) {
1851  histograms.h_simuldzpv[count]->Fill(dzPVSim);
1852  histograms.h_simuldzpvzoomed[count]->Fill(dzPVSim);
1853 
1854  if (doDzPVcutPlots_)
1855  histograms.h_simul_dzpvcut[count]->Fill(0);
1856 
1857  if (isMatched) {
1858  histograms.h_assocdzpv[count]->Fill(dzPVSim);
1859  histograms.h_assocdzpvzoomed[count]->Fill(dzPVSim);
1860 
1861  if (doDzPVcutPlots_) {
1862  histograms.h_simul2_dzpvcut[count]->Fill(0);
1863 
1864  const double dzpvcut = std::abs(track->dz(*pvPosition));
1865  histograms.h_assoc_dzpvcut[count]->Fill(dzpvcut);
1866  }
1867  }
1868  }
1869  if (simPVPosition) {
1870  const auto simpvz = simPVPosition->z();
1871  histograms.h_simul_simpvz[count]->Fill(simpvz);
1872  if (isMatched) {
1873  histograms.h_assoc_simpvz[count]->Fill(simpvz);
1874  }
1875  }
1876  }
1877 }
1878 
1880  int count,
1881  const reco::Track& track1,
1882  const reco::Track& track2) const {
1883  histograms.h_duplicates_oriAlgo_vs_oriAlgo[count]->Fill(track1.originalAlgo(), track2.originalAlgo());
1884 }
1885 
1887  histograms.h_tracksSIM->Fill(numSimTracks);
1888 }
1889 
1890 // dE/dx
1892  const Histograms& histograms,
1893  int count,
1894  const edm::RefToBase<reco::Track>& trackref,
1895  const std::vector<const edm::ValueMap<reco::DeDxData>*>& v_dEdx) const {
1896  for (unsigned int i = 0; i < v_dEdx.size(); i++) {
1897  const edm::ValueMap<reco::DeDxData>& dEdxTrack = *(v_dEdx[i]);
1898  const reco::DeDxData& dedx = dEdxTrack[trackref];
1899  histograms.h_dedx_estim[count][i]->Fill(dedx.dEdx());
1900  histograms.h_dedx_nom[count][i]->Fill(dedx.numberOfMeasurements());
1901  histograms.h_dedx_sat[count][i]->Fill(dedx.numberOfSaturatedMeasurements());
1902  }
1903 }
1904 
1906  int count,
1907  const reco::Track& track,
1908  const TrackerTopology& ttopo,
1909  const math::XYZPoint& bsPosition,
1910  const math::XYZPoint* pvPosition,
1911  const TrackingVertex::LorentzVector* simPVPosition,
1912  bool isMatched,
1913  bool isSigMatched,
1914  bool isChargeMatched,
1915  int numAssocRecoTracks,
1916  int numVertices,
1917  int nSimHits,
1918  double sharedFraction,
1919  double dR,
1920  double dRJet,
1921  const std::vector<float>& mvas,
1922  unsigned int selectsLoose,
1923  unsigned int selectsHP) const {
1924  //Fill track algo histogram
1925  histograms.h_algo[count]->Fill(track.algo());
1926  int sharedHits = sharedFraction * track.numberOfValidHits();
1927 
1928  //Compute fake rate vs eta
1929  const auto eta = getEta(track.momentum().eta());
1930  const auto phi = track.momentum().phi();
1931  const auto pt = getPt(sqrt(track.momentum().perp2()));
1932  const auto dxy = track.dxy(bsPosition);
1933  const auto dz = track.dz(bsPosition);
1934  const auto dxypv = pvPosition ? track.dxy(*pvPosition) : 0.0;
1935  const auto dzpv = pvPosition ? track.dz(*pvPosition) : 0.0;
1936  const auto nhits = track.found();
1937  const auto nlayers = track.hitPattern().trackerLayersWithMeasurement();
1938  const auto nPixelLayers = track.hitPattern().pixelLayersWithMeasurement();
1939  const auto n3DLayers = nPixelLayers + track.hitPattern().numberOfValidStripLayersWithMonoAndStereo();
1940  const auto refPointWrtBS = track.referencePoint() - bsPosition;
1941  const auto vertxy = std::sqrt(refPointWrtBS.perp2());
1942  const auto vertz = refPointWrtBS.z();
1943  const auto chi2 = track.normalizedChi2();
1944  const auto chi2prob = TMath::Prob(track.chi2(), (int)track.ndof());
1945  const bool fillSeedingLayerSets = !seedingLayerSetNames.empty();
1946  const unsigned int seedingLayerSetBin = fillSeedingLayerSets ? getSeedingLayerSetBin(track, ttopo) : 0;
1947  const auto simpvz = simPVPosition ? simPVPosition->z() : 0.0;
1948 
1949  const bool paramsValid = !trackFromSeedFitFailed(track);
1950 
1951  if (paramsValid) {
1952  histograms.h_recoeta[count]->Fill(eta);
1953  histograms.h_recophi[count]->Fill(phi);
1954  histograms.h_recopT[count]->Fill(pt);
1955  histograms.h_recopTvseta[count]->Fill(eta, pt);
1956  histograms.h_recodxy[count]->Fill(dxy);
1957  histograms.h_recodz[count]->Fill(dz);
1958  histograms.h_recochi2[count]->Fill(chi2);
1959  histograms.h_recochi2prob[count]->Fill(chi2prob);
1960  histograms.h_recovertpos[count]->Fill(vertxy);
1961  histograms.h_recozpos[count]->Fill(vertz);
1962  histograms.h_recodr[count]->Fill(dR);
1963  histograms.h_recodrj[count]->Fill(dRJet);
1964  if (dRJet <= 99999) //dRJet can be set to numeric_limits max^2, this is a protection
1965  histograms.chi2_vs_drj[count]->Fill(dRJet, chi2);
1966  if (fillSeedingLayerSets)
1967  histograms.h_reco_seedingLayerSet[count]->Fill(seedingLayerSetBin);
1968  if (pvPosition) {
1969  histograms.h_recodxypv[count]->Fill(dxypv);
1970  histograms.h_recodzpv[count]->Fill(dzpv);
1971  histograms.h_recodxypvzoomed[count]->Fill(dxypv);
1972  histograms.h_recodzpvzoomed[count]->Fill(dzpv);
1973 
1974  if (doDzPVcutPlots_)
1975  histograms.h_reco_dzpvcut[count]->Fill(std::abs(dzpv));
1976  }
1977  if (simPVPosition) {
1978  histograms.h_reco_simpvz[count]->Fill(simpvz);
1979  }
1980  if ((*trackSelectorVsEta)(track, bsPosition)) {
1981  histograms.h_reco2eta[count]->Fill(eta);
1982  }
1983  if ((*trackSelectorVsPt)(track, bsPosition)) {
1984  histograms.h_reco2pT[count]->Fill(pt);
1985  histograms.h_reco2pTvseta[count]->Fill(eta, pt);
1986  }
1987  }
1988  histograms.h_recohit[count]->Fill(nhits);
1989  histograms.h_recolayer[count]->Fill(nlayers);
1990  histograms.h_recopixellayer[count]->Fill(nPixelLayers);
1991  histograms.h_reco3Dlayer[count]->Fill(n3DLayers);
1992  histograms.h_recopu[count]->Fill(numVertices);
1993  if ((*trackSelectorVsPhi)(track, bsPosition)) {
1994  histograms.h_reco2pu[count]->Fill(numVertices);
1995  }
1996 
1997  if (!mvas.empty()) {
1998  assert(histograms.h_reco_mva.size() > static_cast<size_t>(count));
1999  assert(histograms.h_reco_mvacut.size() > static_cast<size_t>(count));
2000  assert(histograms.h_reco_mva_hp.size() > static_cast<size_t>(count));
2001  assert(histograms.h_reco_mvacut_hp.size() > static_cast<size_t>(count));
2002 
2003  fillMVAHistos(histograms.h_reco_mva[count],
2004  histograms.h_reco_mvacut[count],
2005  histograms.h_reco_mva_hp[count],
2006  histograms.h_reco_mvacut_hp[count],
2007  mvas,
2008  selectsLoose,
2009  selectsHP);
2010  }
2011 
2012  if (isMatched) {
2013  if (paramsValid) {
2014  histograms.h_assoc2eta[count]->Fill(eta);
2015  histograms.h_assoc2phi[count]->Fill(phi);
2016  histograms.h_assoc2pT[count]->Fill(pt);
2017  histograms.h_assoc2pTvseta[count]->Fill(eta, pt);
2018  histograms.h_assoc2dxy[count]->Fill(dxy);
2019  histograms.h_assoc2dz[count]->Fill(dz);
2020  histograms.h_assoc2hit[count]->Fill(nhits);
2021  histograms.h_assoc2chi2[count]->Fill(chi2);
2022  histograms.h_assoc2chi2prob[count]->Fill(chi2prob);
2023  histograms.assoc_chi2_vs_eta[count]->Fill(eta, chi2);
2024  histograms.assoc_chi2prob_vs_eta[count]->Fill(eta, chi2prob);
2025  histograms.assoc_chi2_vs_pt[count]->Fill(pt, chi2);
2026  histograms.assoc_chi2prob_vs_pt[count]->Fill(pt, chi2prob);
2027  if (dRJet <= 99999) { //dRJet can be set to numeric_limits max^2, this is a protection
2028  histograms.assoc_chi2_vs_drj[count]->Fill(dRJet, chi2);
2029  histograms.assoc_chi2prob_vs_drj[count]->Fill(dRJet, chi2prob);
2030  }
2031  histograms.h_assoc2vertpos[count]->Fill(vertxy);
2032  histograms.h_assoc2zpos[count]->Fill(vertz);
2033  histograms.h_assoc2dr[count]->Fill(dR);
2034  histograms.h_assoc2drj[count]->Fill(dRJet);
2035  if (fillSeedingLayerSets)
2036  histograms.h_assoc2_seedingLayerSet[count]->Fill(seedingLayerSetBin);
2037  if (pvPosition) {
2038  histograms.h_assoc2dxypv[count]->Fill(dxypv);
2039  histograms.h_assoc2dzpv[count]->Fill(dzpv);
2040  histograms.h_assoc2dxypvzoomed[count]->Fill(dxypv);
2041  histograms.h_assoc2dzpvzoomed[count]->Fill(dzpv);
2042 
2043  if (doDzPVcutPlots_)
2044  histograms.h_assoc2_dzpvcut[count]->Fill(std::abs(dzpv));
2045  }
2046  if (simPVPosition) {
2047  histograms.h_assoc2_simpvz[count]->Fill(simpvz);
2048  }
2049  }
2050  histograms.h_assoc2layer[count]->Fill(nlayers);
2051  histograms.h_assoc2pixellayer[count]->Fill(nPixelLayers);
2052  histograms.h_assoc23Dlayer[count]->Fill(n3DLayers);
2053  histograms.h_assoc2pu[count]->Fill(numVertices);
2054 
2055  if (!mvas.empty()) {
2056  assert(histograms.h_reco_mva.size() > static_cast<size_t>(count));
2057  assert(histograms.h_reco_mvacut.size() > static_cast<size_t>(count));
2058  assert(histograms.h_reco_mva_hp.size() > static_cast<size_t>(count));
2059  assert(histograms.h_reco_mvacut_hp.size() > static_cast<size_t>(count));
2060  fillMVAHistos(histograms.h_assoc2_mva[count],
2061  histograms.h_assoc2_mvacut[count],
2062  histograms.h_assoc2_mva_hp[count],
2063  histograms.h_assoc2_mvacut_hp[count],
2064  mvas,
2065  selectsLoose,
2066  selectsHP);
2067  assert(histograms.h_assoc2_mva_vs_pt.size() > static_cast<size_t>(count));
2068  assert(histograms.h_assoc2_mva_vs_pt_hp.size() > static_cast<size_t>(count));
2069  fillMVAHistos(pt,
2070  histograms.h_assoc2_mva_vs_pt[count],
2071  histograms.h_assoc2_mva_vs_pt_hp[count],
2072  mvas,
2073  selectsLoose,
2074  selectsHP);
2075  assert(histograms.h_assoc2_mva_vs_eta.size() > static_cast<size_t>(count));
2076  assert(histograms.h_assoc2_mva_vs_eta_hp.size() > static_cast<size_t>(count));
2077  fillMVAHistos(eta,
2078  histograms.h_assoc2_mva_vs_eta[count],
2079  histograms.h_assoc2_mva_vs_eta_hp[count],
2080  mvas,
2081  selectsLoose,
2082  selectsHP);
2083  }
2084 
2085  if (histograms.nrecHit_vs_nsimHit_rec2sim[count])
2086  histograms.nrecHit_vs_nsimHit_rec2sim[count]->Fill(track.numberOfValidHits(), nSimHits);
2087  histograms.h_assocFraction[count]->Fill(sharedFraction);
2088  histograms.h_assocSharedHit[count]->Fill(sharedHits);
2089 
2090  if (!doSeedPlots_ && !isChargeMatched) {
2091  histograms.h_misideta[count]->Fill(eta);
2092  histograms.h_misidphi[count]->Fill(phi);
2093  histograms.h_misidpT[count]->Fill(pt);
2094  histograms.h_misidpTvseta[count]->Fill(eta, pt);
2095  histograms.h_misiddxy[count]->Fill(dxy);
2096  histograms.h_misiddz[count]->Fill(dz);
2097  histograms.h_misidhit[count]->Fill(nhits);
2098  histograms.h_misidlayer[count]->Fill(nlayers);
2099  histograms.h_misidpixellayer[count]->Fill(nPixelLayers);
2100  histograms.h_misid3Dlayer[count]->Fill(n3DLayers);
2101  histograms.h_misidpu[count]->Fill(numVertices);
2102  histograms.h_misidchi2[count]->Fill(chi2);
2103  histograms.h_misidchi2prob[count]->Fill(chi2prob);
2104  if (pvPosition) {
2105  histograms.h_misiddxypv[count]->Fill(dxypv);
2106  histograms.h_misiddzpv[count]->Fill(dzpv);
2107  histograms.h_misiddxypvzoomed[count]->Fill(dxypv);
2108  histograms.h_misiddzpvzoomed[count]->Fill(dzpv);
2109  }
2110  }
2111 
2112  if (numAssocRecoTracks > 1) {
2113  if (paramsValid) {
2114  histograms.h_loopereta[count]->Fill(eta);
2115  histograms.h_looperphi[count]->Fill(phi);
2116  histograms.h_looperpT[count]->Fill(pt);
2117  histograms.h_looperpTvseta[count]->Fill(eta, pt);
2118  histograms.h_looperdxy[count]->Fill(dxy);
2119  histograms.h_looperdz[count]->Fill(dz);
2120  histograms.h_looperchi2[count]->Fill(chi2);
2121  histograms.h_looperchi2prob[count]->Fill(chi2prob);
2122  histograms.h_loopervertpos[count]->Fill(vertxy);
2123  histograms.h_looperzpos[count]->Fill(vertz);
2124  histograms.h_looperdr[count]->Fill(dR);
2125  histograms.h_looperdrj[count]->Fill(dRJet);
2126  if (fillSeedingLayerSets)
2127  histograms.h_looper_seedingLayerSet[count]->Fill(seedingLayerSetBin);
2128  if (pvPosition) {
2129  histograms.h_looperdxypv[count]->Fill(dxypv);
2130  histograms.h_looperdzpv[count]->Fill(dzpv);
2131  histograms.h_looperdxypvzoomed[count]->Fill(dxypv);
2132  histograms.h_looperdzpvzoomed[count]->Fill(dzpv);
2133  }
2134  if (simPVPosition) {
2135  histograms.h_looper_simpvz[count]->Fill(simpvz);
2136  }
2137  }
2138  histograms.h_looperhit[count]->Fill(nhits);
2139  histograms.h_looperlayer[count]->Fill(nlayers);
2140  histograms.h_looperpixellayer[count]->Fill(nPixelLayers);
2141  histograms.h_looper3Dlayer[count]->Fill(n3DLayers);
2142  histograms.h_looperpu[count]->Fill(numVertices);
2143  }
2144  if (!isSigMatched) {
2145  if (paramsValid) {
2146  histograms.h_pileupeta[count]->Fill(eta);
2147  histograms.h_pileupphi[count]->Fill(phi);
2148  histograms.h_pileuppT[count]->Fill(pt);
2149  histograms.h_pileuppTvseta[count]->Fill(eta, pt);
2150  histograms.h_pileupdxy[count]->Fill(dxy);
2151  histograms.h_pileupdz[count]->Fill(dz);
2152  histograms.h_pileupchi2[count]->Fill(chi2);
2153  histograms.h_pileupchi2prob[count]->Fill(chi2prob);
2154  histograms.h_pileupvertpos[count]->Fill(vertxy);
2155  histograms.h_pileupzpos[count]->Fill(vertz);
2156  histograms.h_pileupdr[count]->Fill(dR);
2157  histograms.h_pileupdrj[count]->Fill(dRJet);
2158  if (fillSeedingLayerSets)
2159  histograms.h_pileup_seedingLayerSet[count]->Fill(seedingLayerSetBin);
2160  if (pvPosition) {
2161  histograms.h_pileupdxypv[count]->Fill(dxypv);
2162  histograms.h_pileupdzpv[count]->Fill(dzpv);
2163  histograms.h_pileupdxypvzoomed[count]->Fill(dxypv);
2164  histograms.h_pileupdzpvzoomed[count]->Fill(dzpv);
2165 
2166  if (doDzPVcutPlots_)
2167  histograms.h_pileup_dzpvcut[count]->Fill(std::abs(dzpv));
2168  }
2169  if (simPVPosition) {
2170  histograms.h_pileup_simpvz[count]->Fill(simpvz);
2171  }
2172  }
2173  histograms.h_pileuphit[count]->Fill(nhits);
2174  histograms.h_pileuplayer[count]->Fill(nlayers);
2175  histograms.h_pileuppixellayer[count]->Fill(nPixelLayers);
2176  histograms.h_pileup3Dlayer[count]->Fill(n3DLayers);
2177  histograms.h_pileuppu[count]->Fill(numVertices);
2178  }
2179  } else { // !isMatched
2180  if (!mvas.empty()) {
2181  assert(histograms.h_fake_mva_vs_pt.size() > static_cast<size_t>(count));
2182  assert(histograms.h_fake_mva_vs_pt_hp.size() > static_cast<size_t>(count));
2183  assert(histograms.h_fake_mva_vs_eta.size() > static_cast<size_t>(count));
2184  assert(histograms.h_fake_mva_vs_eta_hp.size() > static_cast<size_t>(count));
2185  fillMVAHistos(
2186  pt, histograms.h_fake_mva_vs_pt[count], histograms.h_fake_mva_vs_pt_hp[count], mvas, selectsLoose, selectsHP);
2187  fillMVAHistos(eta,
2188  histograms.h_fake_mva_vs_eta[count],
2189  histograms.h_fake_mva_vs_eta_hp[count],
2190  mvas,
2191  selectsLoose,
2192  selectsHP);
2193  }
2194  }
2195 }
2196 
2198  int count,
2199  const reco::Track& track) const {
2200  //nchi2 and hits global distributions
2201  histograms.h_hits[count]->Fill(track.numberOfValidHits());
2202  histograms.h_losthits[count]->Fill(track.numberOfLostHits());
2203  histograms.h_nmisslayers_inner[count]->Fill(
2204  track.hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS));
2205  histograms.h_nmisslayers_outer[count]->Fill(
2206  track.hitPattern().numberOfLostHits(reco::HitPattern::MISSING_OUTER_HITS));
2208  return;
2209 
2210  histograms.h_nchi2[count]->Fill(track.normalizedChi2());
2211  histograms.h_nchi2_prob[count]->Fill(TMath::Prob(track.chi2(), (int)track.ndof()));
2212  histograms.chi2_vs_nhits[count]->Fill(track.numberOfValidHits(), track.normalizedChi2());
2213  histograms.h_charge[count]->Fill(track.charge());
2214 
2215  //chi2 and #hit vs eta: fill 2D histos
2216  const auto eta = getEta(track.eta());
2217  histograms.chi2_vs_eta[count]->Fill(eta, track.normalizedChi2());
2218  histograms.nhits_vs_eta[count]->Fill(eta, track.numberOfValidHits());
2219  const auto pt = getPt(sqrt(track.momentum().perp2()));
2220  histograms.chi2_vs_pt[count]->Fill(pt, track.normalizedChi2());
2221  const auto pxbHits = track.hitPattern().numberOfValidPixelBarrelHits();
2222  const auto pxfHits = track.hitPattern().numberOfValidPixelEndcapHits();
2223  const auto tibHits = track.hitPattern().numberOfValidStripTIBHits();
2224  const auto tidHits = track.hitPattern().numberOfValidStripTIDHits();
2225  const auto tobHits = track.hitPattern().numberOfValidStripTOBHits();
2226  const auto tecHits = track.hitPattern().numberOfValidStripTECHits();
2227  histograms.nPXBhits_vs_eta[count]->Fill(eta, pxbHits);
2228  histograms.nPXFhits_vs_eta[count]->Fill(eta, pxfHits);
2229  histograms.nPXLhits_vs_eta[count]->Fill(eta, pxbHits + pxfHits);
2230  histograms.nTIBhits_vs_eta[count]->Fill(eta, tibHits);
2231  histograms.nTIDhits_vs_eta[count]->Fill(eta, tidHits);
2232  histograms.nTOBhits_vs_eta[count]->Fill(eta, tobHits);
2233  histograms.nTEChits_vs_eta[count]->Fill(eta, tecHits);
2234  histograms.nSTRIPhits_vs_eta[count]->Fill(eta, tibHits + tidHits + tobHits + tecHits);
2235  histograms.nLayersWithMeas_vs_eta[count]->Fill(eta, track.hitPattern().trackerLayersWithMeasurement());
2236  histograms.nPXLlayersWithMeas_vs_eta[count]->Fill(eta, track.hitPattern().pixelLayersWithMeasurement());
2237  if (doMTDPlots_) {
2238  // const auto mtdHits = track.hitPattern().numberOfValidTimingHits();
2239  const auto btlHits = track.hitPattern().numberOfValidTimingBTLHits();
2240  const auto etlHits = track.hitPattern().numberOfValidTimingETLHits();
2241  histograms.nMTDhits_vs_eta[count]->Fill(eta, btlHits + etlHits);
2242  histograms.nBTLhits_vs_eta[count]->Fill(eta, btlHits);
2243  histograms.nETLhits_vs_eta[count]->Fill(eta, etlHits);
2244  }
2245  int LayersAll = track.hitPattern().stripLayersWithMeasurement();
2246  int Layers2D = track.hitPattern().numberOfValidStripLayersWithMonoAndStereo();
2247  int Layers1D = LayersAll - Layers2D;
2248  histograms.nSTRIPlayersWithMeas_vs_eta[count]->Fill(eta, LayersAll);
2249  histograms.nSTRIPlayersWith1dMeas_vs_eta[count]->Fill(eta, Layers1D);
2250  histograms.nSTRIPlayersWith2dMeas_vs_eta[count]->Fill(eta, Layers2D);
2251 
2252  histograms.nlosthits_vs_eta[count]->Fill(eta, track.numberOfLostHits());
2253 }
2254 
2256  int count,
2257  int assTracks,
2258  int numRecoTracks,
2259  int numRecoTracksSelected,
2260  int numSimTracksSelected) const {
2261  histograms.h_tracks[count]->Fill(assTracks);
2262  histograms.h_fakes[count]->Fill(numRecoTracks - assTracks);
2263  if (histograms.nrec_vs_nsim[count])
2264  histograms.nrec_vs_nsim[count]->Fill(numSimTracksSelected, numRecoTracksSelected);
2265 }
2266 
2268  int count,
2269  const TrackingParticle::Vector& momentumTP,
2270  const TrackingParticle::Point& vertexTP,
2271  int chargeTP,
2272  const reco::Track& track,
2273  const math::XYZPoint& bsPosition) const {
2275  return;
2276 
2277  // evaluation of TP parameters
2278  double qoverpSim = chargeTP / sqrt(momentumTP.x() * momentumTP.x() + momentumTP.y() * momentumTP.y() +
2279  momentumTP.z() * momentumTP.z());
2280  double lambdaSim = M_PI / 2 - momentumTP.theta();
2281  double phiSim = momentumTP.phi();
2282  double dxySim = TrackingParticleIP::dxy(vertexTP, momentumTP, bsPosition);
2283  double dzSim = TrackingParticleIP::dz(vertexTP, momentumTP, bsPosition);
2284 
2285  // reco::Track::ParameterVector rParameters = track.parameters(); // UNUSED
2286 
2287  double qoverpRec(0);
2288  double qoverpErrorRec(0);
2289  double ptRec(0);
2290  double ptErrorRec(0);
2291  double lambdaRec(0);
2292  double lambdaErrorRec(0);
2293  double phiRec(0);
2294  double phiErrorRec(0);
2295 
2296  /* TO BE FIXED LATER -----------
2297  //loop to decide whether to take gsfTrack (utilisation of mode-function) or common track
2298  const GsfTrack* gsfTrack(0);
2299  if(useGsf){
2300  gsfTrack = dynamic_cast<const GsfTrack*>(&(*track));
2301  if (gsfTrack==0) edm::LogInfo("TrackValidator") << "Trying to access mode for a non-GsfTrack";
2302  }
2303 
2304  if (gsfTrack) {
2305  // get values from mode
2306  getRecoMomentum(*gsfTrack, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
2307  lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
2308  }
2309 
2310  else {
2311  // get values from track (without mode)
2312  getRecoMomentum(*track, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec,
2313  lambdaRec,lambdaErrorRec, phiRec, phiErrorRec);
2314  }
2315  */
2316  getRecoMomentum(track, ptRec, ptErrorRec, qoverpRec, qoverpErrorRec, lambdaRec, lambdaErrorRec, phiRec, phiErrorRec);
2317  // -------------
2318 
2319  double ptError = ptErrorRec;
2320  double ptres = ptRec - sqrt(momentumTP.perp2());
2321  double etares = track.eta() - momentumTP.Eta();
2322 
2323  double dxyRec = track.dxy(bsPosition);
2324  double dzRec = track.dz(bsPosition);
2325 
2326  const auto phiRes = phiRec - phiSim;
2327  const auto dxyRes = dxyRec - dxySim;
2328  const auto dzRes = dzRec - dzSim;
2329  const auto cotThetaRes = 1 / tan(M_PI * 0.5 - lambdaRec) - 1 / tan(M_PI * 0.5 - lambdaSim);
2330 
2331  // eta residue; pt, k, theta, phi, dxy, dz pulls
2332  double qoverpPull = (qoverpRec - qoverpSim) / qoverpErrorRec;
2333  double thetaPull = (lambdaRec - lambdaSim) / lambdaErrorRec;
2334  double phiPull = phiRes / phiErrorRec;
2335  double dxyPull = dxyRes / track.dxyError();
2336  double dzPull = dzRes / track.dzError();
2337 
2338 #ifdef EDM_ML_DEBUG
2339  double contrib_Qoverp = ((qoverpRec - qoverpSim) / qoverpErrorRec) * ((qoverpRec - qoverpSim) / qoverpErrorRec) / 5;
2340  double contrib_dxy = ((dxyRec - dxySim) / track.dxyError()) * ((dxyRec - dxySim) / track.dxyError()) / 5;
2341  double contrib_dz = ((dzRec - dzSim) / track.dzError()) * ((dzRec - dzSim) / track.dzError()) / 5;
2342  double contrib_theta = ((lambdaRec - lambdaSim) / lambdaErrorRec) * ((lambdaRec - lambdaSim) / lambdaErrorRec) / 5;
2343  double contrib_phi = ((phiRec - phiSim) / phiErrorRec) * ((phiRec - phiSim) / phiErrorRec) / 5;
2344 
2345  LogTrace("TrackValidatorTEST")
2346  //<< "assocChi2=" << tp.begin()->second << "\n"
2347  << ""
2348  << "\n"
2349  << "ptREC=" << ptRec << "\n"
2350  << "etaREC=" << track.eta() << "\n"
2351  << "qoverpREC=" << qoverpRec << "\n"
2352  << "dxyREC=" << dxyRec << "\n"
2353  << "dzREC=" << dzRec << "\n"
2354  << "thetaREC=" << track.theta() << "\n"
2355  << "phiREC=" << phiRec << "\n"
2356  << ""
2357  << "\n"
2358  << "qoverpError()=" << qoverpErrorRec << "\n"
2359  << "dxyError()=" << track.dxyError() << "\n"
2360  << "dzError()=" << track.dzError() << "\n"
2361  << "thetaError()=" << lambdaErrorRec << "\n"
2362  << "phiError()=" << phiErrorRec << "\n"
2363  << ""
2364  << "\n"
2365  << "ptSIM=" << sqrt(momentumTP.perp2()) << "\n"
2366  << "etaSIM=" << momentumTP.Eta() << "\n"
2367  << "qoverpSIM=" << qoverpSim << "\n"
2368  << "dxySIM=" << dxySim << "\n"
2369  << "dzSIM=" << dzSim << "\n"
2370  << "thetaSIM=" << M_PI / 2 - lambdaSim << "\n"
2371  << "phiSIM=" << phiSim << "\n"
2372  << ""
2373  << "\n"
2374  << "contrib_Qoverp=" << contrib_Qoverp << "\n"
2375  << "contrib_dxy=" << contrib_dxy << "\n"
2376  << "contrib_dz=" << contrib_dz << "\n"
2377  << "contrib_theta=" << contrib_theta << "\n"
2378  << "contrib_phi=" << contrib_phi << "\n"
2379  << ""
2380  << "\n"
2381  << "chi2PULL=" << contrib_Qoverp + contrib_dxy + contrib_dz + contrib_theta + contrib_phi << "\n";
2382 #endif
2383 
2384  histograms.h_pullQoverp[count]->Fill(qoverpPull);
2385  histograms.h_pullTheta[count]->Fill(thetaPull);
2386  histograms.h_pullPhi[count]->Fill(phiPull);
2387  histograms.h_pullDxy[count]->Fill(dxyPull);
2388  histograms.h_pullDz[count]->Fill(dzPull);
2389 
2390  const auto etaSim = getEta(momentumTP.eta());
2391  const auto ptSim = getPt(sqrt(momentumTP.perp2()));
2392 
2393  histograms.h_pt[count]->Fill(ptres / ptError);
2394  histograms.h_eta[count]->Fill(etares);
2395  //histograms.etares_vs_eta[count]->Fill(getEta(track.eta()),etares);
2396  histograms.etares_vs_eta[count]->Fill(etaSim, etares);
2397 
2398  //resolution of track params: fill 2D histos
2399  histograms.dxyres_vs_eta[count]->Fill(etaSim, dxyRes);
2400  histograms.ptres_vs_eta[count]->Fill(etaSim, ptres / ptRec);
2401  histograms.dzres_vs_eta[count]->Fill(etaSim, dzRes);
2402  histograms.phires_vs_eta[count]->Fill(etaSim, phiRes);
2403  histograms.cotThetares_vs_eta[count]->Fill(etaSim, cotThetaRes);
2404 
2405  //same as before but vs pT
2406  histograms.dxyres_vs_pt[count]->Fill(ptSim, dxyRes);
2407  histograms.ptres_vs_pt[count]->Fill(ptSim, ptres / ptRec);
2408  histograms.dzres_vs_pt[count]->Fill(ptSim, dzRes);
2409  histograms.phires_vs_pt[count]->Fill(ptSim, phiRes);
2410  histograms.cotThetares_vs_pt[count]->Fill(ptSim, cotThetaRes);
2411 
2412  //pulls of track params vs eta: fill 2D histos
2413  histograms.dxypull_vs_eta[count]->Fill(etaSim, dxyPull);
2414  histograms.ptpull_vs_eta[count]->Fill(etaSim, ptres / ptError);
2415  histograms.dzpull_vs_eta[count]->Fill(etaSim, dzPull);
2416  histograms.phipull_vs_eta[count]->Fill(etaSim, phiPull);
2417  histograms.thetapull_vs_eta[count]->Fill(etaSim, thetaPull);
2418 
2419  //pulls of track params vs pt: fill 2D histos
2420  histograms.dxypull_vs_pt[count]->Fill(ptSim, dxyPull);
2421  histograms.ptpull_vs_pt[count]->Fill(ptSim, ptres / ptError);
2422  histograms.dzpull_vs_pt[count]->Fill(ptSim, dzPull);
2423  histograms.phipull_vs_pt[count]->Fill(ptSim, phiPull);
2424  histograms.thetapull_vs_pt[count]->Fill(ptSim, thetaPull);
2425 
2426  //plots vs phi
2427  histograms.nhits_vs_phi[count]->Fill(phiRec, track.numberOfValidHits());
2428  histograms.chi2_vs_phi[count]->Fill(phiRec, track.normalizedChi2());
2429  histograms.ptmean_vs_eta_phi[count]->Fill(phiRec, getEta(track.eta()), ptRec);
2430  histograms.phimean_vs_eta_phi[count]->Fill(phiRec, getEta(track.eta()), phiRec);
2431 
2432  histograms.dxyres_vs_phi[count]->Fill(phiSim, dxyRes);
2433  histograms.ptres_vs_phi[count]->Fill(phiSim, ptres / ptRec);
2434  histograms.dzres_vs_phi[count]->Fill(phiSim, dzRes);
2435  histograms.phires_vs_phi[count]->Fill(phiSim, phiRes);
2436 
2437  histograms.ptpull_vs_phi[count]->Fill(phiSim, ptres / ptError);
2438  histograms.phipull_vs_phi[count]->Fill(phiSim, phiPull);
2439  histograms.thetapull_vs_phi[count]->Fill(phiSim, thetaPull);
2440 }
2441 
2443  double& pt,
2444  double& ptError,
2445  double& qoverp,
2446  double& qoverpError,
2447  double& lambda,
2448  double& lambdaError,
2449  double& phi,
2450  double& phiError) const {
2451  pt = track.pt();
2452  ptError = track.ptError();
2453  qoverp = track.qoverp();
2454  qoverpError = track.qoverpError();
2455  lambda = track.lambda();
2456  lambdaError = track.lambdaError();
2457  phi = track.phi();
2458  phiError = track.phiError();
2459  // cout <<"test1" << endl;
2460 }
2461 
2463  double& pt,
2464  double& ptError,
2465  double& qoverp,
2466  double& qoverpError,
2467  double& lambda,
2468  double& lambdaError,
2469  double& phi,
2470  double& phiError) const {
2471  pt = gsfTrack.ptMode();
2472  ptError = gsfTrack.ptModeError();
2473  qoverp = gsfTrack.qoverpMode();
2474  qoverpError = gsfTrack.qoverpModeError();
2475  lambda = gsfTrack.lambdaMode();
2476  lambdaError = gsfTrack.lambdaModeError();
2477  phi = gsfTrack.phiMode();
2478  phiError = gsfTrack.phiModeError();
2479  // cout <<"test2" << endl;
2480 }
2481 
2483  if (useFabsEta)
2484  return fabs(eta);
2485  else
2486  return eta;
2487 }
2488 
2490  if (useInvPt && pt != 0)
2491  return 1 / pt;
2492  else
2493  return pt;
2494 }
2495 
2497  const TrackerTopology& ttopo) const {
2498  if (track.seedRef().isNull() || !track.seedRef().isAvailable())
2499  return seedingLayerSetNames.size() - 1;
2500 
2501  const TrajectorySeed& seed = *(track.seedRef());
2502  SeedingLayerSetId searchId;
2503  const int nhits = seed.nHits();
2504  if (nhits > static_cast<int>(std::tuple_size<SeedingLayerSetId>::value)) {
2505  LogDebug("TrackValidator") << "Got seed with " << nhits << " hits, but I have a hard-coded maximum of "
2507  << ", classifying the seed as 'unknown'. Please increase the maximum in "
2508  "MTVHistoProducerAlgoForTracker.h if needed.";
2509  return seedingLayerSetNames.size() - 1;
2510  }
2511  int i = 0;
2512  for (auto const& recHit : seed.recHits()) {
2513  DetId detId = recHit.geographicalId();
2514 
2515  if (detId.det() != DetId::Tracker) {
2516  throw cms::Exception("LogicError") << "Encountered seed hit detId " << detId.rawId() << " not from Tracker, but "
2517  << detId.det();
2518  }
2519 
2521  bool subdetStrip = false;
2522  switch (detId.subdetId()) {
2525  break;
2528  break;
2529  case StripSubdetector::TIB:
2530  subdet = GeomDetEnumerators::TIB;
2531  subdetStrip = true;
2532  break;
2533  case StripSubdetector::TID:
2534  subdet = GeomDetEnumerators::TID;
2535  subdetStrip = true;
2536  break;
2537  case StripSubdetector::TOB:
2538  subdet = GeomDetEnumerators::TOB;
2539  subdetStrip = true;
2540  break;
2541  case StripSubdetector::TEC:
2542  subdet = GeomDetEnumerators::TEC;
2543  subdetStrip = true;
2544  break;
2545  default:
2546  throw cms::Exception("LogicError") << "Unknown subdetId " << detId.subdetId();
2547  };
2548 
2549  TrackerDetSide side = static_cast<TrackerDetSide>(ttopo.side(detId));
2550 
2551  // Even with the recent addition of
2552  // SeedingLayerSetsBuilder::fillDescription() this assumption is a
2553  // bit ugly.
2554  const bool isStripMono = subdetStrip && trackerHitRTTI::isSingle(recHit);
2555  searchId[i] =
2556  SeedingLayerId(SeedingLayerSetsBuilder::SeedingLayerId(subdet, side, ttopo.layer(detId)), isStripMono);
2557  ++i;
2558  }
2559  auto found = seedingLayerSetToBin.find(searchId);
2560  if (found == seedingLayerSetToBin.end()) {
2561  return seedingLayerSetNames.size() - 1;
2562  }
2563  return found->second;
2564 }
2565 
2567  int count,
2568  const reco::GenParticle& tp,
2569  const TrackingParticle::Vector& momentumTP,
2570  const TrackingParticle::Point& vertexTP,
2571  double dxySim,
2572  double dzSim,
2573  int nSimHits,
2574  const reco::Track* track,
2575  int numVertices) const {
2576  bool isMatched = track;
2577 
2578  if ((*GpSelectorForEfficiencyVsEta)(tp)) {
2579  //effic vs eta
2580  histograms.h_simuleta[count]->Fill(getEta(momentumTP.eta()));
2581  if (isMatched)
2582  histograms.h_assoceta[count]->Fill(getEta(momentumTP.eta()));
2583  }
2584 
2585  if ((*GpSelectorForEfficiencyVsPhi)(tp)) {
2586  histograms.h_simulphi[count]->Fill(momentumTP.phi());
2587  if (isMatched)
2588  histograms.h_assocphi[count]->Fill(momentumTP.phi());
2589  //effic vs hits
2590  histograms.h_simulhit[count]->Fill((int)nSimHits);
2591  if (isMatched) {
2592  histograms.h_assochit[count]->Fill((int)nSimHits);
2593  if (histograms.nrecHit_vs_nsimHit_sim2rec[count])
2594  histograms.nrecHit_vs_nsimHit_sim2rec[count]->Fill(track->numberOfValidHits(), nSimHits);
2595  }
2596  //effic vs pu
2597  histograms.h_simulpu[count]->Fill(numVertices);
2598  if (isMatched)
2599  histograms.h_assocpu[count]->Fill(numVertices);
2600  //efficiency vs dR
2601  //not implemented for now
2602  }
2603 
2604  if ((*GpSelectorForEfficiencyVsPt)(tp)) {
2605  histograms.h_simulpT[count]->Fill(getPt(sqrt(momentumTP.perp2())));
2606  histograms.h_simulpTvseta[count]->Fill(getEta(momentumTP.eta()), getPt(sqrt(momentumTP.perp2())));
2607  if (isMatched) {
2608  histograms.h_assocpT[count]->Fill(getPt(sqrt(momentumTP.perp2())));
2609  histograms.h_assocpTvseta[count]->Fill(getEta(momentumTP.eta()), getPt(sqrt(momentumTP.perp2())));
2610  }
2611  }
2612 
2614  histograms.h_simuldxy[count]->Fill(dxySim);
2615  if (isMatched)
2616  histograms.h_assocdxy[count]->Fill(dxySim);
2617 
2618  histograms.h_simulvertpos[count]->Fill(sqrt(vertexTP.perp2()));
2619  if (isMatched)
2620  histograms.h_assocvertpos[count]->Fill(sqrt(vertexTP.perp2()));
2621  }
2622 
2624  histograms.h_simuldz[count]->Fill(dzSim);
2625  if (isMatched)
2626  histograms.h_assocdz[count]->Fill(dzSim);
2627 
2628  histograms.h_simulzpos[count]->Fill(vertexTP.z());
2629  if (isMatched)
2630  histograms.h_assoczpos[count]->Fill(vertexTP.z());
2631  }
2632 }
2633 
2635  int count,
2636  int seedsFitFailed,
2637  int seedsTotal) const {
2638  histograms.h_seedsFitFailed[count]->Fill(seedsFitFailed);
2639  histograms.h_seedsFitFailedFraction[count]->Fill(static_cast<double>(seedsFitFailed) / seedsTotal);
2640 }
size
Write out results.
static constexpr auto TEC
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsPt
void fill_trackBased_histos(const Histograms &histograms, int count, int assTracks, int numRecoTracks, int numRecoTracksSelected, int numSimTracksSelected) const
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsEta
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:476
bool trackFromSeedFitFailed(const reco::Track &track)
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsVTXR
void fill_generic_recoTrack_histos(const Histograms &histograms, int count, const reco::Track &track, const TrackerTopology &ttopo, const math::XYZPoint &bsPosition, const math::XYZPoint *pvPosition, const TrackingVertex::LorentzVector *simPVPosition, bool isMatched, bool isSigMatched, bool isChargeMatched, int numAssocRecoTracks, int numVertices, int nSimHits, double sharedFraction, double dR, double dR_jet, const std::vector< float > &mvas, unsigned int selectsLoose, unsigned int selectsHP) const
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsVTXR
std::map< SeedingLayerSetId, unsigned int > seedingLayerSetToBin
TrackerDetSide
Definition: TrackerDetSide.h:4
double phiModeError() const
error on phi from mode
Definition: GsfTrack.h:96
S make(const edm::ParameterSet &cfg)
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsVTXZ
double qoverpModeError() const
error on signed transverse curvature from mode
Definition: GsfTrack.h:79
float dEdx() const
Definition: DeDxData.cc:11
std::string to_string(const V &value)
Definition: OMSAccess.h:71
void fill_generic_simTrack_histos(const Histograms &histograms, const TrackingParticle::Vector &, const TrackingParticle::Point &vertex, int bx) const
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsPt
void bookSimHistos(DQMStore::IBooker &ibook, Histograms &histograms)
void bookSimTrackPVAssociationHistos(DQMStore::IBooker &ibook, Histograms &histograms)
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsPhi
unsigned int side(const DetId &id) const
assert(be >=bs)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
void fill_ResoAndPull_recoTrack_histos(const Histograms &histograms, int count, const TrackingParticle::Vector &momentumTP, const TrackingParticle::Point &vertexTP, int chargeTP, const reco::Track &track, const math::XYZPoint &bsPosition) const
unsigned int layer(const DetId &id) const
#define LogTrace(id)
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsPhi
dqm::reco::DQMStore DQMStore
void fill_simTrackBased_histos(const Histograms &histograms, int numSimTracks) const
math::XYZPointD Point
point in the space
math::XYZTLorentzVectorD LorentzVector
TrackAlgorithm originalAlgo() const
Definition: TrackBase.h:548
std::tuple< GeomDetEnumerators::SubDetector, TrackerDetSide, int > SeedingLayerId
std::tuple< SeedingLayerSetsBuilder::SeedingLayerId, bool > SeedingLayerId
unsigned int getSeedingLayerSetBin(const reco::Track &track, const TrackerTopology &ttopo) const
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
auto dz(const T_Vertex &vertex, const T_Momentum &momentum, const T_Point &point)
T sqrt(T t)
Definition: SSEVec.h:19
std::unique_ptr< GenParticleCustomSelector > GpSelectorForEfficiencyVsEta
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
std::unique_ptr< TrackingParticleSelector > generalTpSelector
double ptMode() const
track transverse momentum from mode
Definition: GsfTrack.h:47
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsPt
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
void bookRecoPVAssociationHistos(DQMStore::IBooker &ibook, Histograms &histograms)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isMatched(TrackingRecHit const &hit)
double lambdaModeError() const
error on lambda from mode
Definition: GsfTrack.h:92
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
void eraseSimpleParameter(std::string const &name)
void copyForModify(ParameterSet const &other)
std::string algoName() const
Definition: TrackBase.h:550
bool isTrackerStrip(GeomDetEnumerators::SubDetector m)
#define M_PI
static SeedingLayerId nameToEnumId(const std::string &name)
MTVHistoProducerAlgoForTracker(const edm::ParameterSet &pset, const bool doSeedPlots)
std::array< SeedingLayerId, 4 > SeedingLayerSetId
Definition: DetId.h:17
void fill_recoAssociated_simTrack_histos(const Histograms &histograms, int count, const TrackingParticle &tp, const TrackingParticle::Vector &momentumTP, const TrackingParticle::Point &vertexTP, double dxy, double dz, double dxyPV, double dzPV, int nSimHits, int nSimLayers, int nSimPixelLayers, int nSimStripMonoAndStereoLayers, const reco::Track *track, int numVertices, double dR, double dR_jet, const math::XYZPoint *pvPosition, const TrackingVertex::LorentzVector *simPVPosition, const math::XYZPoint &bsPosition, const std::vector< float > &mvas, unsigned int selectsLoose, unsigned int selectsHP) const
static constexpr auto TIB
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsPhi
bool isSingle(TrackingRecHit const &hit)
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
double phiMode() const
azimuthal angle of momentum vector from mode
Definition: GsfTrack.h:55
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
double ptModeError() const
error on Pt (set to 1000 TeV if charge==0 for safety) from mode
Definition: GsfTrack.h:81
static const std::string algoNames[]
Definition: TrackBase.h:147
void fill_duplicate_histos(const Histograms &histograms, int count, const reco::Track &track1, const reco::Track &track2) const
void fill_seed_histos(const Histograms &histograms, int count, int seedsFitFailed, int seedsTotal) const
std::unique_ptr< TrackingParticleSelector > TpSelectorForEfficiencyVsVTXZ
std::vector< std::string > seedingLayerSetNames
void bookSimTrackHistos(DQMStore::IBooker &ibook, Histograms &histograms, bool doResolutionPlots)
HLT enums.
void getRecoMomentum(const reco::Track &track, double &pt, double &ptError, double &qoverp, double &qoverpError, double &lambda, double &lambdaError, double &phi, double &phiError) const
retrieval of reconstructed momentum components from reco::Track (== mean values for GSF) ...
auto dxy(const T_Vertex &vertex, const T_Momentum &momentum, const T_Point &point)
void bookRecodEdxHistos(DQMStore::IBooker &ibook, Histograms &histograms)
Monte Carlo truth information used for tracking validation.
int numberOfSaturatedMeasurements() const
Definition: DeDxData.cc:20
unsigned int numberOfMeasurements() const
Definition: DeDxData.cc:18
std::unique_ptr< GenParticleCustomSelector > generalGpSelector
void fill_simAssociated_recoTrack_histos(const Histograms &histograms, int count, const reco::Track &track) const
void setBinLabels(std::vector< TH2F > &depth)
Log< level::Warning, false > LogWarning
double qoverpMode() const
q/p from mode
Definition: GsfTrack.h:39
math::XYZVectorD Vector
point in the space
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void bookRecoHistos(DQMStore::IBooker &ibook, Histograms &histograms, bool doResolutionPlots)
std::unique_ptr< RecoTrackSelectorBase > trackSelectorVsEta
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static std::unique_ptr< RecoTrackSelectorBase > makeRecoTrackSelectorFromTPSelectorParameters(const edm::ParameterSet &pset)
double lambdaMode() const
Lambda angle from mode.
Definition: GsfTrack.h:43
static constexpr auto TID
void bookSeedHistos(DQMStore::IBooker &ibook, Histograms &histograms)
void bookMVAHistos(DQMStore::IBooker &ibook, Histograms &histograms, size_t nMVAs)
void fill_dedx_recoTrack_histos(const Histograms &histograms, int count, const edm::RefToBase< reco::Track > &trackref, const std::vector< const edm::ValueMap< reco::DeDxData > *> &v_dEdx) const
static std::vector< std::vector< std::string > > layerNamesInSets(const std::vector< std::string > &namesPSet)
#define LogDebug(id)