10 dropLowQualityCLCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs")),
11 dropLowQualityALCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs")),
12 buildLCTfromALCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM")),
13 buildLCTfromCLCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM")) {
15 edm::LogError(
"CSCGEMMotherboardME21|SetupError") <<
"+++ TMB constructed while isSLHC is not set! +++\n";
19 edm::LogError(
"CSCGEMMotherboardME21|SetupError") <<
"+++ TMB constructed while runME21ILT_ is not set! +++\n";
28 edm::LogError(
"CSCGEMMotherboardME21|SetupError") <<
"+++ TMB constructed while isSLHC is not set! +++\n";
32 edm::LogError(
"CSCGEMMotherboardME21|SetupError") <<
"+++ TMB constructed while runME21ILT_ is not set! +++\n";
43 run(wiredc, compdc, gemPads.get());
54 unsigned alctBits =
alctProc->getHighMultiplictyBits();
57 if (
gem_g !=
nullptr) {
59 edm::LogInfo(
"CSCGEMMotherboardME21|SetupInfo") <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
66 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
73 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
87 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL ALCTs from ME21 " << std::endl;
88 for (
const auto& alct :
alctV)
90 LogTrace(
"CSCGEMCMotherboardME21") << alct << std::endl;
92 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL CLCTs from ME21 " << std::endl;
93 for (
const auto& clct :
clctV)
95 LogTrace(
"CSCGEMCMotherboardME21") << clct << std::endl;
97 int used_clct_mask[20];
98 for (
int c = 0;
c < 20; ++
c)
99 used_clct_mask[
c] = 0;
106 const bool hasCoPads(!
coPads_.empty());
110 if (
alctProc->getBestALCT(bx_alct).isValid()) {
120 <<
"========================================================================" << std::endl
121 <<
"ALCT-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
" in bx range: [" << bx_clct_start <<
","
122 << bx_clct_stop <<
"] for bx " << bx_alct << std::endl
123 <<
"------------------------------------------------------------------------" << std::endl
124 <<
"+++ Best ALCT Details: " <<
alctProc->getBestALCT(bx_alct) << std::endl
125 <<
"+++ Second ALCT Details: " <<
alctProc->getSecondALCT(bx_alct) << std::endl;
132 int nGoodMatches = 0;
133 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
138 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
141 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) << std::endl
142 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
146 const bool lowQualityCLCT(
clctProc->getBestCLCT(bx_clct).getQuality() <= 3);
148 const bool lowQualityALCT(
alctProc->getBestALCT(bx_alct).getQuality() == 0);
151 matches<GEMPadDigi> mPads;
152 matchingPads<GEMPadDigi>(
clctProc->getBestCLCT(bx_clct),
157 matches<GEMCoPadDigi> mCoPads;
158 matchingPads<GEMCoPadDigi>(
clctProc->getBestCLCT(bx_clct),
164 bool hasMatchingPads(!mPads.empty()
or !mCoPads.empty());
173 int mbx = bx_clct - bx_clct_start;
183 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
184 used_clct_mask[bx_clct] += 1;
189 <<
"Good ALCT-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
190 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
193 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
194 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
195 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl
196 <<
allLCTs(bx_alct, mbx, 0).getCLCT() << std::endl;
197 if (
allLCTs(bx_alct, mbx, 0).getType() == 2)
198 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 0).getGEM1() << std::endl;
199 if (
allLCTs(bx_alct, mbx, 0).getType() == 3)
201 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
204 if (
allLCTs(bx_alct, mbx, 1).isValid()) {
205 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
206 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl
207 <<
allLCTs(bx_alct, mbx, 1).getCLCT() << std::endl;
208 if (
allLCTs(bx_alct, mbx, 1).getType() == 2)
209 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 1).getGEM1() << std::endl;
210 if (
allLCTs(bx_alct, mbx, 1).getType() == 3)
212 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
224 int nGoodGEMMatches = 0;
228 LogTrace(
"CSCGEMMotherboardME21") <<
"++No valid ALCT-CLCT matches in ME21" << std::endl;
229 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
235 matches<GEMCoPadDigi> copads;
236 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
241 <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : " << copads.size() << std::endl;
242 if (copads.empty()) {
251 if (
allLCTs(bx_alct, 0, 0).isValid()) {
256 <<
"Good ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct <<
"\n\n"
257 <<
"------------------------------------------------------------------------" << std::endl
259 if (
allLCTs(bx_alct, 0, 0).isValid()) {
260 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, 0, 0) << std::endl
261 <<
allLCTs(bx_alct, 0, 0).getALCT() << std::endl;
262 if (
allLCTs(bx_alct, 0, 0).getType() == 4)
264 <<
allLCTs(bx_alct, 0, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 0).getGEM2() << std::endl
267 if (
allLCTs(bx_alct, 0, 1).isValid()) {
268 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, 0, 1) << std::endl
269 <<
allLCTs(bx_alct, 0, 1).getALCT() << std::endl;
270 if (
allLCTs(bx_alct, 0, 1).getType() == 4)
272 <<
allLCTs(bx_alct, 0, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 1).getGEM2() << std::endl
279 LogTrace(
"CSCGEMMotherboardME21") <<
"No valid LCT is built from ALCT-GEM matching in ME21" << std::endl;
286 <<
"========================================================================" << std::endl;
287 LogTrace(
"CSCGEMMotherboardME21") <<
"Summary: " << std::endl;
288 if (nGoodMatches > 1)
290 <<
"Too many good ALCT-CLCT matches in ME21: " << nGoodMatches <<
", CSCDetId " <<
cscId_
291 <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]"
293 else if (nGoodMatches == 1)
295 <<
"1 good ALCT-CLCT match in ME21: "
296 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
297 << bx_clct_stop <<
"]" << std::endl;
298 else if (nGoodGEMMatches == 1)
300 <<
"1 good ALCT-GEM match in ME21: "
301 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
302 << bx_clct_stop <<
"]" << std::endl;
304 LogTrace(
"CSCGEMMotherboardME21") <<
"Bad ALCT-CLCT match in ME21: "
305 <<
"CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: ["
306 << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
318 <<
"========================================================================" << std::endl
319 <<
"GEM-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
"in bx:" << bx_alct << std::endl
320 <<
"------------------------------------------------------------------------" << std::endl;
325 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
330 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
336 int mbx = bx_clct - bx_clct_start;
342 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
343 used_clct_mask[bx_clct] += 1;
347 <<
"Good GEM-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
348 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
349 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n"
350 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
352 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
353 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
354 if (
allLCTs(bx_alct, mbx, 0).getType() == 5)
356 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
358 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
359 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
360 if (
allLCTs(bx_alct, mbx, 1).getType() == 5)
362 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
417 LogDebug(
"CSCGEMMotherboardME21") <<
"bx " <<
bx <<
" nnLCT:" <<
n <<
" " <<
n << std::endl;
426 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================"
428 LogTrace(
"CSCGEMCMotherboardME21") <<
"Counting the final LCTs in CSCGEM Motherboard ME21" << std::endl;
429 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================"
436 LogTrace(
"CSCGEMCMotherboardME21") <<
"LCT " <<
n <<
" " <<
p << std::endl;
442 std::vector<CSCCorrelatedLCTDigi>
result;
450 for (
const auto& lct :
result) {
471 if (secondALCT == bestALCT)
473 if (secondCLCT == bestCLCT)
481 if (!copads.empty()
or !pads.empty()) {
483 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
484 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
485 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
486 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
489 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
490 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
491 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
492 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
495 const bool ok_bb_copad = ok_bb and bb_copad.
isValid();
496 const bool ok_bs_copad = ok_bs and bs_copad.
isValid();
497 const bool ok_sb_copad = ok_sb and sb_copad.
isValid();
498 const bool ok_ss_copad = ok_ss and ss_copad.
isValid();
500 const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.
isValid();
501 const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.
isValid();
502 const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.
isValid();
503 const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.
isValid();
506 if (ok_bb_copad
or ok_ss_copad) {
511 }
else if (ok_bs_copad
or ok_sb_copad) {
523 if ((ok_bb_pad
or ok_ss_pad) and not(ok_bs_copad
or ok_sb_copad)) {
528 }
else if ((ok_bs_pad
or ok_sb_pad) and not(ok_bb_copad
or ok_ss_copad)) {