51 unsigned sector,
unsigned subsector,
54 theEndcap(endcap), theStation(station), theSector(sector),
55 theSubsector(subsector), theTrigChamber(chamber) {
61 static std::atomic<bool> config_dumped{
false};
82 const bool runME11ILT(commonParams.
existsAs<
bool>(
"runME11ILT")?commonParams.
getParameter<
bool>(
"runME11ILT"):
false);
83 const bool runME21ILT(commonParams.
existsAs<
bool>(
"runME21ILT")?commonParams.
getParameter<
bool>(
"runME21ILT"):
false);
84 const bool runME3141ILT(commonParams.
existsAs<
bool>(
"runME3141ILT")?commonParams.
getParameter<
bool>(
"runME3141ILT"):
false);
93 tmbParams = me11tmbGemParams;
97 tmbParams = me21tmbGemParams;
102 tmbParams = me3141tmbParams;
108 mpc_block_me1a = tmbParams.getParameter<
unsigned int>(
"mpcBlockMe1a");
113 tmbParams.getParameter<
unsigned int>(
"matchTrigWindowSize");
115 tmbParams.getParameter<
unsigned int>(
"tmbL1aWindowSize");
118 early_tbins = tmbParams.getParameter<
int>(
"tmbEarlyTbins");
124 clct_to_alct = tmbParams.getParameter<
bool>(
"clctToAlct");
132 infoV = tmbParams.getParameter<
int>(
"verbosity");
139 if (infoV > 0 && !config_dumped) {
141 config_dumped =
true;
153 static std::atomic<bool> config_dumped{
false};
170 if (
infoV > 0 && !config_dumped) {
172 config_dumped =
true;
187 static std::atomic<bool> config_dumped{
false};
198 alct->setConfigParameters(conf);
199 clct->setConfigParameters(conf);
203 if (!config_dumped) {
205 config_dumped =
true;
213 static const unsigned int max_mpc_block_me1a = 1 << 1;
214 static const unsigned int max_alct_trig_enable = 1 << 1;
215 static const unsigned int max_clct_trig_enable = 1 << 1;
216 static const unsigned int max_match_trig_enable = 1 << 1;
217 static const unsigned int max_match_trig_window_size = 1 << 4;
218 static const unsigned int max_tmb_l1a_window_size = 1 << 4;
224 <<
", exceeds max allowed, " << max_mpc_block_me1a-1 <<
" +++\n" 225 <<
"+++ Try to proceed with the default value, mpc_block_me1a=" 232 <<
", exceeds max allowed, " << max_alct_trig_enable-1 <<
" +++\n" 233 <<
"+++ Try to proceed with the default value, alct_trig_enable=" 240 <<
", exceeds max allowed, " << max_clct_trig_enable-1 <<
" +++\n" 241 <<
"+++ Try to proceed with the default value, clct_trig_enable=" 248 <<
", exceeds max allowed, " << max_match_trig_enable-1 <<
" +++\n" 249 <<
"+++ Try to proceed with the default value, match_trig_enable=" 256 <<
", exceeds max allowed, " << max_match_trig_window_size-1 <<
" +++\n" 257 <<
"+++ Try to proceed with the default value, match_trig_window_size=" 264 <<
", exceeds max allowed, " << max_tmb_l1a_window_size-1 <<
" +++\n" 265 <<
"+++ Try to proceed with the default value, tmb_l1a_window_size=" 282 const std::vector<CSCALCTDigi>& alctV =
alct->run(wiredc);
285 const std::vector<CSCCLCTDigi>& clctV =
clct->run(compdc);
290 int used_alct_mask[20];
291 for (
int a=0;
a<20;++
a) used_alct_mask[
a]=0;
293 int bx_alct_matched = 0;
300 if (
clct->bestCLCT[bx_clct].isValid()) {
309 bool is_matched =
false;
313 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
318 if (
alct->bestALCT[bx_alct].isValid()) {
320 <<
"Successful ALCT-CLCT match: bx_clct = " << bx_clct
321 <<
"; match window: [" << bx_alct_start <<
"; " << bx_alct_stop
322 <<
"]; bx_alct = " << bx_alct;
324 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
326 used_alct_mask[bx_alct] += 1;
328 bx_alct_matched = bx_alct;
336 <<
"Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " 337 << bx_clct <<
"; match window: [" << bx_alct_start
338 <<
"; " << bx_alct_stop <<
"]";
340 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
350 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
353 <<
"Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " 356 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
365 int used_clct_mask[20];
366 for (
int a=0;
a<20;++
a) used_clct_mask[
a]=0;
368 int bx_clct_matched = 0;
375 if (
alct->bestALCT[bx_alct].isValid()) {
384 bool is_matched =
false;
388 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
393 if (
clct->bestCLCT[bx_clct].isValid()) {
395 <<
"Successful CLCT-ALCT match: bx_alct = " << bx_alct
396 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop
397 <<
"]; bx_clct = " << bx_clct;
399 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
401 used_clct_mask[bx_clct] += 1;
403 bx_clct_matched = bx_clct;
411 <<
"Unsuccessful CLCT-ALCT match (ALCT only): bx_alct = " 412 << bx_alct <<
"; match window: [" << bx_clct_start
413 <<
"; " << bx_clct_stop <<
"]";
415 clct->bestCLCT[bx_alct],
clct->secondCLCT[bx_alct],
425 if (bx_clct >= 0 && bx_clct > bx_clct_matched) {
428 <<
"Unsuccessful CLCT-ALCT match (CLCT only): bx_clct = " 431 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
452 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
460 std::vector<CSCCorrelatedLCTDigi> tmpV;
477 <<
"; in-time LCTs are not getting read-out!!! +++" <<
"\n";
482 <<
"+++ Allowed range of time bins, [0-" << late_tbins
484 <<
"+++ Set late_tbins to max allowed +++\n";
485 late_tbins = CSCConstants::MAX_LCT_TBINS-1;
493 const std::vector<CSCCorrelatedLCTDigi>& all_lcts =
getLCTs();
494 for (
auto plct = all_lcts.begin(); plct != all_lcts.end(); plct++) {
495 if (!plct->isValid())
continue;
497 int bx = (*plct).getBX();
501 <<
" Do not report correlated LCT on key halfstrip " 502 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
503 <<
": found at bx " << bx <<
", whereas the earliest allowed bx is " 509 if (bx > late_tbins) {
511 <<
" Do not report correlated LCT on key halfstrip " 512 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
513 <<
": found at bx " << bx <<
", whereas the latest allowed bx is " 522 if (bx_readout == -1 || bx == bx_readout) {
523 tmpV.push_back(*plct);
524 if (bx_readout == -1) bx_readout = bx;
528 else tmpV.push_back(*plct);
535 std::vector<CSCCorrelatedLCTDigi> tmpV;
564 bool anodeBestValid = bestALCT.
isValid();
565 bool anodeSecondValid = secondALCT.
isValid();
566 bool cathodeBestValid = bestCLCT.
isValid();
567 bool cathodeSecondValid = secondCLCT.
isValid();
569 if (anodeBestValid && !anodeSecondValid) secondALCT = bestALCT;
570 if (!anodeBestValid && anodeSecondValid) bestALCT = secondALCT;
571 if (cathodeBestValid && !cathodeSecondValid) secondCLCT = bestCLCT;
572 if (!cathodeBestValid && cathodeSecondValid) bestCLCT = secondCLCT;
580 int bx = lct.
getBX();
586 <<
"+++ Bx of first LCT candidate, " << bx
588 <<
"); skipping it... +++\n";
592 if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
597 int bx = lct.
getBX();
603 <<
"+++ Bx of second LCT candidate, " << bx
605 <<
"); skipping it... +++\n";
632 thisLCT.setCLCT(cLCT);
639 const int stripType)
const {
640 const int kPatternBitWidth = 4;
643 unsigned int pattern = (
abs(ptn) & ((1<<kPatternBitWidth)-1));
662 if (pattern == 1) quality = 3;
669 if (!a4 && !c4) quality = 5;
670 else if ( a4 && !c4) quality = 6;
671 else if (!a4 && c4) quality = 7;
672 else if ( a4 && c4) {
677 if (pattern == 2 || pattern == 3) quality = 11;
678 else if (pattern == 4 || pattern == 5) quality = 12;
679 else if (pattern == 6 || pattern == 7) quality = 13;
680 else if (pattern == 8 || pattern == 9) quality = 14;
681 else if (pattern == 10) quality = 15;
684 <<
"+++ findQuality: Unexpected CLCT pattern id = " 685 << pattern <<
"+++\n";
695 unsigned int lctPattern, lctQuality;
697 for (
int bend = 0; bend < 2; bend++) {
698 for (
int cfeb = 0; cfeb < 5; cfeb++) {
700 for (
int bx = 0; bx < 7; bx++) {
701 for (
int stripType = 0; stripType < 2; stripType++) {
707 for (
int aQuality = 0; aQuality < 4; aQuality++) {
708 for (
int wireGroup = 0; wireGroup < 120; wireGroup++) {
709 for (
int abx = 0; abx < 7; abx++) {
710 CSCALCTDigi aLCT(1, aQuality, 0, 1, wireGroup, abx);
713 thisLCT(0, 1, lctQuality, aLCT.
getKeyWG(),
716 if (lctPattern != static_cast<unsigned int>(thisLCT.getPattern()) )
718 <<
"pattern mismatch: " << lctPattern
719 <<
" " << thisLCT.getPattern();
720 if (bend != thisLCT.getBend())
722 <<
"bend mismatch: " << bend
723 <<
" " << thisLCT.getBend();
724 int key_strip = 32*cfeb +
strip;
725 if (key_strip != thisLCT.getStrip())
727 <<
"strip mismatch: " << key_strip
728 <<
" " << thisLCT.getStrip();
729 if (wireGroup != thisLCT.getKeyWG())
731 <<
"wire group mismatch: " << wireGroup
732 <<
" " << thisLCT.getKeyWG();
733 if (abx != thisLCT.getBX())
735 <<
"bx mismatch: " << abx <<
" " << thisLCT.getBX();
736 if (lctQuality != static_cast<unsigned int>(thisLCT.getQuality()))
738 <<
"quality mismatch: " << lctQuality
739 <<
" " << thisLCT.getQuality();
753 std::ostringstream strm;
755 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
756 strm <<
"+ TMB configuration parameters: +\n";
757 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
758 strm <<
" mpc_block_me1a [block/not block triggers which come from ME1/A] = " 760 strm <<
" alct_trig_enable [allow ALCT-only triggers] = " 762 strm <<
" clct_trig_enable [allow CLCT-only triggers] = " 764 strm <<
" match_trig_enable [allow matched ALCT-CLCT triggers] = " 766 strm <<
" match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " 768 strm <<
" tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " 770 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
771 LogDebug(
"CSCMotherboard") << strm.str();
int getQuality() const
return quality of a pattern (number of layers hit!)
T getParameter(std::string const &) const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
unsigned int clct_trig_enable
unsigned int match_trig_window_size
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
const unsigned theTrigChamber
static const unsigned int def_alct_trig_enable
bool isValid() const
check ALCT validity (1 - valid ALCT)
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, int type)
static const unsigned int def_mpc_block_me1a
unsigned int alctClctOffset
unsigned int tmbClctTrigEnable() const
CSCCorrelatedLCTDigi secondLCT[CSCConstants::MAX_LCT_TBINS]
static const unsigned int def_clct_trig_enable
const CSCGeometry * csc_g
static int ringFromTriggerLabels(int station, int triggerCSCID)
int getStripType() const
return striptype
int getBend() const
return bend
unsigned int mpc_block_me1a
std::vector< CSCCorrelatedLCTDigi > getLCTs() const
unsigned int tmbTmbL1aWindowSize() const
const unsigned theStation
unsigned int tmbMatchTrigWindowSize() const
static const unsigned int def_tmb_l1a_window_size
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
const unsigned theSubsector
int getBX() const
return BX
unsigned int tmbAlctTrigEnable() const
Abs< T >::type abs(const T &t)
unsigned int tmb_l1a_window_size
void checkConfigParameters()
bool isValid() const
check CLCT validity (1 - valid CLCT)
unsigned int match_trig_enable
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb) const
int getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
unsigned int tmbMpcBlockMe1a() const
int getQuality() const
return quality of a pattern
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
int getAccelerator() const
unsigned int findQuality(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT) const
int getPattern() const
return pattern
static const unsigned int def_match_trig_window_size
unsigned int encodePattern(const int ptn, const int highPt) const
unsigned int alct_trig_enable
std::unique_ptr< CSCAnodeLCTProcessor > alct
void dumpConfigParams() const
std::unique_ptr< CSCCathodeLCTProcessor > clct
void setConfigParameters(const CSCDBL1TPParameters *conf)
int getKeyWG() const
return key wire group
static const unsigned int def_match_trig_enable
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
void setBX(const int BX)
set BX
unsigned int tmbMatchTrigEnable() const
CSCCorrelatedLCTDigi firstLCT[CSCConstants::MAX_LCT_TBINS]