Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:55

0001 #include "DQM/L1TMonitor/interface/L1TStage2MuonComp.h"
0002 
0003 L1TStage2MuonComp::L1TStage2MuonComp(const edm::ParameterSet& ps)
0004     : muonToken1(consumes<l1t::MuonBxCollection>(ps.getParameter<edm::InputTag>("muonCollection1"))),
0005       muonToken2(consumes<l1t::MuonBxCollection>(ps.getParameter<edm::InputTag>("muonCollection2"))),
0006       monitorDir(ps.getUntrackedParameter<std::string>("monitorDir")),
0007       muonColl1Title(ps.getUntrackedParameter<std::string>("muonCollection1Title")),
0008       muonColl2Title(ps.getUntrackedParameter<std::string>("muonCollection2Title")),
0009       summaryTitle(ps.getUntrackedParameter<std::string>("summaryTitle")),
0010       ignoreBin(ps.getUntrackedParameter<std::vector<int>>("ignoreBin")),
0011       verbose(ps.getUntrackedParameter<bool>("verbose")),
0012       enable2DComp(
0013           ps.getUntrackedParameter<bool>("enable2DComp")),  // When true eta-phi comparison plots are also produced
0014       displacedQuantities_(ps.getUntrackedParameter<bool>("displacedQuantities")) {
0015   if (displacedQuantities_) {
0016     numErrBins_ += 2;
0017   }
0018   // First include all bins
0019   for (int i = 1; i <= numErrBins_; i++) {
0020     incBin[i] = true;
0021   }
0022   // Then check the list of bins to ignore
0023   for (const auto& i : ignoreBin) {
0024     if (i > 0 && i <= RIDX) {
0025       incBin[i] = false;
0026     }
0027   }
0028 }
0029 
0030 L1TStage2MuonComp::~L1TStage2MuonComp() {}
0031 
0032 void L1TStage2MuonComp::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0033   edm::ParameterSetDescription desc;
0034   desc.add<edm::InputTag>("muonCollection1")->setComment("L1T Muon collection 1");
0035   desc.add<edm::InputTag>("muonCollection2")->setComment("L1T Muon collection 2");
0036   desc.addUntracked<std::string>("monitorDir", "")
0037       ->setComment("Target directory in the DQM file. Will be created if not existing.");
0038   desc.addUntracked<std::string>("muonCollection1Title", "Muon collection 1")
0039       ->setComment("Histogram title for first collection.");
0040   desc.addUntracked<std::string>("muonCollection2Title", "Muon collection 2")
0041       ->setComment("Histogram title for second collection.");
0042   desc.addUntracked<std::string>("summaryTitle", "Summary")->setComment("Title of summary histogram.");
0043   desc.addUntracked<std::vector<int>>("ignoreBin", std::vector<int>())->setComment("List of bins to ignore");
0044   desc.addUntracked<bool>("verbose", false);
0045   desc.addUntracked<bool>("enable2DComp", false);
0046   desc.addUntracked<bool>("displacedQuantities", false);
0047   descriptions.add("l1tStage2MuonComp", desc);
0048 }
0049 
0050 void L1TStage2MuonComp::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) {
0051   // Subsystem Monitoring and Muon Output
0052   ibooker.setCurrentFolder(monitorDir);
0053 
0054   int numBins{16};
0055   if (displacedQuantities_) {
0056     numBins += 2;
0057   }
0058   summary = ibooker.book1D("summary", summaryTitle.c_str(), numBins, 1, numBins + 1);  // range to match bin numbering
0059   summary->setBinLabel(BXRANGEGOOD, "BX range match", 1);
0060   summary->setBinLabel(BXRANGEBAD, "BX range mismatch", 1);
0061   summary->setBinLabel(NMUONGOOD, "muon collection size match", 1);
0062   summary->setBinLabel(NMUONBAD, "muon collection size mismatch", 1);
0063   summary->setBinLabel(MUONALL, "# muons", 1);
0064   summary->setBinLabel(MUONGOOD, "# matching muons", 1);
0065   summary->setBinLabel(PTBAD, "p_{T} mismatch", 1);
0066   summary->setBinLabel(ETABAD, "#eta mismatch", 1);
0067   summary->setBinLabel(PHIBAD, "#phi mismatch", 1);
0068   summary->setBinLabel(ETAATVTXBAD, "#eta at vertex mismatch", 1);
0069   summary->setBinLabel(PHIATVTXBAD, "#phi at vertex mismatch", 1);
0070   summary->setBinLabel(CHARGEBAD, "charge mismatch", 1);
0071   summary->setBinLabel(CHARGEVALBAD, "charge valid mismatch", 1);
0072   summary->setBinLabel(QUALBAD, "quality mismatch", 1);
0073   summary->setBinLabel(ISOBAD, "iso mismatch", 1);
0074   summary->setBinLabel(IDXBAD, "index mismatch", 1);
0075   if (displacedQuantities_) {
0076     summary->setBinLabel(PTUNCONSTRBAD, "p_{T} unconstrained mismatch", 1);
0077     summary->setBinLabel(DXYBAD, "dXY mismatch", 1);
0078   }
0079 
0080   errorSummaryNum = ibooker.book1D(
0081       "errorSummaryNum", summaryTitle.c_str(), numErrBins_, 1, numErrBins_ + 1);  // range to match bin numbering
0082   errorSummaryNum->setBinLabel(RBXRANGE, "BX range mismatch", 1);
0083   errorSummaryNum->setBinLabel(RNMUON, "muon collection size mismatch", 1);
0084   errorSummaryNum->setBinLabel(RMUON, "mismatching muons", 1);
0085   errorSummaryNum->setBinLabel(RPT, "p_{T} mismatch", 1);
0086   errorSummaryNum->setBinLabel(RETA, "#eta mismatch", 1);
0087   errorSummaryNum->setBinLabel(RPHI, "#phi mismatch", 1);
0088   errorSummaryNum->setBinLabel(RETAATVTX, "#eta at vertex mismatch", 1);
0089   errorSummaryNum->setBinLabel(RPHIATVTX, "#phi at vertex mismatch", 1);
0090   errorSummaryNum->setBinLabel(RCHARGE, "charge mismatch", 1);
0091   errorSummaryNum->setBinLabel(RCHARGEVAL, "charge valid mismatch", 1);
0092   errorSummaryNum->setBinLabel(RQUAL, "quality mismatch", 1);
0093   errorSummaryNum->setBinLabel(RISO, "iso mismatch", 1);
0094   errorSummaryNum->setBinLabel(RIDX, "index mismatch", 1);
0095   if (displacedQuantities_) {
0096     errorSummaryNum->setBinLabel(RPTUNCONSTR, "p_{T} unconstrained mismatch", 1);
0097     errorSummaryNum->setBinLabel(RDXY, "dXY mismatch", 1);
0098   }
0099 
0100   // Change the label for those bins that will be ignored
0101   for (unsigned int i = 1; i <= RIDX; i++) {
0102     if (incBin[i] == false) {
0103       errorSummaryNum->setBinLabel(i, "Ignored", 1);
0104     }
0105   }
0106   // Setting canExtend to false is needed to get the correct behaviour when running multithreaded.
0107   // Otherwise, when merging the histgrams of the threads, TH1::Merge sums bins that have the same label in one bin.
0108   // This needs to come after the calls to setBinLabel.
0109   errorSummaryNum->getTH1F()->GetXaxis()->SetCanExtend(false);
0110 
0111   errorSummaryDen = ibooker.book1D(
0112       "errorSummaryDen", "denominators", numErrBins_, 1, numErrBins_ + 1);  // range to match bin numbering
0113   errorSummaryDen->setBinLabel(RBXRANGE, "# events", 1);
0114   errorSummaryDen->setBinLabel(RNMUON, "# muon collections", 1);
0115   for (int i = RMUON; i <= numErrBins_; ++i) {
0116     errorSummaryDen->setBinLabel(i, "# muons", 1);
0117   }
0118   // Needed for correct histogram summing in multithreaded running.
0119   errorSummaryDen->getTH1F()->GetXaxis()->SetCanExtend(false);
0120 
0121   muColl1BxRange = ibooker.book1D("muBxRangeColl1", (muonColl1Title + " mismatching BX range").c_str(), 5, -2.5, 2.5);
0122   muColl1BxRange->setAxisTitle("BX range", 1);
0123   muColl1nMu = ibooker.book1D("nMuColl1", (muonColl1Title + " mismatching muon multiplicity").c_str(), 9, -0.5, 8.5);
0124   muColl1nMu->setAxisTitle("Muon multiplicity", 1);
0125   muColl1hwPt = ibooker.book1D("muHwPtColl1", (muonColl1Title + " mismatching muon p_{T}").c_str(), 512, -0.5, 511.5);
0126   muColl1hwPt->setAxisTitle("Hardware p_{T}", 1);
0127   muColl1hwEta =
0128       ibooker.book1D("muHwEtaColl1", (muonColl1Title + " mismatching muon #eta").c_str(), 461, -230.5, 230.5);
0129   muColl1hwEta->setAxisTitle("Hardware #eta", 1);
0130   muColl1hwPhi = ibooker.book1D("muHwPhiColl1", (muonColl1Title + " mismatching muon #phi").c_str(), 576, -0.5, 575.5);
0131   muColl1hwPhi->setAxisTitle("Hardware #phi", 1);
0132   muColl1hwEtaAtVtx = ibooker.book1D(
0133       "muHwEtaAtVtxColl1", (muonColl1Title + " mismatching muon #eta at vertex").c_str(), 461, -230.5, 230.5);
0134   muColl1hwEtaAtVtx->setAxisTitle("Hardware #eta at vertex", 1);
0135   muColl1hwPhiAtVtx = ibooker.book1D(
0136       "muHwPhiAtVtxColl1", (muonColl1Title + " mismatching muon #phi at vertex").c_str(), 576, -0.5, 575.5);
0137   muColl1hwPhiAtVtx->setAxisTitle("Hardware #phi at vertex", 1);
0138   muColl1hwCharge =
0139       ibooker.book1D("muHwChargeColl1", (muonColl1Title + " mismatching muon charge").c_str(), 2, -0.5, 1.5);
0140   muColl1hwCharge->setAxisTitle("Hardware charge", 1);
0141   muColl1hwChargeValid =
0142       ibooker.book1D("muHwChargeValidColl1", (muonColl1Title + " mismatching muon charge valid").c_str(), 2, -0.5, 1.5);
0143   muColl1hwChargeValid->setAxisTitle("Hardware charge valid", 1);
0144   muColl1hwQual =
0145       ibooker.book1D("muHwQualColl1", (muonColl1Title + " mismatching muon quality").c_str(), 16, -0.5, 15.5);
0146   muColl1hwQual->setAxisTitle("Hardware quality", 1);
0147   muColl1hwIso = ibooker.book1D("muHwIsoColl1", (muonColl1Title + " mismatching muon isolation").c_str(), 4, -0.5, 3.5);
0148   muColl1hwIso->setAxisTitle("Hardware isolation", 1);
0149   muColl1Index =
0150       ibooker.book1D("muIndexColl1", (muonColl1Title + " mismatching Input muon index").c_str(), 108, -0.5, 107.5);
0151   muColl1Index->setAxisTitle("Index", 1);
0152   if (displacedQuantities_) {
0153     muColl1hwPtUnconstrained = ibooker.book1D("muHwPtUnconstrainedColl1",
0154                                               (muonColl1Title + " mismatching muon p_{T} unconstrained").c_str(),
0155                                               512,
0156                                               -0.5,
0157                                               511.5);
0158     muColl1hwPtUnconstrained->setAxisTitle("Hardware p_{T} unconstrained", 1);
0159     muColl1hwDXY =
0160         ibooker.book1D("muHwDXYColl1", (muonColl1Title + " mismatching impact parameter").c_str(), 4, -0.5, 3.5);
0161     muColl1hwDXY->setAxisTitle("Hardware dXY", 1);
0162   }
0163 
0164   // if enable2DComp variable is True, book also the eta-phi map
0165   if (enable2DComp) {
0166     muColl1EtaPhimap = ibooker.book2D(
0167         "muEtaPhimapColl1", (muonColl1Title + " mismatching muon #eta-#phi map").c_str(), 25, -2.5, 2.5, 25, -3.2, 3.2);
0168     muColl1EtaPhimap->setAxisTitle("#eta", 1);
0169     muColl1EtaPhimap->setAxisTitle("#phi", 2);
0170   }
0171 
0172   muColl2BxRange = ibooker.book1D("muBxRangeColl2", (muonColl2Title + " mismatching BX range").c_str(), 5, -2.5, 2.5);
0173   muColl2BxRange->setAxisTitle("BX range", 1);
0174   muColl2nMu = ibooker.book1D("nMuColl2", (muonColl2Title + " mismatching muon multiplicity").c_str(), 9, -0.5, 8.5);
0175   muColl2nMu->setAxisTitle("Muon multiplicity", 1);
0176   muColl2hwPt = ibooker.book1D("muHwPtColl2", (muonColl2Title + " mismatching muon p_{T}").c_str(), 512, -0.5, 511.5);
0177   muColl2hwPt->setAxisTitle("Hardware p_{T}", 1);
0178   muColl2hwEta =
0179       ibooker.book1D("muHwEtaColl2", (muonColl2Title + " mismatching muon #eta").c_str(), 461, -230.5, 230.5);
0180   muColl2hwEta->setAxisTitle("Hardware #eta", 1);
0181   muColl2hwPhi = ibooker.book1D("muHwPhiColl2", (muonColl2Title + " mismatching muon #phi").c_str(), 576, -0.5, 575.5);
0182   muColl2hwPhi->setAxisTitle("Hardware #phi", 1);
0183   muColl2hwEtaAtVtx = ibooker.book1D(
0184       "muHwEtaAtVtxColl2", (muonColl2Title + " mismatching muon #eta at vertex").c_str(), 461, -230.5, 230.5);
0185   muColl2hwEtaAtVtx->setAxisTitle("Hardware #eta at vertex", 1);
0186   muColl2hwPhiAtVtx = ibooker.book1D(
0187       "muHwPhiAtVtxColl2", (muonColl2Title + " mismatching muon #phi at vertex").c_str(), 576, -0.5, 575.5);
0188   muColl2hwPhiAtVtx->setAxisTitle("Hardware #phi at vertex", 1);
0189   muColl2hwCharge =
0190       ibooker.book1D("muHwChargeColl2", (muonColl2Title + " mismatching muon charge").c_str(), 2, -0.5, 1.5);
0191   muColl2hwCharge->setAxisTitle("Hardware charge", 1);
0192   muColl2hwChargeValid =
0193       ibooker.book1D("muHwChargeValidColl2", (muonColl2Title + " mismatching muon charge valid").c_str(), 2, -0.5, 1.5);
0194   muColl2hwChargeValid->setAxisTitle("Hardware charge valid", 1);
0195   muColl2hwQual =
0196       ibooker.book1D("muHwQualColl2", (muonColl2Title + " mismatching muon quality").c_str(), 16, -0.5, 15.5);
0197   muColl2hwQual->setAxisTitle("Hardware quality", 1);
0198   muColl2hwIso = ibooker.book1D("muHwIsoColl2", (muonColl2Title + " mismatching muon isolation").c_str(), 4, -0.5, 3.5);
0199   muColl2hwIso->setAxisTitle("Hardware isolation", 1);
0200   muColl2Index =
0201       ibooker.book1D("muIndexColl2", (muonColl2Title + " mismatching Input muon index").c_str(), 108, -0.5, 107.5);
0202   muColl2Index->setAxisTitle("Index", 1);
0203   if (displacedQuantities_) {
0204     muColl2hwPtUnconstrained = ibooker.book1D("muHwPtUnconstrainedColl2",
0205                                               (muonColl2Title + " mismatching muon p_{T} unconstrained").c_str(),
0206                                               512,
0207                                               -0.5,
0208                                               511.5);
0209     muColl2hwPtUnconstrained->setAxisTitle("Hardware p_{T} unconstrained", 1);
0210     muColl2hwDXY =
0211         ibooker.book1D("muHwDXYColl2", (muonColl2Title + " mismatching impact parameter").c_str(), 4, -0.5, 3.5);
0212     muColl2hwDXY->setAxisTitle("Hardware dXY", 1);
0213   }
0214 
0215   // if enable2DdeMu variable is True, book also the eta-phi map
0216   if (enable2DComp) {
0217     muColl2EtaPhimap = ibooker.book2D(
0218         "muEtaPhimapColl2", (muonColl2Title + " mismatching muon #eta-#phi map").c_str(), 25, -2.5, 2.5, 25, -3.2, 3.2);
0219     muColl2EtaPhimap->setAxisTitle("#eta", 1);
0220     muColl2EtaPhimap->setAxisTitle("#phi", 2);
0221   }
0222 }
0223 
0224 void L1TStage2MuonComp::analyze(const edm::Event& e, const edm::EventSetup& c) {
0225   if (verbose)
0226     edm::LogInfo("L1TStage2MuonComp") << "L1TStage2MuonComp: analyze..." << std::endl;
0227 
0228   edm::Handle<l1t::MuonBxCollection> muonBxColl1;
0229   edm::Handle<l1t::MuonBxCollection> muonBxColl2;
0230   e.getByToken(muonToken1, muonBxColl1);
0231   e.getByToken(muonToken2, muonBxColl2);
0232 
0233   errorSummaryDen->Fill(RBXRANGE);
0234   int bxRange1 = muonBxColl1->getLastBX() - muonBxColl1->getFirstBX() + 1;
0235   int bxRange2 = muonBxColl2->getLastBX() - muonBxColl2->getFirstBX() + 1;
0236   if (bxRange1 != bxRange2) {
0237     summary->Fill(BXRANGEBAD);
0238     if (incBin[RBXRANGE])
0239       errorSummaryNum->Fill(RBXRANGE);
0240     int bx;
0241     for (bx = muonBxColl1->getFirstBX(); bx <= muonBxColl1->getLastBX(); ++bx) {
0242       muColl1BxRange->Fill(bx);
0243     }
0244     for (bx = muonBxColl2->getFirstBX(); bx <= muonBxColl2->getLastBX(); ++bx) {
0245       muColl2BxRange->Fill(bx);
0246     }
0247   } else {
0248     summary->Fill(BXRANGEGOOD);
0249   }
0250 
0251   for (int iBx = muonBxColl1->getFirstBX(); iBx <= muonBxColl1->getLastBX(); ++iBx) {
0252     // don't analyse if this BX does not exist in the second collection
0253     if (iBx < muonBxColl2->getFirstBX() || iBx > muonBxColl2->getLastBX())
0254       continue;
0255 
0256     l1t::MuonBxCollection::const_iterator muonIt1;
0257     l1t::MuonBxCollection::const_iterator muonIt2;
0258 
0259     errorSummaryDen->Fill(RNMUON);
0260     // check number of muons
0261     if (muonBxColl1->size(iBx) != muonBxColl2->size(iBx)) {
0262       summary->Fill(NMUONBAD);
0263       if (incBin[RNMUON])
0264         errorSummaryNum->Fill(RNMUON);
0265       muColl1nMu->Fill(muonBxColl1->size(iBx));
0266       muColl2nMu->Fill(muonBxColl2->size(iBx));
0267 
0268       if (muonBxColl1->size(iBx) > muonBxColl2->size(iBx)) {
0269         muonIt1 = muonBxColl1->begin(iBx) + muonBxColl2->size(iBx);
0270         for (; muonIt1 != muonBxColl1->end(iBx); ++muonIt1) {
0271           muColl1hwPt->Fill(muonIt1->hwPt());
0272           muColl1hwEta->Fill(muonIt1->hwEta());
0273           muColl1hwPhi->Fill(muonIt1->hwPhi());
0274           muColl1hwEtaAtVtx->Fill(muonIt1->hwEtaAtVtx());
0275           muColl1hwPhiAtVtx->Fill(muonIt1->hwPhiAtVtx());
0276           muColl1hwCharge->Fill(muonIt1->hwCharge());
0277           muColl1hwChargeValid->Fill(muonIt1->hwChargeValid());
0278           muColl1hwQual->Fill(muonIt1->hwQual());
0279           muColl1hwIso->Fill(muonIt1->hwIso());
0280           muColl1Index->Fill(muonIt1->tfMuonIndex());
0281           if (enable2DComp) {
0282             muColl1EtaPhimap->Fill(muonIt1->eta(), muonIt1->phi());
0283           }
0284           if (displacedQuantities_) {
0285             muColl1hwPtUnconstrained->Fill(muonIt1->hwPtUnconstrained());
0286             muColl1hwDXY->Fill(muonIt1->hwDXY());
0287           }
0288         }
0289       } else {
0290         muonIt2 = muonBxColl2->begin(iBx) + muonBxColl1->size(iBx);
0291         for (; muonIt2 != muonBxColl2->end(iBx); ++muonIt2) {
0292           muColl2hwPt->Fill(muonIt2->hwPt());
0293           muColl2hwEta->Fill(muonIt2->hwEta());
0294           muColl2hwPhi->Fill(muonIt2->hwPhi());
0295           muColl2hwEtaAtVtx->Fill(muonIt2->hwEtaAtVtx());
0296           muColl2hwPhiAtVtx->Fill(muonIt2->hwPhiAtVtx());
0297           muColl2hwCharge->Fill(muonIt2->hwCharge());
0298           muColl2hwChargeValid->Fill(muonIt2->hwChargeValid());
0299           muColl2hwQual->Fill(muonIt2->hwQual());
0300           muColl2hwIso->Fill(muonIt2->hwIso());
0301           muColl2Index->Fill(muonIt2->tfMuonIndex());
0302           if (enable2DComp) {
0303             muColl2EtaPhimap->Fill(muonIt2->eta(), muonIt2->phi());
0304           }
0305           if (displacedQuantities_) {
0306             muColl2hwPtUnconstrained->Fill(muonIt2->hwPtUnconstrained());
0307             muColl2hwDXY->Fill(muonIt2->hwDXY());
0308           }
0309         }
0310       }
0311     } else {
0312       summary->Fill(NMUONGOOD);
0313     }
0314 
0315     muonIt1 = muonBxColl1->begin(iBx);
0316     muonIt2 = muonBxColl2->begin(iBx);
0317     while (muonIt1 != muonBxColl1->end(iBx) && muonIt2 != muonBxColl2->end(iBx)) {
0318       summary->Fill(MUONALL);
0319       for (int i = RMUON; i <= numErrBins_; ++i) {
0320         errorSummaryDen->Fill(i);
0321       }
0322 
0323       bool muonMismatch = false;     // All muon mismatches
0324       bool muonSelMismatch = false;  // Muon mismatches excluding ignored bins
0325       if (muonIt1->hwPt() != muonIt2->hwPt()) {
0326         muonMismatch = true;
0327         summary->Fill(PTBAD);
0328         if (incBin[RPT]) {
0329           muonSelMismatch = true;
0330           errorSummaryNum->Fill(RPT);
0331         }
0332       }
0333       if (displacedQuantities_) {
0334         if (muonIt1->hwPtUnconstrained() != muonIt2->hwPtUnconstrained()) {
0335           muonMismatch = true;
0336           summary->Fill(PTUNCONSTRBAD);
0337           if (incBin[RPTUNCONSTR]) {
0338             muonSelMismatch = true;
0339             errorSummaryNum->Fill(RPTUNCONSTR);
0340           }
0341         }
0342         if (muonIt1->hwDXY() != muonIt2->hwDXY()) {
0343           muonMismatch = true;
0344           summary->Fill(DXYBAD);
0345           if (incBin[RDXY]) {
0346             muonSelMismatch = true;
0347             errorSummaryNum->Fill(RDXY);
0348           }
0349         }
0350       }
0351       if (muonIt1->hwEta() != muonIt2->hwEta()) {
0352         muonMismatch = true;
0353         summary->Fill(ETABAD);
0354         if (incBin[RETA]) {
0355           muonSelMismatch = true;
0356           errorSummaryNum->Fill(RETA);
0357         }
0358       }
0359       if (muonIt1->hwPhi() != muonIt2->hwPhi()) {
0360         muonMismatch = true;
0361         summary->Fill(PHIBAD);
0362         if (incBin[RPHI]) {
0363           muonSelMismatch = true;
0364           errorSummaryNum->Fill(RPHI);
0365         }
0366       }
0367       if (muonIt1->hwEtaAtVtx() != muonIt2->hwEtaAtVtx()) {
0368         muonMismatch = true;
0369         summary->Fill(ETAATVTXBAD);
0370         if (incBin[RETAATVTX]) {
0371           muonSelMismatch = true;
0372           errorSummaryNum->Fill(RETAATVTX);
0373         }
0374       }
0375       if (muonIt1->hwPhiAtVtx() != muonIt2->hwPhiAtVtx()) {
0376         muonMismatch = true;
0377         summary->Fill(PHIATVTXBAD);
0378         if (incBin[RPHIATVTX]) {
0379           muonSelMismatch = true;
0380           errorSummaryNum->Fill(RPHIATVTX);
0381         }
0382       }
0383       if (muonIt1->hwCharge() != muonIt2->hwCharge()) {
0384         muonMismatch = true;
0385         summary->Fill(CHARGEBAD);
0386         if (incBin[RCHARGE]) {
0387           muonSelMismatch = true;
0388           errorSummaryNum->Fill(RCHARGE);
0389         }
0390       }
0391       if (muonIt1->hwChargeValid() != muonIt2->hwChargeValid()) {
0392         muonMismatch = true;
0393         summary->Fill(CHARGEVALBAD);
0394         if (incBin[RCHARGEVAL]) {
0395           muonSelMismatch = true;
0396           errorSummaryNum->Fill(RCHARGEVAL);
0397         }
0398       }
0399       if (muonIt1->hwQual() != muonIt2->hwQual()) {
0400         muonMismatch = true;
0401         summary->Fill(QUALBAD);
0402         if (incBin[RQUAL]) {
0403           muonSelMismatch = true;
0404           errorSummaryNum->Fill(RQUAL);
0405         }
0406       }
0407       if (muonIt1->hwIso() != muonIt2->hwIso()) {
0408         muonMismatch = true;
0409         summary->Fill(ISOBAD);
0410         if (incBin[RISO]) {
0411           muonSelMismatch = true;
0412           errorSummaryNum->Fill(RISO);
0413         }
0414       }
0415       if (muonIt1->tfMuonIndex() != muonIt2->tfMuonIndex()) {
0416         muonMismatch = true;
0417         summary->Fill(IDXBAD);
0418         if (incBin[RIDX]) {
0419           muonSelMismatch = true;
0420           errorSummaryNum->Fill(RIDX);
0421         }
0422       }
0423 
0424       if (incBin[RMUON] && muonSelMismatch) {
0425         errorSummaryNum->Fill(RMUON);
0426       }
0427 
0428       if (muonMismatch) {
0429         muColl1hwPt->Fill(muonIt1->hwPt());
0430         if (displacedQuantities_) {
0431           muColl1hwPtUnconstrained->Fill(muonIt1->hwPtUnconstrained());
0432           muColl1hwDXY->Fill(muonIt1->hwDXY());
0433         }
0434         muColl1hwEta->Fill(muonIt1->hwEta());
0435         muColl1hwPhi->Fill(muonIt1->hwPhi());
0436         muColl1hwEtaAtVtx->Fill(muonIt1->hwEtaAtVtx());
0437         muColl1hwPhiAtVtx->Fill(muonIt1->hwPhiAtVtx());
0438         muColl1hwCharge->Fill(muonIt1->hwCharge());
0439         muColl1hwChargeValid->Fill(muonIt1->hwChargeValid());
0440         muColl1hwQual->Fill(muonIt1->hwQual());
0441         muColl1hwIso->Fill(muonIt1->hwIso());
0442         muColl1Index->Fill(muonIt1->tfMuonIndex());
0443         if (enable2DComp)
0444           muColl1EtaPhimap->Fill(muonIt1->eta(), muonIt1->phi());
0445 
0446         muColl2hwPt->Fill(muonIt2->hwPt());
0447         if (displacedQuantities_) {
0448           muColl2hwPtUnconstrained->Fill(muonIt2->hwPtUnconstrained());
0449           muColl2hwDXY->Fill(muonIt2->hwDXY());
0450         }
0451         muColl2hwEta->Fill(muonIt2->hwEta());
0452         muColl2hwPhi->Fill(muonIt2->hwPhi());
0453         muColl2hwEtaAtVtx->Fill(muonIt2->hwEtaAtVtx());
0454         muColl2hwPhiAtVtx->Fill(muonIt2->hwPhiAtVtx());
0455         muColl2hwCharge->Fill(muonIt2->hwCharge());
0456         muColl2hwChargeValid->Fill(muonIt2->hwChargeValid());
0457         muColl2hwQual->Fill(muonIt2->hwQual());
0458         muColl2hwIso->Fill(muonIt2->hwIso());
0459         muColl2Index->Fill(muonIt2->tfMuonIndex());
0460         if (enable2DComp) {
0461           muColl2EtaPhimap->Fill(muonIt2->eta(), muonIt2->phi());
0462         }
0463       } else {
0464         summary->Fill(MUONGOOD);
0465       }
0466 
0467       ++muonIt1;
0468       ++muonIt2;
0469     }
0470   }
0471 }