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;
129 mpc_block_me1a = tmbParams.getParameter<
unsigned int>(
"mpcBlockMe1a");
134 tmbParams.getParameter<
unsigned int>(
"matchTrigWindowSize");
136 tmbParams.getParameter<
unsigned int>(
"tmbL1aWindowSize");
141 early_tbins = tmbParams.getParameter<
int>(
"tmbEarlyTbins");
149 infoV = tmbParams.getParameter<
int>(
"verbosity");
158 if (infoV > 0 && !config_dumped) {
160 config_dumped =
true;
172 static bool config_dumped =
false;
192 if (
infoV > 0 && !config_dumped) {
194 config_dumped =
true;
209 static 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=" 300 clct->run(hs_times, ds_times);
302 int bx_alct_matched = 0;
305 if (
clct->bestCLCT[bx_clct].isValid()) {
306 bool is_matched =
false;
312 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
315 if (
alct->bestALCT[bx_alct].isValid()) {
317 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
319 bx_alct_matched = bx_alct;
327 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
333 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
334 if (
alct->bestALCT[bx_alct].isValid()) {
336 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
349 std::vector<CSCALCTDigi> alctV =
alct->run(wiredc);
352 std::vector<CSCCLCTDigi> clctV =
clct->run(compdc);
355 int used_alct_mask[20];
356 for (
int a=0;
a<20;++
a) used_alct_mask[
a]=0;
358 int bx_alct_matched = 0;
365 if (
clct->bestCLCT[bx_clct].isValid()) {
374 bool is_matched =
false;
381 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
386 if (
alct->bestALCT[bx_alct].isValid()) {
388 <<
"Successful ALCT-CLCT match: bx_clct = " << bx_clct
389 <<
"; match window: [" << bx_alct_start <<
"; " << bx_alct_stop
390 <<
"]; bx_alct = " << bx_alct;
392 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
393 used_alct_mask[bx_alct] += 1;
395 bx_alct_matched = bx_alct;
403 <<
"Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " 404 << bx_clct <<
"; match window: [" << bx_alct_start
405 <<
"; " << bx_alct_stop <<
"]";
407 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
416 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
417 if (
alct->bestALCT[bx_alct].isValid()) {
419 <<
"Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " 422 clct->bestCLCT[bx_clct],
clct->secondCLCT[bx_clct]);
439 <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
447 std::vector<CSCCorrelatedLCTDigi> tmpV;
459 static int ifois = 0;
464 <<
"; in-time LCTs are not getting read-out!!! +++" <<
"\n";
469 <<
"+++ Allowed range of time bins, [0-" << late_tbins
470 <<
"] exceeds max allowed, " <<
MAX_LCT_BINS-1 <<
" +++\n" 471 <<
"+++ Set late_tbins to max allowed +++\n";
472 late_tbins = MAX_LCT_BINS-1;
480 std::vector<CSCCorrelatedLCTDigi> all_lcts =
getLCTs();
481 for (std::vector <CSCCorrelatedLCTDigi>::const_iterator plct =
482 all_lcts.begin(); plct != all_lcts.end(); plct++) {
483 if (!plct->isValid())
continue;
485 int bx = (*plct).getBX();
489 <<
" Do not report correlated LCT on key halfstrip " 490 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
491 <<
": found at bx " << bx <<
", whereas the earliest allowed bx is " 497 if (bx > late_tbins) {
499 <<
" Do not report correlated LCT on key halfstrip " 500 << plct->getStrip() <<
" and key wire " << plct->getKeyWG()
501 <<
": found at bx " << bx <<
", whereas the latest allowed bx is " 510 if (bx_readout == -1 || bx == bx_readout) {
511 tmpV.push_back(*plct);
512 if (bx_readout == -1) bx_readout = bx;
516 else tmpV.push_back(*plct);
523 std::vector<CSCCorrelatedLCTDigi> tmpV;
546 bool anodeBestValid = bestALCT.
isValid();
547 bool anodeSecondValid = secondALCT.
isValid();
548 bool cathodeBestValid = bestCLCT.
isValid();
549 bool cathodeSecondValid = secondCLCT.
isValid();
551 if (anodeBestValid && !anodeSecondValid) secondALCT = bestALCT;
552 if (!anodeBestValid && anodeSecondValid) bestALCT = secondALCT;
553 if (cathodeBestValid && !cathodeSecondValid) secondCLCT = bestCLCT;
554 if (!cathodeBestValid && cathodeSecondValid) bestCLCT = secondCLCT;
562 int bx = lct.
getBX();
569 <<
"+++ Bx of first LCT candidate, " << bx
570 <<
", is not within the allowed range, [0-" <<
MAX_LCT_BINS-1
571 <<
"); skipping it... +++\n";
575 if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
580 int bx = lct.
getBX();
587 <<
"+++ Bx of second LCT candidate, " << bx
588 <<
", is not within the allowed range, [0-" <<
MAX_LCT_BINS-1
589 <<
"); skipping it... +++\n";
618 const int stripType) {
619 const int kPatternBitWidth = 4;
624 pattern = (
abs(ptn) & ((1<<(kPatternBitWidth-1))-1));
629 pattern = pattern | (1<<(kPatternBitWidth-1));
634 pattern = (
abs(ptn) & ((1<<kPatternBitWidth)-1));
655 if (isDistrip) {quality = 4;}
664 if (sumQual < 1 || sumQual > 6) {
666 <<
"+++ findQuality: sumQual = " << sumQual <<
"+++ \n";
669 if (sumQual == 2) {quality = 6;}
670 else if (sumQual == 3) {quality = 7;}
671 else if (sumQual == 4) {quality = 8;}
672 else if (sumQual == 5) {quality = 9;}
673 else if (sumQual == 6) {quality = 10;}
676 if (sumQual == 2) {quality = 11;}
677 else if (sumQual == 3) {quality = 12;}
678 else if (sumQual == 4) {quality = 13;}
679 else if (sumQual == 5) {quality = 14;}
680 else if (sumQual == 6) {quality = 15;}
701 if (sumQual < 1 || sumQual > 6) {
703 <<
"+++ findQuality: Unexpected sumQual = " << sumQual <<
"+++\n";
712 quality = offset + sumQual;
725 if (pattern == 1) quality = 3;
732 if (!a4 && !c4) quality = 5;
733 else if ( a4 && !c4) quality = 6;
734 else if (!a4 && c4) quality = 7;
735 else if ( a4 && c4) {
740 if (pattern == 2 || pattern == 3) quality = 11;
741 else if (pattern == 4 || pattern == 5) quality = 12;
742 else if (pattern == 6 || pattern == 7) quality = 13;
743 else if (pattern == 8 || pattern == 9) quality = 14;
744 else if (pattern == 10) quality = 15;
747 <<
"+++ findQuality: Unexpected CLCT pattern id = " 748 << pattern <<
"+++\n";
759 unsigned int lctPattern, lctQuality;
761 for (
int bend = 0; bend < 2; bend++) {
762 for (
int cfeb = 0; cfeb < 5; cfeb++) {
764 for (
int bx = 0; bx < 7; bx++) {
765 for (
int stripType = 0; stripType < 2; stripType++) {
771 for (
int aQuality = 0; aQuality < 4; aQuality++) {
772 for (
int wireGroup = 0; wireGroup < 120; wireGroup++) {
773 for (
int abx = 0; abx < 7; abx++) {
774 CSCALCTDigi aLCT(1, aQuality, 0, 1, wireGroup, abx);
777 thisLCT(0, 1, lctQuality, aLCT.
getKeyWG(),
780 if (lctPattern != static_cast<unsigned int>(thisLCT.getPattern()) )
782 <<
"pattern mismatch: " << lctPattern
783 <<
" " << thisLCT.getPattern();
784 if (bend != thisLCT.getBend())
786 <<
"bend mismatch: " << bend
787 <<
" " << thisLCT.getBend();
788 int key_strip = 32*cfeb +
strip;
789 if (key_strip != thisLCT.getStrip())
791 <<
"strip mismatch: " << key_strip
792 <<
" " << thisLCT.getStrip();
793 if (wireGroup != thisLCT.getKeyWG())
795 <<
"wire group mismatch: " << wireGroup
796 <<
" " << thisLCT.getKeyWG();
797 if (abx != thisLCT.getBX())
799 <<
"bx mismatch: " << abx <<
" " << thisLCT.getBX();
800 if (lctQuality != static_cast<unsigned int>(thisLCT.getQuality()))
802 <<
"quality mismatch: " << lctQuality
803 <<
" " << thisLCT.getQuality();
817 std::ostringstream strm;
819 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
820 strm <<
"+ TMB configuration parameters: +\n";
821 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
822 strm <<
" mpc_block_me1a [block/not block triggers which come from ME1/A] = " 824 strm <<
" alct_trig_enable [allow ALCT-only triggers] = " 826 strm <<
" clct_trig_enable [allow CLCT-only triggers] = " 828 strm <<
" match_trig_enable [allow matched ALCT-CLCT triggers] = " 830 strm <<
" match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " 832 strm <<
" tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " 834 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
835 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()
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
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