12 dropLowQualityCLCTsNoGEMs_ME1a_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs_ME1a")),
13 dropLowQualityCLCTsNoGEMs_ME1b_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs_ME1b")),
14 dropLowQualityALCTsNoGEMs_ME1a_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs_ME1a")),
15 dropLowQualityALCTsNoGEMs_ME1b_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs_ME1b")),
16 buildLCTfromALCTandGEM_ME1a_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM_ME1a")),
17 buildLCTfromALCTandGEM_ME1b_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM_ME1b")),
18 buildLCTfromCLCTandGEM_ME1a_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM_ME1a")),
19 buildLCTfromCLCTandGEM_ME1b_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM_ME1b")),
20 promoteCLCTGEMquality_ME1a_(tmbParams_.getParameter<
bool>(
"promoteCLCTGEMquality_ME1a")),
21 promoteCLCTGEMquality_ME1b_(tmbParams_.getParameter<
bool>(
"promoteCLCTGEMquality_ME1b")) {
23 edm::LogError(
"CSCGEMMotherboardME11|SetupError") <<
"+++ TMB constructed while isSLHC is not set! +++\n";
27 edm::LogError(
"CSCGEMMotherboardME11|SetupError") <<
"+++ TMB constructed while runME11ILT_ is not set! +++\n";
38 edm::LogError(
"CSCGEMMotherboardME11|SetupError") <<
"+++ TMB constructed while isSLHC is not set! +++\n";
42 edm::LogError(
"CSCGEMMotherboardME11|SetupError") <<
"+++ TMB constructed while runME11ILT_ is not set! +++\n";
60 run(wiredc, compdc, gemPads.get());
71 unsigned alctBits =
alctProc->getHighMultiplictyBits();
74 if (
gem_g !=
nullptr) {
76 edm::LogInfo(
"CSCGEMMotherboardME11|SetupInfo") <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
83 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
90 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
105 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL ALCTs from ME11 " << std::endl;
106 for (
const auto& alct :
alctV)
108 LogTrace(
"CSCGEMMotherboardME11") << alct << std::endl;
110 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL CLCTs from ME11 " << std::endl;
111 for (
const auto& clct :
clctV)
113 LogTrace(
"CSCGEMMotherboardME11") << clct << std::endl;
115 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL GEM copads from GE11-ME11 " << std::endl;
117 LogTrace(
"CSCGEMMotherboardME11") <<
g << std::endl;
120 int used_clct_mask[20];
121 for (
int b = 0;
b < 20;
b++)
122 used_clct_mask[
b] = 0;
127 const bool hasPads(!
pads_.empty());
128 const bool hasCoPads(hasPads and !
coPads_.empty());
131 LogTrace(
"CSCGEMMotherboardME11") <<
"hascopads " << hasCoPads << std::endl;
135 if (
alctProc->getBestALCT(bx_alct).isValid()) {
143 <<
"========================================================================\n"
144 <<
"ALCT-CLCT matching in ME1/1 chamber: " <<
cscId_ <<
"\n"
145 <<
"------------------------------------------------------------------------\n"
146 <<
"+++ Best ALCT Details: " <<
alctProc->getBestALCT(bx_alct) <<
"\n"
147 <<
"+++ Second ALCT Details: " <<
alctProc->getSecondALCT(bx_alct) << std::endl;
153 <<
"------------------------------------------------------------------------ \n"
154 <<
"Attempt ALCT-CLCT matching in ME1/b in bx range: [" << bx_clct_start <<
"," << bx_clct_stop <<
"]"
159 int nSuccesFulMatches = 0;
160 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
165 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
167 LogTrace(
"CSCGEMMotherboardME11") <<
"++Valid ME1b CLCT: " <<
clctProc->getBestCLCT(bx_clct) << std::endl;
170 matches<GEMPadDigi> mPads;
171 matchingPads<GEMPadDigi>(
clctProc->getBestCLCT(bx_clct),
176 matches<GEMCoPadDigi> mCoPads;
177 matchingPads<GEMCoPadDigi>(
clctProc->getBestCLCT(bx_clct),
183 const bool lowQualityCLCT(
clctProc->getBestCLCT(bx_clct).getQuality() <= 3);
184 const bool hasMatchingPads(!mPads.empty()
or !mCoPads.empty());
187 LogTrace(
"CSCGEMMotherboardME11") <<
"Dropping low quality CLCT without matching GEM pads "
188 <<
clctProc->getBestCLCT(bx_clct) << std::endl;
193 LogTrace(
"CSCGEMMotherboardME11") <<
"mPads " << mPads.size() <<
" "
194 <<
" mCoPads " << mCoPads.size() << std::endl;
195 for (
auto p : mPads) {
196 LogTrace(
"CSCGEMMotherboardME11") <<
p.first <<
" " <<
p.second << std::endl;
198 for (
auto p : mCoPads) {
199 LogTrace(
"CSCGEMMotherboardME11") <<
p.first <<
" " <<
p.second << std::endl;
203 int mbx = bx_clct - bx_clct_start;
213 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
215 used_clct_mask[bx_clct] += 1;
219 <<
"Successful ALCT-CLCT match in ME1b: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
220 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
221 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n"
222 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
223 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
224 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl;
225 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
226 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getCLCT() << std::endl;
227 if (
allLCTs(bx_alct, mbx, 0).getType() == 2)
228 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getGEM1() << std::endl;
229 if (
allLCTs(bx_alct, mbx, 0).getType() == 3)
231 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
234 if (
allLCTs(bx_alct, mbx, 1).isValid()) {
235 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl;
236 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
237 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getCLCT() << std::endl;
238 if (
allLCTs(bx_alct, mbx, 1).getType() == 2)
239 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getGEM1() << std::endl;
240 if (
allLCTs(bx_alct, mbx, 1).getType() == 3)
242 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
249 LogTrace(
"CSCGEMMotherboardME11") <<
"No valid LCT is built from ALCT-CLCT matching in ME1b" << std::endl;
254 int nSuccesFulGEMMatches = 0;
257 LogTrace(
"CSCGEMMotherboardME11") <<
"++No valid ALCT-CLCT matches in ME1b" << std::endl;
258 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
264 matches<GEMCoPadDigi> copads;
265 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
270 <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : " << copads.size() << std::endl;
271 if (copads.empty()) {
281 if (
allLCTs(bx_alct, 0, 0).isValid()) {
282 ++nSuccesFulGEMMatches;
286 <<
"Successful ALCT-GEM CoPad match in ME1b: bx_alct = " << bx_alct <<
"\n\n"
287 <<
"------------------------------------------------------------------------" << std::endl
289 if (
allLCTs(bx_alct, 0, 0).isValid()) {
290 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, 0, 0) << std::endl;
291 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, 0, 0).getALCT() << std::endl;
292 if (
allLCTs(bx_alct, 0, 0).getType() == 4)
294 <<
allLCTs(bx_alct, 0, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 0).getGEM2() << std::endl
298 <<
"No valid LCT is built from ALCT-GEM matching in ME1b" << std::endl;
300 if (
allLCTs(bx_alct, 0, 1).isValid()) {
301 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, 0, 1) << std::endl;
302 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, 0, 1).getALCT() << std::endl;
303 if (
allLCTs(bx_alct, 0, 1).getType() == 4)
305 <<
allLCTs(bx_alct, 0, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 1).getGEM2() << std::endl
318 <<
"========================================================================" << std::endl
319 <<
"Summary: " << std::endl;
320 if (nSuccesFulMatches > 1)
322 <<
"Too many successful ALCT-CLCT matches in ME1/1: " << nSuccesFulMatches <<
", CSCDetId " <<
cscId_
323 <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]"
325 else if (nSuccesFulMatches == 1)
327 <<
"1 successful ALCT-CLCT match in ME1/1: "
328 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
329 << bx_clct_stop <<
"]" << std::endl;
330 else if (nSuccesFulGEMMatches == 1)
332 <<
"1 successful ALCT-GEM match in ME1/1: "
333 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
334 << bx_clct_stop <<
"]" << std::endl;
336 LogTrace(
"CSCGEMMotherboardME11") <<
"Unsuccessful ALCT-CLCT match in ME1/1: "
337 <<
"CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: ["
338 << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
343 if (!coPads.empty()) {
350 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
355 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
360 int mbx = bx_clct - bx_clct_start;
366 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
367 used_clct_mask[bx_clct] += 1;
372 <<
"Successful GEM-CLCT match in ME1b: bx_alct = " << bx_alct <<
"; match window: ["
373 << bx_clct_start <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
374 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n"
375 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
377 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl;
378 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
379 if (
allLCTs(bx_alct, mbx, 0).getType() == 5)
381 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl
384 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl;
385 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
386 if (
allLCTs(bx_alct, mbx, 1).getType() == 5)
388 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl
403 LogTrace(
"CSCGEMMotherboardME11") <<
"======================================================================== \n"
404 <<
"Counting the final LCTs in CSCGEMMotherboard ME11\n"
405 <<
"======================================================================== \n"
407 unsigned int n1b = 0, n1a = 0;
410 LogTrace(
"CSCGEMMotherboardME11") <<
"1b LCT " << n1b <<
" " <<
p << std::endl;
415 LogTrace(
"CSCGEMMotherboardME11") <<
"1a LCT " << n1a <<
" " <<
p << std::endl;
428 std::vector<CSCCorrelatedLCTDigi> tmpV;
443 std::vector<CSCCorrelatedLCTDigi> all_lcts;
456 LogTrace(
"CSCGEMMotherboardME11") <<
"tmb_cross_bx_algo error" << std::endl;
460 for (
const auto& lct : all_lcts) {
464 int bx = lct.getBX();
482 if (bx_readout == -1)
489 for (
const auto& lct : tmpV) {
506 LCTs.erase(LCTs.begin() +
max_lcts, LCTs.end());
514 std::vector<CSCCorrelatedLCTDigi> LCTs_tmp;
518 for (
const auto&
p : LCTs_tmp) {
546 if (secondALCT == bestALCT)
548 if (secondCLCT == bestCLCT)
560 const int code = (ok11 << 3) | (ok12 << 2) | (ok21 << 1) | (ok22);
564 LogTrace(
"CSCGEMMotherboardME11") <<
"debug correlateLCTs in ME11" <<
cscId_ <<
"\n"
565 <<
"ALCT1: " << bestALCT <<
"\n"
566 <<
"ALCT2: " << secondALCT <<
"\n"
567 <<
"CLCT1: " << bestCLCT <<
"\n"
568 <<
"CLCT2: " << secondCLCT <<
"\n"
569 <<
"ok 11 12 21 22 code = " << ok11 <<
" " << ok12 <<
" " << ok21 <<
" " << ok22
570 <<
" " << code << std::endl;
598 LogTrace(
"CSCGEMMotherboardME11") <<
"lut 0 1 = " << lut[code][0] <<
" " << lut[code][1] << std::endl;
601 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
602 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
603 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
604 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
607 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
608 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
609 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
610 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
613 const bool ok_bb_copad = ok11 == 1 and ok_bb and bb_copad.
isValid();
614 const bool ok_bs_copad = ok12 == 1 and ok_bs and bs_copad.
isValid();
615 const bool ok_sb_copad = ok21 == 1 and ok_sb and sb_copad.
isValid();
616 const bool ok_ss_copad = ok22 == 1 and ok_ss and ss_copad.
isValid();
618 const bool ok_bb_pad = ok11 == 1 and ok_bb and bb_pad.
isValid();
619 const bool ok_bs_pad = ok12 == 1 and ok_bs and bs_pad.
isValid();
620 const bool ok_sb_pad = ok21 == 1 and ok_sb and sb_pad.
isValid();
621 const bool ok_ss_pad = ok22 == 1 and ok_ss and ss_pad.
isValid();
623 switch (lut[code][0]) {
661 LogTrace(
"CSCGEMMotherboardME11") <<
"lct1: " << lct1 << std::endl;
663 switch (lut[code][1]) {
693 LogTrace(
"CSCGEMMotherboardME11") <<
"lct2: " << lct2 << std::endl;
696 LogTrace(
"CSCGEMMotherboardME11") <<
"out of correlateLCTs" << std::endl;