50 unsigned sector,
unsigned subsector,
53 theEndcap(endcap), theStation(station), theSector(sector),
54 theSubsector(subsector), theTrigChamber(chamber) {
60 static bool config_dumped =
false;
103 const bool runME11ILT(commonParams.
existsAs<
bool>(
"runME11ILT")?commonParams.
getParameter<
bool>(
"runME11ILT"):
false);
104 const bool runME21ILT(commonParams.
existsAs<
bool>(
"runME21ILT")?commonParams.
getParameter<
bool>(
"runME21ILT"):
false);
105 const bool runME3141ILT(commonParams.
existsAs<
bool>(
"runME3141ILT")?commonParams.
getParameter<
bool>(
"runME3141ILT"):
false);
114 tmbParams = me11tmbGemParams;
118 tmbParams = me21tmbGemParams;
123 tmbParams = me3141tmbRpcParams;
134 tmbParams.
getParameter<
unsigned int>(
"matchTrigWindowSize");
136 tmbParams.
getParameter<
unsigned int>(
"tmbL1aWindowSize");
158 if (infoV > 0 && !config_dumped) {
160 config_dumped =
true;
169 theEndcap(1), theStation(1), theSector(1),
170 theSubsector(1), theTrigChamber(1) {
172 static bool config_dumped =
false;
192 if (
infoV > 0 && !config_dumped) {
194 config_dumped =
true;
212 static bool config_dumped =
false;
223 alct->setConfigParameters(conf);
224 clct->setConfigParameters(conf);
228 if (!config_dumped) {
230 config_dumped =
true;
238 static const unsigned int max_mpc_block_me1a = 1 << 1;
239 static const unsigned int max_alct_trig_enable = 1 << 1;
240 static const unsigned int max_clct_trig_enable = 1 << 1;
241 static const unsigned int max_match_trig_enable = 1 << 1;
242 static const unsigned int max_match_trig_window_size = 1 << 4;
243 static const unsigned int max_tmb_l1a_window_size = 1 << 4;
249 <<
", exceeds max allowed, " << max_mpc_block_me1a-1 <<
" +++\n"
250 <<
"+++ Try to proceed with the default value, mpc_block_me1a="
257 <<
", exceeds max allowed, " << max_alct_trig_enable-1 <<
" +++\n"
258 <<
"+++ Try to proceed with the default value, alct_trig_enable="
265 <<
", exceeds max allowed, " << max_clct_trig_enable-1 <<
" +++\n"
266 <<
"+++ Try to proceed with the default value, clct_trig_enable="
273 <<
", exceeds max allowed, " << max_match_trig_enable-1 <<
" +++\n"
274 <<
"+++ Try to proceed with the default value, match_trig_enable="
281 <<
", exceeds max allowed, " << max_match_trig_window_size-1 <<
" +++\n"
282 <<
"+++ Try to proceed with the default value, match_trig_window_size="
289 <<
", exceeds max allowed, " << max_tmb_l1a_window_size-1 <<
" +++\n"
290 <<
"+++ Try to proceed with the default value, tmb_l1a_window_size="
303 clct->run(hs_times, ds_times);
305 int bx_alct_matched = 0;
308 if (
clct->bestCLCT[bx_clct].isValid()) {
309 bool is_matched =
false;
315 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
318 if (
alct->bestALCT[bx_alct].isValid()) {
320 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
322 bx_alct_matched = bx_alct;
330 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
336 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
337 if (
alct->bestALCT[bx_alct].isValid()) {
339 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
352 std::vector<CSCALCTDigi> alctV =
alct->run(wiredc);
355 std::vector<CSCCLCTDigi> clctV =
clct->run(compdc);
358 int used_alct_mask[20];
359 for (
int a=0;
a<20;++
a) used_alct_mask[
a]=0;
361 int bx_alct_matched = 0;
368 if (
clct->bestCLCT[bx_clct].isValid()) {
377 bool is_matched =
false;
384 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
389 if (
alct->bestALCT[bx_alct].isValid()) {
391 <<
"Successful ALCT-CLCT match: bx_clct = " << bx_clct
392 <<
"; match window: [" << bx_alct_start <<
"; " << bx_alct_stop
393 <<
"]; bx_alct = " << bx_alct;
395 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
396 used_alct_mask[bx_alct] += 1;
398 bx_alct_matched = bx_alct;
406 <<
"Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = "
407 << bx_clct <<
"; match window: [" << bx_alct_start
408 <<
"; " << bx_alct_stop <<
"]";
410 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
419 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
420 if (
alct->bestALCT[bx_alct].isValid()) {
422 <<
"Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = "
425 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
442 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
450 std::vector<CSCCorrelatedLCTDigi> tmpV;
462 static int ifois = 0;
467 <<
"; in-time LCTs are not getting read-out!!! +++" <<
"\n";
472 <<
"+++ Allowed range of time bins, [0-" << late_tbins
473 <<
"] exceeds max allowed, " <<
MAX_LCT_BINS-1 <<
" +++\n"
474 <<
"+++ Set late_tbins to max allowed +++\n";
475 late_tbins = MAX_LCT_BINS-1;
483 std::vector<CSCCorrelatedLCTDigi> all_lcts =
getLCTs();
484 for (std::vector <CSCCorrelatedLCTDigi>::const_iterator plct =
485 all_lcts.begin(); plct != all_lcts.end(); plct++) {
486 if (!plct->isValid())
continue;
488 int bx = (*plct).getBX();
492 <<
" Do not report correlated LCT on key halfstrip "
493 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
494 <<
": found at bx " << bx <<
", whereas the earliest allowed bx is "
500 if (bx > late_tbins) {
502 <<
" Do not report correlated LCT on key halfstrip "
503 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
504 <<
": found at bx " << bx <<
", whereas the latest allowed bx is "
513 if (bx_readout == -1 || bx == bx_readout) {
514 tmpV.push_back(*plct);
515 if (bx_readout == -1) bx_readout = bx;
519 else tmpV.push_back(*plct);
526 std::vector<CSCCorrelatedLCTDigi> tmpV;
549 bool anodeBestValid = bestALCT.
isValid();
550 bool anodeSecondValid = secondALCT.
isValid();
551 bool cathodeBestValid = bestCLCT.
isValid();
552 bool cathodeSecondValid = secondCLCT.
isValid();
554 if (anodeBestValid && !anodeSecondValid) secondALCT = bestALCT;
555 if (!anodeBestValid && anodeSecondValid) bestALCT = secondALCT;
556 if (cathodeBestValid && !cathodeSecondValid) secondCLCT = bestCLCT;
557 if (!cathodeBestValid && cathodeSecondValid) bestCLCT = secondCLCT;
565 int bx = lct.
getBX();
572 <<
"+++ Bx of first LCT candidate, " << bx
573 <<
", is not within the allowed range, [0-" <<
MAX_LCT_BINS-1
574 <<
"); skipping it... +++\n";
578 if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
583 int bx = lct.
getBX();
590 <<
"+++ Bx of second LCT candidate, " << bx
591 <<
", is not within the allowed range, [0-" <<
MAX_LCT_BINS-1
592 <<
"); skipping it... +++\n";
621 const int stripType) {
622 const int kPatternBitWidth = 4;
627 pattern = (
abs(ptn) & ((1<<(kPatternBitWidth-1))-1));
632 pattern = pattern | (1<<(kPatternBitWidth-1));
637 pattern = (
abs(ptn) & ((1<<kPatternBitWidth)-1));
658 if (isDistrip) {quality = 4;}
667 if (sumQual < 1 || sumQual > 6) {
669 <<
"+++ findQuality: sumQual = " << sumQual <<
"+++ \n";
672 if (sumQual == 2) {quality = 6;}
673 else if (sumQual == 3) {quality = 7;}
674 else if (sumQual == 4) {quality = 8;}
675 else if (sumQual == 5) {quality = 9;}
676 else if (sumQual == 6) {quality = 10;}
679 if (sumQual == 2) {quality = 11;}
680 else if (sumQual == 3) {quality = 12;}
681 else if (sumQual == 4) {quality = 13;}
682 else if (sumQual == 5) {quality = 14;}
683 else if (sumQual == 6) {quality = 15;}
704 if (sumQual < 1 || sumQual > 6) {
706 <<
"+++ findQuality: Unexpected sumQual = " << sumQual <<
"+++\n";
715 quality = offset + sumQual;
728 if (pattern == 1) quality = 3;
735 if (!a4 && !c4) quality = 5;
736 else if ( a4 && !c4) quality = 6;
737 else if (!a4 && c4) quality = 7;
738 else if ( a4 && c4) {
743 if (pattern == 2 || pattern == 3) quality = 11;
744 else if (pattern == 4 || pattern == 5) quality = 12;
745 else if (pattern == 6 || pattern == 7) quality = 13;
746 else if (pattern == 8 || pattern == 9) quality = 14;
747 else if (pattern == 10) quality = 15;
750 <<
"+++ findQuality: Unexpected CLCT pattern id = "
751 << pattern <<
"+++\n";
762 unsigned int lctPattern, lctQuality;
764 for (
int bend = 0; bend < 2; bend++) {
765 for (
int cfeb = 0; cfeb < 5; cfeb++) {
766 for (
int strip = 0; strip < 32; strip++) {
767 for (
int bx = 0; bx < 7; bx++) {
768 for (
int stripType = 0; stripType < 2; stripType++) {
774 for (
int aQuality = 0; aQuality < 4; aQuality++) {
775 for (
int wireGroup = 0; wireGroup < 120; wireGroup++) {
776 for (
int abx = 0; abx < 7; abx++) {
777 CSCALCTDigi aLCT(1, aQuality, 0, 1, wireGroup, abx);
780 thisLCT(0, 1, lctQuality, aLCT.
getKeyWG(),
783 if (lctPattern != static_cast<unsigned int>(thisLCT.getPattern()) )
785 <<
"pattern mismatch: " << lctPattern
786 <<
" " << thisLCT.getPattern();
787 if (bend != thisLCT.getBend())
789 <<
"bend mismatch: " << bend
790 <<
" " << thisLCT.getBend();
791 int key_strip = 32*cfeb + strip;
792 if (key_strip != thisLCT.getStrip())
794 <<
"strip mismatch: " << key_strip
795 <<
" " << thisLCT.getStrip();
796 if (wireGroup != thisLCT.getKeyWG())
798 <<
"wire group mismatch: " << wireGroup
799 <<
" " << thisLCT.getKeyWG();
800 if (abx != thisLCT.getBX())
802 <<
"bx mismatch: " << abx <<
" " << thisLCT.getBX();
803 if (lctQuality != static_cast<unsigned int>(thisLCT.getQuality()))
805 <<
"quality mismatch: " << lctQuality
806 <<
" " << thisLCT.getQuality();
820 std::ostringstream strm;
822 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
823 strm <<
"+ TMB configuration parameters: +\n";
824 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
825 strm <<
" mpc_block_me1a [block/not block triggers which come from ME1/A] = "
827 strm <<
" alct_trig_enable [allow ALCT-only triggers] = "
829 strm <<
" clct_trig_enable [allow CLCT-only triggers] = "
831 strm <<
" match_trig_enable [allow matched ALCT-CLCT triggers] = "
833 strm <<
" match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = "
835 strm <<
" tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = "
837 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
838 LogDebug(
"CSCMotherboard") << strm.str();
int getQuality() const
return quality of a pattern (number of layers hit!)
T getParameter(std::string const &) const
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT)
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()
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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
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