Skip to content

Commit 773ed53

Browse files
authored
Merge pull request cms-sw#34073 from dildick/from-CMSSW_12_0_X_2021-06-09-2300-Remove-duplicate-CLCTs-LCTs
Remove duplicate CLCTs and LCTs from trigger path in L1T CSC DQM
2 parents 79fda4b + 5286f3a commit 773ed53

File tree

4 files changed

+132
-35
lines changed

4 files changed

+132
-35
lines changed

DQM/L1TMonitor/interface/L1TdeCSCTPG.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ class L1TdeCSCTPG : public DQMEDAnalyzer {
2222
void analyze(const edm::Event&, const edm::EventSetup&) override;
2323

2424
private:
25+
// CLCTs and LCTs are considered duplicates if there is an earlier copy
26+
bool isDuplicateCLCT(const CSCCLCTDigi& clct, const std::vector<CSCCLCTDigi>& container) const;
27+
bool isDuplicateLCT(const CSCCorrelatedLCTDigi& lct, const std::vector<CSCCorrelatedLCTDigi>& container) const;
28+
29+
// all properties are the same, except for the BX which is off by +1
30+
bool isCLCTOffByOneBX(const CSCCLCTDigi& lhs, const CSCCLCTDigi& rhs) const;
31+
bool isLCTOffByOneBX(const CSCCorrelatedLCTDigi& lhs, const CSCCorrelatedLCTDigi& rhs) const;
32+
2533
edm::EDGetTokenT<CSCALCTDigiCollection> dataALCT_token_;
2634
edm::EDGetTokenT<CSCALCTDigiCollection> emulALCT_token_;
2735
edm::EDGetTokenT<CSCCLCTDigiCollection> dataCLCT_token_;

DQM/L1TMonitor/src/L1TdeCSCTPG.cc

Lines changed: 96 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,31 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) {
169169
// ignore non-ME1/1 chambers when using B904 test-stand data
170170
if (B904Setup_ and !((*it).first).isME11())
171171
continue;
172+
173+
// remove the duplicate CLCTs
174+
// these are CLCTs that have the same properties as CLCTs found
175+
// before by the emulator, except for the BX, which is off by +1
176+
std::vector<CSCCLCTDigi> cleanedemul;
172177
for (auto clct = range.first; clct != range.second; clct++) {
173-
if (clct->isValid()) {
174-
chamberHistos[type]["clct_pattern_emul"]->Fill(clct->getPattern());
175-
chamberHistos[type]["clct_quality_emul"]->Fill(clct->getQuality());
176-
chamberHistos[type]["clct_halfstrip_emul"]->Fill(clct->getKeyStrip());
177-
chamberHistos[type]["clct_bend_emul"]->Fill(clct->getBend());
178+
if (not isDuplicateCLCT(*clct, cleanedemul))
179+
cleanedemul.push_back(*clct);
180+
}
181+
182+
for (const auto& clct : cleanedemul) {
183+
if (clct.isValid()) {
184+
chamberHistos[type]["clct_pattern_emul"]->Fill(clct.getPattern());
185+
chamberHistos[type]["clct_quality_emul"]->Fill(clct.getQuality());
186+
chamberHistos[type]["clct_halfstrip_emul"]->Fill(clct.getKeyStrip());
187+
chamberHistos[type]["clct_bend_emul"]->Fill(clct.getBend());
178188
if (isRun3_) {
179-
chamberHistos[type]["clct_run3pattern_emul"]->Fill(clct->getRun3Pattern());
180-
chamberHistos[type]["clct_quartstrip_emul"]->Fill(clct->getKeyStrip(4));
181-
chamberHistos[type]["clct_eighthstrip_emul"]->Fill(clct->getKeyStrip(8));
182-
chamberHistos[type]["clct_slope_emul"]->Fill(clct->getSlope());
183-
chamberHistos[type]["clct_compcode_emul"]->Fill(clct->getCompCode());
189+
chamberHistos[type]["clct_run3pattern_emul"]->Fill(clct.getRun3Pattern());
190+
chamberHistos[type]["clct_quartstrip_emul"]->Fill(clct.getKeyStrip(4));
191+
chamberHistos[type]["clct_eighthstrip_emul"]->Fill(clct.getKeyStrip(8));
192+
chamberHistos[type]["clct_slope_emul"]->Fill(clct.getSlope());
193+
chamberHistos[type]["clct_compcode_emul"]->Fill(clct.getCompCode());
184194
if (B904Setup_) {
185-
chamberHistos[type]["clct_quartstripbit_emul"]->Fill(clct->getQuartStripBit());
186-
chamberHistos[type]["clct_eighthstripbit_emul"]->Fill(clct->getEighthStripBit());
195+
chamberHistos[type]["clct_quartstripbit_emul"]->Fill(clct.getQuartStripBit());
196+
chamberHistos[type]["clct_eighthstripbit_emul"]->Fill(clct.getEighthStripBit());
187197
}
188198
}
189199
}
@@ -223,24 +233,86 @@ void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) {
223233
// ignore non-ME1/1 chambers when using B904 test-stand data
224234
if (B904Setup_ and !((*it).first).isME11())
225235
continue;
236+
237+
// remove the duplicate LCTs
238+
// these are LCTs that have the same properties as LCTs found
239+
// before by the emulator, except for the BX, which is off by +1
240+
std::vector<CSCCorrelatedLCTDigi> cleanedemul;
226241
for (auto lct = range.first; lct != range.second; lct++) {
227-
if (lct->isValid()) {
228-
chamberHistos[type]["lct_pattern_emul"]->Fill(lct->getPattern());
229-
chamberHistos[type]["lct_quality_emul"]->Fill(lct->getQuality());
230-
chamberHistos[type]["lct_wiregroup_emul"]->Fill(lct->getKeyWG());
231-
chamberHistos[type]["lct_halfstrip_emul"]->Fill(lct->getStrip());
232-
chamberHistos[type]["lct_bend_emul"]->Fill(lct->getBend());
242+
if (not isDuplicateLCT(*lct, cleanedemul))
243+
cleanedemul.push_back(*lct);
244+
}
245+
246+
for (const auto& lct : cleanedemul) {
247+
if (lct.isValid()) {
248+
chamberHistos[type]["lct_pattern_emul"]->Fill(lct.getPattern());
249+
chamberHistos[type]["lct_quality_emul"]->Fill(lct.getQuality());
250+
chamberHistos[type]["lct_wiregroup_emul"]->Fill(lct.getKeyWG());
251+
chamberHistos[type]["lct_halfstrip_emul"]->Fill(lct.getStrip());
252+
chamberHistos[type]["lct_bend_emul"]->Fill(lct.getBend());
233253
if (isRun3_) {
234-
chamberHistos[type]["lct_run3pattern_emul"]->Fill(lct->getRun3Pattern());
235-
chamberHistos[type]["lct_slope_emul"]->Fill(lct->getSlope());
236-
chamberHistos[type]["lct_quartstrip_emul"]->Fill(lct->getStrip(4));
237-
chamberHistos[type]["lct_eighthstrip_emul"]->Fill(lct->getStrip(8));
254+
chamberHistos[type]["lct_run3pattern_emul"]->Fill(lct.getRun3Pattern());
255+
chamberHistos[type]["lct_slope_emul"]->Fill(lct.getSlope());
256+
chamberHistos[type]["lct_quartstrip_emul"]->Fill(lct.getStrip(4));
257+
chamberHistos[type]["lct_eighthstrip_emul"]->Fill(lct.getStrip(8));
238258
if (B904Setup_) {
239-
chamberHistos[type]["lct_quartstripbit_emul"]->Fill(lct->getQuartStripBit());
240-
chamberHistos[type]["lct_eighthstripbit_emul"]->Fill(lct->getEighthStripBit());
259+
chamberHistos[type]["lct_quartstripbit_emul"]->Fill(lct.getQuartStripBit());
260+
chamberHistos[type]["lct_eighthstripbit_emul"]->Fill(lct.getEighthStripBit());
241261
}
242262
}
243263
}
244264
}
245265
}
246266
}
267+
268+
bool L1TdeCSCTPG::isDuplicateCLCT(const CSCCLCTDigi& clct, const std::vector<CSCCLCTDigi>& container) const {
269+
// if the temporary container is empty, the TP cannot be a duplicate
270+
if (container.empty())
271+
return false;
272+
else {
273+
for (const auto& rhs : container) {
274+
if (isCLCTOffByOneBX(clct, rhs))
275+
return true;
276+
}
277+
return false;
278+
}
279+
}
280+
281+
bool L1TdeCSCTPG::isDuplicateLCT(const CSCCorrelatedLCTDigi& lct,
282+
const std::vector<CSCCorrelatedLCTDigi>& container) const {
283+
// if the temporary container is empty, the TP cannot be a duplicate
284+
if (container.empty())
285+
return false;
286+
else {
287+
for (const auto& rhs : container) {
288+
if (isLCTOffByOneBX(lct, rhs))
289+
return true;
290+
}
291+
return false;
292+
}
293+
}
294+
295+
bool L1TdeCSCTPG::isCLCTOffByOneBX(const CSCCLCTDigi& lhs, const CSCCLCTDigi& rhs) const {
296+
// because the comparator code is degenerate (several comparator codes can produce the
297+
// same slope and position), we leave it out of the comparison
298+
bool returnValue = false;
299+
if (lhs.isValid() == rhs.isValid() && lhs.getQuality() == rhs.getQuality() && lhs.getPattern() == rhs.getPattern() &&
300+
lhs.getRun3Pattern() == rhs.getRun3Pattern() && lhs.getKeyStrip() == rhs.getKeyStrip() &&
301+
lhs.getStripType() == rhs.getStripType() && lhs.getBend() == rhs.getBend() && lhs.getBX() == rhs.getBX() + 1 &&
302+
lhs.getQuartStripBit() == rhs.getQuartStripBit() && lhs.getEighthStripBit() == rhs.getEighthStripBit()) {
303+
returnValue = true;
304+
}
305+
return returnValue;
306+
}
307+
308+
bool L1TdeCSCTPG::isLCTOffByOneBX(const CSCCorrelatedLCTDigi& lhs, const CSCCorrelatedLCTDigi& rhs) const {
309+
bool returnValue = false;
310+
if (lhs.isValid() == rhs.isValid() && lhs.getQuality() == rhs.getQuality() && lhs.getPattern() == rhs.getPattern() &&
311+
lhs.getRun3Pattern() == rhs.getRun3Pattern() && lhs.getStrip() == rhs.getStrip() &&
312+
lhs.getStripType() == rhs.getStripType() && lhs.getBend() == rhs.getBend() && lhs.getBX() == rhs.getBX() + 1 &&
313+
lhs.getQuartStripBit() == rhs.getQuartStripBit() && lhs.getEighthStripBit() == rhs.getEighthStripBit() &&
314+
lhs.getKeyWG() == rhs.getKeyWG()) {
315+
returnValue = true;
316+
}
317+
return returnValue;
318+
}

DataFormats/CSCDigi/src/CSCCLCTDigi.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,17 @@ void CSCCLCTDigi::print() const {
206206
}
207207

208208
std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi) {
209-
return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality()
210-
<< " Pattern = " << digi.getPattern() << " StripType = " << digi.getStripType()
211-
<< " Bend = " << digi.getBend() << " Strip = " << digi.getStrip() << " KeyStrip = " << digi.getKeyStrip()
212-
<< " CFEB = " << digi.getCFEB() << " BX = " << digi.getBX() << " Comp Code " << digi.getCompCode();
209+
if (digi.isRun3())
210+
return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX()
211+
<< " Run-2 Pattern = " << digi.getPattern() << " Run-3 Pattern = " << digi.getRun3Pattern()
212+
<< " Quality = " << digi.getQuality() << " Comp Code " << digi.getCompCode()
213+
<< " Bend = " << digi.getBend() << "\n"
214+
<< " Slope = " << digi.getSlope() << " CFEB = " << digi.getCFEB() << " Strip = " << digi.getStrip()
215+
<< " KeyHalfStrip = " << digi.getKeyStrip() << " KeyQuartStrip = " << digi.getKeyStrip(4)
216+
<< " KeyEighthStrip = " << digi.getKeyStrip(8);
217+
else
218+
return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX()
219+
<< " Pattern = " << digi.getPattern() << " Quality = " << digi.getQuality() << " Bend = " << digi.getBend()
220+
<< " CFEB = " << digi.getCFEB() << " HalfStrip = " << digi.getStrip()
221+
<< " KeyHalfStrip = " << digi.getKeyStrip();
213222
}

DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,19 @@ void CSCCorrelatedLCTDigi::print() const {
153153
}
154154

155155
std::ostream& operator<<(std::ostream& o, const CSCCorrelatedLCTDigi& digi) {
156-
return o << "CSC LCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality()
157-
<< " MPC Link = " << digi.getMPCLink() << " cscID = " << digi.getCSCID()
158-
<< " syncErr = " << digi.getSyncErr() << " Type (SIM) = " << digi.getType() << "\n"
159-
<< " cathode info: Strip = " << digi.getStrip() << " Pattern = " << digi.getPattern()
160-
<< " Bend = " << ((digi.getBend() == 0) ? 'L' : 'R') << "\n"
161-
<< " anode info: Key wire = " << digi.getKeyWG() << " BX = " << digi.getBX()
162-
<< " bx0 = " << digi.getBX0();
156+
// do not print out CSCID and sync error. They are not used anyway in the firmware, or the emulation
157+
if (digi.isRun3())
158+
return o << "CSC LCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX()
159+
<< " Run-2 Pattern = " << digi.getPattern() << " Run-3 Pattern = " << digi.getRun3Pattern()
160+
<< " Quality = " << digi.getQuality() << " Bend = " << digi.getBend() << " Slope = " << digi.getSlope()
161+
<< "\n"
162+
<< " KeyHalfStrip = " << digi.getStrip() << " KeyQuartStrip = " << digi.getStrip(4)
163+
<< " KeyEighthStrip = " << digi.getStrip(8) << " KeyWireGroup = " << digi.getKeyWG()
164+
<< " Type (SIM) = " << digi.getType() << " MPC Link = " << digi.getMPCLink();
165+
else
166+
return o << "CSC LCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX()
167+
<< " Pattern = " << digi.getPattern() << " Quality = " << digi.getQuality() << " Bend = " << digi.getBend()
168+
<< "\n"
169+
<< " KeyHalfStrip = " << digi.getStrip() << " KeyWireGroup = " << digi.getKeyWG()
170+
<< " Type (SIM) = " << digi.getType() << " MPC Link = " << digi.getMPCLink();
163171
}

0 commit comments

Comments
 (0)