12 dropLowQualityCLCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs")),
13 dropLowQualityALCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs")),
14 buildLCTfromALCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM")),
15 buildLCTfromCLCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM")) {
17 edm::LogError(
"CSCGEMMotherboardME21|SetupError") <<
"+++ TMB constructed while runPhase2 is not set! +++\n";
21 edm::LogError(
"CSCGEMMotherboardME21|SetupError") <<
"+++ TMB constructed while runME21ILT_ is not set! +++\n";
25 tmbLUT_ = std::make_unique<CSCGEMMotherboardLUTME21>();
30 edm::LogError(
"CSCGEMMotherboardME21|SetupError") <<
"+++ TMB constructed while runPhase2 is not set! +++\n";
34 edm::LogError(
"CSCGEMMotherboardME21|SetupError") <<
"+++ TMB constructed while runME21ILT_ is not set! +++\n";
46 unsigned alctBits =
alctProc->getHighMultiplictyBits();
49 if (
gem_g !=
nullptr) {
51 edm::LogInfo(
"CSCGEMMotherboardME21|SetupInfo") <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
58 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
64 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
81 int used_clct_mask[20];
82 for (
int c = 0;
c < 20; ++
c)
83 used_clct_mask[
c] = 0;
85 const bool hasCoPads(!
coPads_.empty());
89 if (
alctProc->getBestALCT(bx_alct).isValid()) {
99 <<
"========================================================================" << std::endl
100 <<
"ALCT-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
" in bx range: [" << bx_clct_start <<
","
101 << bx_clct_stop <<
"] for bx " << bx_alct << std::endl
102 <<
"------------------------------------------------------------------------" << std::endl
103 <<
"+++ Best ALCT Details: " <<
alctProc->getBestALCT(bx_alct) << std::endl
104 <<
"+++ Second ALCT Details: " <<
alctProc->getSecondALCT(bx_alct) << std::endl;
111 int nGoodMatches = 0;
112 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
117 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
120 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) << std::endl
121 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
125 const bool lowQualityCLCT(
clctProc->getBestCLCT(bx_clct).getQuality() <= 3);
127 const bool lowQualityALCT(
alctProc->getBestALCT(bx_alct).getQuality() == 0);
130 matches<GEMPadDigi> mPads;
131 matchingPads<GEMPadDigi>(
clctProc->getBestCLCT(bx_clct),
136 matches<GEMCoPadDigi> mCoPads;
137 matchingPads<GEMCoPadDigi>(
clctProc->getBestCLCT(bx_clct),
143 bool hasMatchingPads(!mPads.empty()
or !mCoPads.empty());
152 int mbx = bx_clct - bx_clct_start;
162 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
163 used_clct_mask[bx_clct] += 1;
168 <<
"Good ALCT-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
169 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
173 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
174 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl
175 <<
allLCTs(bx_alct, mbx, 0).getCLCT() << std::endl;
176 if (
allLCTs(bx_alct, mbx, 0).getType() == 2)
177 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 0).getGEM1() << std::endl;
178 if (
allLCTs(bx_alct, mbx, 0).getType() == 3)
180 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
184 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
185 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl
186 <<
allLCTs(bx_alct, mbx, 1).getCLCT() << std::endl;
187 if (
allLCTs(bx_alct, mbx, 1).getType() == 2)
188 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 1).getGEM1() << std::endl;
189 if (
allLCTs(bx_alct, mbx, 1).getType() == 3)
191 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
203 int nGoodGEMMatches = 0;
207 LogTrace(
"CSCGEMMotherboardME21") <<
"++No valid ALCT-CLCT matches in ME21" << std::endl;
208 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
214 matches<GEMCoPadDigi> copads;
215 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
220 <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : " << copads.size() << std::endl;
221 if (copads.empty()) {
230 if (
allLCTs(bx_alct, 0, 0).isValid()) {
235 <<
"Good ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct <<
"\n\n"
236 <<
"------------------------------------------------------------------------" << std::endl
239 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, 0, 0) << std::endl
240 <<
allLCTs(bx_alct, 0, 0).getALCT() << std::endl;
241 if (
allLCTs(bx_alct, 0, 0).getType() == 4)
243 <<
allLCTs(bx_alct, 0, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 0).getGEM2() << std::endl
247 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, 0, 1) << std::endl
248 <<
allLCTs(bx_alct, 0, 1).getALCT() << std::endl;
249 if (
allLCTs(bx_alct, 0, 1).getType() == 4)
251 <<
allLCTs(bx_alct, 0, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 1).getGEM2() << std::endl
258 LogTrace(
"CSCGEMMotherboardME21") <<
"No valid LCT is built from ALCT-GEM matching in ME21" << std::endl;
265 <<
"========================================================================" << std::endl;
266 LogTrace(
"CSCGEMMotherboardME21") <<
"Summary: " << std::endl;
267 if (nGoodMatches > 1)
269 <<
"Too many good ALCT-CLCT matches in ME21: " << nGoodMatches <<
", CSCDetId " <<
cscId_
270 <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]"
272 else if (nGoodMatches == 1)
274 <<
"1 good ALCT-CLCT match in ME21: "
275 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
276 << bx_clct_stop <<
"]" << std::endl;
277 else if (nGoodGEMMatches == 1)
279 <<
"1 good ALCT-GEM match in ME21: "
280 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
281 << bx_clct_stop <<
"]" << std::endl;
283 LogTrace(
"CSCGEMMotherboardME21") <<
"Bad ALCT-CLCT match in ME21: "
284 <<
"CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: ["
285 << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
297 <<
"========================================================================" << std::endl
298 <<
"GEM-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
"in bx:" << bx_alct << std::endl
299 <<
"------------------------------------------------------------------------" << std::endl;
304 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
309 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
315 int mbx = bx_clct - bx_clct_start;
321 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
322 used_clct_mask[bx_clct] += 1;
326 <<
"Good GEM-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
327 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
328 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n"
329 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
331 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
332 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
333 if (
allLCTs(bx_alct, mbx, 0).getType() == 5)
335 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
337 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
338 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
339 if (
allLCTs(bx_alct, mbx, 1).getType() == 5)
341 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
396 LogDebug(
"CSCGEMMotherboardME21") <<
"bx " <<
bx <<
" nnLCT:" <<
n <<
" " <<
n << std::endl;
405 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================"
407 LogTrace(
"CSCGEMCMotherboardME21") <<
"Counting the final LCTs in CSCGEM Motherboard ME21" << std::endl;
408 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================"
415 LogTrace(
"CSCGEMCMotherboardME21") <<
"LCT " <<
n <<
" " <<
p << std::endl;
421 std::vector<CSCCorrelatedLCTDigi>
result;
430 for (
const auto& lct :
result) {
451 if (secondALCT == bestALCT)
453 if (secondCLCT == bestCLCT)
461 if (!copads.empty()
or !pads.empty()) {
463 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
464 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
465 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
466 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
469 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
470 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
471 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
472 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
475 const bool ok_bb_copad = ok_bb and bb_copad.
isValid();
476 const bool ok_bs_copad = ok_bs and bs_copad.
isValid();
477 const bool ok_sb_copad = ok_sb and sb_copad.
isValid();
478 const bool ok_ss_copad = ok_ss and ss_copad.
isValid();
480 const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.
isValid();
481 const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.
isValid();
482 const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.
isValid();
483 const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.
isValid();
486 if (ok_bb_copad
or ok_ss_copad) {
491 }
else if (ok_bs_copad
or ok_sb_copad) {
503 if ((ok_bb_pad
or ok_ss_pad) and not(ok_bs_copad
or ok_sb_copad)) {
508 }
else if ((ok_bs_pad
or ok_sb_pad) and not(ok_bb_copad
or ok_ss_copad)) {