22 static std::atomic<bool> config_dumped{
false};
50 if (
infoV > 0 && !config_dumped) {
116 static std::atomic<bool> config_dumped{
false};
127 alctProc->setConfigParameters(conf);
128 clctProc->setConfigParameters(conf);
132 if (!config_dumped) {
134 config_dumped =
true;
152 edm::LogError(
"CSCMotherboard|SetupError") <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
188 int bx_clct_matched = 0;
194 if (
alctProc->getBestALCT(bx_alct).isValid()) {
203 bool is_matched =
false;
206 std::vector<unsigned> clctBx_qualbend_match;
209 bool hasLocalShower =
false;
219 unsigned bx_clct_qualbend = clctBx_qualbend_match[mbx];
220 unsigned bx_clct = (
sort_clct_bx_ or not(hasLocalShower)) ? bx_clct_run2 : bx_clct_qualbend;
230 if (
clctProc->getBestCLCT(bx_clct).getQuality() <= 3)
233 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
235 LogTrace(
"CSCMotherboard") <<
"Successful ALCT-CLCT match: bx_alct = " << bx_alct
236 <<
"; bx_clct = " << bx_clct <<
"; mbx = " << mbx;
248 if (
allLCTs_(bx_alct, mbx, 0).isValid()) {
250 used_clct_mask[bx_clct] =
true;
251 bx_clct_matched = bx_clct;
261 LogTrace(
"CSCMotherboard") <<
"Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " << bx_alct
262 <<
" first ALCT " <<
alctProc->getBestALCT(bx_alct);
279 if (bx_clct >= 0 && bx_clct > bx_clct_matched) {
282 LogTrace(
"CSCMotherboard") <<
"Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " << bx_clct;
301 std::vector<CSCCorrelatedLCTDigi> tmpV;
322 if (early_tbin < 0) {
324 <<
"Early time bin (early_tbin) smaller than minimum allowed, which is 0. set early_tbin to 0.";
327 if (late_tbin > max_late_tbin) {
329 <<
"Late time bin (late_tbin) larger than maximum allowed, which is " << max_late_tbin
330 <<
". set early_tbin to max allowed";
337 for (
const auto& lct :
lctV) {
339 if (!lct.isValid()) {
343 const int bx = lct.getBX();
345 if (
bx < early_tbin) {
347 LogDebug(
"CSCMotherboard") <<
" Do not report correlated LCT on key halfstrip " << lct.getStrip()
348 <<
" and key wire " << lct.getKeyWG() <<
": found at bx " <<
bx 349 <<
", whereas the earliest allowed bx is " << early_tbin;
354 if (
bx > late_tbin) {
356 LogDebug(
"CSCMotherboard") <<
" Do not report correlated LCT on key halfstrip " << lct.getStrip()
357 <<
" and key wire " << lct.getKeyWG() <<
": found at bx " <<
bx 358 <<
", whereas the latest allowed bx is " << late_tbin;
371 if (bx_readout == -1 ||
bx == bx_readout) {
373 if (bx_readout == -1)
385 for (
const auto& lct : tmpV) {
398 std::vector<CSCShowerDigi> showerOut;
456 if (bestCase1
or bestCase2
or bestCase3) {
476 if ((secondALCT != bestALCT)
or (secondCLCT != bestCLCT)) {
478 if (secondCase1
or secondCase2
or secondCase3)
486 secondALCT = bestALCT;
492 secondCLCT = bestCLCT;
536 const int kPatternBitWidth = 4;
539 unsigned int pattern = (
abs(ptn) & ((1 << kPatternBitWidth) - 1));
549 std::vector<CSCCorrelatedLCTDigi> tempV;
561 for (
const auto& lct : tempV) {
568 for (
const auto& lct :
lctV) {
569 LogDebug(
"CSCMotherboard") <<
"Selected LCT" << lct;
578 clctBxVector.clear();
582 int tempQualBend = 0;
585 if (!
clctProc->getBestCLCT(bx_clct).isValid()) {
586 clctQualBendArray[bx_clct] = tempQualBend;
594 int clctQualBend = clctBend | (bestCLCT.
getQuality() << 5);
595 clctQualBendArray[bx_clct] = clctQualBend;
596 if (clctBxVector.empty())
597 clctBxVector.push_back(bx_clct);
599 for (
auto it = clctBxVector.begin(); it != clctBxVector.end(); it++)
600 if (clctQualBend > clctQualBendArray[*it]) {
601 clctBxVector.insert(it, bx_clct);
615 static const unsigned int max_mpc_block_me1a = 1 << 1;
616 static const unsigned int max_alct_trig_enable = 1 << 1;
617 static const unsigned int max_clct_trig_enable = 1 << 1;
618 static const unsigned int max_match_trig_enable = 1 << 1;
619 static const unsigned int max_match_trig_window_size = 1 << 4;
620 static const unsigned int max_tmb_l1a_window_size = 1 << 4;
636 std::ostringstream strm;
638 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
639 strm <<
"+ TMB configuration parameters: +\n";
640 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
641 strm <<
" mpc_block_me1a [block/not block triggers which come from ME1/A] = " <<
mpc_block_me1a <<
"\n";
642 strm <<
" alct_trig_enable [allow ALCT-only triggers] = " <<
alct_trig_enable <<
"\n";
643 strm <<
" clct_trig_enable [allow CLCT-only triggers] = " <<
clct_trig_enable <<
"\n";
644 strm <<
" match_trig_enable [allow matched ALCT-CLCT triggers] = " <<
match_trig_enable <<
"\n";
645 strm <<
" match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " <<
match_trig_window_size <<
"\n";
646 strm <<
" tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " <<
tmb_l1a_window_size <<
"\n";
647 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
648 LogDebug(
"CSCMotherboard") << strm.str();
667 ashower = anode_showers[
bx];
675 if (cathode_showers[cbx].
isValid() and not used_cshower_mask[cbx]) {
676 cshower = cathode_showers[cbx];
677 used_cshower_mask[cbx] =
true;
682 cshower = cathode_showers[
bx];
685 unsigned matchHMT = 0;
706 CSCShowerDigi::ShowerType::kLCTShower,
717 auto cshowers_v =
clctProc->getAllShower();
718 auto ashowers_v =
alctProc->getAllShower();
720 std::copy(cshowers_v.begin(), cshowers_v.end(), cathode_showers);
721 std::copy(ashowers_v.begin(), ashowers_v.end(), anode_showers);
726 std::copy(std::begin(cathode_showers), std::end(cathode_showers), std::begin(
showers_));
729 std::copy(std::begin(anode_showers), std::end(anode_showers), std::begin(
showers_));
738 std::copy(std::begin(anode_showers), std::end(anode_showers), std::begin(
showers_));
bool isValid() const
check ALCT validity (1 - valid ALCT)
T getParameter(std::string const &) const
unsigned thisShowerSource_
virtual std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
uint16_t getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
std::vector< CSCCLCTDigi > clctV
unsigned int clct_trig_enable
void setESLookupTables(const CSCL1TPLookupTableCCLUT *conf)
unsigned int encodePattern(const int clctPattern) const
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
unsigned int match_trig_window_size
static const unsigned int def_alct_trig_enable
void checkConfigParameters(unsigned int &var, const unsigned int var_max, const unsigned int var_def, const std::string &var_str)
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
unsigned int tmbMpcBlockMe1a() const
uint16_t getComparatorNHits() const
CSCShowerDigi showers_[CSCConstants::MAX_LCT_TBINS]
uint16_t getKeyStrip(const uint16_t n=2) const
static const unsigned int def_mpc_block_me1a
bool getEighthStripBit() const
get single eighth strip bit
std::vector< CSCCorrelatedLCTDigi > lctV
void matchShowers(CSCShowerDigi *anode_showers, CSCShowerDigi *cathode_showers, bool andlogic)
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
static const unsigned int def_clct_trig_enable
Log< level::Error, false > LogError
unsigned short iChamberType() const
unsigned int tmbTmbL1aWindowSize() const
bool isRun3() const
Distinguish Run-1/2 from Run-3.
bool isLooseInTime() const
void copyValidToInValidALCT(CSCALCTDigi &, CSCALCTDigi &) const
CSCCLCTDigi getBXShiftedCLCT(const CSCCLCTDigi &) const
void setMatchTrigWindowSize(unsigned trig_window_size)
unsigned int mpc_block_me1a
bool getQuartStripBit() const
get single quart strip bit
const unsigned theTrigChamber
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, CSCCorrelatedLCTDigi &bLCT, CSCCorrelatedLCTDigi &sLCT, int type) const
bool isTightInTime() const
unsigned int tmbMatchTrigWindowSize() const
std::vector< int > preferred_bx_match_
bool match_earliest_clct_only_
CSCMotherboard(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
std::unique_ptr< CSCALCTCrossCLCT > cscOverlap_
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
std::vector< CSCALCTDigi > alctV
void dumpConfigParams() const
uint16_t getKeyWG() const
return key wire group
Abs< T >::type abs(const T &t)
unsigned int tmb_l1a_window_size
void checkConfigParameters()
unsigned int match_trig_enable
bool ignoreAlctCrossClct_
void copyValidToInValidCLCT(CSCCLCTDigi &, CSCCLCTDigi &) const
bool isValid() const
check CLCT validity (1 - valid CLCT)
std::vector< unsigned > showerSource_
bool isNominalInTime() const
void setBX(const uint16_t BX)
set BX
const CSCGeometry * cscGeometry_
edm::ParameterSet tmbParams_
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
uint16_t getCSCID() const
bool doesALCTCrossCLCT(const CSCALCTDigi &, const CSCCLCTDigi &) const
void sortCLCTByQualBend(int alct_bx, std::vector< unsigned > &clctBxVector)
const unsigned theStation
static const unsigned int def_match_trig_window_size
unsigned int tmbMatchTrigEnable() const
uint16_t getBX() const
return BX
uint16_t getPattern() const
return pattern
unsigned int alct_trig_enable
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
void setBX(const uint16_t bx)
set bx
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
uint16_t getWireNHits() const
const CSCL1TPLookupTableCCLUT * lookupTableCCLUT_
uint16_t getSlope() const
return the slope
unsigned int tmbClctTrigEnable() const
void encodeHighMultiplicityBits()
unsigned int tmbAlctTrigEnable() const
uint16_t getRun3Pattern() const
return pattern
void clear()
clear this CLCT
std::vector< CSCShowerDigi > readoutShower() const
void clear()
clear this Shower
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
Log< level::Warning, false > LogWarning
edm::ParameterSet showerParams_
void setConfigParameters(const CSCDBL1TPParameters *conf)
std::unique_ptr< LCTQualityControl > qualityControl_
static const unsigned int def_match_trig_enable
std::unique_ptr< LCTQualityAssignment > qualityAssignment_
void constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb, CSCCorrelatedLCTDigi &lct) const