Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:27

0001 #include "Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h"
0002 #include "Validation/RecoTrack/interface/trackFromSeedFitFailed.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 #include "DataFormats/TrackReco/interface/DeDxData.h"
0006 #include "DataFormats/Common/interface/ValueMap.h"
0007 #include "DataFormats/Common/interface/Ref.h"
0008 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0009 
0010 #include "SimTracker/TrackAssociation/interface/TrackingParticleIP.h"
0011 
0012 #include "TMath.h"
0013 #include <TF1.h>
0014 #include <cassert>
0015 
0016 using namespace std;
0017 
0018 namespace {
0019   typedef dqm::reco::DQMStore DQMStore;
0020 
0021   void BinLogX(TH1* h) {
0022     TAxis* axis = h->GetXaxis();
0023     int bins = axis->GetNbins();
0024 
0025     float from = axis->GetXmin();
0026     float to = axis->GetXmax();
0027     float width = (to - from) / bins;
0028     std::vector<float> new_bins(bins + 1, 0);
0029 
0030     for (int i = 0; i <= bins; i++) {
0031       new_bins[i] = TMath::Power(10, from + i * width);
0032     }
0033     axis->Set(bins, new_bins.data());
0034   }
0035 
0036   void BinLogY(TH1* h) {
0037     TAxis* axis = h->GetYaxis();
0038     int bins = axis->GetNbins();
0039 
0040     float from = axis->GetXmin();
0041     float to = axis->GetXmax();
0042     float width = (to - from) / bins;
0043     std::vector<float> new_bins(bins + 1, 0);
0044 
0045     for (int i = 0; i <= bins; i++) {
0046       new_bins[i] = TMath::Power(10, from + i * width);
0047     }
0048     axis->Set(bins, new_bins.data());
0049   }
0050 
0051   template <typename... Args>
0052   dqm::reco::MonitorElement* make1DIfLogX(DQMStore::IBooker& ibook, bool logx, Args&&... args) {
0053     auto h = std::make_unique<TH1F>(std::forward<Args>(args)...);
0054     if (logx)
0055       BinLogX(h.get());
0056     const auto& name = h->GetName();
0057     return ibook.book1D(name, h.release());
0058   }
0059 
0060   template <typename... Args>
0061   dqm::reco::MonitorElement* makeProfileIfLogX(DQMStore::IBooker& ibook, bool logx, Args&&... args) {
0062     auto h = std::make_unique<TProfile>(std::forward<Args>(args)...);
0063     if (logx)
0064       BinLogX(h.get());
0065     const auto& name = h->GetName();
0066     return ibook.bookProfile(name, h.release());
0067   }
0068 
0069   template <typename... Args>
0070   dqm::reco::MonitorElement* make2DIfLogX(DQMStore::IBooker& ibook, bool logx, Args&&... args) {
0071     auto h = std::make_unique<TH2F>(std::forward<Args>(args)...);
0072     if (logx)
0073       BinLogX(h.get());
0074     const auto& name = h->GetName();
0075     return ibook.book2D(name, h.release());
0076   }
0077 
0078   template <typename... Args>
0079   dqm::reco::MonitorElement* make2DIfLogY(DQMStore::IBooker& ibook, bool logy, Args&&... args) {
0080     auto h = std::make_unique<TH2F>(std::forward<Args>(args)...);
0081     if (logy)
0082       BinLogY(h.get());
0083     const auto& name = h->GetName();
0084     return ibook.book2D(name, h.release());
0085   }
0086 
0087   void setBinLabels(dqm::reco::MonitorElement*& h, const std::vector<std::string>& labels) {
0088     for (size_t i = 0; i < labels.size(); ++i) {
0089       h->setBinLabel(i + 1, labels[i]);
0090     }
0091     h->disableAlphanumeric();
0092   }
0093 
0094   void setBinLabelsAlgo(dqm::reco::MonitorElement*& h, int axis = 1) {
0095     for (size_t i = 0; i < reco::TrackBase::algoSize; ++i) {
0096       h->setBinLabel(i + 1, reco::TrackBase::algoName(static_cast<reco::TrackBase::TrackAlgorithm>(i)), axis);
0097     }
0098     h->disableAlphanumeric();
0099   }
0100 
0101   void fillMVAHistos(const std::vector<dqm::reco::MonitorElement*>& h_mva,
0102                      const std::vector<dqm::reco::MonitorElement*>& h_mvacut,
0103                      const std::vector<dqm::reco::MonitorElement*>& h_mva_hp,
0104                      const std::vector<dqm::reco::MonitorElement*>& h_mvacut_hp,
0105                      const std::vector<float>& mvas,
0106                      unsigned int selectsLoose,
0107                      unsigned int selectsHP) {
0108     // Fill MVA1 histos with all tracks, MVA2 histos only with tracks
0109     // not selected by MVA1, etc.
0110     for (size_t i = 0; i < mvas.size(); ++i) {
0111       if (i <= selectsLoose) {
0112         h_mva[i]->Fill(mvas[i]);
0113         h_mvacut[i]->Fill(mvas[i]);
0114       }
0115       if (i >= 1 && i <= selectsHP) {
0116         h_mva_hp[i]->Fill(mvas[i]);
0117         h_mvacut_hp[i]->Fill(mvas[i]);
0118       }
0119     }
0120   }
0121 
0122   void fillMVAHistos(double xval,
0123                      const std::vector<dqm::reco::MonitorElement*>& h_mva,
0124                      const std::vector<dqm::reco::MonitorElement*>& h_mva_hp,
0125                      const std::vector<float>& mvas,
0126                      unsigned int selectsLoose,
0127                      unsigned int selectsHP) {
0128     // Fill MVA1 histos with all tracks, MVA2 histos only with tracks
0129     // not selected by MVA1, etc.
0130     for (size_t i = 0; i < mvas.size(); ++i) {
0131       if (i <= selectsLoose) {
0132         h_mva[i]->Fill(xval, mvas[i]);
0133       }
0134       if (i >= 1 && i <= selectsHP) {
0135         h_mva_hp[i]->Fill(xval, mvas[i]);
0136       }
0137     }
0138   }
0139 }  // namespace
0140 
0141 MTVHistoProducerAlgoForTracker::MTVHistoProducerAlgoForTracker(const edm::ParameterSet& pset, const bool doSeedPlots)
0142     : doSeedPlots_(doSeedPlots),
0143       doMTDPlots_(pset.getUntrackedParameter<bool>("doMTDPlots")),
0144       doDzPVcutPlots_(pset.getUntrackedParameter<bool>("doDzPVcutPlots")) {
0145   //parameters for _vs_eta plots
0146   minEta = pset.getParameter<double>("minEta");
0147   maxEta = pset.getParameter<double>("maxEta");
0148   nintEta = pset.getParameter<int>("nintEta");
0149   useFabsEta = pset.getParameter<bool>("useFabsEta");
0150 
0151   //parameters for _vs_pt plots
0152   minPt = pset.getParameter<double>("minPt");
0153   maxPt = pset.getParameter<double>("maxPt");
0154   nintPt = pset.getParameter<int>("nintPt");
0155   useInvPt = pset.getParameter<bool>("useInvPt");
0156   useLogPt = pset.getUntrackedParameter<bool>("useLogPt", false);
0157 
0158   //parameters for _vs_Hit plots
0159   minHit = pset.getParameter<double>("minHit");
0160   maxHit = pset.getParameter<double>("maxHit");
0161   nintHit = pset.getParameter<int>("nintHit");
0162 
0163   //parameters for _vs_Pu plots
0164   minPu = pset.getParameter<double>("minPu");
0165   maxPu = pset.getParameter<double>("maxPu");
0166   nintPu = pset.getParameter<int>("nintPu");
0167 
0168   //parameters for _vs_Layer plots
0169   minLayers = pset.getParameter<double>("minLayers");
0170   maxLayers = pset.getParameter<double>("maxLayers");
0171   nintLayers = pset.getParameter<int>("nintLayers");
0172 
0173   //parameters for _vs_phi plots
0174   minPhi = pset.getParameter<double>("minPhi");
0175   maxPhi = pset.getParameter<double>("maxPhi");
0176   nintPhi = pset.getParameter<int>("nintPhi");
0177 
0178   //parameters for _vs_Dxy plots
0179   minDxy = pset.getParameter<double>("minDxy");
0180   maxDxy = pset.getParameter<double>("maxDxy");
0181   nintDxy = pset.getParameter<int>("nintDxy");
0182 
0183   //parameters for _vs_Dz plots
0184   minDz = pset.getParameter<double>("minDz");
0185   maxDz = pset.getParameter<double>("maxDz");
0186   nintDz = pset.getParameter<int>("nintDz");
0187 
0188   dxyDzZoom = pset.getParameter<double>("dxyDzZoom");
0189 
0190   //parameters for _vs_ProductionVertexTransvPosition plots
0191   minVertpos = pset.getParameter<double>("minVertpos");
0192   maxVertpos = pset.getParameter<double>("maxVertpos");
0193   nintVertpos = pset.getParameter<int>("nintVertpos");
0194   useLogVertpos = pset.getUntrackedParameter<bool>("useLogVertpos");
0195 
0196   //parameters for _vs_ProductionVertexZPosition plots
0197   minZpos = pset.getParameter<double>("minZpos");
0198   maxZpos = pset.getParameter<double>("maxZpos");
0199   nintZpos = pset.getParameter<int>("nintZpos");
0200 
0201   //parameters for _vs_dR plots
0202   mindr = pset.getParameter<double>("mindr");
0203   maxdr = pset.getParameter<double>("maxdr");
0204   nintdr = pset.getParameter<int>("nintdr");
0205 
0206   //parameters for _vs_dR_jet plots
0207   mindrj = pset.getParameter<double>("mindrj");
0208   maxdrj = pset.getParameter<double>("maxdrj");
0209   nintdrj = pset.getParameter<int>("nintdrj");
0210 
0211   // paramers for _vs_chi2 plots
0212   minChi2 = pset.getParameter<double>("minChi2");
0213   maxChi2 = pset.getParameter<double>("maxChi2");
0214   nintChi2 = pset.getParameter<int>("nintChi2");
0215 
0216   //parameters for dE/dx plots
0217   minDeDx = pset.getParameter<double>("minDeDx");
0218   maxDeDx = pset.getParameter<double>("maxDeDx");
0219   nintDeDx = pset.getParameter<int>("nintDeDx");
0220 
0221   //parameters for Pileup plots
0222   minVertcount = pset.getParameter<double>("minVertcount");
0223   maxVertcount = pset.getParameter<double>("maxVertcount");
0224   nintVertcount = pset.getParameter<int>("nintVertcount");
0225 
0226   //parameters for number of tracks plots
0227   minTracks = pset.getParameter<double>("minTracks");
0228   maxTracks = pset.getParameter<double>("maxTracks");
0229   nintTracks = pset.getParameter<int>("nintTracks");
0230 
0231   //parameters for vs. PV z plots
0232   minPVz = pset.getParameter<double>("minPVz");
0233   maxPVz = pset.getParameter<double>("maxPVz");
0234   nintPVz = pset.getParameter<int>("nintPVz");
0235 
0236   //parameters for vs. MVA plots
0237   minMVA = pset.getParameter<double>("minMVA");
0238   maxMVA = pset.getParameter<double>("maxMVA");
0239   nintMVA = pset.getParameter<int>("nintMVA");
0240 
0241   //parameters for resolution plots
0242   ptRes_rangeMin = pset.getParameter<double>("ptRes_rangeMin");
0243   ptRes_rangeMax = pset.getParameter<double>("ptRes_rangeMax");
0244   ptRes_nbin = pset.getParameter<int>("ptRes_nbin");
0245 
0246   phiRes_rangeMin = pset.getParameter<double>("phiRes_rangeMin");
0247   phiRes_rangeMax = pset.getParameter<double>("phiRes_rangeMax");
0248   phiRes_nbin = pset.getParameter<int>("phiRes_nbin");
0249 
0250   cotThetaRes_rangeMin = pset.getParameter<double>("cotThetaRes_rangeMin");
0251   cotThetaRes_rangeMax = pset.getParameter<double>("cotThetaRes_rangeMax");
0252   cotThetaRes_nbin = pset.getParameter<int>("cotThetaRes_nbin");
0253 
0254   dxyRes_rangeMin = pset.getParameter<double>("dxyRes_rangeMin");
0255   dxyRes_rangeMax = pset.getParameter<double>("dxyRes_rangeMax");
0256   dxyRes_nbin = pset.getParameter<int>("dxyRes_nbin");
0257 
0258   dzRes_rangeMin = pset.getParameter<double>("dzRes_rangeMin");
0259   dzRes_rangeMax = pset.getParameter<double>("dzRes_rangeMax");
0260   dzRes_nbin = pset.getParameter<int>("dzRes_nbin");
0261 
0262   maxDzpvCum = pset.getParameter<double>("maxDzpvCumulative");
0263   nintDzpvCum = pset.getParameter<int>("nintDzpvCumulative");
0264 
0265   //--- tracking particle selectors for efficiency measurements
0266   using namespace edm;
0267   using namespace reco::modules;
0268   auto initTPselector = [&](auto& sel, auto& name) {
0269     sel = std::make_unique<TrackingParticleSelector>(
0270         ParameterAdapter<TrackingParticleSelector>::make(pset.getParameter<ParameterSet>(name)));
0271   };
0272   auto initTrackSelector = [&](auto& sel, auto& name) {
0273     sel = makeRecoTrackSelectorFromTPSelectorParameters(pset.getParameter<ParameterSet>(name));
0274   };
0275   auto initGPselector = [&](auto& sel, auto& name) {
0276     sel = std::make_unique<GenParticleCustomSelector>(
0277         ParameterAdapter<GenParticleCustomSelector>::make(pset.getParameter<ParameterSet>(name)));
0278   };
0279 
0280   initTPselector(generalTpSelector, "generalTpSelector");
0281   initTPselector(TpSelectorForEfficiencyVsEta, "TpSelectorForEfficiencyVsEta");
0282   initTPselector(TpSelectorForEfficiencyVsPhi, "TpSelectorForEfficiencyVsPhi");
0283   initTPselector(TpSelectorForEfficiencyVsPt, "TpSelectorForEfficiencyVsPt");
0284   initTPselector(TpSelectorForEfficiencyVsVTXR, "TpSelectorForEfficiencyVsVTXR");
0285   initTPselector(TpSelectorForEfficiencyVsVTXZ, "TpSelectorForEfficiencyVsVTXZ");
0286 
0287   initTrackSelector(trackSelectorVsEta, "TpSelectorForEfficiencyVsEta");
0288   initTrackSelector(trackSelectorVsPhi, "TpSelectorForEfficiencyVsPhi");
0289   initTrackSelector(trackSelectorVsPt, "TpSelectorForEfficiencyVsPt");
0290 
0291   initGPselector(generalGpSelector, "generalGpSelector");
0292   initGPselector(GpSelectorForEfficiencyVsEta, "GpSelectorForEfficiencyVsEta");
0293   initGPselector(GpSelectorForEfficiencyVsPhi, "GpSelectorForEfficiencyVsPhi");
0294   initGPselector(GpSelectorForEfficiencyVsPt, "GpSelectorForEfficiencyVsPt");
0295   initGPselector(GpSelectorForEfficiencyVsVTXR, "GpSelectorForEfficiencyVsVTXR");
0296   initGPselector(GpSelectorForEfficiencyVsVTXZ, "GpSelectorForEfficiencyVsVTXZ");
0297 
0298   // SeedingLayerSets
0299   // If enabled, use last bin to denote other or unknown cases
0300   seedingLayerSetNames = pset.getParameter<std::vector<std::string>>("seedingLayerSets");
0301   std::vector<std::pair<SeedingLayerSetId, std::string>> stripPairSets;
0302   if (!seedingLayerSetNames.empty()) {
0303     std::vector<std::vector<std::string>> layerSets = SeedingLayerSetsBuilder::layerNamesInSets(seedingLayerSetNames);
0304     for (size_t i = 0; i < layerSets.size(); ++i) {
0305       const auto& layerSet = layerSets[i];
0306       if (layerSet.size() > std::tuple_size<SeedingLayerSetId>::value) {
0307         throw cms::Exception("Configuration")
0308             << "Got seedingLayerSet " << seedingLayerSetNames[i] << " with " << layerSet.size()
0309             << " elements, but I have a hard-coded maximum of " << std::tuple_size<SeedingLayerSetId>::value
0310             << ". Please increase the maximum in MTVHistoProducerAlgoForTracker.h";
0311       }
0312       SeedingLayerSetId setId;
0313       for (size_t j = 0; j < layerSet.size(); ++j) {
0314         // SeedingLayerSetsBuilder::fillDescriptions() kind-of
0315         // suggests that the 'M' prefix stands for strip mono hits
0316         // (maybe it should force), so making the assumption here is
0317         // (still) a bit ugly. But, this is the easiest way.
0318         bool isStripMono = !layerSet[j].empty() && layerSet[j][0] == 'M';
0319         setId[j] = std::make_tuple(SeedingLayerSetsBuilder::nameToEnumId(layerSet[j]), isStripMono);
0320       }
0321       // Account for the fact that strip triplet seeding may give pairs
0322       if (layerSet.size() == 3 && isTrackerStrip(std::get<GeomDetEnumerators::SubDetector>(std::get<0>(setId[0])))) {
0323         SeedingLayerSetId pairId;
0324         pairId[0] = setId[0];
0325         pairId[1] = setId[1];
0326         stripPairSets.emplace_back(pairId, layerSet[0] + "+" + layerSet[1]);
0327       }
0328 
0329       auto inserted = seedingLayerSetToBin.insert(std::make_pair(setId, i));
0330       if (!inserted.second)
0331         throw cms::Exception("Configuration") << "SeedingLayerSet " << seedingLayerSetNames[i]
0332                                               << " is specified twice, while the set list should be unique.";
0333     }
0334 
0335     // Add the "strip pairs from strip triplets" if they don't otherwise exist
0336     for (const auto& setIdName : stripPairSets) {
0337       auto inserted = seedingLayerSetToBin.insert(std::make_pair(setIdName.first, seedingLayerSetNames.size()));
0338       if (inserted.second)
0339         seedingLayerSetNames.push_back(setIdName.second);
0340     }
0341 
0342     seedingLayerSetNames.emplace_back("Other/Unknown");
0343   }
0344 
0345   // fix for the LogScale by Ryan
0346   if (useLogPt) {
0347     maxPt = log10(maxPt);
0348     if (minPt > 0) {
0349       minPt = log10(minPt);
0350     } else {
0351       edm::LogWarning("MultiTrackValidator")
0352           << "minPt = " << minPt << " <= 0 out of range while requesting log scale.  Using minPt = 0.1.";
0353       minPt = log10(0.1);
0354     }
0355   }
0356   if (useLogVertpos) {
0357     maxVertpos = std::log10(maxVertpos);
0358     if (minVertpos > 0) {
0359       minVertpos = std::log10(minVertpos);
0360     } else {
0361       edm::LogWarning("MultiTrackValidator")
0362           << "minVertpos = " << minVertpos << " <= 0 out of range while requesting log scale.  Using minVertpos = 0.1.";
0363       minVertpos = -1;
0364     }
0365   }
0366 }
0367 
0368 MTVHistoProducerAlgoForTracker::~MTVHistoProducerAlgoForTracker() {}
0369 
0370 std::unique_ptr<RecoTrackSelectorBase> MTVHistoProducerAlgoForTracker::makeRecoTrackSelectorFromTPSelectorParameters(
0371     const edm::ParameterSet& pset) {
0372   edm::ParameterSet psetTrack;
0373   psetTrack.copyForModify(pset);
0374   psetTrack.eraseSimpleParameter("minHit");
0375   psetTrack.eraseSimpleParameter("signalOnly");
0376   psetTrack.eraseSimpleParameter("intimeOnly");
0377   psetTrack.eraseSimpleParameter("chargedOnly");
0378   psetTrack.eraseSimpleParameter("stableOnly");
0379   psetTrack.addParameter("maxChi2", 1e10);
0380   psetTrack.addParameter("minHit", 0);
0381   psetTrack.addParameter("minPixelHit", 0);
0382   psetTrack.addParameter("minLayer", 0);
0383   psetTrack.addParameter("min3DLayer", 0);
0384   psetTrack.addParameter("quality", std::vector<std::string>{});
0385   psetTrack.addParameter("algorithm", std::vector<std::string>{});
0386   psetTrack.addParameter("originalAlgorithm", std::vector<std::string>{});
0387   psetTrack.addParameter("algorithmMaskContains", std::vector<std::string>{});
0388   psetTrack.addParameter("invertRapidityCut", false);
0389   psetTrack.addParameter("minPhi", -3.2);
0390   psetTrack.addParameter("maxPhi", 3.2);
0391   return std::make_unique<RecoTrackSelectorBase>(psetTrack);
0392 }
0393 
0394 void MTVHistoProducerAlgoForTracker::bookSimHistos(DQMStore::IBooker& ibook, Histograms& histograms) {
0395   histograms.h_ptSIM = make1DIfLogX(ibook, useLogPt, "ptSIM", "generated p_{t}", nintPt, minPt, maxPt);
0396   histograms.h_etaSIM = ibook.book1D("etaSIM", "generated pseudorapidity", nintEta, minEta, maxEta);
0397   histograms.h_phiSIM = ibook.book1D("phiSIM", "generated phi", nintPhi, minPhi, maxPhi);
0398   histograms.h_tracksSIM =
0399       ibook.book1D("tracksSIM", "number of simulated tracks", nintTracks, minTracks, maxTracks * 10);
0400   histograms.h_vertposSIM =
0401       ibook.book1D("vertposSIM", "Transverse position of sim vertices", nintVertpos, minVertpos, maxVertpos);
0402   histograms.h_bunchxSIM = ibook.book1D("bunchxSIM", "bunch crossing", 21, -15.5, 5.5);
0403 }
0404 
0405 void MTVHistoProducerAlgoForTracker::bookSimTrackHistos(DQMStore::IBooker& ibook,
0406                                                         Histograms& histograms,
0407                                                         bool doResolutionPlots) {
0408   histograms.h_assoceta.push_back(
0409       ibook.book1D("num_assoc(simToReco)_eta", "N of associated tracks (simToReco) vs eta", nintEta, minEta, maxEta));
0410   histograms.h_simuleta.push_back(
0411       ibook.book1D("num_simul_eta", "N of simulated tracks vs eta", nintEta, minEta, maxEta));
0412 
0413   histograms.h_assocpT.push_back(make1DIfLogX(
0414       ibook, useLogPt, "num_assoc(simToReco)_pT", "N of associated tracks (simToReco) vs pT", nintPt, minPt, maxPt));
0415   histograms.h_simulpT.push_back(
0416       make1DIfLogX(ibook, useLogPt, "num_simul_pT", "N of simulated tracks vs pT", nintPt, minPt, maxPt));
0417 
0418   histograms.h_assocpTvseta.push_back(make2DIfLogY(ibook,
0419                                                    useLogPt,
0420                                                    "num_assoc(simToReco)_pTvseta",
0421                                                    "N of associated tracks (simToReco) in (pT-eta) please",
0422                                                    nintEta,
0423                                                    minEta,
0424                                                    maxEta,
0425                                                    nintPt,
0426                                                    minPt,
0427                                                    maxPt));
0428   histograms.h_simulpTvseta.push_back(make2DIfLogY(ibook,
0429                                                    useLogPt,
0430                                                    "num_simul_pTvseta",
0431                                                    "N of simulated tracks in (pT-eta) plane",
0432                                                    nintEta,
0433                                                    minEta,
0434                                                    maxEta,
0435                                                    nintPt,
0436                                                    minPt,
0437                                                    maxPt));
0438 
0439   histograms.h_assochit.push_back(
0440       ibook.book1D("num_assoc(simToReco)_hit", "N of associated tracks (simToReco) vs hit", nintHit, minHit, maxHit));
0441   histograms.h_simulhit.push_back(
0442       ibook.book1D("num_simul_hit", "N of simulated tracks vs hit", nintHit, minHit, maxHit));
0443 
0444   histograms.h_assoclayer.push_back(ibook.book1D(
0445       "num_assoc(simToReco)_layer", "N of associated tracks (simToReco) vs layer", nintLayers, minLayers, maxLayers));
0446   histograms.h_simullayer.push_back(
0447       ibook.book1D("num_simul_layer", "N of simulated tracks vs layer", nintLayers, minLayers, maxLayers));
0448 
0449   histograms.h_assocpixellayer.push_back(ibook.book1D("num_assoc(simToReco)_pixellayer",
0450                                                       "N of associated tracks (simToReco) vs pixel layer",
0451                                                       nintLayers,
0452                                                       minLayers,
0453                                                       maxLayers));
0454   histograms.h_simulpixellayer.push_back(
0455       ibook.book1D("num_simul_pixellayer", "N of simulated tracks vs pixel layer", nintLayers, minLayers, maxLayers));
0456 
0457   histograms.h_assoc3Dlayer.push_back(ibook.book1D("num_assoc(simToReco)_3Dlayer",
0458                                                    "N of associated tracks (simToReco) vs 3D layer",
0459                                                    nintLayers,
0460                                                    minLayers,
0461                                                    maxLayers));
0462   histograms.h_simul3Dlayer.push_back(
0463       ibook.book1D("num_simul_3Dlayer", "N of simulated tracks vs 3D layer", nintLayers, minLayers, maxLayers));
0464 
0465   histograms.h_assocpu.push_back(
0466       ibook.book1D("num_assoc(simToReco)_pu", "N of associated tracks (simToReco) vs pu", nintPu, minPu, maxPu));
0467   histograms.h_simulpu.push_back(ibook.book1D("num_simul_pu", "N of simulated tracks vs pu", nintPu, minPu, maxPu));
0468 
0469   histograms.h_assocphi.push_back(
0470       ibook.book1D("num_assoc(simToReco)_phi", "N of associated tracks (simToReco) vs phi", nintPhi, minPhi, maxPhi));
0471   histograms.h_simulphi.push_back(
0472       ibook.book1D("num_simul_phi", "N of simulated tracks vs phi", nintPhi, minPhi, maxPhi));
0473 
0474   histograms.h_assocdxy.push_back(
0475       ibook.book1D("num_assoc(simToReco)_dxy", "N of associated tracks (simToReco) vs dxy", nintDxy, minDxy, maxDxy));
0476   histograms.h_simuldxy.push_back(
0477       ibook.book1D("num_simul_dxy", "N of simulated tracks vs dxy", nintDxy, minDxy, maxDxy));
0478 
0479   histograms.h_assocdz.push_back(
0480       ibook.book1D("num_assoc(simToReco)_dz", "N of associated tracks (simToReco) vs dz", nintDz, minDz, maxDz));
0481   histograms.h_simuldz.push_back(ibook.book1D("num_simul_dz", "N of simulated tracks vs dz", nintDz, minDz, maxDz));
0482 
0483   histograms.h_assocvertpos.push_back(make1DIfLogX(ibook,
0484                                                    useLogVertpos,
0485                                                    "num_assoc(simToReco)_vertpos",
0486                                                    "N of associated tracks (simToReco) vs transverse vert position",
0487                                                    nintVertpos,
0488                                                    minVertpos,
0489                                                    maxVertpos));
0490   histograms.h_simulvertpos.push_back(make1DIfLogX(ibook,
0491                                                    useLogVertpos,
0492                                                    "num_simul_vertpos",
0493                                                    "N of simulated tracks vs transverse vert position",
0494                                                    nintVertpos,
0495                                                    minVertpos,
0496                                                    maxVertpos));
0497 
0498   histograms.h_assoczpos.push_back(ibook.book1D(
0499       "num_assoc(simToReco)_zpos", "N of associated tracks (simToReco) vs z vert position", nintZpos, minZpos, maxZpos));
0500   histograms.h_simulzpos.push_back(
0501       ibook.book1D("num_simul_zpos", "N of simulated tracks vs z vert position", nintZpos, minZpos, maxZpos));
0502 
0503   histograms.h_assocdr.push_back(make1DIfLogX(ibook,
0504                                               true,
0505                                               "num_assoc(simToReco)_dr",
0506                                               "N of associated tracks (simToReco) vs dR",
0507                                               nintdr,
0508                                               log10(mindr),
0509                                               log10(maxdr)));
0510   histograms.h_simuldr.push_back(
0511       make1DIfLogX(ibook, true, "num_simul_dr", "N of simulated tracks vs dR", nintdr, log10(mindr), log10(maxdr)));
0512 
0513   histograms.h_assocdrj.push_back(make1DIfLogX(ibook,
0514                                                true,
0515                                                "num_assoc(simToReco)_drj",
0516                                                "N of associated tracks (simToReco) vs dR(TP,jet)",
0517                                                nintdrj,
0518                                                log10(mindrj),
0519                                                log10(maxdrj)));
0520   histograms.h_simuldrj.push_back(make1DIfLogX(
0521       ibook, true, "num_simul_drj", "N of simulated tracks vs dR(TP,jet)", nintdrj, log10(mindrj), log10(maxdrj)));
0522 
0523   histograms.h_simul_simpvz.push_back(
0524       ibook.book1D("num_simul_simpvz", "N of simulated tracks vs. sim PV z", nintPVz, minPVz, maxPVz));
0525   histograms.h_assoc_simpvz.push_back(ibook.book1D(
0526       "num_assoc(simToReco)_simpvz", "N of associated tracks (simToReco) vs. sim PV z", nintPVz, minPVz, maxPVz));
0527 
0528   histograms.nrecHit_vs_nsimHit_sim2rec.push_back(doResolutionPlots ? ibook.book2D("nrecHit_vs_nsimHit_sim2rec",
0529                                                                                    "nrecHit vs nsimHit (Sim2RecAssoc)",
0530                                                                                    nintHit,
0531                                                                                    minHit,
0532                                                                                    maxHit,
0533                                                                                    nintHit,
0534                                                                                    minHit,
0535                                                                                    maxHit)
0536                                                                     : nullptr);
0537 
0538   // TODO: use the dynamic track algo priority order also here
0539   constexpr auto nalgos = reco::TrackBase::algoSize;
0540   histograms.h_duplicates_oriAlgo_vs_oriAlgo.push_back(ibook.book2D("duplicates_oriAlgo_vs_oriAlgo",
0541                                                                     "Duplicate tracks: originalAlgo vs originalAlgo",
0542                                                                     nalgos,
0543                                                                     0,
0544                                                                     nalgos,
0545                                                                     nalgos,
0546                                                                     0,
0547                                                                     nalgos));
0548   setBinLabelsAlgo(histograms.h_duplicates_oriAlgo_vs_oriAlgo.back(), 1);
0549   setBinLabelsAlgo(histograms.h_duplicates_oriAlgo_vs_oriAlgo.back(), 2);
0550 }
0551 
0552 void MTVHistoProducerAlgoForTracker::bookSimTrackPVAssociationHistos(DQMStore::IBooker& ibook, Histograms& histograms) {
0553   histograms.h_assocdxypv.push_back(ibook.book1D(
0554       "num_assoc(simToReco)_dxypv", "N of associated tracks (simToReco) vs dxy(PV)", nintDxy, minDxy, maxDxy));
0555   histograms.h_simuldxypv.push_back(
0556       ibook.book1D("num_simul_dxypv", "N of simulated tracks vs dxy(PV)", nintDxy, minDxy, maxDxy));
0557 
0558   histograms.h_assocdzpv.push_back(
0559       ibook.book1D("num_assoc(simToReco)_dzpv", "N of associated tracks (simToReco) vs dz(PV)", nintDz, minDz, maxDz));
0560   histograms.h_simuldzpv.push_back(
0561       ibook.book1D("num_simul_dzpv", "N of simulated tracks vs dz(PV)", nintDz, minDz, maxDz));
0562 
0563   histograms.h_assocdxypvzoomed.push_back(ibook.book1D("num_assoc(simToReco)_dxypv_zoomed",
0564                                                        "N of associated tracks (simToReco) vs dxy(PV)",
0565                                                        nintDxy,
0566                                                        minDxy / dxyDzZoom,
0567                                                        maxDxy / dxyDzZoom));
0568   histograms.h_simuldxypvzoomed.push_back(ibook.book1D(
0569       "num_simul_dxypv_zoomed", "N of simulated tracks vs dxy(PV)", nintDxy, minDxy / dxyDzZoom, maxDxy / dxyDzZoom));
0570 
0571   histograms.h_assocdzpvzoomed.push_back(ibook.book1D("num_assoc(simToReco)_dzpv_zoomed",
0572                                                       "N of associated tracks (simToReco) vs dz(PV)",
0573                                                       nintDz,
0574                                                       minDz / dxyDzZoom,
0575                                                       maxDz / dxyDzZoom));
0576   histograms.h_simuldzpvzoomed.push_back(ibook.book1D(
0577       "num_simul_dzpv_zoomed", "N of simulated tracks vs dz(PV)", nintDz, minDz / dxyDzZoom, maxDz / dxyDzZoom));
0578 
0579   if (doDzPVcutPlots_) {
0580     histograms.h_assoc_dzpvcut.push_back(ibook.book1D(
0581         "num_assoc(simToReco)_dzpvcut", "N of associated tracks (simToReco) vs dz(PV)", nintDzpvCum, 0, maxDzpvCum));
0582     histograms.h_simul_dzpvcut.push_back(
0583         ibook.book1D("num_simul_dzpvcut", "N of simulated tracks from sim PV", nintDzpvCum, 0, maxDzpvCum));
0584     histograms.h_simul2_dzpvcut.push_back(ibook.book1D("num_simul2_dzpvcut",
0585                                                        "N of simulated tracks (associated to any track) from sim PV",
0586                                                        nintDzpvCum,
0587                                                        0,
0588                                                        maxDzpvCum));
0589   }
0590 }
0591 
0592 void MTVHistoProducerAlgoForTracker::bookRecoHistos(DQMStore::IBooker& ibook,
0593                                                     Histograms& histograms,
0594                                                     bool doResolutionPlots) {
0595   histograms.h_tracks.push_back(
0596       ibook.book1D("tracks", "number of reconstructed tracks", nintTracks, minTracks, maxTracks));
0597   histograms.h_fakes.push_back(ibook.book1D("fakes", "number of fake reco tracks", nintTracks, minTracks, maxTracks));
0598   histograms.h_charge.push_back(ibook.book1D("charge", "charge", 3, -1.5, 1.5));
0599 
0600   histograms.h_hits.push_back(ibook.book1D("hits", "number of hits per track", nintHit, minHit, maxHit));
0601   histograms.h_losthits.push_back(ibook.book1D("losthits", "number of lost hits per track", nintHit, minHit, maxHit));
0602   histograms.h_nchi2.push_back(ibook.book1D("chi2", "normalized #chi^{2}", 200, 0, 20));
0603   histograms.h_nchi2_prob.push_back(ibook.book1D("chi2_prob", "normalized #chi^{2} probability", 100, 0, 1));
0604 
0605   histograms.h_nmisslayers_inner.push_back(
0606       ibook.book1D("missing_inner_layers", "number of missing inner layers", nintLayers, minLayers, maxLayers));
0607   histograms.h_nmisslayers_outer.push_back(
0608       ibook.book1D("missing_outer_layers", "number of missing outer layers", nintLayers, minLayers, maxLayers));
0609 
0610   histograms.h_algo.push_back(
0611       ibook.book1D("h_algo", "Tracks by algo", reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize)));
0612   for (size_t ibin = 0; ibin < reco::TrackBase::algoSize - 1; ibin++)
0613     histograms.h_algo.back()->setBinLabel(ibin + 1, reco::TrackBase::algoNames[ibin]);
0614   histograms.h_algo.back()->disableAlphanumeric();
0615 
0616   /// these are needed to calculate efficiency during the harvesting for the automated validation
0617   histograms.h_recoeta.push_back(ibook.book1D("num_reco_eta", "N of reco track vs eta", nintEta, minEta, maxEta));
0618   histograms.h_reco2eta.push_back(
0619       ibook.book1D("num_reco2_eta", "N of selected reco track vs eta", nintEta, minEta, maxEta));
0620   histograms.h_assoc2eta.push_back(
0621       ibook.book1D("num_assoc(recoToSim)_eta", "N of associated (recoToSim) tracks vs eta", nintEta, minEta, maxEta));
0622   histograms.h_loopereta.push_back(ibook.book1D(
0623       "num_duplicate_eta", "N of associated (recoToSim) duplicate tracks vs eta", nintEta, minEta, maxEta));
0624   if (!doSeedPlots_)
0625     histograms.h_misideta.push_back(ibook.book1D(
0626         "num_chargemisid_eta", "N of associated (recoToSim) charge misIDed tracks vs eta", nintEta, minEta, maxEta));
0627   histograms.h_pileupeta.push_back(
0628       ibook.book1D("num_pileup_eta", "N of associated (recoToSim) pileup tracks vs eta", nintEta, minEta, maxEta));
0629   //
0630   histograms.h_recopT.push_back(
0631       make1DIfLogX(ibook, useLogPt, "num_reco_pT", "N of reco track vs pT", nintPt, minPt, maxPt));
0632   histograms.h_reco2pT.push_back(
0633       make1DIfLogX(ibook, useLogPt, "num_reco2_pT", "N of selected reco track vs pT", nintPt, minPt, maxPt));
0634   histograms.h_assoc2pT.push_back(make1DIfLogX(
0635       ibook, useLogPt, "num_assoc(recoToSim)_pT", "N of associated (recoToSim) tracks vs pT", nintPt, minPt, maxPt));
0636   histograms.h_looperpT.push_back(make1DIfLogX(
0637       ibook, useLogPt, "num_duplicate_pT", "N of associated (recoToSim) duplicate tracks vs pT", nintPt, minPt, maxPt));
0638   if (!doSeedPlots_)
0639     histograms.h_misidpT.push_back(make1DIfLogX(ibook,
0640                                                 useLogPt,
0641                                                 "num_chargemisid_pT",
0642                                                 "N of associated (recoToSim) charge misIDed tracks vs pT",
0643                                                 nintPt,
0644                                                 minPt,
0645                                                 maxPt));
0646   histograms.h_pileuppT.push_back(make1DIfLogX(
0647       ibook, useLogPt, "num_pileup_pT", "N of associated (recoToSim) pileup tracks vs pT", nintPt, minPt, maxPt));
0648   //
0649   histograms.h_recopTvseta.push_back(make2DIfLogY(ibook,
0650                                                   useLogPt,
0651                                                   "num_reco_pTvseta",
0652                                                   "N of reco track in (pT-eta) plane",
0653                                                   nintEta,
0654                                                   minEta,
0655                                                   maxEta,
0656                                                   nintPt,
0657                                                   minPt,
0658                                                   maxPt));
0659   histograms.h_reco2pTvseta.push_back(make2DIfLogY(ibook,
0660                                                    useLogPt,
0661                                                    "num_reco2_pTvseta",
0662                                                    "N of selected reco track in (pT-eta) plane",
0663                                                    nintEta,
0664                                                    minEta,
0665                                                    maxEta,
0666                                                    nintPt,
0667                                                    minPt,
0668                                                    maxPt));
0669   histograms.h_assoc2pTvseta.push_back(make2DIfLogY(ibook,
0670                                                     useLogPt,
0671                                                     "num_assoc(recoToSim)_pTvseta",
0672                                                     "N of associated (recoToSim) tracks in (pT-eta) plane",
0673                                                     nintEta,
0674                                                     minEta,
0675                                                     maxEta,
0676                                                     nintPt,
0677                                                     minPt,
0678                                                     maxPt));
0679   histograms.h_looperpTvseta.push_back(make2DIfLogY(ibook,
0680                                                     useLogPt,
0681                                                     "num_duplicate_pTvseta",
0682                                                     "N of associated (recoToSim) duplicate tracks in (pT-eta) plane",
0683                                                     nintEta,
0684                                                     minEta,
0685                                                     maxEta,
0686                                                     nintPt,
0687                                                     minPt,
0688                                                     maxPt));
0689   if (!doSeedPlots_)
0690     histograms.h_misidpTvseta.push_back(
0691         make2DIfLogY(ibook,
0692                      useLogPt,
0693                      "num_chargemisid_pTvseta",
0694                      "N of associated (recoToSim) charge misIDed tracks in (pT-eta) plane",
0695                      nintEta,
0696                      minEta,
0697                      maxEta,
0698                      nintPt,
0699                      minPt,
0700                      maxPt));
0701   histograms.h_pileuppTvseta.push_back(make2DIfLogY(ibook,
0702                                                     useLogPt,
0703                                                     "num_pileup_pTvseta",
0704                                                     "N of associated (recoToSim) pileup tracks in (pT-eta) plane",
0705                                                     nintEta,
0706                                                     minEta,
0707                                                     maxEta,
0708                                                     nintPt,
0709                                                     minPt,
0710                                                     maxPt));
0711   //
0712   histograms.h_recohit.push_back(ibook.book1D("num_reco_hit", "N of reco track vs hit", nintHit, minHit, maxHit));
0713   histograms.h_assoc2hit.push_back(
0714       ibook.book1D("num_assoc(recoToSim)_hit", "N of associated (recoToSim) tracks vs hit", nintHit, minHit, maxHit));
0715   histograms.h_looperhit.push_back(ibook.book1D(
0716       "num_duplicate_hit", "N of associated (recoToSim) duplicate tracks vs hit", nintHit, minHit, maxHit));
0717   if (!doSeedPlots_)
0718     histograms.h_misidhit.push_back(ibook.book1D(
0719         "num_chargemisid_hit", "N of associated (recoToSim) charge misIDed tracks vs hit", nintHit, minHit, maxHit));
0720   histograms.h_pileuphit.push_back(
0721       ibook.book1D("num_pileup_hit", "N of associated (recoToSim) pileup tracks vs hit", nintHit, minHit, maxHit));
0722   //
0723   histograms.h_recolayer.push_back(
0724       ibook.book1D("num_reco_layer", "N of reco track vs layer", nintLayers, minLayers, maxLayers));
0725   histograms.h_assoc2layer.push_back(ibook.book1D(
0726       "num_assoc(recoToSim)_layer", "N of associated (recoToSim) tracks vs layer", nintLayers, minLayers, maxLayers));
0727   histograms.h_looperlayer.push_back(ibook.book1D(
0728       "num_duplicate_layer", "N of associated (recoToSim) duplicate tracks vs layer", nintLayers, minLayers, maxLayers));
0729   if (!doSeedPlots_)
0730     histograms.h_misidlayer.push_back(ibook.book1D("num_chargemisid_layer",
0731                                                    "N of associated (recoToSim) charge misIDed tracks vs layer",
0732                                                    nintLayers,
0733                                                    minLayers,
0734                                                    maxLayers));
0735   histograms.h_pileuplayer.push_back(ibook.book1D(
0736       "num_pileup_layer", "N of associated (recoToSim) pileup tracks vs layer", nintLayers, minLayers, maxLayers));
0737   //
0738   histograms.h_recopixellayer.push_back(
0739       ibook.book1D("num_reco_pixellayer", "N of reco track vs pixellayer", nintLayers, minLayers, maxLayers));
0740   histograms.h_assoc2pixellayer.push_back(ibook.book1D("num_assoc(recoToSim)_pixellayer",
0741                                                        "N of associated (recoToSim) tracks vs pixellayer",
0742                                                        nintLayers,
0743                                                        minLayers,
0744                                                        maxLayers));
0745   histograms.h_looperpixellayer.push_back(ibook.book1D("num_duplicate_pixellayer",
0746                                                        "N of associated (recoToSim) duplicate tracks vs pixellayer",
0747                                                        nintLayers,
0748                                                        minLayers,
0749                                                        maxLayers));
0750   if (!doSeedPlots_)
0751     histograms.h_misidpixellayer.push_back(
0752         ibook.book1D("num_chargemisid_pixellayer",
0753                      "N of associated (recoToSim) charge misIDed tracks vs pixellayer",
0754                      nintLayers,
0755                      minLayers,
0756                      maxLayers));
0757   histograms.h_pileuppixellayer.push_back(ibook.book1D("num_pileup_pixellayer",
0758                                                        "N of associated (recoToSim) pileup tracks vs pixellayer",
0759                                                        nintLayers,
0760                                                        minLayers,
0761                                                        maxLayers));
0762   //
0763   histograms.h_reco3Dlayer.push_back(
0764       ibook.book1D("num_reco_3Dlayer", "N of reco track vs 3D layer", nintLayers, minLayers, maxLayers));
0765   histograms.h_assoc23Dlayer.push_back(ibook.book1D("num_assoc(recoToSim)_3Dlayer",
0766                                                     "N of associated (recoToSim) tracks vs 3D layer",
0767                                                     nintLayers,
0768                                                     minLayers,
0769                                                     maxLayers));
0770   histograms.h_looper3Dlayer.push_back(ibook.book1D("num_duplicate_3Dlayer",
0771                                                     "N of associated (recoToSim) duplicate tracks vs 3D layer",
0772                                                     nintLayers,
0773                                                     minLayers,
0774                                                     maxLayers));
0775   if (!doSeedPlots_)
0776     histograms.h_misid3Dlayer.push_back(ibook.book1D("num_chargemisid_3Dlayer",
0777                                                      "N of associated (recoToSim) charge misIDed tracks vs 3D layer",
0778                                                      nintLayers,
0779                                                      minLayers,
0780                                                      maxLayers));
0781   histograms.h_pileup3Dlayer.push_back(ibook.book1D(
0782       "num_pileup_3Dlayer", "N of associated (recoToSim) pileup tracks vs 3D layer", nintLayers, minLayers, maxLayers));
0783   //
0784   histograms.h_recopu.push_back(ibook.book1D("num_reco_pu", "N of reco track vs pu", nintPu, minPu, maxPu));
0785   histograms.h_reco2pu.push_back(ibook.book1D("num_reco2_pu", "N of selected reco track vs pu", nintPu, minPu, maxPu));
0786   histograms.h_assoc2pu.push_back(
0787       ibook.book1D("num_assoc(recoToSim)_pu", "N of associated (recoToSim) tracks vs pu", nintPu, minPu, maxPu));
0788   histograms.h_looperpu.push_back(
0789       ibook.book1D("num_duplicate_pu", "N of associated (recoToSim) duplicate tracks vs pu", nintPu, minPu, maxPu));
0790   if (!doSeedPlots_)
0791     histograms.h_misidpu.push_back(ibook.book1D(
0792         "num_chargemisid_pu", "N of associated (recoToSim) charge misIDed tracks vs pu", nintPu, minPu, maxPu));
0793   histograms.h_pileuppu.push_back(
0794       ibook.book1D("num_pileup_pu", "N of associated (recoToSim) pileup tracks vs pu", nintPu, minPu, maxPu));
0795   //
0796   histograms.h_recophi.push_back(ibook.book1D("num_reco_phi", "N of reco track vs phi", nintPhi, minPhi, maxPhi));
0797   histograms.h_assoc2phi.push_back(
0798       ibook.book1D("num_assoc(recoToSim)_phi", "N of associated (recoToSim) tracks vs phi", nintPhi, minPhi, maxPhi));
0799   histograms.h_looperphi.push_back(ibook.book1D(
0800       "num_duplicate_phi", "N of associated (recoToSim) duplicate tracks vs phi", nintPhi, minPhi, maxPhi));
0801   if (!doSeedPlots_)
0802     histograms.h_misidphi.push_back(ibook.book1D(
0803         "num_chargemisid_phi", "N of associated (recoToSim) charge misIDed tracks vs phi", nintPhi, minPhi, maxPhi));
0804   histograms.h_pileupphi.push_back(
0805       ibook.book1D("num_pileup_phi", "N of associated (recoToSim) pileup tracks vs phi", nintPhi, minPhi, maxPhi));
0806 
0807   histograms.h_recodxy.push_back(ibook.book1D("num_reco_dxy", "N of reco track vs dxy", nintDxy, minDxy, maxDxy));
0808   histograms.h_assoc2dxy.push_back(
0809       ibook.book1D("num_assoc(recoToSim)_dxy", "N of associated (recoToSim) tracks vs dxy", nintDxy, minDxy, maxDxy));
0810   histograms.h_looperdxy.push_back(
0811       ibook.book1D("num_duplicate_dxy", "N of associated (recoToSim) looper tracks vs dxy", nintDxy, minDxy, maxDxy));
0812   if (!doSeedPlots_)
0813     histograms.h_misiddxy.push_back(ibook.book1D(
0814         "num_chargemisid_dxy", "N of associated (recoToSim) charge misIDed tracks vs dxy", nintDxy, minDxy, maxDxy));
0815   histograms.h_pileupdxy.push_back(
0816       ibook.book1D("num_pileup_dxy", "N of associated (recoToSim) pileup tracks vs dxy", nintDxy, minDxy, maxDxy));
0817 
0818   histograms.h_recodz.push_back(ibook.book1D("num_reco_dz", "N of reco track vs dz", nintDz, minDz, maxDz));
0819   histograms.h_assoc2dz.push_back(
0820       ibook.book1D("num_assoc(recoToSim)_dz", "N of associated (recoToSim) tracks vs dz", nintDz, minDz, maxDz));
0821   histograms.h_looperdz.push_back(
0822       ibook.book1D("num_duplicate_dz", "N of associated (recoToSim) looper tracks vs dz", nintDz, minDz, maxDz));
0823   if (!doSeedPlots_)
0824     histograms.h_misiddz.push_back(ibook.book1D(
0825         "num_chargemisid_versus_dz", "N of associated (recoToSim) charge misIDed tracks vs dz", nintDz, minDz, maxDz));
0826   histograms.h_pileupdz.push_back(
0827       ibook.book1D("num_pileup_dz", "N of associated (recoToSim) pileup tracks vs dz", nintDz, minDz, maxDz));
0828 
0829   histograms.h_recovertpos.push_back(make1DIfLogX(ibook,
0830                                                   useLogVertpos,
0831                                                   "num_reco_vertpos",
0832                                                   "N of reconstructed tracks vs transverse ref point position",
0833                                                   nintVertpos,
0834                                                   minVertpos,
0835                                                   maxVertpos));
0836   histograms.h_assoc2vertpos.push_back(
0837       make1DIfLogX(ibook,
0838                    useLogVertpos,
0839                    "num_assoc(recoToSim)_vertpos",
0840                    "N of associated (recoToSim) tracks vs transverse ref point position",
0841                    nintVertpos,
0842                    minVertpos,
0843                    maxVertpos));
0844   histograms.h_loopervertpos.push_back(
0845       make1DIfLogX(ibook,
0846                    useLogVertpos,
0847                    "num_duplicate_vertpos",
0848                    "N of associated (recoToSim) looper tracks vs transverse ref point position",
0849                    nintVertpos,
0850                    minVertpos,
0851                    maxVertpos));
0852   histograms.h_pileupvertpos.push_back(
0853       make1DIfLogX(ibook,
0854                    useLogVertpos,
0855                    "num_pileup_vertpos",
0856                    "N of associated (recoToSim) pileup tracks vs transverse ref point position",
0857                    nintVertpos,
0858                    minVertpos,
0859                    maxVertpos));
0860 
0861   histograms.h_recozpos.push_back(ibook.book1D(
0862       "num_reco_zpos", "N of reconstructed tracks vs transverse ref point position", nintZpos, minZpos, maxZpos));
0863   histograms.h_assoc2zpos.push_back(ibook.book1D("num_assoc(recoToSim)_zpos",
0864                                                  "N of associated (recoToSim) tracks vs transverse ref point position",
0865                                                  nintZpos,
0866                                                  minZpos,
0867                                                  maxZpos));
0868   histograms.h_looperzpos.push_back(
0869       ibook.book1D("num_duplicate_zpos",
0870                    "N of associated (recoToSim) looper tracks vs transverse ref point position",
0871                    nintZpos,
0872                    minZpos,
0873                    maxZpos));
0874   histograms.h_pileupzpos.push_back(
0875       ibook.book1D("num_pileup_zpos",
0876                    "N of associated (recoToSim) pileup tracks vs transverse ref point position",
0877                    nintZpos,
0878                    minZpos,
0879                    maxZpos));
0880 
0881   histograms.h_recodr.push_back(
0882       make1DIfLogX(ibook, true, "num_reco_dr", "N of reconstructed tracks vs dR", nintdr, log10(mindr), log10(maxdr)));
0883   histograms.h_assoc2dr.push_back(make1DIfLogX(ibook,
0884                                                true,
0885                                                "num_assoc(recoToSim)_dr",
0886                                                "N of associated tracks (recoToSim) vs dR",
0887                                                nintdr,
0888                                                log10(mindr),
0889                                                log10(maxdr)));
0890   histograms.h_looperdr.push_back(make1DIfLogX(ibook,
0891                                                true,
0892                                                "num_duplicate_dr",
0893                                                "N of associated (recoToSim) looper tracks vs dR",
0894                                                nintdr,
0895                                                log10(mindr),
0896                                                log10(maxdr)));
0897   histograms.h_pileupdr.push_back(make1DIfLogX(ibook,
0898                                                true,
0899                                                "num_pileup_dr",
0900                                                "N of associated (recoToSim) pileup tracks vs dR",
0901                                                nintdr,
0902                                                log10(mindr),
0903                                                log10(maxdr)));
0904 
0905   histograms.h_recodrj.push_back(make1DIfLogX(
0906       ibook, true, "num_reco_drj", "N of reconstructed tracks vs dR(track,jet)", nintdrj, log10(mindrj), log10(maxdrj)));
0907   histograms.h_assoc2drj.push_back(make1DIfLogX(ibook,
0908                                                 true,
0909                                                 "num_assoc(recoToSim)_drj",
0910                                                 "N of associated tracks (recoToSim) vs dR(track,jet)",
0911                                                 nintdrj,
0912                                                 log10(mindrj),
0913                                                 log10(maxdrj)));
0914   histograms.h_looperdrj.push_back(make1DIfLogX(ibook,
0915                                                 true,
0916                                                 "num_duplicate_drj",
0917                                                 "N of associated (recoToSim) looper tracks vs dR(track,jet)",
0918                                                 nintdrj,
0919                                                 log10(mindrj),
0920                                                 log10(maxdrj)));
0921   histograms.h_pileupdrj.push_back(make1DIfLogX(ibook,
0922                                                 true,
0923                                                 "num_pileup_drj",
0924                                                 "N of associated (recoToSim) pileup tracks vs dR(track,jet)",
0925                                                 nintdrj,
0926                                                 log10(mindrj),
0927                                                 log10(maxdrj)));
0928 
0929   histograms.h_reco_simpvz.push_back(
0930       ibook.book1D("num_reco_simpvz", "N of reco track vs. sim PV z", nintPVz, minPVz, maxPVz));
0931   histograms.h_assoc2_simpvz.push_back(ibook.book1D(
0932       "num_assoc(recoToSim)_simpvz", "N of associated tracks (recoToSim) vs. sim PV z", nintPVz, minPVz, maxPVz));
0933   histograms.h_looper_simpvz.push_back(ibook.book1D(
0934       "num_duplicate_simpvz", "N of associated (recoToSim) looper tracks vs. sim PV z", nintPVz, minPVz, maxPVz));
0935   histograms.h_pileup_simpvz.push_back(ibook.book1D(
0936       "num_pileup_simpvz", "N of associated (recoToSim) pileup tracks vs. sim PV z", nintPVz, minPVz, maxPVz));
0937 
0938   histograms.h_recochi2.push_back(
0939       ibook.book1D("num_reco_chi2", "N of reco track vs normalized #chi^{2}", nintChi2, minChi2, maxChi2));
0940   histograms.h_assoc2chi2.push_back(ibook.book1D("num_assoc(recoToSim)_chi2",
0941                                                  "N of associated (recoToSim) tracks vs normalized #chi^{2}",
0942                                                  nintChi2,
0943                                                  minChi2,
0944                                                  maxChi2));
0945   histograms.h_looperchi2.push_back(ibook.book1D("num_duplicate_chi2",
0946                                                  "N of associated (recoToSim) looper tracks vs normalized #chi^{2}",
0947                                                  nintChi2,
0948                                                  minChi2,
0949                                                  maxChi2));
0950   if (!doSeedPlots_)
0951     histograms.h_misidchi2.push_back(
0952         ibook.book1D("num_chargemisid_chi2",
0953                      "N of associated (recoToSim) charge misIDed tracks vs normalized #chi^{2}",
0954                      nintChi2,
0955                      minChi2,
0956                      maxChi2));
0957   histograms.h_pileupchi2.push_back(ibook.book1D("num_pileup_chi2",
0958                                                  "N of associated (recoToSim) pileup tracks vs normalized #chi^{2}",
0959                                                  nintChi2,
0960                                                  minChi2,
0961                                                  maxChi2));
0962 
0963   histograms.h_recochi2prob.push_back(
0964       ibook.book1D("num_reco_chi2prob", "N of reco track vs normalized #chi^{2}", 100, 0., 1.));
0965   histograms.h_assoc2chi2prob.push_back(ibook.book1D(
0966       "num_assoc(recoToSim)_chi2prob", "N of associated (recoToSim) tracks vs normalized #chi^{2}", 100, 0., 1.));
0967   histograms.h_looperchi2prob.push_back(ibook.book1D(
0968       "num_duplicate_chi2prob", "N of associated (recoToSim) looper tracks vs normalized #chi^{2}", 100, 0., 1.));
0969   if (!doSeedPlots_)
0970     histograms.h_misidchi2prob.push_back(
0971         ibook.book1D("num_chargemisid_chi2prob",
0972                      "N of associated (recoToSim) charge misIDed tracks vs normalized #chi^{2}",
0973                      100,
0974                      0.,
0975                      1.));
0976   histograms.h_pileupchi2prob.push_back(ibook.book1D(
0977       "num_pileup_chi2prob", "N of associated (recoToSim) pileup tracks vs normalized #chi^{2}", 100, 0., 1.));
0978 
0979   if (!seedingLayerSetNames.empty()) {
0980     const auto size = seedingLayerSetNames.size();
0981     histograms.h_reco_seedingLayerSet.push_back(
0982         ibook.book1D("num_reco_seedingLayerSet", "N of reco track vs. seedingLayerSet", size, 0, size));
0983     histograms.h_assoc2_seedingLayerSet.push_back(
0984         ibook.book1D("num_assoc(recoToSim)_seedingLayerSet",
0985                      "N of associated track (recoToSim) tracks vs. seedingLayerSet",
0986                      size,
0987                      0,
0988                      size));
0989     histograms.h_looper_seedingLayerSet.push_back(ibook.book1D(
0990         "num_duplicate_seedingLayerSet", "N of reco associated (recoToSim) looper vs. seedingLayerSet", size, 0, size));
0991     histograms.h_pileup_seedingLayerSet.push_back(ibook.book1D(
0992         "num_pileup_seedingLayerSet", "N of reco associated (recoToSim) pileup vs. seedingLayerSet", size, 0, size));
0993 
0994     setBinLabels(histograms.h_reco_seedingLayerSet.back(), seedingLayerSetNames);
0995     setBinLabels(histograms.h_assoc2_seedingLayerSet.back(), seedingLayerSetNames);
0996     setBinLabels(histograms.h_looper_seedingLayerSet.back(), seedingLayerSetNames);
0997     setBinLabels(histograms.h_pileup_seedingLayerSet.back(), seedingLayerSetNames);
0998   }
0999 
1000   /////////////////////////////////
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,
1183                         ptRes_rangeMin,
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,
1194                         ptRes_rangeMin,
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,
1205                         ptRes_rangeMin,
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,
1215                         cotThetaRes_nbin,
1216                         cotThetaRes_rangeMin,
1217                         cotThetaRes_rangeMax);
1218 
1219   bookResolutionPlots2D(histograms.cotThetares_vs_pt,
1220                         useLogPt,
1221                         "cotThetares_vs_pt",
1222                         "cotThetares_vs_pt",
1223                         nintPt,
1224                         minPt,
1225                         maxPt,
1226                         cotThetaRes_nbin,
1227                         cotThetaRes_rangeMin,
1228                         cotThetaRes_rangeMax);
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,
1238                         phiRes_rangeMin,
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,
1249                         phiRes_rangeMin,
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,
1260                         phiRes_rangeMin,
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,
1271                         dxyRes_rangeMin,
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,
1282                         dxyRes_rangeMin,
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,
1293                         dxyRes_rangeMin,
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,
1304                         dzRes_rangeMin,
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,
1315                         dzRes_rangeMin,
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,
1326                         dzRes_rangeMin,
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 
1406 void MTVHistoProducerAlgoForTracker::bookRecoPVAssociationHistos(DQMStore::IBooker& ibook, Histograms& histograms) {
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 
1496 void MTVHistoProducerAlgoForTracker::bookRecodEdxHistos(DQMStore::IBooker& ibook, Histograms& histograms) {
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 
1517 void MTVHistoProducerAlgoForTracker::bookSeedHistos(DQMStore::IBooker& ibook, Histograms& histograms) {
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 
1524 void MTVHistoProducerAlgoForTracker::bookMVAHistos(DQMStore::IBooker& ibook, Histograms& histograms, size_t nMVAs) {
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 
1714 void MTVHistoProducerAlgoForTracker::fill_generic_simTrack_histos(const Histograms& histograms,
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 
1727 void MTVHistoProducerAlgoForTracker::fill_recoAssociated_simTrack_histos(
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 
1823   if ((*TpSelectorForEfficiencyVsVTXR)(tp)) {
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 
1841   if ((*TpSelectorForEfficiencyVsVTXZ)(tp)) {
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 
1879 void MTVHistoProducerAlgoForTracker::fill_duplicate_histos(const Histograms& histograms,
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 
1886 void MTVHistoProducerAlgoForTracker::fill_simTrackBased_histos(const Histograms& histograms, int numSimTracks) const {
1887   histograms.h_tracksSIM->Fill(numSimTracks);
1888 }
1889 
1890 // dE/dx
1891 void MTVHistoProducerAlgoForTracker::fill_dedx_recoTrack_histos(
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 
1905 void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histograms& histograms,
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 
2197 void MTVHistoProducerAlgoForTracker::fill_simAssociated_recoTrack_histos(const Histograms& histograms,
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));
2207   if (trackFromSeedFitFailed(track))
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 
2255 void MTVHistoProducerAlgoForTracker::fill_trackBased_histos(const Histograms& histograms,
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 
2267 void MTVHistoProducerAlgoForTracker::fill_ResoAndPull_recoTrack_histos(const Histograms& histograms,
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 {
2274   if (trackFromSeedFitFailed(track))
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 
2442 void MTVHistoProducerAlgoForTracker::getRecoMomentum(const reco::Track& track,
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 
2462 void MTVHistoProducerAlgoForTracker::getRecoMomentum(const reco::GsfTrack& gsfTrack,
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 
2482 double MTVHistoProducerAlgoForTracker::getEta(double eta) const {
2483   if (useFabsEta)
2484     return fabs(eta);
2485   else
2486     return eta;
2487 }
2488 
2489 double MTVHistoProducerAlgoForTracker::getPt(double pt) const {
2490   if (useInvPt && pt != 0)
2491     return 1 / pt;
2492   else
2493     return pt;
2494 }
2495 
2496 unsigned int MTVHistoProducerAlgoForTracker::getSeedingLayerSetBin(const reco::Track& track,
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 "
2506                                << std::tuple_size<SeedingLayerSetId>::value
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 
2520     GeomDetEnumerators::SubDetector subdet;
2521     bool subdetStrip = false;
2522     switch (detId.subdetId()) {
2523       case PixelSubdetector::PixelBarrel:
2524         subdet = GeomDetEnumerators::PixelBarrel;
2525         break;
2526       case PixelSubdetector::PixelEndcap:
2527         subdet = GeomDetEnumerators::PixelEndcap;
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 
2566 void MTVHistoProducerAlgoForTracker::fill_recoAssociated_simTrack_histos(const Histograms& histograms,
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 
2613   if ((*GpSelectorForEfficiencyVsVTXR)(tp)) {
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 
2623   if ((*GpSelectorForEfficiencyVsVTXZ)(tp)) {
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 
2634 void MTVHistoProducerAlgoForTracker::fill_seed_histos(const Histograms& histograms,
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 }