18 :
CSCBaseboard(endcap, station, sector, subsector, chamber, conf) {
21 static std::atomic<bool> config_dumped{
false};
50 if (infoV > 0 && !config_dumped) {
58 static std::atomic<bool> config_dumped{
false};
75 if (
infoV > 0 && !config_dumped) {
101 static std::atomic<bool> config_dumped{
false};
112 alctProc->setConfigParameters(conf);
113 clctProc->setConfigParameters(conf);
117 if (!config_dumped) {
119 config_dumped =
true;
130 edm::LogError(
"CSCMotherboard|SetupError") <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
147 int used_alct_mask[20];
148 for (
int a = 0;
a < 20; ++
a)
149 used_alct_mask[
a] = 0;
151 int bx_alct_matched = 0;
157 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
166 bool is_matched =
false;
170 for (
int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
176 if (
alctProc->getBestALCT(bx_alct).isValid()) {
178 LogTrace(
"CSCMotherboard") <<
"Successful CLCT-ALCT match: bx_clct = " << bx_clct <<
"; match window: [" 179 << bx_alct_start <<
"; " << bx_alct_stop <<
"]; bx_alct = " << bx_alct;
185 used_alct_mask[bx_alct] += 1;
187 bx_alct_matched = bx_alct;
195 LogTrace(
"CSCMotherboard") <<
"Unsuccessful CLCT-ALCT match (CLCT only): bx_clct = " << bx_clct
196 <<
" first ALCT " <<
clctProc->getBestCLCT(bx_clct) <<
"; match window: [" 197 << bx_alct_start <<
"; " << bx_alct_stop <<
"]";
211 if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
214 LogTrace(
"CSCMotherboard") <<
"Unsuccessful CLCT-ALCT match (ALCT only): bx_alct = " << bx_alct;
227 int used_clct_mask[20];
228 for (
int a = 0;
a < 20; ++
a)
229 used_clct_mask[
a] = 0;
231 int bx_clct_matched = 0;
237 if (
alctProc->getBestALCT(bx_alct).isValid()) {
246 bool is_matched =
false;
250 for (
int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
256 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
258 LogTrace(
"CSCMotherboard") <<
"Successful ALCT-CLCT match: bx_alct = " << bx_alct <<
"; match window: [" 259 << bx_clct_start <<
"; " << bx_clct_stop <<
"]; bx_clct = " << bx_clct;
265 used_clct_mask[bx_clct] += 1;
267 bx_clct_matched = bx_clct;
275 LogTrace(
"CSCMotherboard") <<
"Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " << bx_alct
276 <<
" first ALCT " <<
alctProc->getBestALCT(bx_alct) <<
"; match window: [" 277 << bx_clct_start <<
"; " << bx_clct_stop <<
"]";
292 if (bx_clct >= 0 && bx_clct > bx_clct_matched) {
295 LogTrace(
"CSCMotherboard") <<
"Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " << bx_clct;
322 std::vector<CSCCorrelatedLCTDigi> tmpV;
338 <<
"+++ early_tbins = " <<
early_tbins <<
"; in-time LCTs are not getting read-out!!! +++" 345 <<
"+++ Allowed range of time bins, [0-" << late_tbins <<
"] exceeds max allowed, " 347 <<
"+++ Set late_tbins to max allowed +++\n";
348 late_tbins = CSCConstants::MAX_LCT_TBINS - 1;
356 const std::vector<CSCCorrelatedLCTDigi>& all_lcts =
getLCTs();
357 for (
auto plct = all_lcts.begin(); plct != all_lcts.end(); plct++) {
358 if (!plct->isValid())
361 int bx = (*plct).getBX();
365 LogDebug(
"CSCMotherboard") <<
" Do not report correlated LCT on key halfstrip " << plct->getStrip()
366 <<
" and key wire " << plct->getKeyWG() <<
": found at bx " << bx
367 <<
", whereas the earliest allowed bx is " <<
early_tbins + 1;
372 if (bx > late_tbins) {
374 LogDebug(
"CSCMotherboard") <<
" Do not report correlated LCT on key halfstrip " << plct->getStrip()
375 <<
" and key wire " << plct->getKeyWG() <<
": found at bx " << bx
376 <<
", whereas the latest allowed bx is " << late_tbins;
384 if (bx_readout == -1 || bx == bx_readout) {
385 tmpV.push_back(*plct);
386 if (bx_readout == -1)
392 tmpV.push_back(*plct);
399 std::vector<CSCCorrelatedLCTDigi> tmpV;
420 bool anodeBestValid = bestALCT.
isValid();
421 bool anodeSecondValid = secondALCT.
isValid();
422 bool cathodeBestValid = bestCLCT.
isValid();
423 bool cathodeSecondValid = secondCLCT.
isValid();
425 if (anodeBestValid && !anodeSecondValid)
426 secondALCT = bestALCT;
427 if (!anodeBestValid && anodeSecondValid)
428 bestALCT = secondALCT;
429 if (cathodeBestValid && !cathodeSecondValid)
430 secondCLCT = bestCLCT;
431 if (!cathodeBestValid && cathodeSecondValid)
432 bestCLCT = secondCLCT;
445 <<
"+++ Bx of first LCT candidate, " << bx <<
", is not within the allowed range, [0-" 450 if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
460 <<
"+++ Bx of second LCT candidate, " << bx <<
", is not within the allowed range, [0-" 483 trknmb, 1, quality, aLCT.
getKeyWG(), cLCT.
getKeyStrip(),
pattern, cLCT.
getBend(),
bx, 0, 0, 0,
theTrigChamber);
493 const int kPatternBitWidth = 4;
496 unsigned int pattern = (
abs(ptn) & ((1 << kPatternBitWidth) - 1));
535 if (pattern == 2 || pattern == 3)
537 else if (pattern == 4 || pattern == 5)
539 else if (pattern == 6 || pattern == 7)
541 else if (pattern == 8 || pattern == 9)
543 else if (pattern == 10)
548 <<
"+++ findQuality: Unexpected CLCT pattern id = " << pattern <<
"+++\n";
561 static const unsigned int max_mpc_block_me1a = 1 << 1;
562 static const unsigned int max_alct_trig_enable = 1 << 1;
563 static const unsigned int max_clct_trig_enable = 1 << 1;
564 static const unsigned int max_match_trig_enable = 1 << 1;
565 static const unsigned int max_match_trig_window_size = 1 << 4;
566 static const unsigned int max_tmb_l1a_window_size = 1 << 4;
572 <<
"+++ Value of mpc_block_me1a, " <<
mpc_block_me1a <<
", exceeds max allowed, " << max_mpc_block_me1a - 1
574 <<
"+++ Try to proceed with the default value, mpc_block_me1a=" <<
def_mpc_block_me1a <<
" +++\n";
580 <<
"+++ Value of alct_trig_enable, " <<
alct_trig_enable <<
", exceeds max allowed, " 581 << max_alct_trig_enable - 1 <<
" +++\n" 582 <<
"+++ Try to proceed with the default value, alct_trig_enable=" <<
def_alct_trig_enable <<
" +++\n";
588 <<
"+++ Value of clct_trig_enable, " <<
clct_trig_enable <<
", exceeds max allowed, " 589 << max_clct_trig_enable - 1 <<
" +++\n" 590 <<
"+++ Try to proceed with the default value, clct_trig_enable=" <<
def_clct_trig_enable <<
" +++\n";
596 <<
"+++ Value of match_trig_enable, " <<
match_trig_enable <<
", exceeds max allowed, " 597 << max_match_trig_enable - 1 <<
" +++\n" 598 <<
"+++ Try to proceed with the default value, match_trig_enable=" <<
def_match_trig_enable <<
" +++\n";
605 << max_match_trig_window_size - 1 <<
" +++\n" 613 <<
"+++ Value of tmb_l1a_window_size, " <<
tmb_l1a_window_size <<
", exceeds max allowed, " 614 << max_tmb_l1a_window_size - 1 <<
" +++\n" 621 std::ostringstream strm;
623 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
624 strm <<
"+ TMB configuration parameters: +\n";
625 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
626 strm <<
" mpc_block_me1a [block/not block triggers which come from ME1/A] = " <<
mpc_block_me1a <<
"\n";
627 strm <<
" alct_trig_enable [allow ALCT-only triggers] = " <<
alct_trig_enable <<
"\n";
628 strm <<
" clct_trig_enable [allow CLCT-only triggers] = " <<
clct_trig_enable <<
"\n";
629 strm <<
" match_trig_enable [allow matched ALCT-CLCT triggers] = " <<
match_trig_enable <<
"\n";
630 strm <<
" match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " <<
match_trig_window_size <<
"\n";
631 strm <<
" tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " <<
tmb_l1a_window_size <<
"\n";
632 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
633 LogDebug(
"CSCMotherboard") << strm.str();
int getQuality() const
return quality of a pattern (number of layers hit!)
T getParameter(std::string const &) const
std::vector< CSCCLCTDigi > clctV
unsigned int clct_trig_enable
unsigned int match_trig_window_size
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
CSCCLCTDigi getBXShiftedCLCT(const CSCCLCTDigi &) const
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]
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
static const unsigned int def_clct_trig_enable
int getBend() const
return bend
unsigned int mpc_block_me1a
std::vector< CSCCorrelatedLCTDigi > getLCTs() const
const unsigned theTrigChamber
unsigned int tmbTmbL1aWindowSize() const
void setBX(const int bx)
set bx
unsigned int tmbMatchTrigWindowSize() const
static const unsigned int def_tmb_l1a_window_size
std::vector< CSCALCTDigi > alctV
int getBX() const
return BX
unsigned int tmbAlctTrigEnable() const
Abs< T >::type abs(const T &t)
unsigned int encodePattern(const int clctPattern) const
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
const CSCGeometry * cscGeometry_
unsigned int tmbMpcBlockMe1a() const
edm::ParameterSet tmbParams_
int getQuality() const
return quality of a pattern
virtual 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 alct_trig_enable
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
void dumpConfigParams() const
void setConfigParameters(const CSCDBL1TPParameters *conf)
int getKeyWG() const
return key wire group
unsigned int alctClctOffset_
static const unsigned int def_match_trig_enable
virtual std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
void setBX(const int BX)
set BX
unsigned int tmbMatchTrigEnable() const
CSCCorrelatedLCTDigi firstLCT[CSCConstants::MAX_LCT_TBINS]