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};
104 const bool runME11ILT(commonParams.
existsAs<
bool>(
"runME11ILT")?commonParams.
getParameter<
bool>(
"runME11ILT"):
false);
105 const bool runME21ILT(commonParams.
existsAs<
bool>(
"runME21ILT")?commonParams.
getParameter<
bool>(
"runME21ILT"):
false);
106 const bool runME3141ILT(commonParams.
existsAs<
bool>(
"runME3141ILT")?commonParams.
getParameter<
bool>(
"runME3141ILT"):
false);
115 tmbParams = me11tmbGemParams;
119 tmbParams = me21tmbGemParams;
124 tmbParams = me3141tmbRpcParams;
130 mpc_block_me1a = tmbParams.getParameter<
unsigned int>(
"mpcBlockMe1a");
135 tmbParams.getParameter<
unsigned int>(
"matchTrigWindowSize");
137 tmbParams.getParameter<
unsigned int>(
"tmbL1aWindowSize");
142 early_tbins = tmbParams.getParameter<
int>(
"tmbEarlyTbins");
150 infoV = tmbParams.getParameter<
int>(
"verbosity");
159 if (infoV > 0 && !config_dumped) {
161 config_dumped =
true;
173 static std::atomic<bool> config_dumped{
false};
193 if (
infoV > 0 && !config_dumped) {
195 config_dumped =
true;
210 static std::atomic<bool> config_dumped{
false};
221 alct->setConfigParameters(conf);
222 clct->setConfigParameters(conf);
226 if (!config_dumped) {
228 config_dumped =
true;
236 static const unsigned int max_mpc_block_me1a = 1 << 1;
237 static const unsigned int max_alct_trig_enable = 1 << 1;
238 static const unsigned int max_clct_trig_enable = 1 << 1;
239 static const unsigned int max_match_trig_enable = 1 << 1;
240 static const unsigned int max_match_trig_window_size = 1 << 4;
241 static const unsigned int max_tmb_l1a_window_size = 1 << 4;
247 <<
", exceeds max allowed, " << max_mpc_block_me1a-1 <<
" +++\n" 248 <<
"+++ Try to proceed with the default value, mpc_block_me1a=" 255 <<
", exceeds max allowed, " << max_alct_trig_enable-1 <<
" +++\n" 256 <<
"+++ Try to proceed with the default value, alct_trig_enable=" 263 <<
", exceeds max allowed, " << max_clct_trig_enable-1 <<
" +++\n" 264 <<
"+++ Try to proceed with the default value, clct_trig_enable=" 271 <<
", exceeds max allowed, " << max_match_trig_enable-1 <<
" +++\n" 272 <<
"+++ Try to proceed with the default value, match_trig_enable=" 279 <<
", exceeds max allowed, " << max_match_trig_window_size-1 <<
" +++\n" 280 <<
"+++ Try to proceed with the default value, match_trig_window_size=" 287 <<
", exceeds max allowed, " << max_tmb_l1a_window_size-1 <<
" +++\n" 288 <<
"+++ Try to proceed with the default value, tmb_l1a_window_size=" 301 clct->run(hs_times, ds_times);
303 int bx_alct_matched = 0;
306 if (
clct->bestCLCT[bx_clct].isValid()) {
307 bool is_matched =
false;
313 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
316 if (
alct->bestALCT[bx_alct].isValid()) {
318 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
320 bx_alct_matched = bx_alct;
328 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
334 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
335 if (
alct->bestALCT[bx_alct].isValid()) {
337 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
350 std::vector<CSCALCTDigi> alctV =
alct->run(wiredc);
353 std::vector<CSCCLCTDigi> clctV =
clct->run(compdc);
356 int used_alct_mask[20];
357 for (
int a=0;
a<20;++
a) used_alct_mask[
a]=0;
359 int bx_alct_matched = 0;
366 if (
clct->bestCLCT[bx_clct].isValid()) {
375 bool is_matched =
false;
382 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
387 if (
alct->bestALCT[bx_alct].isValid()) {
389 <<
"Successful ALCT-CLCT match: bx_clct = " << bx_clct
390 <<
"; match window: [" << bx_alct_start <<
"; " << bx_alct_stop
391 <<
"]; bx_alct = " << bx_alct;
393 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
394 used_alct_mask[bx_alct] += 1;
396 bx_alct_matched = bx_alct;
404 <<
"Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " 405 << bx_clct <<
"; match window: [" << bx_alct_start
406 <<
"; " << bx_alct_stop <<
"]";
408 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
417 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
418 if (
alct->bestALCT[bx_alct].isValid()) {
420 <<
"Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " 423 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
440 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
448 std::vector<CSCCorrelatedLCTDigi> tmpV;
465 <<
"; in-time LCTs are not getting read-out!!! +++" <<
"\n";
470 <<
"+++ Allowed range of time bins, [0-" << late_tbins
471 <<
"] exceeds max allowed, " <<
MAX_LCT_BINS-1 <<
" +++\n" 472 <<
"+++ Set late_tbins to max allowed +++\n";
473 late_tbins = MAX_LCT_BINS-1;
481 std::vector<CSCCorrelatedLCTDigi> all_lcts =
getLCTs();
482 for (std::vector <CSCCorrelatedLCTDigi>::const_iterator plct =
483 all_lcts.begin(); plct != all_lcts.end(); plct++) {
484 if (!plct->isValid())
continue;
486 int bx = (*plct).getBX();
490 <<
" Do not report correlated LCT on key halfstrip " 491 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
492 <<
": found at bx " << bx <<
", whereas the earliest allowed bx is " 498 if (bx > late_tbins) {
500 <<
" Do not report correlated LCT on key halfstrip " 501 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
502 <<
": found at bx " << bx <<
", whereas the latest allowed bx is " 511 if (bx_readout == -1 || bx == bx_readout) {
512 tmpV.push_back(*plct);
513 if (bx_readout == -1) bx_readout = bx;
517 else tmpV.push_back(*plct);
524 std::vector<CSCCorrelatedLCTDigi> tmpV;
547 bool anodeBestValid = bestALCT.
isValid();
548 bool anodeSecondValid = secondALCT.
isValid();
549 bool cathodeBestValid = bestCLCT.
isValid();
550 bool cathodeSecondValid = secondCLCT.
isValid();
552 if (anodeBestValid && !anodeSecondValid) secondALCT = bestALCT;
553 if (!anodeBestValid && anodeSecondValid) bestALCT = secondALCT;
554 if (cathodeBestValid && !cathodeSecondValid) secondCLCT = bestCLCT;
555 if (!cathodeBestValid && cathodeSecondValid) bestCLCT = secondCLCT;
563 int bx = lct.
getBX();
570 <<
"+++ Bx of first LCT candidate, " << bx
571 <<
", is not within the allowed range, [0-" <<
MAX_LCT_BINS-1
572 <<
"); skipping it... +++\n";
576 if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
581 int bx = lct.
getBX();
588 <<
"+++ Bx of second LCT candidate, " << bx
589 <<
", is not within the allowed range, [0-" <<
MAX_LCT_BINS-1
590 <<
"); skipping it... +++\n";
615 thisLCT.setALCT(aLCT);
616 thisLCT.setCLCT(cLCT);
623 const int stripType) {
624 const int kPatternBitWidth = 4;
629 pattern = (
abs(ptn) & ((1<<(kPatternBitWidth-1))-1));
634 pattern = pattern | (1<<(kPatternBitWidth-1));
639 pattern = (
abs(ptn) & ((1<<kPatternBitWidth)-1));
660 if (isDistrip) {quality = 4;}
669 if (sumQual < 1 || sumQual > 6) {
671 <<
"+++ findQuality: sumQual = " << sumQual <<
"+++ \n";
674 if (sumQual == 2) {quality = 6;}
675 else if (sumQual == 3) {quality = 7;}
676 else if (sumQual == 4) {quality = 8;}
677 else if (sumQual == 5) {quality = 9;}
678 else if (sumQual == 6) {quality = 10;}
681 if (sumQual == 2) {quality = 11;}
682 else if (sumQual == 3) {quality = 12;}
683 else if (sumQual == 4) {quality = 13;}
684 else if (sumQual == 5) {quality = 14;}
685 else if (sumQual == 6) {quality = 15;}
706 if (sumQual < 1 || sumQual > 6) {
708 <<
"+++ findQuality: Unexpected sumQual = " << sumQual <<
"+++\n";
717 quality = offset + sumQual;
730 if (pattern == 1) quality = 3;
737 if (!a4 && !c4) quality = 5;
738 else if ( a4 && !c4) quality = 6;
739 else if (!a4 && c4) quality = 7;
740 else if ( a4 && c4) {
745 if (pattern == 2 || pattern == 3) quality = 11;
746 else if (pattern == 4 || pattern == 5) quality = 12;
747 else if (pattern == 6 || pattern == 7) quality = 13;
748 else if (pattern == 8 || pattern == 9) quality = 14;
749 else if (pattern == 10) quality = 15;
752 <<
"+++ findQuality: Unexpected CLCT pattern id = " 753 << pattern <<
"+++\n";
764 unsigned int lctPattern, lctQuality;
766 for (
int bend = 0; bend < 2; bend++) {
767 for (
int cfeb = 0; cfeb < 5; cfeb++) {
769 for (
int bx = 0; bx < 7; bx++) {
770 for (
int stripType = 0; stripType < 2; stripType++) {
776 for (
int aQuality = 0; aQuality < 4; aQuality++) {
777 for (
int wireGroup = 0; wireGroup < 120; wireGroup++) {
778 for (
int abx = 0; abx < 7; abx++) {
779 CSCALCTDigi aLCT(1, aQuality, 0, 1, wireGroup, abx);
782 thisLCT(0, 1, lctQuality, aLCT.
getKeyWG(),
785 if (lctPattern != static_cast<unsigned int>(thisLCT.getPattern()) )
787 <<
"pattern mismatch: " << lctPattern
788 <<
" " << thisLCT.getPattern();
789 if (bend != thisLCT.getBend())
791 <<
"bend mismatch: " << bend
792 <<
" " << thisLCT.getBend();
793 int key_strip = 32*cfeb +
strip;
794 if (key_strip != thisLCT.getStrip())
796 <<
"strip mismatch: " << key_strip
797 <<
" " << thisLCT.getStrip();
798 if (wireGroup != thisLCT.getKeyWG())
800 <<
"wire group mismatch: " << wireGroup
801 <<
" " << thisLCT.getKeyWG();
802 if (abx != thisLCT.getBX())
804 <<
"bx mismatch: " << abx <<
" " << thisLCT.getBX();
805 if (lctQuality != static_cast<unsigned int>(thisLCT.getQuality()))
807 <<
"quality mismatch: " << lctQuality
808 <<
" " << thisLCT.getQuality();
822 std::ostringstream strm;
824 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
825 strm <<
"+ TMB configuration parameters: +\n";
826 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
827 strm <<
" mpc_block_me1a [block/not block triggers which come from ME1/A] = " 829 strm <<
" alct_trig_enable [allow ALCT-only triggers] = " 831 strm <<
" clct_trig_enable [allow CLCT-only triggers] = " 833 strm <<
" match_trig_enable [allow matched ALCT-CLCT triggers] = " 835 strm <<
" match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " 837 strm <<
" tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " 839 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
840 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
std::vector< CSCCorrelatedLCTDigi > getLCTs()
static bool sortByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
std::vector< CSCCorrelatedLCTDigi > readoutLCTs()
unsigned int match_trig_window_size
const unsigned theTrigChamber
static const unsigned int def_alct_trig_enable
bool isValid() const
check ALCT validity (1 - valid ALCT)
static const unsigned int def_mpc_block_me1a
unsigned int tmbClctTrigEnable() const
unsigned int findQuality(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT)
static const unsigned int def_clct_trig_enable
static int ringFromTriggerLabels(int station, int triggerCSCID)
int getStripType() const
return striptype
int getBend() const
return bend
unsigned int mpc_block_me1a
unsigned int tmbTmbL1aWindowSize() const
void correlateLCTs(CSCALCTDigi bestALCT, CSCALCTDigi secondALCT, CSCCLCTDigi bestCLCT, CSCCLCTDigi secondCLCT)
const unsigned theStation
unsigned int tmbMatchTrigWindowSize() const
CSCCorrelatedLCTDigi secondLCT[MAX_LCT_BINS]
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
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int)
const unsigned theSubsector
void run(const std::vector< int > w_time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES], const std::vector< int > hs_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const std::vector< int > ds_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
int getBX() const
return BX
unsigned int tmbAlctTrigEnable() const
unsigned int encodePattern(const int ptn, const int highPt)
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
int getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
CSCCorrelatedLCTDigi firstLCT[MAX_LCT_BINS]
unsigned int tmbMpcBlockMe1a() const
int getQuality() const
return quality of a pattern
int getAccelerator() const
int getPattern() const
return pattern
static const unsigned int def_match_trig_window_size
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
static bool sortByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
unsigned int tmbMatchTrigEnable() const