4 unsigned sector,
unsigned subsector,
9 , dropLowQualityCLCTsNoGEMs_ME1a_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs_ME1a"))
10 , dropLowQualityCLCTsNoGEMs_ME1b_(tmbParams_.getParameter<
bool>(
"dropLowQualityCLCTsNoGEMs_ME1b"))
11 , dropLowQualityALCTsNoGEMs_ME1a_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs_ME1a"))
12 , dropLowQualityALCTsNoGEMs_ME1b_(tmbParams_.getParameter<
bool>(
"dropLowQualityALCTsNoGEMs_ME1b"))
13 , buildLCTfromALCTandGEM_ME1a_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM_ME1a"))
14 , buildLCTfromALCTandGEM_ME1b_(tmbParams_.getParameter<
bool>(
"buildLCTfromALCTandGEM_ME1b"))
15 , buildLCTfromCLCTandGEM_ME1a_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM_ME1a"))
16 , buildLCTfromCLCTandGEM_ME1b_(tmbParams_.getParameter<
bool>(
"buildLCTfromCLCTandGEM_ME1b"))
17 , promoteCLCTGEMquality_ME1a_(tmbParams_.getParameter<
bool>(
"promoteCLCTGEMquality_ME1a"))
18 , promoteCLCTGEMquality_ME1b_(tmbParams_.getParameter<
bool>(
"promoteCLCTGEMquality_ME1b"))
21 <<
"+++ Upgrade CSCGEMMotherboardME11 constructed while isSLHC is not set! +++\n";
34 <<
"+++ Upgrade CSCGEMMotherboardME11 constructed while isSLHC is not set! +++\n";
58 if (
gem_g !=
nullptr) {
60 <<
"+++ run() called for GEM-CSC integrated trigger! +++ \n";
67 <<
"+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
75 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
88 LogTrace(
"CSCGEMCMotherboardME11") <<
"ALL ALCTs from ME11 "<< std::endl;
89 for (
const auto& alct :
alctV)
91 LogTrace(
"CSCGEMCMotherboardME11") << alct << std::endl;
93 LogTrace(
"CSCGEMCMotherboardME11") <<
"ALL CLCTs from ME11 "<< std::endl;
94 for (
const auto& clct :
clctV)
96 LogTrace(
"CSCGEMCMotherboardME11") << clct << std::endl;
98 int used_clct_mask[20];
99 for (
int b=0;
b<20;
b++)
100 used_clct_mask[
b] = 0;
105 const bool hasPads(!
pads_.empty());
106 const bool hasCoPads(hasPads and !
coPads_.empty());
111 if (
alctProc->bestALCT[bx_alct].isValid())
119 LogTrace(
"CSCGEMCMotherboardME11") <<
"========================================================================\n" 120 <<
"ALCT-CLCT matching in ME1/1 chamber: " <<
cscChamber->
id() <<
"\n" 121 <<
"------------------------------------------------------------------------\n" 122 <<
"+++ Best ALCT Details: " <<
alctProc->bestALCT[bx_alct] <<
"\n" 123 <<
"+++ Second ALCT Details: " <<
alctProc->secondALCT[bx_alct] << std::endl;
128 LogTrace(
"CSCGEMCMotherboardME11") <<
"------------------------------------------------------------------------ \n" 129 <<
"Attempt ALCT-CLCT matching in ME1/b in bx range: [" << bx_clct_start <<
"," << bx_clct_stop <<
"]" << std::endl;
133 int nSuccesFulMatches = 0;
134 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
138 if (
clctProc->bestCLCT[bx_clct].isValid())
144 matches<GEMPadDigi> mPads;
145 matchingPads<GEMPadDigi>(
clctProc->bestCLCT[bx_clct],
clctProc->secondCLCT[bx_clct],
147 matches<GEMCoPadDigi> mCoPads;
148 matchingPads<GEMCoPadDigi>(
clctProc->bestCLCT[bx_clct],
clctProc->secondCLCT[bx_clct],
153 int nFound(mPads.size());
155 const bool clctInEdge(
clctProc->bestCLCT[bx_clct].getKeyStrip() < 5
or clctProc->bestCLCT[bx_clct].getKeyStrip() > 124);
157 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME11") <<
"\tInfo: low quality CLCT in CSC chamber edge, don't care about GEM pads" << std::endl;
161 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME11") <<
"\tInfo: low quality CLCT with " << nFound <<
" matching GEM trigger pads" << std::endl;
164 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME11") <<
"\tWarning: low quality CLCT without matching GEM trigger pad" << std::endl;
173 int mbx = bx_clct-bx_clct_start;
179 LogTrace(
"CSCGEMCMotherboardME11") <<
"Successful ALCT-CLCT match in ME1b: bx_alct = " << bx_alct
180 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop
181 <<
"]; bx_clct = " << bx_clct <<
"\n" 182 <<
"+++ Best CLCT Details: " <<
clctProc->bestCLCT[bx_clct] <<
"\n" 183 <<
"+++ Second CLCT Details: " <<
clctProc->secondCLCT[bx_clct] << std::endl;
184 if (
allLCTs(bx_alct,mbx,0).isValid())
185 LogTrace(
"CSCGEMCMotherboardME11") <<
"LCT #1 "<<
allLCTs(bx_alct,mbx,0) << std::endl;
187 LogTrace(
"CSCGEMCMotherboardME11") <<
"No valid LCT is built from ALCT-CLCT matching in ME1b" << std::endl;
188 if (
allLCTs(bx_alct,mbx,1).isValid())
189 LogTrace(
"CSCGEMCMotherboardME11") <<
"LCT #2 "<<
allLCTs(bx_alct,mbx,1) << std::endl;
192 if (
allLCTs(bx_alct,mbx,0).isValid()) {
193 used_clct_mask[bx_clct] += 1;
200 int nSuccesFulGEMMatches = 0;
202 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME11") <<
"++No valid ALCT-CLCT matches in ME1b" << std::endl;
203 for (
int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
209 matches<GEMCoPadDigi> copads;
210 matchingPads<CSCALCTDigi, GEMCoPadDigi>(
alctProc->bestALCT[bx_alct],
alctProc->secondALCT[bx_alct], copads);
212 if (
debug_matching)
LogTrace(
"CSCGEMCMotherboardME11") <<
"\t++Number of matching GEM CoPads in BX " << bx_alct <<
" : "<< copads.size() << std::endl;
213 if (copads.empty()) {
221 LogTrace(
"CSCGEMCMotherboardME11") <<
"Successful ALCT-GEM CoPad match in ME1b: bx_alct = " << bx_alct <<
"\n\n" 222 <<
"------------------------------------------------------------------------" << std::endl << std::endl;
223 if (
allLCTs(bx_alct,0,0).isValid())
224 LogTrace(
"CSCGEMCMotherboardME11") <<
"LCT #1 "<<
allLCTs(bx_alct,0,0) << std::endl;
226 LogTrace(
"CSCGEMCMotherboardME11") <<
"No valid LCT is built from ALCT-GEM matching in ME1b" << std::endl;
227 if (
allLCTs(bx_alct,0,1).isValid())
228 LogTrace(
"CSCGEMCMotherboardME11") <<
"LCT #2 "<<
allLCTs(bx_alct,0,1) << std::endl;
231 if (
allLCTs(bx_alct,0,0).isValid()) {
232 ++nSuccesFulGEMMatches;
239 LogTrace(
"CSCGEMCMotherboardME11") <<
"========================================================================" << std::endl
240 <<
"Summary: " << std::endl;
241 if (nSuccesFulMatches>1)
242 LogTrace(
"CSCGEMCMotherboardME11") <<
"Too many successful ALCT-CLCT matches in ME1b: " << nSuccesFulMatches
244 <<
", bx_alct = " << bx_alct
245 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
246 else if (nSuccesFulMatches==1)
247 LogTrace(
"CSCGEMCMotherboardME11") <<
"1 successful ALCT-CLCT match in ME1b: " 249 <<
", bx_alct = " << bx_alct
250 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
251 else if (nSuccesFulGEMMatches==1)
252 LogTrace(
"CSCGEMCMotherboardME11") <<
"1 successful ALCT-GEM match in ME1b: " 254 <<
", bx_alct = " << bx_alct
255 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
257 LogTrace(
"CSCGEMCMotherboardME11") <<
"Unsuccessful ALCT-CLCT match in ME1b: " 259 <<
", bx_alct = " << bx_alct
260 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop <<
"]" << std::endl;
262 LogTrace(
"CSCGEMCMotherboardME11") <<
"------------------------------------------------------------------------" << std::endl
263 <<
"Attempt ALCT-CLCT matching in ME1/a in bx range: [" << bx_clct_start <<
"," << bx_clct_stop <<
"]" << std::endl;
268 if (!coPads.empty()) {
275 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
278 if (
clctProc->bestCLCT[bx_clct].isValid()) {
282 int mbx = bx_clct-bx_clct_start;
287 LogTrace(
"CSCGEMCMotherboardME11") <<
"Successful GEM-CLCT match in ME1b: bx_alct = " << bx_alct
288 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop
289 <<
"]; bx_clct = " << bx_clct <<
"\n" 290 <<
"+++ Best CLCT Details: " <<
clctProc->bestCLCT[bx_clct] <<
"\n" 291 <<
"+++ Second CLCT Details: " <<
clctProc->secondCLCT[bx_clct] << std::endl;
293 if (
allLCTs(bx_alct,mbx,0).isValid()) {
294 used_clct_mask[bx_clct] += 1;
305 LogTrace(
"CSCGEMCMotherboardME11") <<
"======================================================================== \n" 306 <<
"Counting the LCTs in CSCGEMMotherboard ME11 \n" 307 <<
"========================================================================" << std::endl;
311 unsigned int n1b=0, n1a=0;
312 LogTrace(
"CSCGEMCMotherboardME11") <<
"======================================================================== \n" 313 <<
"Counting the final LCTs in CSCGEMMotherboard ME11\n" 314 <<
"======================================================================== \n" 319 LogTrace(
"CSCGEMCMotherboardME11") <<
"1b LCT "<<n1b<<
" " <<
p <<std::endl;
324 LogTrace(
"CSCGEMCMotherboardME11") <<
"1a LCT "<<n1a<<
" " <<
p <<std::endl;
346 std::vector<CSCCorrelatedLCTDigi> tmpV;
362 std::vector<CSCCorrelatedLCTDigi> all_lcts;
371 default:
LogTrace(
"CSCGEMCMotherboardME11")<<
"tmb_cross_bx_algo error" <<std::endl;
375 for (
const auto& lct: all_lcts)
377 if (!lct.isValid())
continue;
379 int bx = lct.getBX();
384 if (bx > late_tbins)
continue;
395 if (bx_readout == -1) bx_readout = bx;
397 else tmpV.push_back(lct);
420 std::vector<CSCCorrelatedLCTDigi> LCTs_tmp;
424 for (
const auto&
p: LCTs_tmp){
452 if (secondALCT == bestALCT) secondALCT.
clear();
453 if (secondCLCT == bestCLCT) secondCLCT.
clear();
464 const int code = (ok11<<3) | (ok12<<2) | (ok21<<1) | (ok22);
469 if (dbg)
LogTrace(
"CSCGEMMotherboardME11")<<
"debug correlateLCTs in ME11"<<did<<
"\n" 470 <<
"ALCT1: "<<bestALCT<<
"\n" 471 <<
"ALCT2: "<<secondALCT<<
"\n" 472 <<
"CLCT1: "<<bestCLCT<<
"\n" 473 <<
"CLCT2: "<<secondCLCT<<
"\n" 474 <<
"ok 11 12 21 22 code = "<<ok11<<
" "<<ok12<<
" "<<ok21<<
" "<<ok22<<
" "<<code<<std::endl;
476 if ( code==0 )
return;
500 if (dbg)
LogTrace(
"CSCGEMMotherboardME11")<<
"lut 0 1 = "<<lut[code][0]<<
" "<<lut[code][1]<<std::endl;
503 const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
504 const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
505 const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
506 const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
509 const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
510 const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
511 const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
512 const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
515 const bool ok_bb_copad = ok11==1 and ok_bb and bb_copad.
isValid();
516 const bool ok_bs_copad = ok12==1 and ok_bs and bs_copad.isValid();
517 const bool ok_sb_copad = ok21==1 and ok_sb and sb_copad.isValid();
518 const bool ok_ss_copad = ok22==1 and ok_ss and ss_copad.isValid();
520 const bool ok_bb_pad = (not ok_bb_copad) and ok11==1 and ok_bb and bb_pad.isValid();
521 const bool ok_bs_pad = (not ok_bs_copad) and ok12==1 and ok_bs and bs_pad.isValid();
522 const bool ok_sb_pad = (not ok_sb_copad) and ok21==1 and ok_sb and sb_pad.isValid();
523 const bool ok_ss_pad = (not ok_ss_copad) and ok22==1 and ok_ss and ss_pad.isValid();
525 switch (lut[code][0]) {
550 if (dbg)
LogTrace(
"CSCGEMMotherboardME11")<<
"lct1: "<<lct1<<std::endl;
552 switch (lut[code][1]){
572 if (dbg)
LogTrace(
"CSCGEMMotherboardME11")<<
"lct2: "<<lct2<<std::endl;
574 if (dbg)
LogTrace(
"CSCGEMMotherboardME11")<<
"out of correlateLCTs"<<std::endl;
void retrieveGEMPads(const GEMPadDigiCollection *pads, unsigned id)
bool gemGeometryAvailable
std::vector< CSCCLCTDigi > clctV
unsigned int match_trig_window_size
CSCDetId id() const
Get the (concrete) DetId.
const unsigned theTrigChamber
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
unsigned int alctClctOffset
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 &)
const CSCChamber * cscChamber
const CSCGeometry * csc_g
matches< GEMCoPadDigi > GEMCoPadDigiIds
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1b() const
std::vector< GEMCoPadDigi > gemCoPadV
std::unique_ptr< CSCMotherboardLUTME11 > cscTmbLUT_
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1a() const
bool buildLCTfromALCTandGEM_ME1b_
const unsigned theStation
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
void correlateLCTsGEM(T &best, T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
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
const unsigned theSubsector
~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
void getTimeMatched(const int bx, std::vector< CSCCorrelatedLCTDigi > &) const
bool dropLowQualityCLCTsNoGEMs_ME1b_
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, int i) const
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) 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
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
void clear()
clear this CLCT
matches< GEMPadDigi > GEMPadDigiIds
const GEMGeometry * gem_g
bool buildLCTfromCLCTandGEM_ME1b_
unsigned int tmb_cross_bx_algo
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart)
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads) override