Skip to content

Commit

Permalink
Fix bug that prevented us from alerting on displaced quantity mismatc…
Browse files Browse the repository at this point in the history
…hes at uGMT output

Also small refactor to avoid a similar bug in the RegionalMuonCand DQM.
  • Loading branch information
dinyar committed Mar 12, 2021
1 parent d194d54 commit 24d6ff9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 30 deletions.
4 changes: 4 additions & 0 deletions DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h
Expand Up @@ -63,6 +63,10 @@ class L1TStage2RegionalMuonCandComp : public DQMEDAnalyzer {
RPT2
};
enum tfs { BMTFBIN = 1, OMTFNEGBIN, OMTFPOSBIN, EMTFNEGBIN, EMTFPOSBIN };
int numSummaryBins_{
TRACKADDRBAD}; // In Run-2 we didn't have the last two bins. This is incremented in source file if we configure for Run-3.
int numErrBins_{
RTRACKADDR}; // In Run-2 we didn't have the last two bins. This is incremented in source file if we configure for Run-3.
bool incBin[RPT2 + 1];

edm::EDGetTokenT<l1t::RegionalMuonCandBxCollection> muonToken1;
Expand Down
8 changes: 4 additions & 4 deletions DQM/L1TMonitor/src/L1TStage2MuonComp.cc
Expand Up @@ -12,8 +12,11 @@ L1TStage2MuonComp::L1TStage2MuonComp(const edm::ParameterSet& ps)
enable2DComp(
ps.getUntrackedParameter<bool>("enable2DComp")), // When true eta-phi comparison plots are also produced
displacedQuantities_(ps.getUntrackedParameter<bool>("displacedQuantities")) {
if (displacedQuantities_) {
numErrBins_ += 2;
}
// First include all bins
for (unsigned int i = 1; i <= RIDX; i++) {
for (int i = 1; i <= numErrBins_; i++) {
incBin[i] = true;
}
// Then check the list of bins to ignore
Expand Down Expand Up @@ -74,9 +77,6 @@ void L1TStage2MuonComp::bookHistograms(DQMStore::IBooker& ibooker, const edm::Ru
summary->setBinLabel(DXYBAD, "dXY mismatch", 1);
}

if (displacedQuantities_) {
numErrBins_ += 2;
}
errorSummaryNum = ibooker.book1D(
"errorSummaryNum", summaryTitle.c_str(), numErrBins_, 1, numErrBins_ + 1); // range to match bin numbering
errorSummaryNum->setBinLabel(RBXRANGE, "BX range mismatch", 1);
Expand Down
40 changes: 14 additions & 26 deletions DQM/L1TMonitor/src/L1TStage2RegionalMuonCandComp.cc
Expand Up @@ -13,8 +13,12 @@ L1TStage2RegionalMuonCandComp::L1TStage2RegionalMuonCandComp(const edm::Paramete
ignoreBin(ps.getUntrackedParameter<std::vector<int>>("ignoreBin")),
verbose(ps.getUntrackedParameter<bool>("verbose")),
hasDisplacementInfo(ps.getUntrackedParameter<bool>("hasDisplacementInfo")) {
if (hasDisplacementInfo) {
numErrBins_ += 2;
numSummaryBins_ += 2;
}
// First include all bins
for (unsigned int i = 1; i <= RPT2; i++) {
for (int i = 1; i <= numErrBins_; i++) {
incBin[i] = true;
}
// Then check the list of bins to ignore
Expand Down Expand Up @@ -53,16 +57,14 @@ void L1TStage2RegionalMuonCandComp::bookHistograms(DQMStore::IBooker& ibooker,
trkAddrIgnoreText = " (Bad track addresses ignored)";
}

int nbins = 17;
if (hasDisplacementInfo) {
nbins += 2;
}

// Subsystem Monitoring and Muon Output
ibooker.setCurrentFolder(monitorDir);

summary = ibooker.book1D(
"summary", (summaryTitle + trkAddrIgnoreText).c_str(), nbins, 1, nbins + 1); // range to match bin numbering
summary = ibooker.book1D("summary",
(summaryTitle + trkAddrIgnoreText).c_str(),
numSummaryBins_,
1,
numSummaryBins_ + 1); // range to match bin numbering
summary->setBinLabel(BXRANGEGOOD, "BX range match", 1);
summary->setBinLabel(BXRANGEBAD, "BX range mismatch", 1);
summary->setBinLabel(NMUONGOOD, "muon collection size match", 1);
Expand All @@ -85,16 +87,11 @@ void L1TStage2RegionalMuonCandComp::bookHistograms(DQMStore::IBooker& ibooker,
summary->setBinLabel(PT2BAD, "P_{T} unconstrained mismatch", 1);
}

int nbinsNum = 14;
if (hasDisplacementInfo) {
nbinsNum += 2;
}

errorSummaryNum = ibooker.book1D("errorSummaryNum",
(summaryTitle + trkAddrIgnoreText).c_str(),
nbinsNum,
numErrBins_,
1,
nbinsNum + 1); // range to match bin numbering
numErrBins_ + 1); // range to match bin numbering
errorSummaryNum->setBinLabel(RBXRANGE, "BX range mismatch", 1);
errorSummaryNum->setBinLabel(RNMUON, "muon collection size mismatch", 1);
errorSummaryNum->setBinLabel(RMUON, "mismatching muons", 1);
Expand Down Expand Up @@ -125,8 +122,8 @@ void L1TStage2RegionalMuonCandComp::bookHistograms(DQMStore::IBooker& ibooker,
// This needs to come after the calls to setBinLabel.
errorSummaryNum->getTH1F()->GetXaxis()->SetCanExtend(false);

errorSummaryDen =
ibooker.book1D("errorSummaryDen", "denominators", nbinsNum, 1, nbinsNum + 1); // range to match bin numbering
errorSummaryDen = ibooker.book1D(
"errorSummaryDen", "denominators", numErrBins_, 1, numErrBins_ + 1); // range to match bin numbering
errorSummaryDen->setBinLabel(RBXRANGE, "# events", 1);
errorSummaryDen->setBinLabel(RNMUON, "# muon collections", 1);
for (int i = RMUON; i <= errorSummaryDen->getNbinsX(); ++i) {
Expand Down Expand Up @@ -377,16 +374,7 @@ void L1TStage2RegionalMuonCandComp::analyze(const edm::Event& e, const edm::Even

muonIt1 = muonBxColl1->begin(iBx);
muonIt2 = muonBxColl2->begin(iBx);
//std::cout << "Analysing muons from BX " << iBx << std::endl;
while (muonIt1 != muonBxColl1->end(iBx) && muonIt2 != muonBxColl2->end(iBx)) {
//std::cout << "Coll 1 muon: hwPt=" << muonIt1->hwPt() << ", hwEta=" << muonIt1->hwEta() << ", hwPhi=" << muonIt1->hwPhi()
// << ", hwSign=" << muonIt1->hwSign() << ", hwSignValid=" << muonIt1->hwSignValid()
// << ", hwQual=" << muonIt1->hwQual() << ", link=" << muonIt1->link() << ", processor=" << muonIt1->processor()
// << ", trackFinderType=" << muonIt1->trackFinderType() << std::endl;
//std::cout << "Coll 2 muon: hwPt=" << muonIt2->hwPt() << ", hwEta=" << muonIt2->hwEta() << ", hwPhi=" << muonIt2->hwPhi()
// << ", hwSign=" << muonIt2->hwSign() << ", hwSignValid=" << muonIt2->hwSignValid()
// << ", hwQual=" << muonIt2->hwQual() << ", link=" << muonIt2->link() << ", processor=" << muonIt2->processor()
// << ", trackFinderType=" << muonIt2->trackFinderType() << std::endl;
summary->Fill(MUONALL);
for (int i = RMUON; i <= errorSummaryDen->getNbinsX(); ++i) {
errorSummaryDen->Fill(i);
Expand Down

0 comments on commit 24d6ff9

Please sign in to comment.