22 static std::atomic<bool> config_dumped{
false};
50 if (
infoV > 0 && !config_dumped) {
113 if (
nullptr == conf) {
116 static std::atomic<bool> config_dumped{
false};
127 alctProc->setConfigParameters(conf);
128 clctProc->setConfigParameters(conf);
132 if (!config_dumped) {
134 config_dumped =
true;
147 std::tuple<std::vector<CSCALCTDigi>, std::vector<CSCCLCTDigi>> retValue;
151 edm::LogError(
"CSCMotherboard|SetupError") <<
"+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
172 if (alctV.empty() and clctV.empty())
187 int bx_clct_matched = 0;
193 if (
alctProc->getBestALCT(bx_alct).isValid()) {
202 bool is_matched =
false;
205 std::vector<unsigned> clctBx_qualbend_match;
208 bool hasLocalShower =
false;
218 unsigned bx_clct_qualbend = clctBx_qualbend_match[mbx];
219 unsigned bx_clct = (
sort_clct_bx_ or not(hasLocalShower)) ? bx_clct_run2 : bx_clct_qualbend;
229 if (
clctProc->getBestCLCT(bx_clct).getQuality() <= 3)
232 if (
clctProc->getBestCLCT(bx_clct).isValid()) {
234 LogTrace(
"CSCMotherboard") <<
"Successful ALCT-CLCT match: bx_alct = " << bx_alct
235 <<
"; bx_clct = " << bx_clct <<
"; mbx = " << mbx;
247 if (
allLCTs_(bx_alct, mbx, 0).isValid()) {
249 used_clct_mask[bx_clct] =
true;
250 bx_clct_matched = bx_clct;
260 LogTrace(
"CSCMotherboard") <<
"Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " << bx_alct
261 <<
" first ALCT " <<
alctProc->getBestALCT(bx_alct);
278 if (bx_clct >= 0 && bx_clct > bx_clct_matched) {
281 LogTrace(
"CSCMotherboard") <<
"Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " << bx_clct;
300 std::vector<CSCCorrelatedLCTDigi> tmpV;
321 if (early_tbin < 0) {
323 <<
"Early time bin (early_tbin) smaller than minimum allowed, which is 0. set early_tbin to 0.";
326 if (late_tbin > max_late_tbin) {
328 <<
"Late time bin (late_tbin) larger than maximum allowed, which is " << max_late_tbin
329 <<
". set early_tbin to max allowed";
336 for (
const auto& lct :
lctV) {
338 if (!lct.isValid()) {
342 const int bx = lct.getBX();
344 if (
bx < early_tbin) {
346 LogDebug(
"CSCMotherboard") <<
" Do not report correlated LCT on key halfstrip " << lct.getStrip()
347 <<
" and key wire " << lct.getKeyWG() <<
": found at bx " <<
bx 348 <<
", whereas the earliest allowed bx is " << early_tbin;
353 if (
bx > late_tbin) {
355 LogDebug(
"CSCMotherboard") <<
" Do not report correlated LCT on key halfstrip " << lct.getStrip()
356 <<
" and key wire " << lct.getKeyWG() <<
": found at bx " <<
bx 357 <<
", whereas the latest allowed bx is " << late_tbin;
370 if (bx_readout == -1 ||
bx == bx_readout) {
372 if (bx_readout == -1)
384 for (
const auto& lct : tmpV) {
397 std::vector<CSCShowerDigi> showerOut;
455 if (bestCase1
or bestCase2
or bestCase3) {
475 if ((secondALCT != bestALCT)
or (secondCLCT != bestCLCT)) {
477 if (secondCase1
or secondCase2
or secondCase3)
485 secondALCT = bestALCT;
491 secondCLCT = bestCLCT;
535 const int kPatternBitWidth = 4;
538 unsigned int pattern = (
abs(ptn) & ((1 << kPatternBitWidth) - 1));
548 std::vector<CSCCorrelatedLCTDigi> tempV;
560 for (
const auto& lct : tempV) {
567 for (
const auto& lct :
lctV) {
568 LogDebug(
"CSCMotherboard") <<
"Selected LCT" << lct;
577 clctBxVector.clear();
581 int tempQualBend = 0;
584 if (!
clctProc->getBestCLCT(bx_clct).isValid()) {
585 clctQualBendArray[bx_clct] = tempQualBend;
593 int clctQualBend = clctBend | (bestCLCT.
getQuality() << 5);
594 clctQualBendArray[bx_clct] = clctQualBend;
595 if (clctBxVector.empty())
596 clctBxVector.push_back(bx_clct);
598 for (
auto it = clctBxVector.begin(); it != clctBxVector.end(); it++)
599 if (clctQualBend > clctQualBendArray[*it]) {
600 clctBxVector.insert(it, bx_clct);
614 static constexpr
unsigned int max_mpc_block_me1a = 1 << 1;
615 static constexpr
unsigned int max_alct_trig_enable = 1 << 1;
616 static constexpr
unsigned int max_clct_trig_enable = 1 << 1;
617 static constexpr
unsigned int max_match_trig_enable = 1 << 1;
618 static constexpr
unsigned int max_match_trig_window_size = 1 << 4;
619 static constexpr
unsigned int max_tmb_l1a_window_size = 1 << 4;
637 std::ostringstream strm;
639 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
640 strm <<
"+ TMB configuration parameters: +\n";
641 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
642 strm <<
" mpc_block_me1a [block/not block triggers which come from ME1/A] = " <<
mpc_block_me1a_ <<
"\n";
643 strm <<
" alct_trig_enable [allow ALCT-only triggers] = " <<
alct_trig_enable_ <<
"\n";
644 strm <<
" clct_trig_enable [allow CLCT-only triggers] = " <<
clct_trig_enable_ <<
"\n";
645 strm <<
" match_trig_enable [allow matched ALCT-CLCT triggers] = " <<
match_trig_enable_ <<
"\n";
646 strm <<
" match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " <<
match_trig_window_size_ <<
"\n";
647 strm <<
" tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " <<
tmb_l1a_window_size_ <<
"\n";
648 strm <<
"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
649 LogDebug(
"CSCMotherboard") << strm.str();
668 ashower = anode_showers[
bx];
676 if (cathode_showers[cbx].
isValid() and not used_cshower_mask[cbx]) {
677 cshower = cathode_showers[cbx];
678 used_cshower_mask[cbx] =
true;
683 cshower = cathode_showers[
bx];
686 unsigned matchHMT = 0;
707 CSCShowerDigi::ShowerType::kLCTShower,
718 auto cshowers_v =
clctProc->getAllShower();
719 auto ashowers_v =
alctProc->getAllShower();
721 std::copy(cshowers_v.begin(), cshowers_v.end(), cathode_showers);
722 std::copy(ashowers_v.begin(), ashowers_v.end(), anode_showers);
727 std::copy(std::begin(cathode_showers), std::end(cathode_showers), std::begin(
showers_));
730 std::copy(std::begin(anode_showers), std::end(anode_showers), std::begin(
showers_));
739 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
unsigned int encodePattern(const int clctPattern) const
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
std::tuple< std::vector< CSCALCTDigi >, std::vector< CSCCLCTDigi > > runCommon(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const RunContext &context)
unsigned int tmb_l1a_window_size_
unsigned int alct_trig_enable_
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
unsigned int match_trig_enable_
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
edm::ParameterSet const & showerParams() const
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)
bool getQuartStripBit() const
get single quart strip bit
const unsigned theTrigChamber
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const RunContext &)
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, CSCCorrelatedLCTDigi &bLCT, CSCCorrelatedLCTDigi &sLCT, int type) const
bool isTightInTime() const
CSCMotherboard(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, CSCBaseboard::Parameters &conf)
unsigned int tmbMatchTrigWindowSize() const
std::vector< int > preferred_bx_match_
bool match_earliest_clct_only_
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
void dumpConfigParams() const
uint16_t getKeyWG() const
return key wire group
edm::ParameterSet const & tmbParams() const
const CSCChamber * cscChamber(CSCGeometry const &) const
Abs< T >::type abs(const T &t)
void checkConfigParameters()
bool ignoreAlctCrossClct_
void copyValidToInValidCLCT(CSCCLCTDigi &, CSCCLCTDigi &) const
unsigned int match_trig_window_size_
bool isValid() const
check CLCT validity (1 - valid CLCT)
unsigned int mpc_block_me1a_
std::vector< unsigned > showerSource_
bool isNominalInTime() const
void setBX(const uint16_t BX)
set BX
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
edm::ParameterSet const & conf() const
void setBX(const uint16_t bx)
set bx
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
uint16_t getWireNHits() const
uint16_t getSlope() const
return the slope
unsigned int tmbClctTrigEnable() const
void encodeHighMultiplicityBits()
unsigned int tmbAlctTrigEnable() const
uint16_t getRun3Pattern() const
return pattern
unsigned int clct_trig_enable_
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
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