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";
48 unsigned alctBits =
alctProc->getHighMultiplictyBits();
51 if (
gem_g !=
nullptr) {
53 edm::LogInfo(
"CSCGEMMotherboardME21|SetupInfo") <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
60 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
66 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
83 int used_clct_mask[20];
84 for (
int c = 0;
c < 20; ++
c)
85 used_clct_mask[
c] = 0;
87 const bool hasCoPads(!
coPads_.empty());
91 if (
alctProc->getBestALCT(bx_alct).isValid()) {
101 <<
"========================================================================" << std::endl
102 <<
"ALCT-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
" in bx range: [" << bx_clct_start <<
","
103 << bx_clct_stop <<
"] for bx " << bx_alct << std::endl
104 <<
"------------------------------------------------------------------------" << std::endl
105 <<
"+++ Best ALCT Details: " <<
alctProc->getBestALCT(bx_alct) << std::endl
106 <<
"+++ Second ALCT Details: " <<
alctProc->getSecondALCT(bx_alct) << std::endl;
113 int nGoodMatches = 0;
114 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
119 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
122 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) << std::endl
123 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
127 const bool lowQualityCLCT(
clctProc->getBestCLCT(bx_clct).getQuality() <= 3);
129 const bool lowQualityALCT(
alctProc->getBestALCT(bx_alct).getQuality() == 0);
132 matches<GEMPadDigi> mPads;
133 matchingPads<GEMPadDigi>(
clctProc->getBestCLCT(bx_clct),
138 matches<GEMCoPadDigi> mCoPads;
139 matchingPads<GEMCoPadDigi>(
clctProc->getBestCLCT(bx_clct),
145 bool hasMatchingPads(!mPads.empty()
or !mCoPads.empty());
154 int mbx = bx_clct - bx_clct_start;
164 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
165 used_clct_mask[bx_clct] += 1;
170 <<
"Good ALCT-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
171 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
174 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
175 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
176 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl
177 <<
allLCTs(bx_alct, mbx, 0).getCLCT() << std::endl;
178 if (
allLCTs(bx_alct, mbx, 0).getType() == 2)
179 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 0).getGEM1() << std::endl;
180 if (
allLCTs(bx_alct, mbx, 0).getType() == 3)
182 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
185 if (
allLCTs(bx_alct, mbx, 1).isValid()) {
186 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
187 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl
188 <<
allLCTs(bx_alct, mbx, 1).getCLCT() << std::endl;
189 if (
allLCTs(bx_alct, mbx, 1).getType() == 2)
190 LogTrace(
"CSCGEMMotherboardME21") <<
allLCTs(bx_alct, mbx, 1).getGEM1() << std::endl;
191 if (
allLCTs(bx_alct, mbx, 1).getType() == 3)
193 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
205 int nGoodGEMMatches = 0;
209 LogTrace(
"CSCGEMMotherboardME21") <<
"++No valid ALCT-CLCT matches in ME21" << std::endl;
210 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
216 matches<GEMCoPadDigi> copads;
217 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
222 <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : " << copads.size() << std::endl;
223 if (copads.empty()) {
232 if (
allLCTs(bx_alct, 0, 0).isValid()) {
237 <<
"Good ALCT-GEM CoPad match in ME21: bx_alct = " << bx_alct <<
"\n\n"
238 <<
"------------------------------------------------------------------------" << std::endl
240 if (
allLCTs(bx_alct, 0, 0).isValid()) {
241 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, 0, 0) << std::endl
242 <<
allLCTs(bx_alct, 0, 0).getALCT() << std::endl;
243 if (
allLCTs(bx_alct, 0, 0).getType() == 4)
245 <<
allLCTs(bx_alct, 0, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 0).getGEM2() << std::endl
248 if (
allLCTs(bx_alct, 0, 1).isValid()) {
249 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, 0, 1) << std::endl
250 <<
allLCTs(bx_alct, 0, 1).getALCT() << std::endl;
251 if (
allLCTs(bx_alct, 0, 1).getType() == 4)
253 <<
allLCTs(bx_alct, 0, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 1).getGEM2() << std::endl
260 LogTrace(
"CSCGEMMotherboardME21") <<
"No valid LCT is built from ALCT-GEM matching in ME21" << std::endl;
267 <<
"========================================================================" << std::endl;
268 LogTrace(
"CSCGEMMotherboardME21") <<
"Summary: " << std::endl;
269 if (nGoodMatches > 1)
271 <<
"Too many good ALCT-CLCT matches in ME21: " << nGoodMatches <<
", CSCDetId " <<
cscId_
272 <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]"
274 else if (nGoodMatches == 1)
276 <<
"1 good ALCT-CLCT match in ME21: "
277 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
278 << bx_clct_stop <<
"]" << std::endl;
279 else if (nGoodGEMMatches == 1)
281 <<
"1 good ALCT-GEM match in ME21: "
282 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
283 << bx_clct_stop <<
"]" << std::endl;
285 LogTrace(
"CSCGEMMotherboardME21") <<
"Bad ALCT-CLCT match in ME21: "
286 <<
"CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: ["
287 << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
299 <<
"========================================================================" << std::endl
300 <<
"GEM-CLCT matching in ME2/1 chamber: " <<
cscId_ <<
"in bx:" << bx_alct << std::endl
301 <<
"------------------------------------------------------------------------" << std::endl;
306 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
311 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
317 int mbx = bx_clct - bx_clct_start;
323 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
324 used_clct_mask[bx_clct] += 1;
328 <<
"Good GEM-CLCT match in ME21: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
329 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
330 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n"
331 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
333 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl
334 <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
335 if (
allLCTs(bx_alct, mbx, 0).getType() == 5)
337 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
339 LogTrace(
"CSCGEMMotherboardME21") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl
340 <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
341 if (
allLCTs(bx_alct, mbx, 1).getType() == 5)
343 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
398 LogDebug(
"CSCGEMMotherboardME21") <<
"bx " <<
bx <<
" nnLCT:" <<
n <<
" " <<
n << std::endl;
407 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================"
409 LogTrace(
"CSCGEMCMotherboardME21") <<
"Counting the final LCTs in CSCGEM Motherboard ME21" << std::endl;
410 LogTrace(
"CSCGEMCMotherboardME21") <<
"========================================================================"
417 LogTrace(
"CSCGEMCMotherboardME21") <<
"LCT " <<
n <<
" " <<
p << std::endl;
423 std::vector<CSCCorrelatedLCTDigi>
result;
432 for (
const auto& lct :
result) {
453 if (secondALCT == bestALCT)
455 if (secondCLCT == bestCLCT)
463 if (!copads.empty()
or !pads.empty()) {
465 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
466 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
467 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
468 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
471 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
472 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
473 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
474 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
477 const bool ok_bb_copad = ok_bb and bb_copad.
isValid();
478 const bool ok_bs_copad = ok_bs and bs_copad.
isValid();
479 const bool ok_sb_copad = ok_sb and sb_copad.
isValid();
480 const bool ok_ss_copad = ok_ss and ss_copad.
isValid();
482 const bool ok_bb_pad = (not ok_bb_copad) and ok_bb and bb_pad.
isValid();
483 const bool ok_bs_pad = (not ok_bs_copad) and ok_bs and bs_pad.
isValid();
484 const bool ok_sb_pad = (not ok_sb_copad) and ok_sb and sb_pad.
isValid();
485 const bool ok_ss_pad = (not ok_ss_copad) and ok_ss and ss_pad.
isValid();
488 if (ok_bb_copad
or ok_ss_copad) {
493 }
else if (ok_bs_copad
or ok_sb_copad) {
505 if ((ok_bb_pad
or ok_ss_pad) and not(ok_bs_copad
or ok_sb_copad)) {
510 }
else if ((ok_bs_pad
or ok_sb_pad) and not(ok_bb_copad
or ok_ss_copad)) {