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")) {
24 <<
"+++ Upgrade CSCGEMMotherboardME11 constructed while isSLHC is not set! +++\n";
35 <<
"+++ Upgrade CSCGEMMotherboardME11 constructed while isSLHC is not set! +++\n";
52 run(wiredc, compdc, gemPads.get());
63 unsigned alctBits =
alctProc->getHighMultiplictyBits();
66 if (
gem_g !=
nullptr) {
68 edm::LogInfo(
"CSCGEMMotherboardME11|SetupInfo") <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
76 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
84 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
99 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL ALCTs from ME11 " << std::endl;
100 for (
const auto& alct :
alctV)
102 LogTrace(
"CSCGEMMotherboardME11") << alct << std::endl;
104 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL CLCTs from ME11 " << std::endl;
105 for (
const auto& clct :
clctV)
107 LogTrace(
"CSCGEMMotherboardME11") << clct << std::endl;
109 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL GEM copads from GE11-ME11 " << std::endl;
111 LogTrace(
"CSCGEMMotherboardME11") <<
g << std::endl;
114 int used_clct_mask[20];
115 for (
int b = 0;
b < 20;
b++)
116 used_clct_mask[
b] = 0;
121 const bool hasPads(!
pads_.empty());
122 const bool hasCoPads(hasPads and !
coPads_.empty());
125 LogTrace(
"CSCGEMMotherboardME11") <<
"hascopads " << hasCoPads << std::endl;
129 if (
alctProc->getBestALCT(bx_alct).isValid()) {
137 <<
"========================================================================\n"
138 <<
"ALCT-CLCT matching in ME1/1 chamber: " <<
cscId_ <<
"\n"
139 <<
"------------------------------------------------------------------------\n"
140 <<
"+++ Best ALCT Details: " <<
alctProc->getBestALCT(bx_alct) <<
"\n"
141 <<
"+++ Second ALCT Details: " <<
alctProc->getSecondALCT(bx_alct) << std::endl;
147 <<
"------------------------------------------------------------------------ \n"
148 <<
"Attempt ALCT-CLCT matching in ME1/b in bx range: [" << bx_clct_start <<
"," << bx_clct_stop <<
"]"
153 int nSuccesFulMatches = 0;
154 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
159 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
161 LogTrace(
"CSCGEMMotherboardME11") <<
"++Valid ME1b CLCT: " <<
clctProc->getBestCLCT(bx_clct) << std::endl;
164 matches<GEMPadDigi> mPads;
165 matchingPads<GEMPadDigi>(
clctProc->getBestCLCT(bx_clct),
170 matches<GEMCoPadDigi> mCoPads;
171 matchingPads<GEMCoPadDigi>(
clctProc->getBestCLCT(bx_clct),
177 const bool lowQualityCLCT(
clctProc->getBestCLCT(bx_clct).getQuality() <= 3);
178 const bool hasMatchingPads(!mPads.empty()
or !mCoPads.empty());
181 LogTrace(
"CSCGEMMotherboardME11") <<
"Dropping low quality CLCT without matching GEM pads "
182 <<
clctProc->getBestCLCT(bx_clct) << std::endl;
187 LogTrace(
"CSCGEMMotherboardME11") <<
"mPads " << mPads.size() <<
" "
188 <<
" mCoPads " << mCoPads.size() << std::endl;
189 for (
auto p : mPads) {
190 LogTrace(
"CSCGEMMotherboardME11") <<
p.first <<
" " <<
p.second << std::endl;
192 for (
auto p : mCoPads) {
193 LogTrace(
"CSCGEMMotherboardME11") <<
p.first <<
" " <<
p.second << std::endl;
197 int mbx = bx_clct - bx_clct_start;
207 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
209 used_clct_mask[bx_clct] += 1;
213 <<
"Successful ALCT-CLCT match in ME1b: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
214 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
215 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n"
216 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
217 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
218 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl;
219 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
220 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getCLCT() << std::endl;
221 if (
allLCTs(bx_alct, mbx, 0).getType() == 2)
222 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getGEM1() << std::endl;
223 if (
allLCTs(bx_alct, mbx, 0).getType() == 3)
225 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
228 if (
allLCTs(bx_alct, mbx, 1).isValid()) {
229 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl;
230 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
231 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getCLCT() << std::endl;
232 if (
allLCTs(bx_alct, mbx, 1).getType() == 2)
233 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getGEM1() << std::endl;
234 if (
allLCTs(bx_alct, mbx, 1).getType() == 3)
236 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
243 LogTrace(
"CSCGEMMotherboardME11") <<
"No valid LCT is built from ALCT-CLCT matching in ME1b" << std::endl;
248 int nSuccesFulGEMMatches = 0;
251 LogTrace(
"CSCGEMMotherboardME11") <<
"++No valid ALCT-CLCT matches in ME1b" << std::endl;
252 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
258 matches<GEMCoPadDigi> copads;
259 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
264 <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : " << copads.size() << std::endl;
265 if (copads.empty()) {
275 if (
allLCTs(bx_alct, 0, 0).isValid()) {
276 ++nSuccesFulGEMMatches;
280 <<
"Successful ALCT-GEM CoPad match in ME1b: bx_alct = " << bx_alct <<
"\n\n"
281 <<
"------------------------------------------------------------------------" << std::endl
283 if (
allLCTs(bx_alct, 0, 0).isValid()) {
284 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, 0, 0) << std::endl;
285 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, 0, 0).getALCT() << std::endl;
286 if (
allLCTs(bx_alct, 0, 0).getType() == 4)
288 <<
allLCTs(bx_alct, 0, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 0).getGEM2() << std::endl
292 <<
"No valid LCT is built from ALCT-GEM matching in ME1b" << std::endl;
294 if (
allLCTs(bx_alct, 0, 1).isValid()) {
295 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, 0, 1) << std::endl;
296 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, 0, 1).getALCT() << std::endl;
297 if (
allLCTs(bx_alct, 0, 1).getType() == 4)
299 <<
allLCTs(bx_alct, 0, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 1).getGEM2() << std::endl
312 <<
"========================================================================" << std::endl
313 <<
"Summary: " << std::endl;
314 if (nSuccesFulMatches > 1)
316 <<
"Too many successful ALCT-CLCT matches in ME1/1: " << nSuccesFulMatches <<
", CSCDetId " <<
cscId_
317 <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]"
319 else if (nSuccesFulMatches == 1)
321 <<
"1 successful ALCT-CLCT match in ME1/1: "
322 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
323 << bx_clct_stop <<
"]" << std::endl;
324 else if (nSuccesFulGEMMatches == 1)
326 <<
"1 successful ALCT-GEM match in ME1/1: "
327 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; "
328 << bx_clct_stop <<
"]" << std::endl;
330 LogTrace(
"CSCGEMMotherboardME11") <<
"Unsuccessful ALCT-CLCT match in ME1/1: "
331 <<
"CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: ["
332 << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
337 if (!coPads.empty()) {
344 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
349 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
354 int mbx = bx_clct - bx_clct_start;
360 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
361 used_clct_mask[bx_clct] += 1;
366 <<
"Successful GEM-CLCT match in ME1b: bx_alct = " << bx_alct <<
"; match window: ["
367 << bx_clct_start <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n"
368 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n"
369 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
371 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl;
372 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
373 if (
allLCTs(bx_alct, mbx, 0).getType() == 5)
375 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl
378 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl;
379 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
380 if (
allLCTs(bx_alct, mbx, 1).getType() == 5)
382 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl
397 LogTrace(
"CSCGEMMotherboardME11") <<
"======================================================================== \n"
398 <<
"Counting the final LCTs in CSCGEMMotherboard ME11\n"
399 <<
"======================================================================== \n"
401 unsigned int n1b = 0, n1a = 0;
404 LogTrace(
"CSCGEMMotherboardME11") <<
"1b LCT " << n1b <<
" " <<
p << std::endl;
409 LogTrace(
"CSCGEMMotherboardME11") <<
"1a LCT " << n1a <<
" " <<
p << std::endl;
422 std::vector<CSCCorrelatedLCTDigi> tmpV;
437 std::vector<CSCCorrelatedLCTDigi> all_lcts;
450 LogTrace(
"CSCGEMMotherboardME11") <<
"tmb_cross_bx_algo error" << std::endl;
454 for (
const auto& lct : all_lcts) {
458 int bx = lct.getBX();
476 if (bx_readout == -1)
494 LCTs.erase(LCTs.begin() +
max_lcts, LCTs.end());
502 std::vector<CSCCorrelatedLCTDigi> LCTs_tmp;
506 for (
const auto&
p : LCTs_tmp) {
534 if (secondALCT == bestALCT)
536 if (secondCLCT == bestCLCT)
548 const int code = (ok11 << 3) | (ok12 << 2) | (ok21 << 1) | (ok22);
552 LogTrace(
"CSCGEMMotherboardME11") <<
"debug correlateLCTs in ME11" <<
cscId_ <<
"\n"
553 <<
"ALCT1: " << bestALCT <<
"\n"
554 <<
"ALCT2: " << secondALCT <<
"\n"
555 <<
"CLCT1: " << bestCLCT <<
"\n"
556 <<
"CLCT2: " << secondCLCT <<
"\n"
557 <<
"ok 11 12 21 22 code = " << ok11 <<
" " << ok12 <<
" " << ok21 <<
" " << ok22
558 <<
" " << code << std::endl;
586 LogTrace(
"CSCGEMMotherboardME11") <<
"lut 0 1 = " << lut[code][0] <<
" " << lut[code][1] << std::endl;
589 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
590 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
591 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
592 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
595 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
596 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
597 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
598 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
601 const bool ok_bb_copad = ok11 == 1 and ok_bb and bb_copad.
isValid();
602 const bool ok_bs_copad = ok12 == 1 and ok_bs and bs_copad.
isValid();
603 const bool ok_sb_copad = ok21 == 1 and ok_sb and sb_copad.
isValid();
604 const bool ok_ss_copad = ok22 == 1 and ok_ss and ss_copad.
isValid();
606 const bool ok_bb_pad = ok11 == 1 and ok_bb and bb_pad.
isValid();
607 const bool ok_bs_pad = ok12 == 1 and ok_bs and bs_pad.
isValid();
608 const bool ok_sb_pad = ok21 == 1 and ok_sb and sb_pad.
isValid();
609 const bool ok_ss_pad = ok22 == 1 and ok_ss and ss_pad.
isValid();
611 switch (lut[code][0]) {
649 LogTrace(
"CSCGEMMotherboardME11") <<
"lct1: " << lct1 << std::endl;
651 switch (lut[code][1]) {
681 LogTrace(
"CSCGEMMotherboardME11") <<
"lct2: " << lct2 << std::endl;
684 LogTrace(
"CSCGEMMotherboardME11") <<
"out of correlateLCTs" << std::endl;