File indexing completed on 2024-04-06 12:07:55
0001 #include "DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h"
0002
0003 L1TStage2RegionalMuonCandComp::L1TStage2RegionalMuonCandComp(const edm::ParameterSet& ps)
0004 : muonToken1(
0005 consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("regionalMuonCollection1"))),
0006 muonToken2(
0007 consumes<l1t::RegionalMuonCandBxCollection>(ps.getParameter<edm::InputTag>("regionalMuonCollection2"))),
0008 monitorDir(ps.getUntrackedParameter<std::string>("monitorDir")),
0009 muonColl1Title(ps.getUntrackedParameter<std::string>("regionalMuonCollection1Title")),
0010 muonColl2Title(ps.getUntrackedParameter<std::string>("regionalMuonCollection2Title")),
0011 summaryTitle(ps.getUntrackedParameter<std::string>("summaryTitle")),
0012 ignoreBadTrkAddr(ps.getUntrackedParameter<bool>("ignoreBadTrackAddress")),
0013 ignoreBin(ps.getUntrackedParameter<std::vector<int>>("ignoreBin")),
0014 verbose(ps.getUntrackedParameter<bool>("verbose")),
0015 hasDisplacementInfo(ps.getUntrackedParameter<bool>("hasDisplacementInfo")) {
0016 if (hasDisplacementInfo) {
0017 numErrBins_ += 2;
0018 numSummaryBins_ += 2;
0019 }
0020
0021 for (int i = 1; i <= numErrBins_; i++) {
0022 incBin[i] = true;
0023 }
0024
0025 for (const auto& i : ignoreBin) {
0026 if (i > 0 && i <= RPT2) {
0027 incBin[i] = false;
0028 }
0029 }
0030 }
0031
0032 L1TStage2RegionalMuonCandComp::~L1TStage2RegionalMuonCandComp() {}
0033
0034 void L1TStage2RegionalMuonCandComp::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0035 edm::ParameterSetDescription desc;
0036 desc.add<edm::InputTag>("regionalMuonCollection1")->setComment("L1T RegionalMuonCand collection 1");
0037 desc.add<edm::InputTag>("regionalMuonCollection2")->setComment("L1T RegionalMuonCand collection 2");
0038 desc.addUntracked<std::string>("monitorDir", "")
0039 ->setComment("Target directory in the DQM file. Will be created if not existing.");
0040 desc.addUntracked<std::string>("regionalMuonCollection1Title", "Regional muon collection 1")
0041 ->setComment("Histogram title for first collection.");
0042 desc.addUntracked<std::string>("regionalMuonCollection2Title", "Regional muon collection 2")
0043 ->setComment("Histogram title for second collection.");
0044 desc.addUntracked<std::string>("summaryTitle", "Summary")->setComment("Title of summary histogram.");
0045 desc.addUntracked<bool>("ignoreBadTrackAddress", false)->setComment("Ignore muon track address mismatches.");
0046 desc.addUntracked<std::vector<int>>("ignoreBin", std::vector<int>())->setComment("List of bins to ignore");
0047 desc.addUntracked<bool>("verbose", false);
0048 desc.addUntracked<bool>("hasDisplacementInfo", false);
0049 descriptions.add("l1tStage2RegionalMuonCandComp", desc);
0050 }
0051
0052 void L1TStage2RegionalMuonCandComp::bookHistograms(DQMStore::IBooker& ibooker,
0053 const edm::Run&,
0054 const edm::EventSetup&) {
0055 std::string trkAddrIgnoreText = "";
0056 if (ignoreBadTrkAddr) {
0057 trkAddrIgnoreText = " (Bad track addresses ignored)";
0058 }
0059
0060
0061 ibooker.setCurrentFolder(monitorDir);
0062
0063 summary = ibooker.book1D("summary",
0064 (summaryTitle + trkAddrIgnoreText).c_str(),
0065 numSummaryBins_,
0066 1,
0067 numSummaryBins_ + 1);
0068 summary->setBinLabel(BXRANGEGOOD, "BX range match", 1);
0069 summary->setBinLabel(BXRANGEBAD, "BX range mismatch", 1);
0070 summary->setBinLabel(NMUONGOOD, "muon collection size match", 1);
0071 summary->setBinLabel(NMUONBAD, "muon collection size mismatch", 1);
0072 summary->setBinLabel(MUONALL, "# muons", 1);
0073 summary->setBinLabel(MUONGOOD, "# matching muons", 1);
0074 summary->setBinLabel(PTBAD, "p_{T} mismatch", 1);
0075 summary->setBinLabel(ETABAD, "#eta mismatch", 1);
0076 summary->setBinLabel(LOCALPHIBAD, "local #phi mismatch", 1);
0077 summary->setBinLabel(SIGNBAD, "sign mismatch", 1);
0078 summary->setBinLabel(SIGNVALBAD, "sign valid mismatch", 1);
0079 summary->setBinLabel(QUALBAD, "quality mismatch", 1);
0080 summary->setBinLabel(HFBAD, "HF bit mismatch", 1);
0081 summary->setBinLabel(LINKBAD, "link mismatch", 1);
0082 summary->setBinLabel(PROCBAD, "processor mismatch", 1);
0083 summary->setBinLabel(TFBAD, "track finder type mismatch", 1);
0084 summary->setBinLabel(TRACKADDRBAD, "track address mismatch", 1);
0085 if (hasDisplacementInfo) {
0086 summary->setBinLabel(DXYBAD, "DXY mismatch", 1);
0087 summary->setBinLabel(PT2BAD, "P_{T} unconstrained mismatch", 1);
0088 }
0089
0090 errorSummaryNum = ibooker.book1D("errorSummaryNum",
0091 (summaryTitle + trkAddrIgnoreText).c_str(),
0092 numErrBins_,
0093 1,
0094 numErrBins_ + 1);
0095 errorSummaryNum->setBinLabel(RBXRANGE, "BX range mismatch", 1);
0096 errorSummaryNum->setBinLabel(RNMUON, "muon collection size mismatch", 1);
0097 errorSummaryNum->setBinLabel(RMUON, "mismatching muons", 1);
0098 errorSummaryNum->setBinLabel(RPT, "p_{T} mismatch", 1);
0099 errorSummaryNum->setBinLabel(RETA, "#eta mismatch", 1);
0100 errorSummaryNum->setBinLabel(RLOCALPHI, "local #phi mismatch", 1);
0101 errorSummaryNum->setBinLabel(RSIGN, "sign mismatch", 1);
0102 errorSummaryNum->setBinLabel(RSIGNVAL, "sign valid mismatch", 1);
0103 errorSummaryNum->setBinLabel(RQUAL, "quality mismatch", 1);
0104 errorSummaryNum->setBinLabel(RHF, "HF bit mismatch", 1);
0105 errorSummaryNum->setBinLabel(RLINK, "link mismatch", 1);
0106 errorSummaryNum->setBinLabel(RPROC, "processor mismatch", 1);
0107 errorSummaryNum->setBinLabel(RTF, "track finder type mismatch", 1);
0108 errorSummaryNum->setBinLabel(RTRACKADDR, "track address mismatch", 1);
0109 if (hasDisplacementInfo) {
0110 errorSummaryNum->setBinLabel(RDXY, "DXY mismatch", 1);
0111 errorSummaryNum->setBinLabel(RPT2, "P_{T} unconstrained mismatch", 1);
0112 }
0113
0114
0115 for (int i = 1; i <= errorSummaryNum->getNbinsX(); i++) {
0116 if (incBin[i] == false) {
0117 errorSummaryNum->setBinLabel(i, "Ignored", 1);
0118 }
0119 }
0120
0121
0122
0123 errorSummaryNum->getTH1F()->GetXaxis()->SetCanExtend(false);
0124
0125 errorSummaryDen = ibooker.book1D(
0126 "errorSummaryDen", "denominators", numErrBins_, 1, numErrBins_ + 1);
0127 errorSummaryDen->setBinLabel(RBXRANGE, "# events", 1);
0128 errorSummaryDen->setBinLabel(RNMUON, "# muon collections", 1);
0129 for (int i = RMUON; i <= errorSummaryDen->getNbinsX(); ++i) {
0130 errorSummaryDen->setBinLabel(i, "# muons", 1);
0131 }
0132
0133 errorSummaryDen->getTH1F()->GetXaxis()->SetCanExtend(false);
0134
0135 muColl1BxRange = ibooker.book1D("muBxRangeColl1", (muonColl1Title + " mismatching BX range").c_str(), 11, -5.5, 5.5);
0136 muColl1BxRange->setAxisTitle("BX range", 1);
0137 muColl1nMu = ibooker.book1D("nMuColl1", (muonColl1Title + " mismatching muon multiplicity").c_str(), 37, -0.5, 36.5);
0138 muColl1nMu->setAxisTitle("Muon multiplicity", 1);
0139 muColl1hwPt = ibooker.book1D(
0140 "muHwPtColl1", (muonColl1Title + " mismatching muon p_{T}" + trkAddrIgnoreText).c_str(), 512, -0.5, 511.5);
0141 muColl1hwPt->setAxisTitle("Hardware p_{T}", 1);
0142 muColl1hwEta = ibooker.book1D(
0143 "muHwEtaColl1", (muonColl1Title + " mismatching muon #eta" + trkAddrIgnoreText).c_str(), 512, -256.5, 255.5);
0144 muColl1hwEta->setAxisTitle("Hardware #eta", 1);
0145 muColl1hwPhi = ibooker.book1D(
0146 "muHwPhiColl1", (muonColl1Title + " mismatching muon #phi" + trkAddrIgnoreText).c_str(), 256, -128.5, 127.5);
0147 muColl1hwPhi->setAxisTitle("Hardware #phi", 1);
0148 muColl1hwSign = ibooker.book1D(
0149 "muHwSignColl1", (muonColl1Title + " mismatching muon sign" + trkAddrIgnoreText).c_str(), 2, -0.5, 1.5);
0150 muColl1hwSign->setAxisTitle("Hardware sign", 1);
0151 muColl1hwSignValid = ibooker.book1D(
0152 "muHwSignValidColl1", (muonColl1Title + " mismatching muon sign valid" + trkAddrIgnoreText).c_str(), 2, -0.5, 1.5);
0153 muColl1hwSignValid->setAxisTitle("Hardware sign valid", 1);
0154 muColl1hwQual = ibooker.book1D(
0155 "muHwQualColl1", (muonColl1Title + " mismatching muon quality" + trkAddrIgnoreText).c_str(), 16, -0.5, 15.5);
0156 muColl1hwQual->setAxisTitle("Hardware quality", 1);
0157 muColl1link = ibooker.book1D(
0158 "muLinkColl1", (muonColl1Title + " mismatching muon link" + trkAddrIgnoreText).c_str(), 36, 35.5, 71.5);
0159 muColl1link->setAxisTitle("Link", 1);
0160 muColl1processor = ibooker.book1D(
0161 "muProcessorColl1", (muonColl1Title + " mismatching muon processor" + trkAddrIgnoreText).c_str(), 12, -0.5, 11.5);
0162 muColl1processor->setAxisTitle("Processor", 1);
0163 muColl1trackFinderType =
0164 ibooker.book1D("muTrackFinderTypeColl1",
0165 (muonColl1Title + " mismatching muon track finder type" + trkAddrIgnoreText).c_str(),
0166 5,
0167 -0.5,
0168 4.5);
0169 muColl1trackFinderType->setAxisTitle("Track finder type", 1);
0170 muColl1trackFinderType->setBinLabel(BMTFBIN, "BMTF", 1);
0171 muColl1trackFinderType->setBinLabel(OMTFNEGBIN, "OMTF-", 1);
0172 muColl1trackFinderType->setBinLabel(OMTFPOSBIN, "OMTF+", 1);
0173 muColl1trackFinderType->setBinLabel(EMTFNEGBIN, "EMTF-", 1);
0174 muColl1trackFinderType->setBinLabel(EMTFPOSBIN, "EMTF+", 1);
0175 muColl1hwHF = ibooker.book1D(
0176 "muHwHFColl1", (muonColl1Title + " mismatching muon halo/fine-eta bit" + trkAddrIgnoreText).c_str(), 2, -0.5, 1.5);
0177 muColl1hwHF->setAxisTitle("Hardware H/F bit", 1);
0178 muColl1TrkAddrSize =
0179 ibooker.book1D("muTrkAddrSizeColl1",
0180 (muonColl1Title + " mismatching muon number of track address keys" + trkAddrIgnoreText).c_str(),
0181 11,
0182 -0.5,
0183 10.5);
0184 muColl1TrkAddrSize->setAxisTitle("number of keys", 1);
0185 muColl1TrkAddr = ibooker.book2D("muTrkAddrColl1",
0186 (muonColl1Title + " mismatching muon track address" + trkAddrIgnoreText).c_str(),
0187 10,
0188 -0.5,
0189 9.5,
0190 16,
0191 -0.5,
0192 15.5);
0193 muColl1TrkAddr->setAxisTitle("key", 1);
0194 muColl1TrkAddr->setAxisTitle("value", 2);
0195 if (hasDisplacementInfo) {
0196 muColl1hwDXY = ibooker.book1D("muhwDXYColl1", (muonColl1Title + " HW DXY" + trkAddrIgnoreText).c_str(), 4, 0, 4);
0197 muColl1hwDXY->setAxisTitle("Hardware DXY", 1);
0198 muColl1hwPtUnconstrained = ibooker.book1D("muhwPtUnconstrainedColl1",
0199 (muonColl1Title + "HW p_{T} unconstrained" + trkAddrIgnoreText).c_str(),
0200 512,
0201 -0.5,
0202 511.5);
0203 muColl1hwPtUnconstrained->setAxisTitle("Hardware P_{T} unconstrained", 1);
0204 }
0205
0206 muColl2BxRange = ibooker.book1D("muBxRangeColl2", (muonColl2Title + " mismatching BX range").c_str(), 11, -5.5, 5.5);
0207 muColl2BxRange->setAxisTitle("BX range", 1);
0208 muColl2nMu = ibooker.book1D("nMuColl2", (muonColl2Title + " mismatching muon multiplicity").c_str(), 37, -0.5, 36.5);
0209 muColl2nMu->setAxisTitle("Muon multiplicity", 1);
0210 muColl2hwPt = ibooker.book1D(
0211 "muHwPtColl2", (muonColl2Title + " mismatching muon p_{T}" + trkAddrIgnoreText).c_str(), 512, -0.5, 511.5);
0212 muColl2hwPt->setAxisTitle("Hardware p_{T}", 1);
0213 muColl2hwEta = ibooker.book1D(
0214 "muHwEtaColl2", (muonColl2Title + " mismatching muon #eta" + trkAddrIgnoreText).c_str(), 512, -256.5, 255.5);
0215 muColl2hwEta->setAxisTitle("Hardware #eta", 1);
0216 muColl2hwPhi = ibooker.book1D(
0217 "muHwPhiColl2", (muonColl2Title + " mismatching muon #phi" + trkAddrIgnoreText).c_str(), 256, -128.5, 127.5);
0218 muColl2hwPhi->setAxisTitle("Hardware #phi", 1);
0219 muColl2hwSign = ibooker.book1D(
0220 "muHwSignColl2", (muonColl2Title + " mismatching muon sign" + trkAddrIgnoreText).c_str(), 2, -0.5, 1.5);
0221 muColl2hwSign->setAxisTitle("Hardware sign", 1);
0222 muColl2hwSignValid = ibooker.book1D(
0223 "muHwSignValidColl2", (muonColl2Title + " mismatching muon sign valid" + trkAddrIgnoreText).c_str(), 2, -0.5, 1.5);
0224 muColl2hwSignValid->setAxisTitle("Hardware sign valid", 1);
0225 muColl2hwQual = ibooker.book1D(
0226 "muHwQualColl2", (muonColl2Title + " mismatching muon quality" + trkAddrIgnoreText).c_str(), 16, -0.5, 15.5);
0227 muColl2hwQual->setAxisTitle("Hardware quality", 1);
0228 muColl2link = ibooker.book1D(
0229 "muLinkColl2", (muonColl2Title + " mismatching muon link" + trkAddrIgnoreText).c_str(), 36, 35.5, 71.5);
0230 muColl2link->setAxisTitle("Link", 1);
0231 muColl2processor = ibooker.book1D(
0232 "muProcessorColl2", (muonColl2Title + " mismatching muon processor" + trkAddrIgnoreText).c_str(), 12, -0.5, 11.5);
0233 muColl2processor->setAxisTitle("Processor", 1);
0234 muColl2trackFinderType =
0235 ibooker.book1D("muTrackFinderTypeColl2",
0236 (muonColl2Title + " mismatching muon track finder type" + trkAddrIgnoreText).c_str(),
0237 5,
0238 -0.5,
0239 4.5);
0240 muColl2trackFinderType->setAxisTitle("Track finder type", 1);
0241 muColl2trackFinderType->setBinLabel(BMTFBIN, "BMTF", 1);
0242 muColl2trackFinderType->setBinLabel(OMTFNEGBIN, "OMTF-", 1);
0243 muColl2trackFinderType->setBinLabel(OMTFPOSBIN, "OMTF+", 1);
0244 muColl2trackFinderType->setBinLabel(EMTFNEGBIN, "EMTF-", 1);
0245 muColl2trackFinderType->setBinLabel(EMTFPOSBIN, "EMTF+", 1);
0246 muColl2hwHF = ibooker.book1D(
0247 "muHwHFColl2", (muonColl2Title + " mismatching muon halo/fine-eta bit" + trkAddrIgnoreText).c_str(), 2, -0.5, 1.5);
0248 muColl2hwHF->setAxisTitle("Hardware H/F bit", 1);
0249 muColl2TrkAddrSize =
0250 ibooker.book1D("muTrkAddrSizeColl2",
0251 (muonColl2Title + " mismatching muon number of track address keys" + trkAddrIgnoreText).c_str(),
0252 11,
0253 -0.5,
0254 10.5);
0255 muColl2TrkAddrSize->setAxisTitle("number of keys", 1);
0256 muColl2TrkAddr = ibooker.book2D("muTrkAddrColl2",
0257 (muonColl2Title + " mismatching muon track address" + trkAddrIgnoreText).c_str(),
0258 10,
0259 -0.5,
0260 9.5,
0261 16,
0262 -0.5,
0263 15.5);
0264 muColl2TrkAddr->setAxisTitle("key", 1);
0265 muColl2TrkAddr->setAxisTitle("value", 2);
0266 if (hasDisplacementInfo) {
0267 muColl2hwDXY = ibooker.book1D("muhwDXYColl2", (muonColl2Title + " HW DXY" + trkAddrIgnoreText).c_str(), 4, 0, 4);
0268 muColl2hwDXY->setAxisTitle("Hardware DXY", 1);
0269 muColl2hwPtUnconstrained = ibooker.book1D("muhwPtUnconstrainedColl2",
0270 (muonColl2Title + "HW p_{T} unconstrained" + trkAddrIgnoreText).c_str(),
0271 512,
0272 -0.5,
0273 511.5);
0274 muColl2hwPtUnconstrained->setAxisTitle("Hardware P_{T} unconstrained", 1);
0275 }
0276 }
0277
0278 void L1TStage2RegionalMuonCandComp::analyze(const edm::Event& e, const edm::EventSetup& c) {
0279 if (verbose)
0280 edm::LogInfo("L1TStage2RegionalMuonCandComp") << "L1TStage2RegionalMuonCandComp: analyze..." << std::endl;
0281
0282 edm::Handle<l1t::RegionalMuonCandBxCollection> muonBxColl1;
0283 edm::Handle<l1t::RegionalMuonCandBxCollection> muonBxColl2;
0284 e.getByToken(muonToken1, muonBxColl1);
0285 e.getByToken(muonToken2, muonBxColl2);
0286
0287 errorSummaryDen->Fill(RBXRANGE);
0288 int bxRange1 = muonBxColl1->getLastBX() - muonBxColl1->getFirstBX() + 1;
0289 int bxRange2 = muonBxColl2->getLastBX() - muonBxColl2->getFirstBX() + 1;
0290 if (bxRange1 != bxRange2) {
0291 summary->Fill(BXRANGEBAD);
0292 if (incBin[RBXRANGE])
0293 errorSummaryNum->Fill(RBXRANGE);
0294 int bx;
0295 for (bx = muonBxColl1->getFirstBX(); bx <= muonBxColl1->getLastBX(); ++bx) {
0296 muColl1BxRange->Fill(bx);
0297 }
0298 for (bx = muonBxColl2->getFirstBX(); bx <= muonBxColl2->getLastBX(); ++bx) {
0299 muColl2BxRange->Fill(bx);
0300 }
0301 } else {
0302 summary->Fill(BXRANGEGOOD);
0303 }
0304
0305 for (int iBx = muonBxColl1->getFirstBX(); iBx <= muonBxColl1->getLastBX(); ++iBx) {
0306
0307 if (iBx < muonBxColl2->getFirstBX() || iBx > muonBxColl2->getLastBX())
0308 continue;
0309
0310 l1t::RegionalMuonCandBxCollection::const_iterator muonIt1;
0311 l1t::RegionalMuonCandBxCollection::const_iterator muonIt2;
0312
0313 errorSummaryDen->Fill(RNMUON);
0314
0315 if (muonBxColl1->size(iBx) != muonBxColl2->size(iBx)) {
0316 summary->Fill(NMUONBAD);
0317 if (incBin[RNMUON])
0318 errorSummaryNum->Fill(RNMUON);
0319 muColl1nMu->Fill(muonBxColl1->size(iBx));
0320 muColl2nMu->Fill(muonBxColl2->size(iBx));
0321
0322 if (muonBxColl1->size(iBx) > muonBxColl2->size(iBx)) {
0323 muonIt1 = muonBxColl1->begin(iBx) + muonBxColl2->size(iBx);
0324 const std::map<int, int> muon1TrackAddr = muonIt1->trackAddress();
0325 for (; muonIt1 != muonBxColl1->end(iBx); ++muonIt1) {
0326 muColl1hwPt->Fill(muonIt1->hwPt());
0327 muColl1hwEta->Fill(muonIt1->hwEta());
0328 muColl1hwPhi->Fill(muonIt1->hwPhi());
0329 muColl1hwSign->Fill(muonIt1->hwSign());
0330 muColl1hwSignValid->Fill(muonIt1->hwSignValid());
0331 muColl1hwQual->Fill(muonIt1->hwQual());
0332 muColl1link->Fill(muonIt1->link());
0333 muColl1processor->Fill(muonIt1->processor());
0334 muColl1trackFinderType->Fill(muonIt1->trackFinderType());
0335 muColl1hwHF->Fill(muonIt1->hwHF());
0336 muColl1TrkAddrSize->Fill(muon1TrackAddr.size());
0337 if (hasDisplacementInfo) {
0338 muColl1hwDXY->Fill(muonIt1->hwDXY());
0339 muColl1hwPtUnconstrained->Fill(muonIt1->hwPtUnconstrained());
0340 }
0341 for (std::map<int, int>::const_iterator trIt1 = muon1TrackAddr.begin(); trIt1 != muon1TrackAddr.end();
0342 ++trIt1) {
0343 muColl1TrkAddr->Fill(trIt1->first, trIt1->second);
0344 }
0345 }
0346 } else {
0347 muonIt2 = muonBxColl2->begin(iBx) + muonBxColl1->size(iBx);
0348 const std::map<int, int> muon2TrackAddr = muonIt2->trackAddress();
0349 for (; muonIt2 != muonBxColl2->end(iBx); ++muonIt2) {
0350 muColl2hwPt->Fill(muonIt2->hwPt());
0351 muColl2hwEta->Fill(muonIt2->hwEta());
0352 muColl2hwPhi->Fill(muonIt2->hwPhi());
0353 muColl2hwSign->Fill(muonIt2->hwSign());
0354 muColl2hwSignValid->Fill(muonIt2->hwSignValid());
0355 muColl2hwQual->Fill(muonIt2->hwQual());
0356 muColl2link->Fill(muonIt2->link());
0357 muColl2processor->Fill(muonIt2->processor());
0358 muColl2trackFinderType->Fill(muonIt2->trackFinderType());
0359 muColl2hwHF->Fill(muonIt2->hwHF());
0360 muColl2TrkAddrSize->Fill(muon2TrackAddr.size());
0361 if (hasDisplacementInfo) {
0362 muColl2hwDXY->Fill(muonIt2->hwDXY());
0363 muColl2hwPtUnconstrained->Fill(muonIt2->hwPtUnconstrained());
0364 }
0365 for (std::map<int, int>::const_iterator trIt2 = muon2TrackAddr.begin(); trIt2 != muon2TrackAddr.end();
0366 ++trIt2) {
0367 muColl2TrkAddr->Fill(trIt2->first, trIt2->second);
0368 }
0369 }
0370 }
0371 } else {
0372 summary->Fill(NMUONGOOD);
0373 }
0374
0375 muonIt1 = muonBxColl1->begin(iBx);
0376 muonIt2 = muonBxColl2->begin(iBx);
0377 while (muonIt1 != muonBxColl1->end(iBx) && muonIt2 != muonBxColl2->end(iBx)) {
0378 summary->Fill(MUONALL);
0379 for (int i = RMUON; i <= errorSummaryDen->getNbinsX(); ++i) {
0380 errorSummaryDen->Fill(i);
0381 }
0382
0383 bool muonMismatch = false;
0384 bool muonSelMismatch = false;
0385 if (muonIt1->hwPt() != muonIt2->hwPt()) {
0386 muonMismatch = true;
0387 summary->Fill(PTBAD);
0388 if (incBin[RPT]) {
0389 muonSelMismatch = true;
0390 errorSummaryNum->Fill(RPT);
0391 }
0392 }
0393 if (muonIt1->hwEta() != muonIt2->hwEta()) {
0394 muonMismatch = true;
0395 summary->Fill(ETABAD);
0396 if (incBin[RETA]) {
0397 muonSelMismatch = true;
0398 errorSummaryNum->Fill(RETA);
0399 }
0400 }
0401 if (muonIt1->hwPhi() != muonIt2->hwPhi()) {
0402 muonMismatch = true;
0403 summary->Fill(LOCALPHIBAD);
0404 if (incBin[RLOCALPHI]) {
0405 muonSelMismatch = true;
0406 errorSummaryNum->Fill(RLOCALPHI);
0407 }
0408 }
0409 if (muonIt1->hwSign() != muonIt2->hwSign()) {
0410 muonMismatch = true;
0411 summary->Fill(SIGNBAD);
0412 if (incBin[RSIGN]) {
0413 muonSelMismatch = true;
0414 errorSummaryNum->Fill(RSIGN);
0415 }
0416 }
0417 if (muonIt1->hwSignValid() != muonIt2->hwSignValid()) {
0418 muonMismatch = true;
0419 summary->Fill(SIGNVALBAD);
0420 if (incBin[RSIGNVAL]) {
0421 muonSelMismatch = true;
0422 errorSummaryNum->Fill(RSIGNVAL);
0423 }
0424 }
0425 if (muonIt1->hwQual() != muonIt2->hwQual()) {
0426 muonMismatch = true;
0427 summary->Fill(QUALBAD);
0428 if (incBin[RQUAL]) {
0429 muonSelMismatch = true;
0430 errorSummaryNum->Fill(RQUAL);
0431 }
0432 }
0433 if (muonIt1->hwHF() != muonIt2->hwHF()) {
0434 muonMismatch = true;
0435 summary->Fill(HFBAD);
0436 if (incBin[RHF]) {
0437 muonSelMismatch = true;
0438 errorSummaryNum->Fill(RHF);
0439 }
0440 }
0441 if (muonIt1->link() != muonIt2->link()) {
0442 muonMismatch = true;
0443 summary->Fill(LINKBAD);
0444 if (incBin[RLINK]) {
0445 muonSelMismatch = true;
0446 errorSummaryNum->Fill(RLINK);
0447 }
0448 }
0449 if (muonIt1->processor() != muonIt2->processor()) {
0450 muonMismatch = true;
0451 summary->Fill(PROCBAD);
0452 if (incBin[RPROC]) {
0453 muonSelMismatch = true;
0454 errorSummaryNum->Fill(RPROC);
0455 }
0456 }
0457 if (muonIt1->trackFinderType() != muonIt2->trackFinderType()) {
0458 muonMismatch = true;
0459 summary->Fill(TFBAD);
0460 if (incBin[RTF]) {
0461 muonSelMismatch = true;
0462 errorSummaryNum->Fill(RTF);
0463 }
0464 }
0465
0466 const std::map<int, int> muon1TrackAddr = muonIt1->trackAddress();
0467 std::map<int, int> muon2TrackAddr = muonIt2->trackAddress();
0468 bool badTrackAddr = false;
0469 if (muon1TrackAddr.size() == muon2TrackAddr.size()) {
0470 for (std::map<int, int>::const_iterator trIt1 = muon1TrackAddr.begin(); trIt1 != muon1TrackAddr.end();
0471 ++trIt1) {
0472 if (muon2TrackAddr.find(trIt1->first) == muon2TrackAddr.end()) {
0473 badTrackAddr = true;
0474 break;
0475 } else if (muon2TrackAddr[trIt1->first] != trIt1->second) {
0476 badTrackAddr = true;
0477 break;
0478 }
0479 }
0480 } else {
0481 badTrackAddr = true;
0482 }
0483 if (badTrackAddr) {
0484 if (!ignoreBadTrkAddr) {
0485 muonMismatch = true;
0486 if (incBin[RTRACKADDR])
0487 muonSelMismatch = true;
0488 }
0489 summary->Fill(TRACKADDRBAD);
0490 if (incBin[RTRACKADDR])
0491 errorSummaryNum->Fill(RTRACKADDR);
0492 }
0493
0494 if (hasDisplacementInfo) {
0495 if (muonIt1->hwDXY() != muonIt2->hwDXY()) {
0496 muonMismatch = true;
0497 summary->Fill(DXYBAD);
0498 if (incBin[RDXY]) {
0499 muonSelMismatch = true;
0500 errorSummaryNum->Fill(RDXY);
0501 }
0502 }
0503 if (muonIt1->hwPtUnconstrained() != muonIt2->hwPtUnconstrained()) {
0504 muonMismatch = true;
0505 summary->Fill(PT2BAD);
0506 if (incBin[RPT2]) {
0507 muonSelMismatch = true;
0508 errorSummaryNum->Fill(RPT2);
0509 }
0510 }
0511 }
0512
0513 if (incBin[RMUON] && muonSelMismatch) {
0514 errorSummaryNum->Fill(RMUON);
0515 }
0516
0517 if (muonMismatch) {
0518 muColl1hwPt->Fill(muonIt1->hwPt());
0519 muColl1hwEta->Fill(muonIt1->hwEta());
0520 muColl1hwPhi->Fill(muonIt1->hwPhi());
0521 muColl1hwSign->Fill(muonIt1->hwSign());
0522 muColl1hwSignValid->Fill(muonIt1->hwSignValid());
0523 muColl1hwQual->Fill(muonIt1->hwQual());
0524 muColl1link->Fill(muonIt1->link());
0525 muColl1processor->Fill(muonIt1->processor());
0526 muColl1trackFinderType->Fill(muonIt1->trackFinderType());
0527 muColl1hwHF->Fill(muonIt1->hwHF());
0528 muColl1TrkAddrSize->Fill(muon1TrackAddr.size());
0529 if (hasDisplacementInfo) {
0530 muColl1hwDXY->Fill(muonIt1->hwDXY());
0531 muColl1hwPtUnconstrained->Fill(muonIt1->hwPtUnconstrained());
0532 }
0533 for (std::map<int, int>::const_iterator trIt1 = muon1TrackAddr.begin(); trIt1 != muon1TrackAddr.end();
0534 ++trIt1) {
0535 muColl1TrkAddr->Fill(trIt1->first, trIt1->second);
0536 }
0537
0538 muColl2hwPt->Fill(muonIt2->hwPt());
0539 muColl2hwEta->Fill(muonIt2->hwEta());
0540 muColl2hwPhi->Fill(muonIt2->hwPhi());
0541 muColl2hwSign->Fill(muonIt2->hwSign());
0542 muColl2hwSignValid->Fill(muonIt2->hwSignValid());
0543 muColl2hwQual->Fill(muonIt2->hwQual());
0544 muColl2link->Fill(muonIt2->link());
0545 muColl2processor->Fill(muonIt2->processor());
0546 muColl2trackFinderType->Fill(muonIt2->trackFinderType());
0547 muColl2hwHF->Fill(muonIt2->hwHF());
0548 muColl2TrkAddrSize->Fill(muon2TrackAddr.size());
0549 if (hasDisplacementInfo) {
0550 muColl2hwDXY->Fill(muonIt2->hwDXY());
0551 muColl2hwPtUnconstrained->Fill(muonIt2->hwPtUnconstrained());
0552 }
0553 for (std::map<int, int>::const_iterator trIt2 = muon2TrackAddr.begin(); trIt2 != muon2TrackAddr.end();
0554 ++trIt2) {
0555 muColl2TrkAddr->Fill(trIt2->first, trIt2->second);
0556 }
0557 } else {
0558 summary->Fill(MUONGOOD);
0559 }
0560
0561 ++muonIt1;
0562 ++muonIt2;
0563 }
0564 }
0565 }