10 dropLowQualityCLCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs")),
11 dropLowQualityALCTsNoGEMs_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs")),
12 buildLCTfromALCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM")),
13 buildLCTfromCLCTandGEM_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM")) {
16 <<
"+++ Upgrade CSCGEMMotherboardME21 constructed while isSLHC is not set! +++\n";
25 <<
"+++ Upgrade CSCGEMMotherboardME21 constructed while isSLHC is not set! +++\n";
35 run(wiredc, compdc, gemPads.get());
46 unsigned alctBits =
alctProc->getHighMultiplictyBits();
49 if (
gem_g !=
nullptr) {
51 edm::LogInfo(
"CSCGEMMotherboardME21|SetupInfo") <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
59 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
67 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
81 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL ALCTs from ME21 " << std::endl;
82 for (
const auto& alct :
alctV)
84 LogTrace(
"CSCGEMCMotherboardME21") << alct << std::endl;
86 LogTrace(
"CSCGEMCMotherboardME21") <<
"ALL CLCTs from ME21 " << std::endl;
87 for (
const auto& clct :
clctV)
89 LogTrace(
"CSCGEMCMotherboardME21") << clct << std::endl;
91 int used_clct_mask[20];
92 for (
int c = 0;
c < 20; ++
c)
93 used_clct_mask[
c] = 0;
100 const bool hasCoPads(!
coPads_.empty());
104 if (
alctProc->getBestALCT(bx_alct).isValid()) {
112 <<
"========================================================================" << std::endl
113 <<
"ALCT-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
" in bx range: [" << bx_clct_start <<
","
114 << bx_clct_stop <<
"] for bx " << bx_alct << std::endl
115 <<
"------------------------------------------------------------------------" << std::endl
116 <<
"+++ Best ALCT Details: " <<
alctProc->getBestALCT(bx_alct) << std::endl
117 <<
"+++ Second ALCT Details: " <<
alctProc->getSecondALCT(bx_alct) << std::endl;
124 int nGoodMatches = 0;
125 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
130 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
133 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) << std::endl
134 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
138 const bool lowQualityCLCT(
clctProc->getBestCLCT(bx_clct).getQuality() <= 3);
140 const bool lowQualityALCT(
alctProc->getBestALCT(bx_alct).getQuality() == 0);
143 matches<GEMPadDigi> mPads;
144 matchingPads<GEMPadDigi>(
clctProc->getBestCLCT(bx_clct),
149 matches<GEMCoPadDigi> mCoPads;
150 matchingPads<GEMCoPadDigi>(
clctProc->getBestCLCT(bx_clct),
156 bool hasMatchingPads(!mPads.empty()
or !mCoPads.empty());
165 int mbx = bx_clct - bx_clct_start;
175 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
176 used_clct_mask[bx_clct] += 1;
181 <<
"Good ALCT-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
182 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
185 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
186 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
187 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl
188 <<
allLCTs(bx_alct, mbx, 0).getCLCT() << std::endl;
189 if (
allLCTs(bx_alct, mbx, 0).getType() == 2)
190 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 0).getGEM1() << std::endl;
191 if (
allLCTs(bx_alct, mbx, 0).getType() == 3)
193 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
196 if (
allLCTs(bx_alct, mbx, 1).isValid()) {
197 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
198 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl
199 <<
allLCTs(bx_alct, mbx, 1).getCLCT() << std::endl;
200 if (
allLCTs(bx_alct, mbx, 1).getType() == 2)
201 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 1).getGEM1() << std::endl;
202 if (
allLCTs(bx_alct, mbx, 1).getType() == 3)
204 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
216 int nGoodGEMMatches = 0;
219 LogTrace(
"CSCGEMMotherboardME21") <<
"++No valid ALCT-CLCT matches in ME21" << std::endl;
220 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
226 matches<GEMCoPadDigi> copads;
227 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
232 <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : " << copads.size() << std::endl;
233 if (copads.empty()) {
242 if (
allLCTs(bx_alct, 0, 0).isValid()) {
247 <<
"Good ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct <<
"\n\n"
248 <<
"------------------------------------------------------------------------" << std::endl
250 if (
allLCTs(bx_alct, 0, 0).isValid()) {
251 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, 0, 0) << std::endl
252 <<
allLCTs(bx_alct, 0, 0).getALCT() << std::endl;
253 if (
allLCTs(bx_alct, 0, 0).getType() == 4)
255 <<
allLCTs(bx_alct, 0, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 0).getGEM2() << std::endl
258 if (
allLCTs(bx_alct, 0, 1).isValid()) {
259 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, 0, 1) << std::endl
260 <<
allLCTs(bx_alct, 0, 1).getALCT() << std::endl;
261 if (
allLCTs(bx_alct, 0, 1).getType() == 4)
263 <<
allLCTs(bx_alct, 0, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 1).getGEM2() << std::endl
270 LogTrace(
"CSCGEMMotherboardME21") <<
"No valid LCT is built from ALCT-GEM matching in ME21" << std::endl;
277 <<
"========================================================================" << std::endl;
278 LogTrace(
"CSCGEMMotherboardME21") <<
"Summary: " << std::endl;
279 if (nGoodMatches > 1)
281 <<
"Too many good ALCT-CLCT matches in ME21: " << nGoodMatches <<
", CSCDetId " <<
cscId_
282 <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]"
284 else if (nGoodMatches == 1)
286 <<
"1 good ALCT-CLCT match in ME21: "
287 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
288 << bx_clct_stop <<
"]" << std::endl;
289 else if (nGoodGEMMatches == 1)
291 <<
"1 good ALCT-GEM match in ME21: "
292 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
293 << bx_clct_stop <<
"]" << std::endl;
295 LogTrace(
"CSCGEMMotherboardME21") <<
"Bad ALCT-CLCT match in ME21: "
296 <<
"CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: ["
297 << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
309 <<
"========================================================================" << std::endl
310 <<
"GEM-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
"in bx:" << bx_alct << std::endl
311 <<
"------------------------------------------------------------------------" << std::endl;
316 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
321 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
327 int mbx = bx_clct - bx_clct_start;
333 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
334 used_clct_mask[bx_clct] += 1;
338 <<
"Good GEM-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
339 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
340 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n"
341 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
343 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
344 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
345 if (
allLCTs(bx_alct, mbx, 0).getType() == 5)
347 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
349 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
350 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
351 if (
allLCTs(bx_alct, mbx, 1).getType() == 5)
353 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
408 LogDebug(
"CSCGEMMotherboardME21") <<
"bx " <<
bx <<
" nnLCT:" <<
n <<
" " <<
n << std::endl;
417 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================"
419 LogTrace(
"CSCGEMCMotherboardME21") <<
"Counting the final LCTs in CSCGEM Motherboard ME21" << std::endl;
420 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================"
427 LogTrace(
"CSCGEMCMotherboardME21") <<
"LCT " <<
n <<
" " <<
p << std::endl;
433 std::vector<CSCCorrelatedLCTDigi>
result;
456 if (secondALCT == bestALCT)
458 if (secondCLCT == bestCLCT)
466 if (!copads.empty()
or !pads.empty()) {
468 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
469 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
470 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
471 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
474 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
475 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
476 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
477 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
480 const bool ok_bb_copad = ok_bb and bb_copad.
isValid();
481 const bool ok_bs_copad = ok_bs and bs_copad.
isValid();
482 const bool ok_sb_copad = ok_sb and sb_copad.
isValid();
483 const bool ok_ss_copad = ok_ss and ss_copad.
isValid();
485 const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.
isValid();
486 const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.
isValid();
487 const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.
isValid();
488 const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.
isValid();
491 if (ok_bb_copad
or ok_ss_copad) {
496 }
else if (ok_bs_copad
or ok_sb_copad) {
508 if ((ok_bb_pad
or ok_ss_pad) and not(ok_bs_copad
or ok_sb_copad)) {
513 }
else if ((ok_bs_pad
or ok_sb_pad) and not(ok_bb_copad
or ok_ss_copad)) {