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 = me3141tmbParams;
130 mpc_block_me1a = tmbParams.getParameter<
unsigned int>(
"mpcBlockMe1a");
135 tmbParams.getParameter<
unsigned int>(
"matchTrigWindowSize");
137 tmbParams.getParameter<
unsigned int>(
"tmbL1aWindowSize");
140 early_tbins = tmbParams.getParameter<
int>(
"tmbEarlyTbins");
146 clct_to_alct = tmbParams.getParameter<
bool>(
"clctToAlct");
151 infoV = tmbParams.getParameter<
int>(
"verbosity");
158 if (infoV > 0 && !config_dumped) {
160 config_dumped =
true;
172 static std::atomic<bool> config_dumped{
false};
192 if (
infoV > 0 && !config_dumped) {
194 config_dumped =
true;
209 static std::atomic<bool> config_dumped{
false};
220 alct->setConfigParameters(conf);
221 clct->setConfigParameters(conf);
225 if (!config_dumped) {
227 config_dumped =
true;
235 static const unsigned int max_mpc_block_me1a = 1 << 1;
236 static const unsigned int max_alct_trig_enable = 1 << 1;
237 static const unsigned int max_clct_trig_enable = 1 << 1;
238 static const unsigned int max_match_trig_enable = 1 << 1;
239 static const unsigned int max_match_trig_window_size = 1 << 4;
240 static const unsigned int max_tmb_l1a_window_size = 1 << 4;
246 <<
", exceeds max allowed, " << max_mpc_block_me1a-1 <<
" +++\n" 247 <<
"+++ Try to proceed with the default value, mpc_block_me1a=" 254 <<
", exceeds max allowed, " << max_alct_trig_enable-1 <<
" +++\n" 255 <<
"+++ Try to proceed with the default value, alct_trig_enable=" 262 <<
", exceeds max allowed, " << max_clct_trig_enable-1 <<
" +++\n" 263 <<
"+++ Try to proceed with the default value, clct_trig_enable=" 270 <<
", exceeds max allowed, " << max_match_trig_enable-1 <<
" +++\n" 271 <<
"+++ Try to proceed with the default value, match_trig_enable=" 278 <<
", exceeds max allowed, " << max_match_trig_window_size-1 <<
" +++\n" 279 <<
"+++ Try to proceed with the default value, match_trig_window_size=" 286 <<
", exceeds max allowed, " << max_tmb_l1a_window_size-1 <<
" +++\n" 287 <<
"+++ Try to proceed with the default value, tmb_l1a_window_size=" 305 clct->run(hs_times, ds_times);
307 int bx_alct_matched = 0;
310 if (
clct->bestCLCT[bx_clct].isValid()) {
311 bool is_matched =
false;
317 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
320 if (
alct->bestALCT[bx_alct].isValid()) {
322 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
325 bx_alct_matched = bx_alct;
333 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
340 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
341 if (
alct->bestALCT[bx_alct].isValid()) {
343 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
362 const std::vector<CSCALCTDigi>& alctV =
alct->run(wiredc);
365 const std::vector<CSCCLCTDigi>& clctV =
clct->run(compdc);
370 int used_alct_mask[20];
371 for (
int a=0;
a<20;++
a) used_alct_mask[
a]=0;
373 int bx_alct_matched = 0;
380 if (
clct->bestCLCT[bx_clct].isValid()) {
389 bool is_matched =
false;
396 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
401 if (
alct->bestALCT[bx_alct].isValid()) {
403 <<
"Successful ALCT-CLCT match: bx_clct = " << bx_clct
404 <<
"; match window: [" << bx_alct_start <<
"; " << bx_alct_stop
405 <<
"]; bx_alct = " << bx_alct;
407 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
409 used_alct_mask[bx_alct] += 1;
411 bx_alct_matched = bx_alct;
419 <<
"Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " 420 << bx_clct <<
"; match window: [" << bx_alct_start
421 <<
"; " << bx_alct_stop <<
"]";
423 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
433 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
434 if (
alct->bestALCT[bx_alct].isValid()) {
436 <<
"Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " 439 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
448 int used_clct_mask[20];
449 for (
int a=0;
a<20;++
a) used_clct_mask[
a]=0;
451 int bx_clct_matched = 0;
458 if (
alct->bestALCT[bx_alct].isValid()) {
467 bool is_matched =
false;
474 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
479 if (
clct->bestCLCT[bx_clct].isValid()) {
481 <<
"Successful CLCT-ALCT match: bx_alct = " << bx_alct
482 <<
"; match window: [" << bx_clct_start <<
"; " << bx_clct_stop
483 <<
"]; bx_clct = " << bx_clct;
485 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
487 used_clct_mask[bx_clct] += 1;
489 bx_clct_matched = bx_clct;
497 <<
"Unsuccessful CLCT-ALCT match (ALCT only): bx_alct = " 498 << bx_alct <<
"; match window: [" << bx_clct_start
499 <<
"; " << bx_clct_stop <<
"]";
501 clct->bestCLCT[bx_alct],
clct->secondCLCT[bx_alct],
511 if (bx_clct >= 0 && bx_clct > bx_clct_matched) {
512 if (
clct->bestCLCT[bx_clct].isValid()) {
514 <<
"Unsuccessful CLCT-ALCT match (CLCT only): bx_clct = " 517 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct],
538 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
546 std::vector<CSCCorrelatedLCTDigi> tmpV;
563 <<
"; in-time LCTs are not getting read-out!!! +++" <<
"\n";
568 <<
"+++ Allowed range of time bins, [0-" << late_tbins
570 <<
"+++ Set late_tbins to max allowed +++\n";
571 late_tbins = CSCConstants::MAX_LCT_TBINS-1;
579 const std::vector<CSCCorrelatedLCTDigi>& all_lcts =
getLCTs();
580 for (
auto plct = all_lcts.begin(); plct != all_lcts.end(); plct++) {
581 if (!plct->isValid())
continue;
583 int bx = (*plct).getBX();
587 <<
" Do not report correlated LCT on key halfstrip " 588 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
589 <<
": found at bx " << bx <<
", whereas the earliest allowed bx is " 595 if (bx > late_tbins) {
597 <<
" Do not report correlated LCT on key halfstrip " 598 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
599 <<
": found at bx " << bx <<
", whereas the latest allowed bx is " 608 if (bx_readout == -1 || bx == bx_readout) {
609 tmpV.push_back(*plct);
610 if (bx_readout == -1) bx_readout = bx;
614 else tmpV.push_back(*plct);
621 std::vector<CSCCorrelatedLCTDigi> tmpV;
650 bool anodeBestValid = bestALCT.
isValid();
651 bool anodeSecondValid = secondALCT.
isValid();
652 bool cathodeBestValid = bestCLCT.
isValid();
653 bool cathodeSecondValid = secondCLCT.
isValid();
655 if (anodeBestValid && !anodeSecondValid) secondALCT = bestALCT;
656 if (!anodeBestValid && anodeSecondValid) bestALCT = secondALCT;
657 if (cathodeBestValid && !cathodeSecondValid) secondCLCT = bestCLCT;
658 if (!cathodeBestValid && cathodeSecondValid) bestCLCT = secondCLCT;
666 int bx = lct.
getBX();
672 <<
"+++ Bx of first LCT candidate, " << bx
674 <<
"); skipping it... +++\n";
678 if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
683 int bx = lct.
getBX();
689 <<
"+++ Bx of second LCT candidate, " << bx
691 <<
"); skipping it... +++\n";
716 thisLCT.setALCT(aLCT);
717 thisLCT.setCLCT(cLCT);
724 const int stripType)
const {
725 const int kPatternBitWidth = 4;
730 pattern = (
abs(ptn) & ((1<<(kPatternBitWidth-1))-1));
735 pattern = pattern | (1<<(kPatternBitWidth-1));
740 pattern = (
abs(ptn) & ((1<<kPatternBitWidth)-1));
761 if (isDistrip) {quality = 4;}
770 if (sumQual < 1 || sumQual > 6) {
772 <<
"+++ findQuality: sumQual = " << sumQual <<
"+++ \n";
775 if (sumQual == 2) {quality = 6;}
776 else if (sumQual == 3) {quality = 7;}
777 else if (sumQual == 4) {quality = 8;}
778 else if (sumQual == 5) {quality = 9;}
779 else if (sumQual == 6) {quality = 10;}
782 if (sumQual == 2) {quality = 11;}
783 else if (sumQual == 3) {quality = 12;}
784 else if (sumQual == 4) {quality = 13;}
785 else if (sumQual == 5) {quality = 14;}
786 else if (sumQual == 6) {quality = 15;}
807 if (sumQual < 1 || sumQual > 6) {
809 <<
"+++ findQuality: Unexpected sumQual = " << sumQual <<
"+++\n";
818 quality = offset + sumQual;
831 if (pattern == 1) quality = 3;
838 if (!a4 && !c4) quality = 5;
839 else if ( a4 && !c4) quality = 6;
840 else if (!a4 && c4) quality = 7;
841 else if ( a4 && c4) {
846 if (pattern == 2 || pattern == 3) quality = 11;
847 else if (pattern == 4 || pattern == 5) quality = 12;
848 else if (pattern == 6 || pattern == 7) quality = 13;
849 else if (pattern == 8 || pattern == 9) quality = 14;
850 else if (pattern == 10) quality = 15;
853 <<
"+++ findQuality: Unexpected CLCT pattern id = " 854 << pattern <<
"+++\n";
865 unsigned int lctPattern, lctQuality;
867 for (
int bend = 0; bend < 2; bend++) {
868 for (
int cfeb = 0; cfeb < 5; cfeb++) {
870 for (
int bx = 0; bx < 7; bx++) {
871 for (
int stripType = 0; stripType < 2; stripType++) {
877 for (
int aQuality = 0; aQuality < 4; aQuality++) {
878 for (
int wireGroup = 0; wireGroup < 120; wireGroup++) {
879 for (
int abx = 0; abx < 7; abx++) {
880 CSCALCTDigi aLCT(1, aQuality, 0, 1, wireGroup, abx);
883 thisLCT(0, 1, lctQuality, aLCT.
getKeyWG(),
886 if (lctPattern != static_cast<unsigned int>(thisLCT.getPattern()) )
888 <<
"pattern mismatch: " << lctPattern
889 <<
" " << thisLCT.getPattern();
890 if (bend != thisLCT.getBend())
892 <<
"bend mismatch: " << bend
893 <<
" " << thisLCT.getBend();
894 int key_strip = 32*cfeb +
strip;
895 if (key_strip != thisLCT.getStrip())
897 <<
"strip mismatch: " << key_strip
898 <<
" " << thisLCT.getStrip();
899 if (wireGroup != thisLCT.getKeyWG())
901 <<
"wire group mismatch: " << wireGroup
902 <<
" " << thisLCT.getKeyWG();
903 if (abx != thisLCT.getBX())
905 <<
"bx mismatch: " << abx <<
" " << thisLCT.getBX();
906 if (lctQuality != static_cast<unsigned int>(thisLCT.getQuality()))
908 <<
"quality mismatch: " << lctQuality
909 <<
" " << thisLCT.getQuality();
923 std::ostringstream strm;
925 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
926 strm <<
"+ TMB configuration parameters: +\n";
927 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
928 strm <<
" mpc_block_me1a [block/not block triggers which come from ME1/A] = " 930 strm <<
" alct_trig_enable [allow ALCT-only triggers] = " 932 strm <<
" clct_trig_enable [allow CLCT-only triggers] = " 934 strm <<
" match_trig_enable [allow matched ALCT-CLCT triggers] = " 936 strm <<
" match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " 938 strm <<
" tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " 940 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
941 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
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 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
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
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
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
unsigned int tmbMatchTrigEnable() const
CSCCorrelatedLCTDigi firstLCT[CSCConstants::MAX_LCT_TBINS]