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";
56 if (
gem_g !=
nullptr) {
58 edm::LogInfo(
"CSCGEMMotherboardME11|SetupInfo") <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
66 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
74 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
89 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL ALCTs from ME11 " << std::endl;
90 for (
const auto& alct :
alctV)
92 LogTrace(
"CSCGEMMotherboardME11") << alct << std::endl;
94 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL CLCTs from ME11 " << std::endl;
95 for (
const auto& clct :
clctV)
97 LogTrace(
"CSCGEMMotherboardME11") << clct << std::endl;
99 LogTrace(
"CSCGEMMotherboardME11") <<
"ALL GEM copads from GE11-ME11 " << std::endl;
101 LogTrace(
"CSCGEMMotherboardME11") <<
g << std::endl;
104 int used_clct_mask[20];
105 for (
int b = 0;
b < 20;
b++)
106 used_clct_mask[
b] = 0;
111 const bool hasPads(!
pads_.empty());
112 const bool hasCoPads(hasPads and !
coPads_.empty());
115 LogTrace(
"CSCGEMMotherboardME11") <<
"hascopads " << hasCoPads << std::endl;
119 if (
alctProc->getBestALCT(bx_alct).isValid()) {
127 <<
"========================================================================\n" 128 <<
"ALCT-CLCT matching in ME1/1 chamber: " <<
cscId_ <<
"\n" 129 <<
"------------------------------------------------------------------------\n" 130 <<
"+++ Best ALCT Details: " <<
alctProc->getBestALCT(bx_alct) <<
"\n" 131 <<
"+++ Second ALCT Details: " <<
alctProc->getSecondALCT(bx_alct) << std::endl;
137 <<
"------------------------------------------------------------------------ \n" 138 <<
"Attempt ALCT-CLCT matching in ME1/b in bx range: [" << bx_clct_start <<
"," << bx_clct_stop <<
"]" 143 int nSuccesFulMatches = 0;
144 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
149 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
151 LogTrace(
"CSCGEMMotherboardME11") <<
"++Valid ME1b CLCT: " <<
clctProc->getBestCLCT(bx_clct) << std::endl;
154 matches<GEMPadDigi> mPads;
155 matchingPads<GEMPadDigi>(
clctProc->getBestCLCT(bx_clct),
160 matches<GEMCoPadDigi> mCoPads;
161 matchingPads<GEMCoPadDigi>(
clctProc->getBestCLCT(bx_clct),
167 const bool lowQualityCLCT(
clctProc->getBestCLCT(bx_clct).getQuality() <= 3);
168 const bool hasMatchingPads(!mPads.empty()
or !mCoPads.empty());
171 LogTrace(
"CSCGEMMotherboardME11") <<
"Dropping low quality CLCT without matching GEM pads " 172 <<
clctProc->getBestCLCT(bx_clct) << std::endl;
177 LogTrace(
"CSCGEMMotherboardME11") <<
"mPads " << mPads.size() <<
" " 178 <<
" mCoPads " << mCoPads.size() << std::endl;
179 for (
auto p : mPads) {
180 LogTrace(
"CSCGEMMotherboardME11") <<
p.first <<
" " <<
p.second << std::endl;
182 for (
auto p : mCoPads) {
183 LogTrace(
"CSCGEMMotherboardME11") <<
p.first <<
" " <<
p.second << std::endl;
187 int mbx = bx_clct - bx_clct_start;
197 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
199 used_clct_mask[bx_clct] += 1;
203 <<
"Successful ALCT-CLCT match in ME1b: bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start
204 <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n" 205 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n" 206 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
207 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
208 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl;
209 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
210 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getCLCT() << std::endl;
211 if (
allLCTs(bx_alct, mbx, 0).getType() == 2)
212 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getGEM1() << std::endl;
213 if (
allLCTs(bx_alct, mbx, 0).getType() == 3)
215 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl;
218 if (
allLCTs(bx_alct, mbx, 1).isValid()) {
219 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl;
220 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
221 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getCLCT() << std::endl;
222 if (
allLCTs(bx_alct, mbx, 1).getType() == 2)
223 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getGEM1() << std::endl;
224 if (
allLCTs(bx_alct, mbx, 1).getType() == 3)
226 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl;
233 LogTrace(
"CSCGEMMotherboardME11") <<
"No valid LCT is built from ALCT-CLCT matching in ME1b" << std::endl;
238 int nSuccesFulGEMMatches = 0;
241 LogTrace(
"CSCGEMMotherboardME11") <<
"++No valid ALCT-CLCT matches in ME1b" << std::endl;
242 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
248 matches<GEMCoPadDigi> copads;
249 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
254 <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : " << copads.size() << std::endl;
255 if (copads.empty()) {
265 if (
allLCTs(bx_alct, 0, 0).isValid()) {
266 ++nSuccesFulGEMMatches;
270 <<
"Successful ALCT-GEM CoPad match in ME1b: bx_alct = " << bx_alct <<
"\n\n" 271 <<
"------------------------------------------------------------------------" << std::endl
273 if (
allLCTs(bx_alct, 0, 0).isValid()) {
274 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, 0, 0) << std::endl;
275 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, 0, 0).getALCT() << std::endl;
276 if (
allLCTs(bx_alct, 0, 0).getType() == 4)
278 <<
allLCTs(bx_alct, 0, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 0).getGEM2() << std::endl
282 <<
"No valid LCT is built from ALCT-GEM matching in ME1b" << std::endl;
284 if (
allLCTs(bx_alct, 0, 1).isValid()) {
285 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, 0, 1) << std::endl;
286 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, 0, 1).getALCT() << std::endl;
287 if (
allLCTs(bx_alct, 0, 1).getType() == 4)
289 <<
allLCTs(bx_alct, 0, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, 0, 1).getGEM2() << std::endl
302 <<
"========================================================================" << std::endl
303 <<
"Summary: " << std::endl;
304 if (nSuccesFulMatches > 1)
306 <<
"Too many successful ALCT-CLCT matches in ME1/1: " << nSuccesFulMatches <<
", CSCDetId " <<
cscId_ 307 <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" 309 else if (nSuccesFulMatches == 1)
311 <<
"1 successful ALCT-CLCT match in ME1/1: " 312 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " 313 << bx_clct_stop <<
"]" << std::endl;
314 else if (nSuccesFulGEMMatches == 1)
316 <<
"1 successful ALCT-GEM match in ME1/1: " 317 <<
" CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" << bx_clct_start <<
"; " 318 << bx_clct_stop <<
"]" << std::endl;
320 LogTrace(
"CSCGEMMotherboardME11") <<
"Unsuccessful ALCT-CLCT match in ME1/1: " 321 <<
"CSCDetId " <<
cscId_ <<
", bx_alct = " << bx_alct <<
"; match window: [" 322 << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
327 if (!coPads.empty()) {
334 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
339 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
344 int mbx = bx_clct - bx_clct_start;
350 if (
allLCTs(bx_alct, mbx, 0).isValid()) {
351 used_clct_mask[bx_clct] += 1;
356 <<
"Successful GEM-CLCT match in ME1b: bx_alct = " << bx_alct <<
"; match window: [" 357 << bx_clct_start <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct <<
"\n" 358 <<
"+++ Best CLCT Details: " <<
clctProc->getBestCLCT(bx_clct) <<
"\n" 359 <<
"+++ Second CLCT Details: " <<
clctProc->getSecondCLCT(bx_clct) << std::endl;
361 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #1 " <<
allLCTs(bx_alct, mbx, 0) << std::endl;
362 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 0).getALCT() << std::endl;
363 if (
allLCTs(bx_alct, mbx, 0).getType() == 5)
365 <<
allLCTs(bx_alct, mbx, 0).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 0).getGEM2() << std::endl
368 LogTrace(
"CSCGEMMotherboardME11") <<
"LCT #2 " <<
allLCTs(bx_alct, mbx, 1) << std::endl;
369 LogTrace(
"CSCGEMMotherboardME11") <<
allLCTs(bx_alct, mbx, 1).getALCT() << std::endl;
370 if (
allLCTs(bx_alct, mbx, 1).getType() == 5)
372 <<
allLCTs(bx_alct, mbx, 1).getGEM1() <<
" " <<
allLCTs(bx_alct, mbx, 1).getGEM2() << std::endl
387 LogTrace(
"CSCGEMMotherboardME11") <<
"======================================================================== \n" 388 <<
"Counting the final LCTs in CSCGEMMotherboard ME11\n" 389 <<
"======================================================================== \n" 391 unsigned int n1b = 0, n1a = 0;
394 LogTrace(
"CSCGEMMotherboardME11") <<
"1b LCT " << n1b <<
" " <<
p << std::endl;
399 LogTrace(
"CSCGEMMotherboardME11") <<
"1a LCT " << n1a <<
" " <<
p << std::endl;
412 std::vector<CSCCorrelatedLCTDigi> tmpV;
427 std::vector<CSCCorrelatedLCTDigi> all_lcts;
440 LogTrace(
"CSCGEMMotherboardME11") <<
"tmb_cross_bx_algo error" << std::endl;
444 for (
const auto& lct : all_lcts) {
448 int bx = lct.getBX();
466 if (bx_readout == -1)
484 LCTs.erase(LCTs.begin() +
max_lcts, LCTs.end());
492 std::vector<CSCCorrelatedLCTDigi> LCTs_tmp;
496 for (
const auto&
p : LCTs_tmp) {
524 if (secondALCT == bestALCT)
526 if (secondCLCT == bestCLCT)
538 const int code = (ok11 << 3) | (ok12 << 2) | (ok21 << 1) | (ok22);
542 LogTrace(
"CSCGEMMotherboardME11") <<
"debug correlateLCTs in ME11" <<
cscId_ <<
"\n" 543 <<
"ALCT1: " << bestALCT <<
"\n" 544 <<
"ALCT2: " << secondALCT <<
"\n" 545 <<
"CLCT1: " << bestCLCT <<
"\n" 546 <<
"CLCT2: " << secondCLCT <<
"\n" 547 <<
"ok 11 12 21 22 code = " << ok11 <<
" " << ok12 <<
" " << ok21 <<
" " << ok22
548 <<
" " << code << std::endl;
576 LogTrace(
"CSCGEMMotherboardME11") <<
"lut 0 1 = " << lut[code][0] <<
" " << lut[code][1] << std::endl;
579 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
580 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
581 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
582 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
585 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
586 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
587 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
588 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
591 const bool ok_bb_copad = ok11 == 1 and ok_bb and bb_copad.
isValid();
592 const bool ok_bs_copad = ok12 == 1 and ok_bs and bs_copad.isValid();
593 const bool ok_sb_copad = ok21 == 1 and ok_sb and sb_copad.isValid();
594 const bool ok_ss_copad = ok22 == 1 and ok_ss and ss_copad.isValid();
596 const bool ok_bb_pad = ok11 == 1 and ok_bb and bb_pad.isValid();
597 const bool ok_bs_pad = ok12 == 1 and ok_bs and bs_pad.isValid();
598 const bool ok_sb_pad = ok21 == 1 and ok_sb and sb_pad.isValid();
599 const bool ok_ss_pad = ok22 == 1 and ok_ss and ss_pad.isValid();
601 switch (lut[code][0]) {
639 LogTrace(
"CSCGEMMotherboardME11") <<
"lct1: " << lct1 << std::endl;
641 switch (lut[code][1]) {
671 LogTrace(
"CSCGEMMotherboardME11") <<
"lct2: " << lct2 << std::endl;
674 LogTrace(
"CSCGEMMotherboardME11") <<
"out of correlateLCTs" << std::endl;
void retrieveGEMPads(const GEMPadDigiCollection *pads, unsigned id)
bool gemGeometryAvailable
void correlateLCTsGEM(const T &best, const T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
std::vector< CSCCLCTDigi > clctV
unsigned int match_trig_window_size
bool isValid() const
check ALCT validity (1 - valid ALCT)
GEMCoPadDigiIdsBX coPads_
bool match_earliest_clct_only
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &, int bx, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
void clear()
clear this ALCT
bool doesALCTCrossCLCT(const CSCALCTDigi &a, const CSCCLCTDigi &c) const
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
matches< GEMCoPadDigi > GEMCoPadDigiIds
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1b() const
std::vector< GEMCoPadDigi > gemCoPadV
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
std::unique_ptr< CSCMotherboardLUTME11 > cscTmbLUT_
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1a() const
bool buildLCTfromALCTandGEM_ME1b_
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::vector< CSCALCTDigi > alctV
~CSCGEMMotherboardME11() override
static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
void printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart)
unsigned int tmb_l1a_window_size
bool isValid() const
check CLCT validity (1 - valid CLCT)
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb) const
bool dropLowQualityCLCTsNoGEMs_ME1b_
const CSCGeometry * cscGeometry_
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, int i) const
std::vector< CSCCorrelatedLCTDigi > readoutLCTsME11(enum CSCPart me1ab) const
std::unique_ptr< CSCGEMMotherboardLUTME11 > tmbLUT_
void correlateLCTsGEM(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, const GEMPadDigiIds &pads, const GEMCoPadDigiIds &copads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
bool doesWiregroupCrossStrip(int key_wg, int key_hs) const override
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
void getTimeMatched(const int bx, std::vector< CSCCorrelatedLCTDigi > &) const
void clear()
clear this CLCT
matches< GEMPadDigi > GEMPadDigiIds
const GEMGeometry * gem_g
bool buildLCTfromCLCTandGEM_ME1b_
unsigned int tmb_cross_bx_algo
unsigned int alctClctOffset_
void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart)
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads) override