Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-03-31 22:27:14

0001 #include "Validation/RecoMuon/plugins/MuonTrackValidator.h"
0002 #include "FWCore/Framework/interface/MakerMacros.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 #include "DataFormats/TrackReco/interface/Track.h"
0006 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0007 #include "DataFormats/Math/interface/deltaR.h"
0008 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0009 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0010 #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h"
0011 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0012 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0013 #include "TrackingTools/PatternTools/interface/TSCBLBuilderNoMaterial.h"
0014 #include "SimTracker/TrackAssociation/interface/TrackingParticleIP.h"
0015 
0016 #include "TMath.h"
0017 #include <optional>
0018 
0019 using namespace std;
0020 using namespace edm;
0021 
0022 void MuonTrackValidator::bookHistograms(DQMEDAnalyzer::DQMStore::IBooker& ibooker,
0023                                         edm::Run const&,
0024                                         edm::EventSetup const& setup) {
0025   // No booking if there are no tracks in a collection
0026   if (label.empty()) {
0027     return;
0028   }
0029 
0030   const auto minColl = -0.5;
0031   const auto maxColl = label.size() - 0.5;
0032   const auto nintColl = label.size();
0033   edm::LogVerbatim("MuonTrackValidator") << "Label size: " << label.size() << "\n"
0034                                          << "Associator size: " << associators.size() << "\n"
0035                                          << "HistoParameters size: " << histoParameters.size();
0036 
0037   auto binLabels = [&](dqm::reco::MonitorElement* me) -> dqm::reco::MonitorElement* {
0038     for (size_t i = 0; i < label.size(); ++i) {
0039       std::string labelName =
0040           label[i].instance().empty() ? label[i].label() : label[i].label() + "_" + label[i].instance();
0041       me->setBinLabel(i + 1, labelName);
0042     }
0043     me->disableAlphanumeric();
0044     return me;
0045   };
0046 
0047   size_t outerLoopSize = UseAssociators ? associators.size() : 1;
0048   for (unsigned int ww = 0; ww < outerLoopSize; ++ww) {
0049     if (doSummaryPlots_) {
0050       ibooker.setCurrentFolder(dirName_);
0051       h_assoc_coll.push_back(binLabels(ibooker.book1D("num_asso_SimToReco_coll",
0052                                                       "N of associated (SimToReco) muons vs muon collection",
0053                                                       nintColl,
0054                                                       minColl,
0055                                                       maxColl)));
0056       h_simul_coll.push_back(binLabels(
0057           ibooker.book1D("num_simul_coll", "N of simulated muons vs muon collection", nintColl, minColl, maxColl)));
0058       h_reco_coll.push_back(
0059           binLabels(ibooker.book1D("num_reco_coll", "N of reco muons vs muon collection", nintColl, minColl, maxColl)));
0060       h_assoc2_coll.push_back(binLabels(ibooker.book1D("num_asso_RecoToSim_coll",
0061                                                        "N of associated (recoToSim) muons vs muon collection",
0062                                                        nintColl,
0063                                                        minColl,
0064                                                        maxColl)));
0065     }
0066     for (unsigned int www = 0; www < label.size(); ++www) {
0067       edm::LogVerbatim("MuonTrackValidator")
0068           << " Label " << www << ", Associator: " << associators[www] << '\n'
0069           << "Track Label: " << label[www].label() << ", instance: " << label[www].instance()
0070           << ", process name: " << label[www].process() << "\n";
0071 
0072       ibooker.cd();
0073       InputTag algo = label[www];
0074       string dirName = dirName_;
0075 
0076       auto setBinLogX = [&](TH1* th1) {
0077         if (histoParameters[www].useLogPt) {
0078           BinLogX(th1);
0079         }
0080       };
0081 
0082       if (!algo.process().empty())
0083         dirName += algo.process() + "_";
0084       if (!algo.label().empty())
0085         dirName += algo.label();
0086       if (!algo.instance().empty())
0087         dirName += ("_" + algo.instance());
0088       if (dirName.find("Tracks") < dirName.length()) {
0089         dirName.replace(dirName.find("Tracks"), 6, "Trks");
0090       }
0091       if (dirName.find("UpdatedAtVtx") < dirName.length()) {
0092         dirName.replace(dirName.find("UpdatedAtVtx"), 12, "UpdAtVtx");
0093       }
0094       if (associators[www].find("tpToTkmuTrackAssociation") != std::string::npos) {
0095         dirName += "_TkAsso";
0096       }
0097       std::replace(dirName.begin(), dirName.end(), ':', '_');
0098       ibooker.setCurrentFolder(dirName);
0099 
0100       h_tracks.push_back(ibooker.book1D("Ntracks",
0101                                         "Number of reconstructed tracks",
0102                                         histoParameters[www].nintNTracks,
0103                                         histoParameters[www].minNTracks,
0104                                         histoParameters[www].maxNTracks));
0105       h_fakes.push_back(ibooker.book1D("Nfakes",
0106                                        "Number of fake reco tracks",
0107                                        histoParameters[www].nintFTracks,
0108                                        histoParameters[www].minFTracks,
0109                                        histoParameters[www].maxFTracks));
0110       h_charge.push_back(ibooker.book1D("Ncharge", "track charge", 3, -1.5, 1.5));
0111 
0112       h_recoeta.push_back(ibooker.book1D("num_reco_eta",
0113                                          "N of reco track vs eta",
0114                                          histoParameters[www].nintEta,
0115                                          histoParameters[www].minEta,
0116                                          histoParameters[www].maxEta));
0117       h_assoceta.push_back(ibooker.book1D("num_assoSimToReco_eta",
0118                                           "N of associated tracks (simToReco) vs eta",
0119                                           histoParameters[www].nintEta,
0120                                           histoParameters[www].minEta,
0121                                           histoParameters[www].maxEta));
0122       h_assoc2eta.push_back(ibooker.book1D("num_assoRecoToSim_eta",
0123                                            "N of associated (recoToSim) tracks vs eta",
0124                                            histoParameters[www].nintEta,
0125                                            histoParameters[www].minEta,
0126                                            histoParameters[www].maxEta));
0127       h_simuleta.push_back(ibooker.book1D("num_simul_eta",
0128                                           "N of simulated tracks vs eta",
0129                                           histoParameters[www].nintEta,
0130                                           histoParameters[www].minEta,
0131                                           histoParameters[www].maxEta));
0132       h_misideta.push_back(ibooker.book1D("num_chargemisid_eta",
0133                                           "N of associated (simToReco) tracks with charge misID vs eta",
0134                                           histoParameters[www].nintEta,
0135                                           histoParameters[www].minEta,
0136                                           histoParameters[www].maxEta));
0137 
0138       h_recopT.push_back(ibooker.book1D("num_reco_pT",
0139                                         "N of reco track vs pT",
0140                                         histoParameters[www].nintPt,
0141                                         histoParameters[www].minPt,
0142                                         histoParameters[www].maxPt,
0143                                         setBinLogX));
0144       h_assocpT.push_back(ibooker.book1D("num_assoSimToReco_pT",
0145                                          "N of associated tracks (simToReco) vs pT",
0146                                          histoParameters[www].nintPt,
0147                                          histoParameters[www].minPt,
0148                                          histoParameters[www].maxPt,
0149                                          setBinLogX));
0150       h_assoc2pT.push_back(ibooker.book1D("num_assoRecoToSim_pT",
0151                                           "N of associated (recoToSim) tracks vs pT",
0152                                           histoParameters[www].nintPt,
0153                                           histoParameters[www].minPt,
0154                                           histoParameters[www].maxPt,
0155                                           setBinLogX));
0156       h_simulpT.push_back(ibooker.book1D("num_simul_pT",
0157                                          "N of simulated tracks vs pT",
0158                                          histoParameters[www].nintPt,
0159                                          histoParameters[www].minPt,
0160                                          histoParameters[www].maxPt,
0161                                          setBinLogX));
0162       h_misidpT.push_back(ibooker.book1D("num_chargemisid_pT",
0163                                          "N of associated (simToReco) tracks with charge misID vs pT",
0164                                          histoParameters[www].nintPt,
0165                                          histoParameters[www].minPt,
0166                                          histoParameters[www].maxPt,
0167                                          setBinLogX));
0168 
0169       h_assocpTB.push_back(ibooker.book1D("num_assoSimToReco_pT_barrel",
0170                                           "N of associated tracks (simToReco) vs pT - BARREL",
0171                                           histoParameters[www].nintPt,
0172                                           histoParameters[www].minPt,
0173                                           histoParameters[www].maxPt,
0174                                           setBinLogX));
0175       h_simulpTB.push_back(ibooker.book1D("num_simul_pT_barrel",
0176                                           "N of simulated tracks vs pT - BARREL",
0177                                           histoParameters[www].nintPt,
0178                                           histoParameters[www].minPt,
0179                                           histoParameters[www].maxPt,
0180                                           setBinLogX));
0181 
0182       h_assocpTO.push_back(ibooker.book1D("num_assoSimToReco_pT_overlap",
0183                                           "N of associated tracks (simToReco) vs pT - OVERLAP",
0184                                           histoParameters[www].nintPt,
0185                                           histoParameters[www].minPt,
0186                                           histoParameters[www].maxPt,
0187                                           setBinLogX));
0188       h_simulpTO.push_back(ibooker.book1D("num_simul_pT_overlap",
0189                                           "N of simulated tracks vs pT - OVERLAP",
0190                                           histoParameters[www].nintPt,
0191                                           histoParameters[www].minPt,
0192                                           histoParameters[www].maxPt,
0193                                           setBinLogX));
0194 
0195       h_assocpTE.push_back(ibooker.book1D("num_assoSimToReco_pT_endcap",
0196                                           "N of associated tracks (simToReco) vs pT - ENCAP",
0197                                           histoParameters[www].nintPt,
0198                                           histoParameters[www].minPt,
0199                                           histoParameters[www].maxPt,
0200                                           setBinLogX));
0201       h_simulpTE.push_back(ibooker.book1D("num_simul_pT_endcap",
0202                                           "N of simulated tracks vs pT - ENDCAP",
0203                                           histoParameters[www].nintPt,
0204                                           histoParameters[www].minPt,
0205                                           histoParameters[www].maxPt,
0206                                           setBinLogX));
0207 
0208       h_recophi.push_back(ibooker.book1D("num_reco_phi",
0209                                          "N of reco track vs phi",
0210                                          histoParameters[www].nintPhi,
0211                                          histoParameters[www].minPhi,
0212                                          histoParameters[www].maxPhi));
0213       h_assocphi.push_back(ibooker.book1D("num_assoSimToReco_phi",
0214                                           "N of associated tracks (simToReco) vs phi",
0215                                           histoParameters[www].nintPhi,
0216                                           histoParameters[www].minPhi,
0217                                           histoParameters[www].maxPhi));
0218       h_assoc2phi.push_back(ibooker.book1D("num_assoRecoToSim_phi",
0219                                            "N of associated (recoToSim) tracks vs phi",
0220                                            histoParameters[www].nintPhi,
0221                                            histoParameters[www].minPhi,
0222                                            histoParameters[www].maxPhi));
0223       h_simulphi.push_back(ibooker.book1D("num_simul_phi",
0224                                           "N of simulated tracks vs phi",
0225                                           histoParameters[www].nintPhi,
0226                                           histoParameters[www].minPhi,
0227                                           histoParameters[www].maxPhi));
0228       h_misidphi.push_back(ibooker.book1D("num_chargemisid_phi",
0229                                           "N of associated (simToReco) tracks with charge misID vs phi",
0230                                           histoParameters[www].nintPhi,
0231                                           histoParameters[www].minPhi,
0232                                           histoParameters[www].maxPhi));
0233 
0234       h_assocphiB.push_back(ibooker.book1D("num_assoSimToReco_phi_barrel",
0235                                            "N of associated tracks (simToReco) vs phi - BARREL",
0236                                            histoParameters[www].nintPhi,
0237                                            histoParameters[www].minPhi,
0238                                            histoParameters[www].maxPhi));
0239       h_simulphiB.push_back(ibooker.book1D("num_simul_phi_barrel",
0240                                            "N of simulated track vs phi - BARREL",
0241                                            histoParameters[www].nintPhi,
0242                                            histoParameters[www].minPhi,
0243                                            histoParameters[www].maxPhi));
0244 
0245       h_assocphiO.push_back(ibooker.book1D("num_assoSimToReco_phi_overlap",
0246                                            "N of associated tracks (simToReco) vs phi - OVERLAP",
0247                                            histoParameters[www].nintPhi,
0248                                            histoParameters[www].minPhi,
0249                                            histoParameters[www].maxPhi));
0250       h_simulphiO.push_back(ibooker.book1D("num_simul_phi_overlap",
0251                                            "N of simulated track vs phi - OVERLAP",
0252                                            histoParameters[www].nintPhi,
0253                                            histoParameters[www].minPhi,
0254                                            histoParameters[www].maxPhi));
0255 
0256       h_assocphiE.push_back(ibooker.book1D("num_assoSimToReco_phi_endcap",
0257                                            "N of associated tracks (simToReco) vs phi - ENDCAP",
0258                                            histoParameters[www].nintPhi,
0259                                            histoParameters[www].minPhi,
0260                                            histoParameters[www].maxPhi));
0261       h_simulphiE.push_back(ibooker.book1D("num_simul_phi_endcap",
0262                                            "N of simulated track vs phi - ENDCAP",
0263                                            histoParameters[www].nintPhi,
0264                                            histoParameters[www].minPhi,
0265                                            histoParameters[www].maxPhi));
0266 
0267       h_recohit.push_back(ibooker.book1D("num_reco_hit",
0268                                          "N of reco tracks vs N SimHits",
0269                                          histoParameters[www].nintNHit,
0270                                          histoParameters[www].minNHit,
0271                                          histoParameters[www].maxNHit));
0272       h_assochit.push_back(ibooker.book1D("num_assoSimToReco_hit",
0273                                           "N of associated tracks (simToReco) vs N SimHits",
0274                                           histoParameters[www].nintNHit,
0275                                           histoParameters[www].minNHit,
0276                                           histoParameters[www].maxNHit));
0277       h_assoc2hit.push_back(ibooker.book1D("num_assoRecoToSim_hit",
0278                                            "N of associated (recoToSim) tracks vs N Rechits",
0279                                            histoParameters[www].nintNHit,
0280                                            histoParameters[www].minNHit,
0281                                            histoParameters[www].maxNHit));
0282       h_simulhit.push_back(ibooker.book1D("num_simul_hit",
0283                                           "N of simulated tracks vs N SimHits",
0284                                           histoParameters[www].nintNHit,
0285                                           histoParameters[www].minNHit,
0286                                           histoParameters[www].maxNHit));
0287       h_misidhit.push_back(ibooker.book1D("num_chargemisid_hit",
0288                                           "N of associated (recoToSim) tracks with charge misID vs N RecHits",
0289                                           histoParameters[www].nintNHit,
0290                                           histoParameters[www].minNHit,
0291                                           histoParameters[www].maxNHit));
0292 
0293       h_recodR.push_back(ibooker.book1D("num_reco_dR",
0294                                         "N of reco track vs dR",
0295                                         histoParameters[www].nintdR,
0296                                         histoParameters[www].mindR,
0297                                         histoParameters[www].maxdR));
0298       h_assocdR.push_back(ibooker.book1D("num_assoSimToReco_dR",
0299                                          "N of associated tracks (simToReco) vs dR",
0300                                          histoParameters[www].nintdR,
0301                                          histoParameters[www].mindR,
0302                                          histoParameters[www].maxdR));
0303       h_assoc2dR.push_back(ibooker.book1D("num_assoRecoToSim_dR",
0304                                           "N of associated (recoToSim) tracks vs dR",
0305                                           histoParameters[www].nintdR,
0306                                           histoParameters[www].mindR,
0307                                           histoParameters[www].maxdR));
0308       h_simuldR.push_back(ibooker.book1D("num_simul_dR",
0309                                          "N of simulated tracks vs dR",
0310                                          histoParameters[www].nintdR,
0311                                          histoParameters[www].mindR,
0312                                          histoParameters[www].maxdR));
0313       h_misiddR.push_back(ibooker.book1D("num_chargemisid_dR",
0314                                          "N of associated (simToReco) tracks with charge misID vs dR",
0315                                          histoParameters[www].nintdR,
0316                                          histoParameters[www].mindR,
0317                                          histoParameters[www].maxdR));
0318 
0319       h_recodxy.push_back(ibooker.book1D("num_reco_dxy",
0320                                          "N of reco track vs dxy",
0321                                          histoParameters[www].nintDxy,
0322                                          histoParameters[www].minDxy,
0323                                          histoParameters[www].maxDxy));
0324       h_assocdxy.push_back(ibooker.book1D("num_assoSimToReco_dxy",
0325                                           "N of associated tracks (simToReco) vs dxy",
0326                                           histoParameters[www].nintDxy,
0327                                           histoParameters[www].minDxy,
0328                                           histoParameters[www].maxDxy));
0329       h_assoc2dxy.push_back(ibooker.book1D("num_assoRecoToSim_dxy",
0330                                            "N of associated (recoToSim) tracks vs dxy",
0331                                            histoParameters[www].nintDxy,
0332                                            histoParameters[www].minDxy,
0333                                            histoParameters[www].maxDxy));
0334       h_simuldxy.push_back(ibooker.book1D("num_simul_dxy",
0335                                           "N of simulated tracks vs dxy",
0336                                           histoParameters[www].nintDxy,
0337                                           histoParameters[www].minDxy,
0338                                           histoParameters[www].maxDxy));
0339       h_misiddxy.push_back(ibooker.book1D("num_chargemisid_dxy",
0340                                           "N of associated (simToReco) tracks with charge misID vs dxy",
0341                                           histoParameters[www].nintDxy,
0342                                           histoParameters[www].minDxy,
0343                                           histoParameters[www].maxDxy));
0344       h_recodz.push_back(ibooker.book1D("num_reco_dz",
0345                                         "N of reco track vs dz",
0346                                         histoParameters[www].nintDz,
0347                                         histoParameters[www].minDz,
0348                                         histoParameters[www].maxDz));
0349       h_assocdz.push_back(ibooker.book1D("num_assoSimToReco_dz",
0350                                          "N of associated tracks (simToReco) vs dz",
0351                                          histoParameters[www].nintDz,
0352                                          histoParameters[www].minDz,
0353                                          histoParameters[www].maxDz));
0354       h_assoc2dz.push_back(ibooker.book1D("num_assoRecoToSim_dz",
0355                                           "N of associated (recoToSim) tracks vs dz",
0356                                           histoParameters[www].nintDz,
0357                                           histoParameters[www].minDz,
0358                                           histoParameters[www].maxDz));
0359       h_simuldz.push_back(ibooker.book1D("num_simul_dz",
0360                                          "N of simulated tracks vs dz",
0361                                          histoParameters[www].nintDz,
0362                                          histoParameters[www].minDz,
0363                                          histoParameters[www].maxDz));
0364       h_misiddz.push_back(ibooker.book1D("num_chargemisid_dz",
0365                                          "N of associated (simToReco) tracks with charge misID vs dz",
0366                                          histoParameters[www].nintDz,
0367                                          histoParameters[www].minDz,
0368                                          histoParameters[www].maxDz));
0369 
0370       h_assocRpos.push_back(ibooker.book1D("num_assoSimToReco_Rpos",
0371                                            "N of associated tracks (simToReco) vs Radius",
0372                                            histoParameters[www].nintRpos,
0373                                            histoParameters[www].minRpos,
0374                                            histoParameters[www].maxRpos));
0375       h_simulRpos.push_back(ibooker.book1D("num_simul_Rpos",
0376                                            "N of simulated tracks vs Radius",
0377                                            histoParameters[www].nintRpos,
0378                                            histoParameters[www].minRpos,
0379                                            histoParameters[www].maxRpos));
0380 
0381       h_assocZpos.push_back(ibooker.book1D("num_assoSimToReco_Zpos",
0382                                            "N of associated tracks (simToReco) vs Z",
0383                                            histoParameters[www].nintZpos,
0384                                            histoParameters[www].minZpos,
0385                                            histoParameters[www].maxZpos));
0386       h_simulZpos.push_back(ibooker.book1D("num_simul_Zpos",
0387                                            "N of simulated tracks vs Z",
0388                                            histoParameters[www].nintZpos,
0389                                            histoParameters[www].minZpos,
0390                                            histoParameters[www].maxZpos));
0391 
0392       h_recopu.push_back(ibooker.book1D("num_reco_pu",
0393                                         "N of reco track vs pu",
0394                                         histoParameters[www].nintPU,
0395                                         histoParameters[www].minPU,
0396                                         histoParameters[www].maxPU));
0397       h_assocpu.push_back(ibooker.book1D("num_assoSimToReco_pu",
0398                                          "N of associated tracks (simToReco) vs pu",
0399                                          histoParameters[www].nintPU,
0400                                          histoParameters[www].minPU,
0401                                          histoParameters[www].maxPU));
0402       h_assoc2pu.push_back(ibooker.book1D("num_assoRecoToSim_pu",
0403                                           "N of associated (recoToSim) tracks vs pu",
0404                                           histoParameters[www].nintPU,
0405                                           histoParameters[www].minPU,
0406                                           histoParameters[www].maxPU));
0407       h_simulpu.push_back(ibooker.book1D("num_simul_pu",
0408                                          "N of simulated tracks vs pu",
0409                                          histoParameters[www].nintPU,
0410                                          histoParameters[www].minPU,
0411                                          histoParameters[www].maxPU));
0412       h_misidpu.push_back(ibooker.book1D("num_chargemisid_pu",
0413                                          "N of associated (simToReco) charge misIDed tracks vs pu",
0414                                          histoParameters[www].nintPU,
0415                                          histoParameters[www].minPU,
0416                                          histoParameters[www].maxPU));
0417 
0418       h_nchi2.push_back(ibooker.book1D("chi2", "Track normalized #chi^{2}", 80, 0., 20.));
0419       h_nchi2_prob.push_back(ibooker.book1D("chi2prob", "Probability of track normalized #chi^{2}", 100, 0., 1.));
0420 
0421       chi2_vs_nhits.push_back(ibooker.book2D("chi2_vs_nhits",
0422                                              "#chi^{2} vs nhits",
0423                                              histoParameters[www].nintNHit,
0424                                              histoParameters[www].minNHit,
0425                                              histoParameters[www].maxNHit,
0426                                              20,
0427                                              0.,
0428                                              10.));
0429       chi2_vs_eta.push_back(ibooker.book2D("chi2_vs_eta",
0430                                            "chi2_vs_eta",
0431                                            histoParameters[www].nintEta,
0432                                            histoParameters[www].minEta,
0433                                            histoParameters[www].maxEta,
0434                                            40,
0435                                            0.,
0436                                            20.));
0437       chi2_vs_phi.push_back(ibooker.book2D("chi2_vs_phi",
0438                                            "#chi^{2} vs #phi",
0439                                            histoParameters[www].nintPhi,
0440                                            histoParameters[www].minPhi,
0441                                            histoParameters[www].maxPhi,
0442                                            40,
0443                                            0.,
0444                                            20.));
0445 
0446       h_nhits.push_back(ibooker.book1D("nhits",
0447                                        "Number of hits per track",
0448                                        histoParameters[www].nintNHit,
0449                                        histoParameters[www].minNHit,
0450                                        histoParameters[www].maxNHit));
0451       nhits_vs_eta.push_back(ibooker.book2D("nhits_vs_eta",
0452                                             "Number of Hits vs eta",
0453                                             histoParameters[www].nintEta,
0454                                             histoParameters[www].minEta,
0455                                             histoParameters[www].maxEta,
0456                                             histoParameters[www].nintNHit,
0457                                             histoParameters[www].minNHit,
0458                                             histoParameters[www].maxNHit));
0459       nhits_vs_phi.push_back(ibooker.book2D("nhits_vs_phi",
0460                                             "#hits vs #phi",
0461                                             histoParameters[www].nintPhi,
0462                                             histoParameters[www].minPhi,
0463                                             histoParameters[www].maxPhi,
0464                                             histoParameters[www].nintNHit,
0465                                             histoParameters[www].minNHit,
0466                                             histoParameters[www].maxNHit));
0467 
0468       if (histoParameters[www].do_MUOhitsPlots) {
0469         nDThits_vs_eta.push_back(ibooker.book2D("nDThits_vs_eta",
0470                                                 "Number of DT hits vs eta",
0471                                                 histoParameters[www].nintEta,
0472                                                 histoParameters[www].minEta,
0473                                                 histoParameters[www].maxEta,
0474                                                 histoParameters[www].nintDTHit,
0475                                                 histoParameters[www].minDTHit,
0476                                                 histoParameters[www].maxDTHit));
0477         nCSChits_vs_eta.push_back(ibooker.book2D("nCSChits_vs_eta",
0478                                                  "Number of CSC hits vs eta",
0479                                                  histoParameters[www].nintEta,
0480                                                  histoParameters[www].minEta,
0481                                                  histoParameters[www].maxEta,
0482                                                  histoParameters[www].nintCSCHit,
0483                                                  histoParameters[www].minCSCHit,
0484                                                  histoParameters[www].maxCSCHit));
0485         nRPChits_vs_eta.push_back(ibooker.book2D("nRPChits_vs_eta",
0486                                                  "Number of RPC hits vs eta",
0487                                                  histoParameters[www].nintEta,
0488                                                  histoParameters[www].minEta,
0489                                                  histoParameters[www].maxEta,
0490                                                  histoParameters[www].nintRPCHit,
0491                                                  histoParameters[www].minRPCHit,
0492                                                  histoParameters[www].maxRPCHit));
0493         if (useGEMs_)
0494           nGEMhits_vs_eta.push_back(ibooker.book2D("nGEMhits_vs_eta",
0495                                                    "Number of GEM hits vs eta",
0496                                                    histoParameters[www].nintEta,
0497                                                    histoParameters[www].minEta,
0498                                                    histoParameters[www].maxEta,
0499                                                    histoParameters[www].nintNHit,
0500                                                    histoParameters[www].minNHit,
0501                                                    histoParameters[www].maxNHit));
0502         if (useME0_)
0503           nME0hits_vs_eta.push_back(ibooker.book2D("nME0hits_vs_eta",
0504                                                    "Number of ME0 hits vs eta",
0505                                                    histoParameters[www].nintEta,
0506                                                    histoParameters[www].minEta,
0507                                                    histoParameters[www].maxEta,
0508                                                    histoParameters[www].nintNHit,
0509                                                    histoParameters[www].minNHit,
0510                                                    histoParameters[www].maxNHit));
0511       }
0512 
0513       if (histoParameters[www].do_TRKhitsPlots) {
0514         nTRK_LayersWithMeas_vs_eta.push_back(ibooker.book2D("nTRK_LayersWithMeas_vs_eta",
0515                                                             "# TRK Layers with measurement vs eta",
0516                                                             histoParameters[www].nintEta,
0517                                                             histoParameters[www].minEta,
0518                                                             histoParameters[www].maxEta,
0519                                                             histoParameters[www].nintLayers,
0520                                                             histoParameters[www].minLayers,
0521                                                             histoParameters[www].maxLayers));
0522         nPixel_LayersWithMeas_vs_eta.push_back(ibooker.book2D("nPixel_LayersWithMeas_vs_eta",
0523                                                               "Number of Pixel Layers with measurement vs eta",
0524                                                               histoParameters[www].nintEta,
0525                                                               histoParameters[www].minEta,
0526                                                               histoParameters[www].maxEta,
0527                                                               histoParameters[www].nintPixels,
0528                                                               histoParameters[www].minPixels,
0529                                                               histoParameters[www].maxPixels));
0530         h_nmisslayers_inner.push_back(ibooker.book1D("nTRK_misslayers_inner",
0531                                                      "Number of missing inner TRK layers",
0532                                                      histoParameters[www].nintLayers,
0533                                                      histoParameters[www].minLayers,
0534                                                      histoParameters[www].maxLayers));
0535         h_nmisslayers_outer.push_back(ibooker.book1D("nTRK_misslayers_outer",
0536                                                      "Number of missing outer TRK layers",
0537                                                      histoParameters[www].nintLayers,
0538                                                      histoParameters[www].minLayers,
0539                                                      histoParameters[www].maxLayers));
0540         h_nlosthits.push_back(ibooker.book1D("nlosthits", "Number of lost hits per track", 6, -0.5, 5.5));
0541         nlosthits_vs_eta.push_back(ibooker.book2D("nlosthits_vs_eta",
0542                                                   "Number of lost hits per track vs eta",
0543                                                   histoParameters[www].nintEta,
0544                                                   histoParameters[www].minEta,
0545                                                   histoParameters[www].maxEta,
0546                                                   6,
0547                                                   -0.5,
0548                                                   5.5));
0549       }
0550 
0551       ptres_vs_eta.push_back(ibooker.book2D("ptres_vs_eta",
0552                                             "p_{T} Relative Residual vs #eta",
0553                                             histoParameters[www].nintEta,
0554                                             histoParameters[www].minEta,
0555                                             histoParameters[www].maxEta,
0556                                             histoParameters[www].ptRes_nbin,
0557                                             histoParameters[www].ptRes_rangeMin,
0558                                             histoParameters[www].ptRes_rangeMax));
0559       ptres_vs_phi.push_back(ibooker.book2D("ptres_vs_phi",
0560                                             "p_{T} Relative Residual vs #phi",
0561                                             histoParameters[www].nintPhi,
0562                                             histoParameters[www].minPhi,
0563                                             histoParameters[www].maxPhi,
0564                                             histoParameters[www].ptRes_nbin,
0565                                             histoParameters[www].ptRes_rangeMin,
0566                                             histoParameters[www].ptRes_rangeMax));
0567       ptres_vs_pt.push_back(ibooker.book2D("ptres_vs_pt",
0568                                            "p_{T} Relative Residual vs p_{T}",
0569                                            histoParameters[www].nintPt,
0570                                            histoParameters[www].minPt,
0571                                            histoParameters[www].maxPt,
0572                                            histoParameters[www].ptRes_nbin,
0573                                            histoParameters[www].ptRes_rangeMin,
0574                                            histoParameters[www].ptRes_rangeMax,
0575                                            setBinLogX));
0576       h_ptpull.push_back(ibooker.book1D("ptpull", "p_{T} Pull", 100, -10., 10.));
0577       ptpull_vs_eta.push_back(ibooker.book2D("ptpull_vs_eta",
0578                                              "p_{T} Pull vs #eta",
0579                                              histoParameters[www].nintEta,
0580                                              histoParameters[www].minEta,
0581                                              histoParameters[www].maxEta,
0582                                              100,
0583                                              -10.,
0584                                              10.));
0585       ptpull_vs_phi.push_back(ibooker.book2D("ptpull_vs_phi",
0586                                              "p_{T} Pull vs #phi",
0587                                              histoParameters[www].nintPhi,
0588                                              histoParameters[www].minPhi,
0589                                              histoParameters[www].maxPhi,
0590                                              100,
0591                                              -10.,
0592                                              10.));
0593       h_qoverppull.push_back(ibooker.book1D("qoverppull", "q/p Pull", 100, -10., 10.));
0594 
0595       h_etaRes.push_back(ibooker.book1D("etaRes",
0596                                         "#eta residual",
0597                                         histoParameters[www].etaRes_nbin,
0598                                         histoParameters[www].etaRes_rangeMin,
0599                                         histoParameters[www].etaRes_rangeMax));
0600       etares_vs_eta.push_back(ibooker.book2D("etares_vs_eta",
0601                                              "#eta Residual vs #eta",
0602                                              histoParameters[www].nintEta,
0603                                              histoParameters[www].minEta,
0604                                              histoParameters[www].maxEta,
0605                                              histoParameters[www].etaRes_nbin,
0606                                              histoParameters[www].etaRes_rangeMin,
0607                                              histoParameters[www].etaRes_rangeMax));
0608 
0609       thetaCotres_vs_eta.push_back(ibooker.book2D("thetaCotres_vs_eta",
0610                                                   "cot(#theta) Residual vs #eta",
0611                                                   histoParameters[www].nintEta,
0612                                                   histoParameters[www].minEta,
0613                                                   histoParameters[www].maxEta,
0614                                                   histoParameters[www].cotThetaRes_nbin,
0615                                                   histoParameters[www].cotThetaRes_rangeMin,
0616                                                   histoParameters[www].cotThetaRes_rangeMax));
0617       thetaCotres_vs_pt.push_back(ibooker.book2D("thetaCotres_vs_pt",
0618                                                  "cot(#theta) Residual vs p_{T}",
0619                                                  histoParameters[www].nintPt,
0620                                                  histoParameters[www].minPt,
0621                                                  histoParameters[www].maxPt,
0622                                                  histoParameters[www].cotThetaRes_nbin,
0623                                                  histoParameters[www].cotThetaRes_rangeMin,
0624                                                  histoParameters[www].cotThetaRes_rangeMax,
0625                                                  setBinLogX));
0626       h_thetapull.push_back(ibooker.book1D("thetapull", "#theta Pull", 100, -10., 10.));
0627       thetapull_vs_eta.push_back(ibooker.book2D("thetapull_vs_eta",
0628                                                 "#theta Pull vs #eta",
0629                                                 histoParameters[www].nintEta,
0630                                                 histoParameters[www].minEta,
0631                                                 histoParameters[www].maxEta,
0632                                                 100,
0633                                                 -10,
0634                                                 10));
0635       thetapull_vs_phi.push_back(ibooker.book2D("thetapull_vs_phi",
0636                                                 "#theta Pull vs #phi",
0637                                                 histoParameters[www].nintPhi,
0638                                                 histoParameters[www].minPhi,
0639                                                 histoParameters[www].maxPhi,
0640                                                 100,
0641                                                 -10,
0642                                                 10));
0643 
0644       phires_vs_eta.push_back(ibooker.book2D("phires_vs_eta",
0645                                              "#phi Residual vs #eta",
0646                                              histoParameters[www].nintEta,
0647                                              histoParameters[www].minEta,
0648                                              histoParameters[www].maxEta,
0649                                              histoParameters[www].phiRes_nbin,
0650                                              histoParameters[www].phiRes_rangeMin,
0651                                              histoParameters[www].phiRes_rangeMax));
0652       phires_vs_pt.push_back(ibooker.book2D("phires_vs_pt",
0653                                             "#phi Residual vs p_{T}",
0654                                             histoParameters[www].nintPt,
0655                                             histoParameters[www].minPt,
0656                                             histoParameters[www].maxPt,
0657                                             histoParameters[www].phiRes_nbin,
0658                                             histoParameters[www].phiRes_rangeMin,
0659                                             histoParameters[www].phiRes_rangeMax,
0660                                             setBinLogX));
0661       phires_vs_phi.push_back(ibooker.book2D("phires_vs_phi",
0662                                              "#phi Residual vs #phi",
0663                                              histoParameters[www].nintPhi,
0664                                              histoParameters[www].minPhi,
0665                                              histoParameters[www].maxPhi,
0666                                              histoParameters[www].phiRes_nbin,
0667                                              histoParameters[www].phiRes_rangeMin,
0668                                              histoParameters[www].phiRes_rangeMax));
0669       h_phipull.push_back(ibooker.book1D("phipull", "#phi Pull", 100, -10., 10.));
0670       phipull_vs_eta.push_back(ibooker.book2D("phipull_vs_eta",
0671                                               "#phi Pull vs #eta",
0672                                               histoParameters[www].nintEta,
0673                                               histoParameters[www].minEta,
0674                                               histoParameters[www].maxEta,
0675                                               100,
0676                                               -10,
0677                                               10));
0678       phipull_vs_phi.push_back(ibooker.book2D("phipull_vs_phi",
0679                                               "#phi Pull vs #phi",
0680                                               histoParameters[www].nintPhi,
0681                                               histoParameters[www].minPhi,
0682                                               histoParameters[www].maxPhi,
0683                                               100,
0684                                               -10,
0685                                               10));
0686 
0687       dxyres_vs_eta.push_back(ibooker.book2D("dxyres_vs_eta",
0688                                              "dxy Residual vs #eta",
0689                                              histoParameters[www].nintEta,
0690                                              histoParameters[www].minEta,
0691                                              histoParameters[www].maxEta,
0692                                              histoParameters[www].dxyRes_nbin,
0693                                              histoParameters[www].dxyRes_rangeMin,
0694                                              histoParameters[www].dxyRes_rangeMax));
0695       dxyres_vs_pt.push_back(ibooker.book2D("dxyres_vs_pt",
0696                                             "dxy Residual vs p_{T}",
0697                                             histoParameters[www].nintPt,
0698                                             histoParameters[www].minPt,
0699                                             histoParameters[www].maxPt,
0700                                             histoParameters[www].dxyRes_nbin,
0701                                             histoParameters[www].dxyRes_rangeMin,
0702                                             histoParameters[www].dxyRes_rangeMax,
0703                                             setBinLogX));
0704       h_dxypull.push_back(ibooker.book1D("dxypull", "dxy Pull", 100, -10., 10.));
0705       dxypull_vs_eta.push_back(ibooker.book2D("dxypull_vs_eta",
0706                                               "dxy Pull vs #eta",
0707                                               histoParameters[www].nintEta,
0708                                               histoParameters[www].minEta,
0709                                               histoParameters[www].maxEta,
0710                                               100,
0711                                               -10,
0712                                               10));
0713 
0714       dzres_vs_eta.push_back(ibooker.book2D("dzres_vs_eta",
0715                                             "dz Residual vs #eta",
0716                                             histoParameters[www].nintEta,
0717                                             histoParameters[www].minEta,
0718                                             histoParameters[www].maxEta,
0719                                             histoParameters[www].dzRes_nbin,
0720                                             histoParameters[www].dzRes_rangeMin,
0721                                             histoParameters[www].dzRes_rangeMax));
0722       dzres_vs_pt.push_back(ibooker.book2D("dzres_vs_pt",
0723                                            "dz Residual vs p_{T}",
0724                                            histoParameters[www].nintPt,
0725                                            histoParameters[www].minPt,
0726                                            histoParameters[www].maxPt,
0727                                            histoParameters[www].dzRes_nbin,
0728                                            histoParameters[www].dzRes_rangeMin,
0729                                            histoParameters[www].dzRes_rangeMax,
0730                                            setBinLogX));
0731       h_dzpull.push_back(ibooker.book1D("dzpull", "dz Pull", 100, -10., 10.));
0732       dzpull_vs_eta.push_back(ibooker.book2D("dzpull_vs_eta",
0733                                              "dz Pull vs #eta",
0734                                              histoParameters[www].nintEta,
0735                                              histoParameters[www].minEta,
0736                                              histoParameters[www].maxEta,
0737                                              100,
0738                                              -10,
0739                                              10));
0740 
0741       nRecHits_vs_nSimHits.push_back(ibooker.book2D("nRecHits_vs_nSimHits",
0742                                                     "nRecHits vs nSimHits",
0743                                                     histoParameters[www].nintNHit,
0744                                                     histoParameters[www].minNHit,
0745                                                     histoParameters[www].maxNHit,
0746                                                     histoParameters[www].nintNHit,
0747                                                     histoParameters[www].minNHit,
0748                                                     histoParameters[www].maxNHit));
0749 
0750       if (MABH) {
0751         h_PurityVsQuality.push_back(
0752             ibooker.book2D("PurityVsQuality", "Purity vs Quality (MABH)", 20, 0.01, 1.01, 20, 0.01, 1.01));
0753       }
0754       if (UseAssociators) {
0755         if (associators[ww] == "trackAssociatorByChi2") {
0756           h_assochi2.push_back(ibooker.book1D("assocChi2", "track association #chi^{2}", 1000, 0., 100.));
0757           h_assochi2_prob.push_back(
0758               ibooker.book1D("assocChi2_prob", "probability of association #chi^{2}", 100, 0., 1.));
0759         } else if (associators[ww] == "trackAssociatorByHits") {
0760           h_assocFraction.push_back(ibooker.book1D("assocFraction", "fraction of shared hits", 22, 0., 1.1));
0761           h_assocSharedHit.push_back(ibooker.book1D("assocSharedHit", "number of shared hits", 41, -0.5, 40.5));
0762         }
0763       }
0764 
0765     }  //for (unsigned int www=0;www<label.size();www++)
0766   }  //for (unsigned int ww=0;ww<associators.size();ww++)
0767 }
0768 
0769 void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& setup) {
0770   using namespace reco;
0771 
0772   edm::LogInfo("MuonTrackValidator") << "\n===================================================="
0773                                      << "\n"
0774                                      << "Analyzing new event"
0775                                      << "\n"
0776                                      << "====================================================\n"
0777                                      << "\n";
0778 
0779   edm::Handle<std::vector<PileupSummaryInfo> > puinfoH;
0780   int PU_NumInteractions(-1);
0781 
0782   if (parametersDefiner == "LhcParametersDefinerForTP") {
0783     // PileupSummaryInfo is contained only in collision events
0784     event.getByToken(pileupinfo_Token, puinfoH);
0785     for (std::vector<PileupSummaryInfo>::const_iterator puInfoIt = puinfoH->begin(); puInfoIt != puinfoH->end();
0786          ++puInfoIt) {
0787       if (puInfoIt->getBunchCrossing() == 0) {
0788         PU_NumInteractions = puInfoIt->getPU_NumInteractions();
0789         break;
0790       }
0791     }
0792 
0793   } else if (parametersDefiner == "CosmicParametersDefinerForTP") {
0794     edm::Handle<SimHitTPAssociationProducer::SimHitTPAssociationList> simHitsTPAssoc;
0795     //warning: make sure the TP collection used in the map is the same used here
0796     event.getByToken(_simHitTpMapTag, simHitsTPAssoc);
0797     cosmicParametersDefinerTP_->initEvent(simHitsTPAssoc);
0798     cosmictpSelector.initEvent(simHitsTPAssoc);
0799   }
0800 
0801   TrackingParticleRefVector TPrefV;
0802   const TrackingParticleRefVector* ptr_TPrefV = nullptr;
0803   edm::Handle<TrackingParticleCollection> TPCollection_H;
0804   edm::Handle<TrackingParticleRefVector> TPCollectionRefVector_H;
0805 
0806   if (label_tp_refvector) {
0807     event.getByToken(tp_refvector_Token, TPCollectionRefVector_H);
0808     ptr_TPrefV = TPCollectionRefVector_H.product();
0809   } else {
0810     event.getByToken(tp_Token, TPCollection_H);
0811     size_t nTP = TPCollection_H->size();
0812     for (size_t i = 0; i < nTP; ++i) {
0813       TPrefV.push_back(TrackingParticleRef(TPCollection_H, i));
0814     }
0815     ptr_TPrefV = &TPrefV;
0816   }
0817   TrackingParticleRefVector const& tPC = *ptr_TPrefV;
0818 
0819   edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
0820   bool bs_Available = event.getByToken(bsSrc_Token, recoBeamSpotHandle);
0821   reco::BeamSpot bs;
0822   if (bs_Available)
0823     bs = *recoBeamSpotHandle;
0824   edm::LogVerbatim("MuonTrackValidator") << bs;
0825 
0826   std::vector<const reco::TrackToTrackingParticleAssociator*> associator;
0827   if (UseAssociators) {
0828     edm::Handle<reco::TrackToTrackingParticleAssociator> theAssociator;
0829     for (auto const& associatorName : associators) {
0830       event.getByLabel(associatorName, theAssociator);
0831       associator.push_back(theAssociator.product());
0832     }
0833   }
0834 
0835   int w = 0;
0836   unsigned int muonPlotIndex = 0;
0837   unsigned int trackerPlotIndex = 0;
0838   const size_t outerLoopSize = UseAssociators ? associators.size() : 1;
0839   for (unsigned int ww = 0; ww < outerLoopSize; ++ww) {
0840     for (unsigned int www = 0; www < label.size(); ++www, ++w) {  // increment w here to account for continue
0841       bool muonIndexIncremented = false;
0842       bool trackerIndexIncremented = false;
0843       //
0844       //get collections from the event
0845       //
0846       edm::Handle<edm::View<Track> > trackCollection;
0847       unsigned int trackCollectionSize = 0;
0848 
0849       reco::RecoToSimCollection recSimColl;
0850       reco::SimToRecoCollection simRecColl;
0851 
0852       // account for missing track collections (HLT case)
0853       if (!event.getByToken(track_Collection_Token[www], trackCollection) && ignoremissingtkcollection_) {
0854         recSimColl.post_insert();
0855         simRecColl.post_insert();
0856       }
0857 
0858       //associate tracks to TrackingParticles
0859       else {
0860         trackCollectionSize = trackCollection->size();
0861 
0862         if (UseAssociators) {
0863           edm::LogVerbatim("MuonTrackValidator")
0864               << "Analyzing " << label[www].process() << ":" << label[www].label() << ":" << label[www].instance()
0865               << " with " << associators[ww].c_str() << "\n";
0866 
0867           LogTrace("MuonTrackValidator") << "Calling associateRecoToSim method"
0868                                          << "\n";
0869           recSimColl = associator[ww]->associateRecoToSim(trackCollection, TPCollection_H);
0870           LogTrace("MuonTrackValidator") << "Calling associateSimToReco method"
0871                                          << "\n";
0872           simRecColl = associator[ww]->associateSimToReco(trackCollection, TPCollection_H);
0873         } else {
0874           edm::LogVerbatim("MuonTrackValidator")
0875               << "Analyzing " << label[www].process() << ":" << label[www].label() << ":" << label[www].instance()
0876               << " with " << associatormap[www].process() << ":" << associatormap[www].label() << ":"
0877               << associatormap[www].instance() << "\n";
0878 
0879           Handle<reco::SimToRecoCollection> simtorecoCollectionH;
0880           event.getByToken(simToRecoCollection_Token[www], simtorecoCollectionH);
0881           simRecColl = *simtorecoCollectionH.product();
0882 
0883           Handle<reco::RecoToSimCollection> recotosimCollectionH;
0884           event.getByToken(recoToSimCollection_Token[www], recotosimCollectionH);
0885           recSimColl = *recotosimCollectionH.product();
0886         }
0887       }
0888 
0889       //
0890       //fill simulation histograms
0891       //
0892       edm::LogVerbatim("MuonTrackValidator") << "\n# of TrackingParticles: " << tPC.size() << "\n";
0893       int ats = 0;
0894       int st = 0;
0895 
0896       std::optional<double> dR = [&]() -> std::optional<double> {
0897         if (tpSelector.isSignalOnly() && tPC.size() == 2) {
0898           const auto& tp1 = *tPC[0];
0899           const auto& tp2 = *tPC[1];
0900           return reco::deltaR(tp1.momentum(), tp2.momentum());
0901         }
0902         return std::nullopt;
0903       }();
0904 
0905       for (size_t i = 0; i < tPC.size(); i++) {
0906         bool TP_is_matched = false;
0907         bool isChargeOK = true;
0908         double quality = 0.;
0909 
0910         const TrackingParticleRef& tpr = tPC[i];
0911         const TrackingParticle& tp = *tpr;
0912 
0913         TrackingParticle::Vector momentumTP;
0914         TrackingParticle::Point vertexTP;
0915         double dxySim = 0;
0916         double dzSim = 0;
0917 
0918         //If the TrackingParticle is collision-like, get the momentum and vertex at production state
0919         //and the impact parameters w.r.t. PCA
0920         if (parametersDefiner == "LhcParametersDefinerForTP") {
0921           LogTrace("MuonTrackValidator") << "TrackingParticle " << i;
0922           if (!tpSelector(tp))
0923             continue;
0924           momentumTP = tp.momentum();
0925           vertexTP = tp.vertex();
0926           TrackingParticle::Vector momentum = lhcParametersDefinerTP_->momentum(event, setup, tpr);
0927           TrackingParticle::Point vertex = lhcParametersDefinerTP_->vertex(event, setup, tpr);
0928           dxySim = TrackingParticleIP::dxy(vertex, momentum, bs.position());
0929           dzSim = TrackingParticleIP::dz(vertex, momentum, bs.position());
0930         }
0931         //for cosmics get the momentum and vertex at PCA
0932         else if (parametersDefiner == "CosmicParametersDefinerForTP") {
0933           edm::LogVerbatim("MuonTrackValidator") << "TrackingParticle " << i;
0934           if (!cosmictpSelector(tpr, &bs, event, setup))
0935             continue;
0936           momentumTP = cosmicParametersDefinerTP_->momentum(event, setup, tpr);
0937           vertexTP = cosmicParametersDefinerTP_->vertex(event, setup, tpr);
0938           dxySim = TrackingParticleIP::dxy(vertexTP, momentumTP, bs.position());
0939           dzSim = TrackingParticleIP::dz(vertexTP, momentumTP, bs.position());
0940         }
0941 
0942         // Number of counted SimHits depend on the selection of tracker and muon detectors (via cfg parameters)
0943         int nSimHits = 0;
0944         if (histoParameters[www].usetracker && histoParameters[www].usemuon) {
0945           nSimHits = tpr.get()->numberOfHits();
0946         } else if (!histoParameters[www].usetracker && histoParameters[www].usemuon) {
0947           nSimHits = tpr.get()->numberOfHits() - tpr.get()->numberOfTrackerHits();
0948         } else if (histoParameters[www].usetracker && !histoParameters[www].usemuon) {
0949           nSimHits = tpr.get()->numberOfTrackerHits();
0950         }
0951 
0952         edm::LogVerbatim("MuonTrackValidator") << "--------------------Selected TrackingParticle #" << tpr.key()
0953                                                << "  (N counted simhits = " << nSimHits << ")";
0954         edm::LogVerbatim("MuonTrackValidator")
0955             << "momentumTP: pt = " << sqrt(momentumTP.perp2()) << ", pz = " << momentumTP.z()
0956             << ", \t vertexTP: radius = " << sqrt(vertexTP.perp2()) << ",  z = " << vertexTP.z();
0957         st++;
0958 
0959         double TPeta = momentumTP.eta();
0960         double xTPeta = getEta(TPeta);
0961         double absEta = fabs(TPeta);
0962         double TPpt = sqrt(momentumTP.perp2());
0963         double xTPpt = getPt(TPpt);
0964         double TPphi = momentumTP.phi();
0965         double TPrpos = sqrt(vertexTP.perp2());
0966         double TPzpos = vertexTP.z();
0967 
0968         int assoc_recoTrack_NValidHits = 0;
0969         if (simRecColl.find(tpr) != simRecColl.end()) {
0970           auto const& rt = simRecColl[tpr];
0971           if (!rt.empty()) {
0972             RefToBase<Track> assoc_recoTrack = rt.begin()->first;
0973             TP_is_matched = true;
0974             ats++;
0975             if (assoc_recoTrack->charge() != tpr->charge())
0976               isChargeOK = false;
0977             quality = rt.begin()->second;
0978             assoc_recoTrack_NValidHits = assoc_recoTrack->numberOfValidHits();
0979             edm::LogVerbatim("MuonTrackValidator") << "-----------------------------associated to Track #"
0980                                                    << assoc_recoTrack.key() << " with quality:" << quality << "\n";
0981           }
0982         } else {
0983           edm::LogVerbatim("MuonTrackValidator")
0984               << "TrackingParticle #" << tpr.key() << " with pt,eta,phi: " << sqrt(momentumTP.perp2()) << " , "
0985               << momentumTP.eta() << " , " << momentumTP.phi() << " , "
0986               << " NOT associated to any reco::Track"
0987               << "\n";
0988         }
0989 
0990         // histos for efficiency vs eta
0991         fillPlotNoFlow(h_simuleta[w], xTPeta);
0992         if (TP_is_matched) {
0993           fillPlotNoFlow(h_assoceta[w], xTPeta);
0994           if (!isChargeOK)
0995             fillPlotNoFlow(h_misideta[w], xTPeta);
0996         }
0997 
0998         // histos for efficiency vs phi
0999         fillPlotNoFlow(h_simulphi[w], TPphi);
1000         if (absEta < 0.9) {
1001           fillPlotNoFlow(h_simulphiB[w], TPphi);
1002         } else if (absEta < 1.2) {
1003           fillPlotNoFlow(h_simulphiO[w], TPphi);
1004         } else {
1005           fillPlotNoFlow(h_simulphiE[w], TPphi);
1006         }
1007         if (TP_is_matched) {
1008           fillPlotNoFlow(h_assocphi[w], TPphi);
1009           if (absEta < 0.9) {
1010             fillPlotNoFlow(h_assocphiB[w], TPphi);
1011           } else if (absEta < 1.2) {
1012             fillPlotNoFlow(h_assocphiO[w], TPphi);
1013           } else {
1014             fillPlotNoFlow(h_assocphiE[w], TPphi);
1015           }
1016           if (!isChargeOK)
1017             fillPlotNoFlow(h_misidphi[w], TPphi);
1018         }
1019 
1020         // histos for efficiency vs dR
1021         if (dR) {
1022           fillPlotNoFlow(h_simuldR[w], *dR);
1023           if (TP_is_matched) {
1024             fillPlotNoFlow(h_assocdR[w], *dR);
1025             if (!isChargeOK)
1026               fillPlotNoFlow(h_misiddR[w], *dR);
1027           }
1028         }
1029 
1030         // histos for efficiency vs pT
1031         fillPlotNoFlow(h_simulpT[w], xTPpt);
1032         if (absEta < 0.9) {
1033           fillPlotNoFlow(h_simulpTB[w], xTPpt);
1034         } else if (absEta < 1.2) {
1035           fillPlotNoFlow(h_simulpTO[w], xTPpt);
1036         } else {
1037           fillPlotNoFlow(h_simulpTE[w], xTPpt);
1038         }
1039         if (TP_is_matched) {
1040           fillPlotNoFlow(h_assocpT[w], xTPpt);
1041           if (absEta < 0.9) {
1042             fillPlotNoFlow(h_assocpTB[w], xTPpt);
1043           } else if (absEta < 1.2) {
1044             fillPlotNoFlow(h_assocpTO[w], xTPpt);
1045           } else {
1046             fillPlotNoFlow(h_assocpTE[w], xTPpt);
1047           }
1048           if (!isChargeOK)
1049             fillPlotNoFlow(h_misidpT[w], xTPpt);
1050         }
1051 
1052         // histos for efficiency vs dxy
1053         fillPlotNoFlow(h_simuldxy[w], dxySim);
1054         if (TP_is_matched) {
1055           fillPlotNoFlow(h_assocdxy[w], dxySim);
1056           if (!isChargeOK)
1057             fillPlotNoFlow(h_misiddxy[w], dxySim);
1058         }
1059 
1060         // histos for efficiency vs dz
1061         fillPlotNoFlow(h_simuldz[w], dzSim);
1062         if (TP_is_matched) {
1063           fillPlotNoFlow(h_assocdz[w], dzSim);
1064           if (!isChargeOK)
1065             fillPlotNoFlow(h_misiddz[w], dzSim);
1066         }
1067 
1068         // histos for efficiency vs Radius
1069         fillPlotNoFlow(h_simulRpos[w], TPrpos);
1070         if (TP_is_matched)
1071           fillPlotNoFlow(h_assocRpos[w], TPrpos);
1072 
1073         // histos for efficiency vs z position
1074         fillPlotNoFlow(h_simulZpos[w], TPzpos);
1075         if (TP_is_matched)
1076           fillPlotNoFlow(h_assocZpos[w], TPzpos);
1077 
1078         // histos for efficiency vs Number of Hits
1079         fillPlotNoFlow(h_simulhit[w], nSimHits);
1080         if (TP_is_matched) {
1081           fillPlotNoFlow(h_assochit[w], nSimHits);
1082           nRecHits_vs_nSimHits[w]->Fill(nSimHits, assoc_recoTrack_NValidHits);
1083 
1084           // charge misid is more useful w.r.t. nRecHits (filled after)
1085           //if (!isChargeOK) fillPlotNoFlow(h_misidhit[w], nSimHits);
1086         }
1087 
1088         // histos for efficiency vs PileUp
1089         fillPlotNoFlow(h_simulpu[w], PU_NumInteractions);
1090         if (TP_is_matched) {
1091           fillPlotNoFlow(h_assocpu[w], PU_NumInteractions);
1092           if (!isChargeOK)
1093             fillPlotNoFlow(h_misidpu[w], PU_NumInteractions);
1094         }
1095 
1096         if (doSummaryPlots_) {
1097           fillPlotNoFlow(h_simul_coll[ww], www);
1098           if (TP_is_matched) {
1099             fillPlotNoFlow(h_assoc_coll[ww], www);
1100           }
1101         }
1102 
1103       }  // End for (size_t i = 0; i < tPCeff.size(); i++) {
1104 
1105       //
1106       //fill reconstructed track histograms
1107       //
1108       edm::LogVerbatim("MuonTrackValidator")
1109           << "\n# of reco::Tracks with " << label[www].process() << ":" << label[www].label() << ":"
1110           << label[www].instance() << ": " << trackCollectionSize << "\n";
1111 
1112       int at = 0;
1113       int rT = 0;
1114       for (edm::View<Track>::size_type i = 0; i < trackCollectionSize; ++i) {
1115         bool Track_is_matched = false;
1116         bool isChargeOK = true;
1117         RefToBase<Track> track(trackCollection, i);
1118         int nRecHits = track->numberOfValidHits();
1119         rT++;
1120 
1121         std::vector<std::pair<TrackingParticleRef, double> > tp;
1122         TrackingParticleRef tpr;
1123 
1124         // new logic (bidirectional)
1125         if (BiDirectional_RecoToSim_association) {
1126           edm::LogVerbatim("MuonTrackValidator") << "----------------------------------------Track #" << track.key()
1127                                                  << " (N valid rechits = " << nRecHits << ")";
1128 
1129           if (recSimColl.find(track) != recSimColl.end()) {
1130             tp = recSimColl[track];
1131             if (!tp.empty()) {
1132               tpr = tp.begin()->first;
1133               // RtS and StR must associate the same pair !
1134               if (simRecColl.find(tpr) != simRecColl.end()) {
1135                 auto const& assoc_track_checkback = simRecColl[tpr].begin()->first;
1136 
1137                 if (assoc_track_checkback.key() == track.key()) {
1138                   Track_is_matched = true;
1139                   at++;
1140                   if (track->charge() != tpr->charge())
1141                     isChargeOK = false;
1142                   double Purity = tp.begin()->second;
1143                   double Quality = simRecColl[tpr].begin()->second;
1144                   edm::LogVerbatim("MuonTrackValidator")
1145                       << "with pt=" << track->pt() << " associated with purity:" << Purity << " to TrackingParticle #"
1146                       << tpr.key() << "\n";
1147                   if (MABH)
1148                     h_PurityVsQuality[w]->Fill(Quality, Purity);
1149                 }
1150               }
1151             }
1152           }
1153 
1154           if (!Track_is_matched)
1155             edm::LogVerbatim("MuonTrackValidator")
1156                 << "with pt=" << track->pt() << " NOT associated to any TrackingParticle"
1157                 << "\n";
1158         }
1159         // old logic, valid for cosmics 2-legs reco (bugged for collision scenario)
1160         else {
1161           if (recSimColl.find(track) != recSimColl.end()) {
1162             tp = recSimColl[track];
1163             if (!tp.empty()) {
1164               tpr = tp.begin()->first;
1165               Track_is_matched = true;
1166               at++;
1167               if (track->charge() != tpr->charge())
1168                 isChargeOK = false;
1169               edm::LogVerbatim("MuonTrackValidator") << "reco::Track #" << track.key() << " with pt=" << track->pt()
1170                                                      << " associated with quality:" << tp.begin()->second << "\n";
1171             }
1172           } else {
1173             edm::LogVerbatim("MuonTrackValidator") << "reco::Track #" << track.key() << " with pt=" << track->pt()
1174                                                    << " NOT associated to any TrackingParticle"
1175                                                    << "\n";
1176           }
1177         }
1178 
1179         double etaRec = track->eta();
1180         double xetaRec = getEta(etaRec);
1181 
1182         double ptRec = track->pt();
1183         double xptRec = getPt(ptRec);
1184 
1185         double qoverpRec = track->qoverp();
1186         double phiRec = track->phi();
1187         double thetaRec = track->theta();
1188         double dxyRec = track->dxy(bs.position());
1189         double dzRec = track->dz(bs.position());
1190 
1191         double qoverpError = track->qoverpError();
1192         double ptError = track->ptError();
1193         double thetaError = track->thetaError();
1194         double phiError = track->phiError();
1195         double dxyError = track->dxyError();
1196         double dzError = track->dzError();
1197 
1198         // histos for coll
1199         if (doSummaryPlots_) {
1200           fillPlotNoFlow(h_reco_coll[ww], www);
1201           if (Track_is_matched) {
1202             fillPlotNoFlow(h_assoc2_coll[ww], www);
1203           }
1204         }
1205 
1206         // histos for fake rate vs eta
1207         fillPlotNoFlow(h_recoeta[w], xetaRec);
1208         if (Track_is_matched) {
1209           fillPlotNoFlow(h_assoc2eta[w], xetaRec);
1210         }
1211 
1212         // histos for fake rate vs phi
1213         fillPlotNoFlow(h_recophi[w], phiRec);
1214         if (Track_is_matched) {
1215           fillPlotNoFlow(h_assoc2phi[w], phiRec);
1216         }
1217 
1218         // histos for fake rate vs pT
1219         fillPlotNoFlow(h_recopT[w], xptRec);
1220         if (Track_is_matched) {
1221           fillPlotNoFlow(h_assoc2pT[w], xptRec);
1222         }
1223 
1224         if (dR) {
1225           fillPlotNoFlow(h_recodR[w], *dR);
1226           if (Track_is_matched) {
1227             fillPlotNoFlow(h_assoc2dR[w], *dR);
1228           }
1229         }
1230 
1231         // histos for fake rate vs dxy
1232         fillPlotNoFlow(h_recodxy[w], dxyRec);
1233         if (Track_is_matched) {
1234           fillPlotNoFlow(h_assoc2dxy[w], dxyRec);
1235         }
1236 
1237         // histos for fake rate vs dz
1238         fillPlotNoFlow(h_recodz[w], dzRec);
1239         if (Track_is_matched) {
1240           fillPlotNoFlow(h_assoc2dz[w], dzRec);
1241         }
1242 
1243         // histos for fake rate vs Number of RecHits in track
1244         fillPlotNoFlow(h_recohit[w], nRecHits);
1245         if (Track_is_matched) {
1246           fillPlotNoFlow(h_assoc2hit[w], nRecHits);
1247           // charge misid w.r.t. nRecHits
1248           if (!isChargeOK)
1249             fillPlotNoFlow(h_misidhit[w], nRecHits);
1250         }
1251 
1252         // histos for fake rate vs Number of PU interactions
1253         fillPlotNoFlow(h_recopu[w], PU_NumInteractions);
1254         if (Track_is_matched) {
1255           fillPlotNoFlow(h_assoc2pu[w], PU_NumInteractions);
1256         }
1257 
1258         // Fill other histos
1259         TrackingParticle* tpp = const_cast<TrackingParticle*>(tpr.get());
1260         // TrackingParticle parameters at point of closest approach to the beamline
1261         TrackingParticle::Vector momentumTP;
1262         TrackingParticle::Point vertexTP;
1263 
1264         if (parametersDefiner == "LhcParametersDefinerForTP") {
1265           // following reco plots are made only from tracks associated to selected signal TPs
1266           if (!(Track_is_matched && tpSelector(*tpp)))
1267             continue;
1268           else {
1269             momentumTP = lhcParametersDefinerTP_->momentum(event, setup, tpr);
1270             vertexTP = lhcParametersDefinerTP_->vertex(event, setup, tpr);
1271           }
1272         } else if (parametersDefiner == "CosmicParametersDefinerForTP") {
1273           // following reco plots are made only from tracks associated to selected signal TPs
1274           if (!(Track_is_matched && cosmictpSelector(tpr, &bs, event, setup)))
1275             continue;
1276           else {
1277             momentumTP = cosmicParametersDefinerTP_->momentum(event, setup, tpr);
1278             vertexTP = cosmicParametersDefinerTP_->vertex(event, setup, tpr);
1279           }
1280         }
1281 
1282         if (UseAssociators) {
1283           if (associators[ww] == "trackAssociatorByChi2") {
1284             //association chi2
1285             double assocChi2 = -tp.begin()->second;  //in association map is stored -chi2
1286             h_assochi2[www]->Fill(assocChi2);
1287             h_assochi2_prob[www]->Fill(TMath::Prob((assocChi2) * 5, 5));
1288           } else if (associators[ww] == "trackAssociatorByHits") {
1289             double fraction = tp.begin()->second;
1290             h_assocFraction[www]->Fill(fraction);
1291             h_assocSharedHit[www]->Fill(fraction * nRecHits);
1292           }
1293         }
1294 
1295         h_charge[w]->Fill(track->charge());
1296 
1297         // Hits
1298         h_nhits[w]->Fill(nRecHits);
1299         nhits_vs_eta[w]->Fill(xetaRec, nRecHits);
1300         nhits_vs_phi[w]->Fill(phiRec, nRecHits);
1301 
1302         if (histoParameters[www].do_MUOhitsPlots) {
1303           nDThits_vs_eta[muonPlotIndex]->Fill(xetaRec, track->hitPattern().numberOfValidMuonDTHits());
1304           nCSChits_vs_eta[muonPlotIndex]->Fill(xetaRec, track->hitPattern().numberOfValidMuonCSCHits());
1305           nRPChits_vs_eta[muonPlotIndex]->Fill(xetaRec, track->hitPattern().numberOfValidMuonRPCHits());
1306           if (useGEMs_) {
1307             nGEMhits_vs_eta[muonPlotIndex]->Fill(xetaRec, track->hitPattern().numberOfValidMuonGEMHits());
1308           }
1309           if (useME0_) {
1310             nME0hits_vs_eta[muonPlotIndex]->Fill(xetaRec, track->hitPattern().numberOfValidMuonME0Hits());
1311           }
1312         }
1313 
1314         if (histoParameters[www].do_TRKhitsPlots) {
1315           nTRK_LayersWithMeas_vs_eta[trackerPlotIndex]->Fill(xetaRec,
1316                                                              track->hitPattern().trackerLayersWithMeasurement());
1317           nPixel_LayersWithMeas_vs_eta[trackerPlotIndex]->Fill(xetaRec,
1318                                                                track->hitPattern().pixelLayersWithMeasurement());
1319           h_nlosthits[trackerPlotIndex]->Fill(track->numberOfLostHits());
1320           h_nmisslayers_inner[trackerPlotIndex]->Fill(
1321               track->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS));
1322           h_nmisslayers_outer[trackerPlotIndex]->Fill(
1323               track->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_OUTER_HITS));
1324           nlosthits_vs_eta[trackerPlotIndex]->Fill(xetaRec, track->numberOfLostHits());
1325         }
1326 
1327         // normalized chi2
1328         h_nchi2[w]->Fill(track->normalizedChi2());
1329         h_nchi2_prob[w]->Fill(TMath::Prob(track->chi2(), (int)track->ndof()));
1330         chi2_vs_nhits[w]->Fill(nRecHits, track->normalizedChi2());
1331         chi2_vs_eta[w]->Fill(xetaRec, track->normalizedChi2());
1332         chi2_vs_phi[w]->Fill(phiRec, track->normalizedChi2());
1333 
1334         double ptSim = sqrt(momentumTP.perp2());
1335         double xptSim = getPt(ptSim);
1336         double qoverpSim = tpr->charge() / sqrt(momentumTP.x() * momentumTP.x() + momentumTP.y() * momentumTP.y() +
1337                                                 momentumTP.z() * momentumTP.z());
1338         double etaSim = momentumTP.eta();
1339         double thetaSim = momentumTP.theta();
1340         double phiSim = momentumTP.phi();
1341         double dxySim = TrackingParticleIP::dxy(vertexTP, momentumTP, bs.position());
1342         double dzSim = TrackingParticleIP::dz(vertexTP, momentumTP, bs.position());
1343 
1344         double etares = etaRec - etaSim;
1345         double ptRelRes = (ptRec - ptSim) / ptSim;  // relative residual -> resolution
1346         double ptPull = (ptRec - ptSim) / ptError;
1347         double qoverpPull = (qoverpRec - qoverpSim) / qoverpError;
1348         double thetaPull = (thetaRec - thetaSim) / thetaError;
1349         double phiDiff = reco::deltaPhi(phiRec, phiSim);
1350         double phiPull = phiDiff / phiError;
1351         double dxyPull = (dxyRec - dxySim) / dxyError;
1352         double dzPull = (dzRec - dzSim) / dzError;
1353 
1354         h_etaRes[w]->Fill(etares);
1355         etares_vs_eta[w]->Fill(xetaRec, etares);
1356 
1357         ptres_vs_eta[w]->Fill(xetaRec, ptRelRes);
1358         ptres_vs_pt[w]->Fill(xptSim, ptRelRes);
1359         ptres_vs_phi[w]->Fill(phiRec, ptRelRes);
1360         h_ptpull[w]->Fill(ptPull);
1361         ptpull_vs_eta[w]->Fill(xetaRec, ptPull);
1362         ptpull_vs_phi[w]->Fill(phiRec, ptPull);
1363         h_qoverppull[w]->Fill(qoverpPull);
1364 
1365         thetaCotres_vs_eta[w]->Fill(xetaRec, cos(thetaRec) / sin(thetaRec) - cos(thetaSim) / sin(thetaSim));
1366         thetaCotres_vs_pt[w]->Fill(xptSim, cos(thetaRec) / sin(thetaRec) - cos(thetaSim) / sin(thetaSim));
1367         h_thetapull[w]->Fill(thetaPull);
1368         thetapull_vs_eta[w]->Fill(xetaRec, thetaPull);
1369         thetapull_vs_phi[w]->Fill(phiRec, thetaPull);
1370 
1371         phires_vs_eta[w]->Fill(xetaRec, phiDiff);
1372         phires_vs_pt[w]->Fill(xptSim, phiDiff);
1373         phires_vs_phi[w]->Fill(phiRec, phiDiff);
1374         h_phipull[w]->Fill(phiPull);
1375         phipull_vs_eta[w]->Fill(xetaRec, phiPull);
1376         phipull_vs_phi[w]->Fill(phiRec, phiPull);
1377 
1378         dxyres_vs_eta[w]->Fill(xetaRec, dxyRec - dxySim);
1379         dxyres_vs_pt[w]->Fill(xptSim, dxyRec - dxySim);
1380         h_dxypull[w]->Fill(dxyPull);
1381         dxypull_vs_eta[w]->Fill(xetaRec, dxyPull);
1382 
1383         dzres_vs_eta[w]->Fill(xetaRec, dzRec - dzSim);
1384         dzres_vs_pt[w]->Fill(xptSim, dzRec - dzSim);
1385         h_dzpull[w]->Fill(dzPull);
1386         dzpull_vs_eta[w]->Fill(xetaRec, dzPull);
1387 
1388         double contrib_Qoverp = qoverpPull * qoverpPull / 5;
1389         double contrib_dxy = dxyPull * dxyPull / 5;
1390         double contrib_dz = dzPull * dzPull / 5;
1391         double contrib_theta = thetaPull * thetaPull / 5;
1392         double contrib_phi = phiPull * phiPull / 5;
1393         double assoChi2 = contrib_Qoverp + contrib_dxy + contrib_dz + contrib_theta + contrib_phi;
1394 
1395         LogTrace("MuonTrackValidator") << "normalized Chi2 (track 5-dofs matching) = " << assoChi2 << "\n"
1396                                        << "\t contrib_Qoverp = " << contrib_Qoverp << "\n"
1397                                        << "\t contrib_theta = " << contrib_theta << "\n"
1398                                        << "\t contrib_phi = " << contrib_phi << "\n"
1399                                        << "\t contrib_dxy = " << contrib_dxy << "\n"
1400                                        << "\t contrib_dz = " << contrib_dz << "\n";
1401 
1402         LogTrace("MuonTrackValidator") << "ptRec = " << ptRec << "\n"
1403                                        << "etaRec = " << etaRec << "\n"
1404                                        << "qoverpRec = " << qoverpRec << "\n"
1405                                        << "thetaRec = " << thetaRec << "\n"
1406                                        << "phiRec = " << phiRec << "\n"
1407                                        << "dxyRec = " << dxyRec << "\n"
1408                                        << "dzRec = " << dzRec << "\n"
1409                                        << ""
1410                                        << "\n"
1411                                        << "qoverpError = " << qoverpError << "\n"
1412                                        << "thetaError = " << thetaError << "\n"
1413                                        << "phiError = " << phiError << "\n"
1414                                        << "dxyError = " << dxyError << "\n"
1415                                        << "dzError = " << dzError << "\n"
1416                                        << ""
1417                                        << "\n"
1418                                        << "ptSim = " << ptSim << "\n"
1419                                        << "etaSim = " << etaSim << "\n"
1420                                        << "qoverpSim = " << qoverpSim << "\n"
1421                                        << "thetaSim = " << thetaSim << "\n"
1422                                        << "phiSim = " << phiSim << "\n"
1423                                        << "dxySim = " << dxySim << "\n"
1424                                        << "dzSim = " << dzSim << "\n";
1425       }  // End of for(edm::View<Track>::size_type i=0; i<trackCollectionSize; ++i) {
1426 
1427       if (histoParameters[www].do_MUOhitsPlots && !muonIndexIncremented) {
1428         ++muonPlotIndex;
1429         muonIndexIncremented = true;
1430       }
1431       if (histoParameters[www].do_TRKhitsPlots && !trackerIndexIncremented) {
1432         ++trackerPlotIndex;
1433         trackerIndexIncremented = true;
1434       }
1435 
1436       h_tracks[w]->Fill(at);
1437       h_fakes[w]->Fill(rT - at);
1438       edm::LogVerbatim("MuonTrackValidator") << "Total Simulated: " << st << "\n"
1439                                              << "Total Associated (simToReco): " << ats << "\n"
1440                                              << "Total Reconstructed: " << rT << "\n"
1441                                              << "Total Associated (recoToSim): " << at << "\n"
1442                                              << "Total Fakes: " << rT - at << "\n";
1443     }  // End of for (unsigned int www=0;www<label.size();www++){
1444   }  //END of for (unsigned int ww=0;ww<associators.size();ww++){
1445 }