CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
CSCCathodeLCTProcessor Class Reference

#include <CSCCathodeLCTProcessor.h>

Inheritance diagram for CSCCathodeLCTProcessor:
CSCBaseboard CSCUpgradeCathodeLCTProcessor

Public Member Functions

void clear ()
 
 CSCCathodeLCTProcessor (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, CSCBaseboard::Parameters &conf)
 
std::vector< CSCShowerDigigetAllShower () const
 
CSCCLCTDigi getBestCLCT (int bx) const
 
std::vector< CSCCLCTDigigetCLCTs () const
 
bool getLocalShowerFlag (int bx) const
 
CSCCLCTDigi getSecondCLCT (int bx) const
 
std::vector< int > preTriggerBXs () const
 
std::vector< CSCCLCTPreTriggerDigipreTriggerDigis () const
 
std::vector< CSCCLCTDigireadoutCLCTs () const
 
std::vector< CSCShowerDigireadoutShower () const
 
std::vector< CSCCLCTDigirun (const CSCComparatorDigiCollection *compdc, const CSCChamber *chamber, const CSCL1TPLookupTableCCLUT *lookupTable)
 
void run (const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], const CSCL1TPLookupTableCCLUT *lookupTable)
 
void setConfigParameters (const CSCDBL1TPParameters *conf)
 
 ~CSCCathodeLCTProcessor () override=default
 
- Public Member Functions inherited from CSCBaseboard
 CSCBaseboard (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, Parameters &conf)
 
 CSCBaseboard ()
 
std::string getCSCName () const
 
CSCDetId id () const
 
virtual ~CSCBaseboard ()=default
 

Protected Member Functions

void checkConfigParameters ()
 
void checkLocalShower (int zone, const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
 
void cleanComparatorContainer (CSCCLCTDigi &lct) const
 
void clearPreTriggers ()
 
CSCCLCTDigi constructCLCT (const int bx, const unsigned halfstrip_withstagger, const CSCCLCTDigi::ComparatorContainer &hits, const CSCL1TPLookupTableCCLUT *lookupTable)
 
CSCCLCTPreTriggerDigi constructPreCLCT (const int bx, const unsigned halfstrip, const unsigned index) const
 
void dumpConfigParams () const
 
void dumpDigis (const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const
 
void encodeHighMultiplicityBits ()
 
virtual std::vector< CSCCLCTDigifindLCTs (const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], const CSCL1TPLookupTableCCLUT *lookupTable)
 
bool getDigis (const CSCComparatorDigiCollection *compdc)
 
void getDigis (const CSCComparatorDigiCollection *compdc, const CSCDetId &id)
 
void markBusyKeys (const int best_hstrip, const int best_patid, int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
 
bool patternFinding (const unsigned int bx_time, std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &hits_in_patterns)
 
virtual bool preTrigger (const int start_bx, int &first_bx)
 
void pulseExtension (const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
 
void readComparatorDigis (std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
 
void setDefaultConfigParameters ()
 
- Protected Member Functions inherited from CSCBaseboard
void checkConfigParameters (unsigned int &var, const unsigned int var_max, const unsigned int var_def, const std::string &var_str)
 
const CSCChambercscChamber (CSCGeometry const &) const
 

Protected Attributes

unsigned int best_pid [CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
 
CSCCLCTDigi bestCLCT [CSCConstants::MAX_CLCT_TBINS]
 
CSCShowerDigi cathode_showers_ [CSCConstants::MAX_CLCT_TBINS]
 
std::unique_ptr< ComparatorCodeLUTcclut_
 
CSCPatternBank::LCTPatterns clct_pattern_ = {}
 
std::vector< CSCComparatorDigidigiV [CSCConstants::NUM_LAYERS]
 
unsigned int drift_delay
 
int early_tbins
 
unsigned int fifo_pretrig
 
unsigned int fifo_tbins
 
unsigned int hit_persist
 
bool ispretrig_ [CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
 
bool localShowerFlag [CSCConstants::MAX_CLCT_TBINS]
 
int localShowerThresh
 
int localShowerZone
 
unsigned maxbx_readout_
 
unsigned int min_separation
 
unsigned minbx_readout_
 
unsigned minLayersCentralTBin_
 
unsigned int nhits [CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
 
unsigned int nplanes_hit_pattern
 
unsigned int nplanes_hit_pretrig
 
int numCFEBs_
 
int numHalfStrips_
 
int numStrips_
 
bool peakCheck_
 
unsigned int pid_thresh_pretrig
 
PulseArray pulse_
 
std::unique_ptr< LCTQualityControlqualityControl_
 
bool readout_earliest_2
 
CSCCLCTDigi secondCLCT [CSCConstants::MAX_CLCT_TBINS]
 
unsigned showerNumTBins_
 
int stagger [CSCConstants::NUM_LAYERS]
 
int start_bx_shift
 
std::vector< int > thePreTriggerBXs
 
std::vector< CSCCLCTPreTriggerDigithePreTriggerDigis
 
std::vector< unsigned > thresholds_
 
unsigned int tmb_l1a_window_size
 
- Protected Attributes inherited from CSCBaseboard
CSCDetId cscId_
 
bool disableME1a_
 
bool enableAlctPhase2_
 
bool gangedME1a_
 
int infoV
 
bool isME11_
 
bool isME12_
 
bool isME13_
 
bool isME21_
 
bool isME22_
 
bool isME31_
 
bool isME32_
 
bool isME41_
 
bool isME42_
 
bool run3_
 
bool runCCLUT_
 
bool runCCLUT_OTMB_
 
bool runCCLUT_TMB_
 
bool runME11ILT_
 
bool runME11Up_
 
bool runME21ILT_
 
bool runME21Up_
 
bool runME31Up_
 
bool runME41Up_
 
bool runPhase2_
 
unsigned theChamber
 
std::string theCSCName_
 
const unsigned theEndcap
 
int theRegion
 
unsigned theRing
 
const unsigned theSector
 
const unsigned theStation
 
const unsigned theSubsector
 
const unsigned theTrigChamber
 

Static Protected Attributes

static const unsigned int def_drift_delay = 2
 
static const unsigned int def_fifo_pretrig = 7
 
static const unsigned int def_fifo_tbins = 12
 
static const unsigned int def_hit_persist = 6
 
static const unsigned int def_min_separation = 10
 
static const unsigned int def_nplanes_hit_pattern = 4
 
static const unsigned int def_nplanes_hit_pretrig = 2
 
static const unsigned int def_pid_thresh_pretrig = 2
 
static const unsigned int def_tmb_l1a_window_size = 7
 

Detailed Description

This class simulates the functionality of the cathode LCT card. It is run by the MotherBoard and returns up to two CathodeLCTs. It can be run either in a test mode, where it is passed arrays of halfstrip times, or in normal mode where it determines the time and comparator information from the comparator digis.

The CathodeLCTs only come halfstrip flavors

Date
May 2001 Removed the card boundaries. Changed the Pretrigger to emulate the hardware electronic logic. Also changed the keylayer to be the 4th layer in a chamber instead of the 3rd layer from the interaction region. The code is a more realistic simulation of hardware LCT logic now. -Jason Mumford.
Author
Benn Tannenbaum UCLA 13 July 1999 benn@.nosp@m.phys.nosp@m.ics.u.nosp@m.cla..nosp@m.edu Numerous later improvements by Jason Mumford and Slava Valuev (see cvs in ORCA). Porting from ORCA by S. Valuev (Slava.nosp@m..Val.nosp@m.uev@c.nosp@m.ern..nosp@m.ch), May 2006.

Updates for high pileup running by Vadim Khotilovich (TAMU), December 2012

Updates for integrated local trigger with GEMs by Sven Dildick (TAMU) and Tao Huang (TAMU), April 2015

Removing usage of outdated class CSCTriggerGeometry by Sven Dildick (TAMU)

Definition at line 44 of file CSCCathodeLCTProcessor.h.

Constructor & Destructor Documentation

◆ CSCCathodeLCTProcessor()

CSCCathodeLCTProcessor::CSCCathodeLCTProcessor ( unsigned  endcap,
unsigned  station,
unsigned  sector,
unsigned  subsector,
unsigned  chamber,
CSCBaseboard::Parameters conf 
)

Normal constructor.

Definition at line 21 of file CSCCathodeLCTProcessor.cc.

References cms::cuda::assert(), cclut_, relativeConstraints::chamber, checkConfigParameters(), CSCConstants::CLCT_EMUL_TIME_OFFSET, clct_pattern_, CSCPatternBank::clct_pattern_legacy_, CSCPatternBank::clct_pattern_run3_, CSCBaseboard::Parameters::clctParams(), CSCBaseboard::Parameters::conf(), drift_delay, dumpConfigParams(), early_tbins, makeMuonMisalignmentScenario::endcap, fifo_pretrig, fifo_tbins, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), hit_persist, mps_fire::i, CSCBaseboard::infoV, ispretrig_, CSCConstants::LCT_CENTRAL_BX, localShowerThresh, localShowerZone, CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER, maxbx_readout_, min_separation, minbx_readout_, minLayersCentralTBin_, nplanes_hit_pattern, nplanes_hit_pretrig, CSCConstants::NUM_LAYERS, numStrips_, peakCheck_, pid_thresh_pretrig, qualityControl_, readout_earliest_2, CSCBaseboard::runCCLUT_, nano_mu_digi_cff::sector, showerNumTBins_, CSCBaseboard::Parameters::showerParams(), stagger, start_bx_shift, relativeConstraints::station, nano_mu_digi_cff::subsector, thePreTriggerDigis, thresholds_, tmb_l1a_window_size, and CSCBaseboard::Parameters::tmbParams().

28  static std::atomic<bool> config_dumped{false};
29 
30  // CLCT configuration parameters.
31  fifo_tbins = conf.clctParams().getParameter<unsigned int>("clctFifoTbins");
32  hit_persist = conf.clctParams().getParameter<unsigned int>("clctHitPersist");
33  drift_delay = conf.clctParams().getParameter<unsigned int>("clctDriftDelay");
34  nplanes_hit_pretrig = conf.clctParams().getParameter<unsigned int>("clctNplanesHitPretrig");
35  nplanes_hit_pattern = conf.clctParams().getParameter<unsigned int>("clctNplanesHitPattern");
36 
37  // Not used yet.
38  fifo_pretrig = conf.clctParams().getParameter<unsigned int>("clctFifoPretrig");
39 
40  pid_thresh_pretrig = conf.clctParams().getParameter<unsigned int>("clctPidThreshPretrig");
41  min_separation = conf.clctParams().getParameter<unsigned int>("clctMinSeparation");
42 
43  start_bx_shift = conf.clctParams().getParameter<int>("clctStartBxShift");
44 
45  localShowerZone = conf.clctParams().getParameter<int>("clctLocalShowerZone");
46 
47  localShowerThresh = conf.clctParams().getParameter<int>("clctLocalShowerThresh");
48 
49  // Motherboard parameters: common for all configurations.
50  tmb_l1a_window_size = // Common to CLCT and TMB
51  conf.tmbParams().getParameter<unsigned int>("tmbL1aWindowSize");
52 
53  /*
54  In Summer 2021 the CLCT readout function was updated so that the
55  window is based on a number of time bins around the central CLCT
56  time BX7. In the past the window was based on early_tbins and late_tbins.
57  The parameter is kept, but is not used.
58  */
59  early_tbins = conf.tmbParams().getParameter<int>("tmbEarlyTbins");
60  if (early_tbins < 0)
62 
63  // wether to readout only the earliest two LCTs in readout window
64  readout_earliest_2 = conf.tmbParams().getParameter<bool>("tmbReadoutEarliest2");
65 
66  // Verbosity level, set to 0 (no print) by default.
67  infoV = conf.clctParams().getParameter<int>("verbosity");
68 
69  // Do not exclude pattern 0 and 1 when the Run-3 patterns are enabled!!
70  // Valid Run-3 patterns are 0,1,2,3,4
71  if (runCCLUT_) {
73  }
74 
75  // Check and print configuration parameters.
77  if ((infoV > 0) && !config_dumped) {
79  config_dumped = true;
80  }
81 
82  numStrips_ = 0; // Will be set later.
83  // Provisional, but should be OK for all stations except ME1.
84  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
85  if ((i_layer + 1) % 2 == 0)
86  stagger[i_layer] = 0;
87  else
88  stagger[i_layer] = 1;
89  }
90 
92  ispretrig_[i] = false;
93  }
94 
95  // which patterns should we use?
96  if (runCCLUT_) {
98  // comparator code lookup table algorithm for Phase-2
99  cclut_ = std::make_unique<ComparatorCodeLUT>(conf.conf());
100  } else {
102  }
103 
104  const auto& shower = conf.showerParams().getParameterSet("cathodeShower");
105  thresholds_ = shower.getParameter<std::vector<unsigned>>("showerThresholds");
106  showerNumTBins_ = shower.getParameter<unsigned>("showerNumTBins");
107  minLayersCentralTBin_ = shower.getParameter<unsigned>("minLayersCentralTBin");
108  peakCheck_ = shower.getParameter<bool>("peakCheck");
112 
113  thePreTriggerDigis.clear();
114 
115  // quality control of stubs
116  qualityControl_ = std::make_unique<LCTQualityControl>(endcap, station, sector, subsector, chamber, conf);
117 }
std::unique_ptr< ComparatorCodeLUT > cclut_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterSet const & getParameterSet(std::string const &) const
CSCPatternBank::LCTPatterns clct_pattern_
std::unique_ptr< LCTQualityControl > qualityControl_
edm::ParameterSet const & showerParams() const
Definition: CSCBaseboard.h:21
assert(be >=bs)
edm::ParameterSet const & clctParams() const
Definition: CSCBaseboard.h:24
static const LCTPatterns clct_pattern_run3_
edm::ParameterSet const & tmbParams() const
Definition: CSCBaseboard.h:22
static constexpr int MAX_NUM_HALF_STRIPS_RUN2_TRIGGER
Definition: CSCConstants.h:74
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
static const LCTPatterns clct_pattern_legacy_
int stagger[CSCConstants::NUM_LAYERS]
edm::ParameterSet const & conf() const
Definition: CSCBaseboard.h:18
bool ispretrig_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
std::vector< unsigned > thresholds_

◆ ~CSCCathodeLCTProcessor()

CSCCathodeLCTProcessor::~CSCCathodeLCTProcessor ( )
overridedefault

Default destructor.

Member Function Documentation

◆ checkConfigParameters()

void CSCCathodeLCTProcessor::checkConfigParameters ( )
protected

Make sure that the parameter values are within the allowed range.

Definition at line 157 of file CSCCathodeLCTProcessor.cc.

References cms::cuda::assert(), CSCBaseboard::checkConfigParameters(), def_drift_delay, def_fifo_pretrig, def_fifo_tbins, def_hit_persist, def_min_separation, def_nplanes_hit_pattern, def_nplanes_hit_pretrig, def_pid_thresh_pretrig, def_tmb_l1a_window_size, drift_delay, fifo_pretrig, fifo_tbins, hit_persist, CSCConstants::LCT_CENTRAL_BX, CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER, min_separation, nplanes_hit_pattern, nplanes_hit_pretrig, pid_thresh_pretrig, and tmb_l1a_window_size.

Referenced by CSCCathodeLCTProcessor(), and setConfigParameters().

157  {
158  // Make sure that the parameter values are within the allowed range.
159 
160  // Max expected values.
161  static const unsigned int max_fifo_tbins = 1 << 5;
162  static const unsigned int max_fifo_pretrig = 1 << 5;
163  static const unsigned int max_hit_persist = 1 << 4;
164  static const unsigned int max_drift_delay = 1 << 2;
165  static const unsigned int max_nplanes_hit_pretrig = 1 << 3;
166  static const unsigned int max_nplanes_hit_pattern = 1 << 3;
167  static const unsigned int max_pid_thresh_pretrig = 1 << 4;
168  static const unsigned int max_min_separation = CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER;
169  static const unsigned int max_tmb_l1a_window_size = 1 << 4;
170 
171  // Checks.
172  CSCBaseboard::checkConfigParameters(fifo_tbins, max_fifo_tbins, def_fifo_tbins, "fifo_tbins");
173  CSCBaseboard::checkConfigParameters(fifo_pretrig, max_fifo_pretrig, def_fifo_pretrig, "fifo_pretrig");
174  CSCBaseboard::checkConfigParameters(hit_persist, max_hit_persist, def_hit_persist, "hit_persist");
175  CSCBaseboard::checkConfigParameters(drift_delay, max_drift_delay, def_drift_delay, "drift_delay");
177  nplanes_hit_pretrig, max_nplanes_hit_pretrig, def_nplanes_hit_pretrig, "nplanes_hit_pretrig");
179  nplanes_hit_pattern, max_nplanes_hit_pattern, def_nplanes_hit_pattern, "nplanes_hit_pattern");
181  pid_thresh_pretrig, max_pid_thresh_pretrig, def_pid_thresh_pretrig, "pid_thresh_pretrig");
182  CSCBaseboard::checkConfigParameters(min_separation, max_min_separation, def_min_separation, "min_separation");
184  tmb_l1a_window_size, max_tmb_l1a_window_size, def_tmb_l1a_window_size, "tmb_l1a_window_size");
186 }
static const unsigned int def_drift_delay
static const unsigned int def_fifo_tbins
void checkConfigParameters(unsigned int &var, const unsigned int var_max, const unsigned int var_def, const std::string &var_str)
static const unsigned int def_min_separation
assert(be >=bs)
static const unsigned int def_nplanes_hit_pretrig
static const unsigned int def_pid_thresh_pretrig
static const unsigned int def_tmb_l1a_window_size
static const unsigned int def_nplanes_hit_pattern
static constexpr int MAX_NUM_HALF_STRIPS_RUN2_TRIGGER
Definition: CSCConstants.h:74
static const unsigned int def_fifo_pretrig
static const unsigned int def_hit_persist

◆ checkLocalShower()

void CSCCathodeLCTProcessor::checkLocalShower ( int  zone,
const std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER] 
)
protected

Definition at line 402 of file CSCCathodeLCTProcessor.cc.

References bestCLCT, nano_mu_digi_cff::bx, drift_delay, CSCCLCTDigi::getKeyStrip(), CSCBaseboard::infoV, PulseArray::isOneShotHighAtBX(), sistrip::SpyUtilities::isValid(), CSCConstants::KEY_CLCT_LAYER, localShowerFlag, localShowerThresh, LogDebug, CSCConstants::MAX_CLCT_TBINS, CSCConstants::NUM_LAYERS, numHalfStrips_, pulse_, pulseExtension(), and stagger.

Referenced by run().

404  {
405  // Fire half-strip one-shots for hit_persist bx's (4 bx's by default).
406  //check local shower after pulse extension
407  pulseExtension(halfstrip);
408 
409  for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
410  if (not bestCLCT[bx].isValid())
411  continue;
412 
413  //only check the region around best CLCT
414  int keyHS = bestCLCT[bx].getKeyStrip();
415  int minHS = (keyHS - zone) >= stagger[CSCConstants::KEY_CLCT_LAYER - 1] ? keyHS - zone
417  int maxHS = (keyHS + zone) >= numHalfStrips_ ? numHalfStrips_ : keyHS + zone;
418  int totalHits = 0;
419  for (int hstrip = minHS; hstrip < maxHS; hstrip++) {
420  for (int this_layer = 0; this_layer < CSCConstants::NUM_LAYERS; this_layer++)
421  if (pulse_.isOneShotHighAtBX(this_layer, hstrip, bx + drift_delay))
422  totalHits++;
423  }
424 
425  localShowerFlag[bx] = totalHits >= localShowerThresh;
426  if (infoV > 1)
427  LogDebug("CSCCathodeLCTProcessor") << " bx " << bx << " bestCLCT key HS " << keyHS
428  << " localshower zone: " << minHS << ", " << maxHS << " totalHits "
429  << totalHits
430  << (localShowerFlag[bx] ? " Validlocalshower " : " NolocalShower ");
431  }
432 }
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
bool isOneShotHighAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:37
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
bool localShowerFlag[CSCConstants::MAX_CLCT_TBINS]
int stagger[CSCConstants::NUM_LAYERS]
#define LogDebug(id)

◆ cleanComparatorContainer()

void CSCCathodeLCTProcessor::cleanComparatorContainer ( CSCCLCTDigi lct) const
protected

Definition at line 1067 of file CSCCathodeLCTProcessor.cc.

References CSCCLCTDigi::getHits(), mps_fire::i, CSCConstants::INVALID_HALF_STRIP, AlCaHLTBitMon_ParallelJobs::p, and CSCCLCTDigi::setHits().

Referenced by constructCLCT().

1067  {
1068  CSCCLCTDigi::ComparatorContainer newHits = clct.getHits();
1069  for (auto& p : newHits) {
1070  p.erase(
1071  std::remove_if(p.begin(), p.end(), [](unsigned i) -> bool { return i == CSCConstants::INVALID_HALF_STRIP; }),
1072  p.end());
1073  }
1074  clct.setHits(newHits);
1075 }
std::vector< std::vector< uint16_t > > ComparatorContainer
Definition: CSCCLCTDigi.h:19
static constexpr int INVALID_HALF_STRIP
Definition: CSCConstants.h:99

◆ clear()

void CSCCathodeLCTProcessor::clear ( void  )

Clears the LCT containers.

Definition at line 188 of file CSCCathodeLCTProcessor.cc.

References bestCLCT, nano_mu_digi_cff::bx, cathode_showers_, CSCShowerDigi::clear(), CSCCLCTDigi::clear(), localShowerFlag, CSCConstants::MAX_CLCT_TBINS, secondCLCT, thePreTriggerBXs, and thePreTriggerDigis.

188  {
189  thePreTriggerDigis.clear();
190  thePreTriggerBXs.clear();
191  for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
192  bestCLCT[bx].clear();
193  secondCLCT[bx].clear();
195  localShowerFlag[bx] = false; //init with no shower around CLCT
196  }
197 }
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
CSCShowerDigi cathode_showers_[CSCConstants::MAX_CLCT_TBINS]
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
bool localShowerFlag[CSCConstants::MAX_CLCT_TBINS]
std::vector< int > thePreTriggerBXs
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:73
void clear()
clear this Shower

◆ clearPreTriggers()

void CSCCathodeLCTProcessor::clearPreTriggers ( )
protected

Definition at line 1061 of file CSCCathodeLCTProcessor.cc.

References ispretrig_, CSCConstants::KEY_CLCT_LAYER, numHalfStrips_, and stagger.

Referenced by CSCUpgradeCathodeLCTProcessor::findLCTs(), CSCUpgradeCathodeLCTProcessor::preTrigger(), and preTrigger().

1061  {
1062  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
1063  ispretrig_[hstrip] = false;
1064  }
1065 }
int stagger[CSCConstants::NUM_LAYERS]
bool ispretrig_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]

◆ constructCLCT()

CSCCLCTDigi CSCCathodeLCTProcessor::constructCLCT ( const int  bx,
const unsigned  halfstrip_withstagger,
const CSCCLCTDigi::ComparatorContainer hits,
const CSCL1TPLookupTableCCLUT lookupTable 
)
protected

Definition at line 1007 of file CSCCathodeLCTProcessor.cc.

References best_pid, nano_mu_digi_cff::bx, cclut_, clct_pattern_, cleanComparatorContainer(), CSCPatternBank::getPatternBend(), hfClusterShapes_cfi::hits, CSCBaseboard::infoV, CSCConstants::KEY_CLCT_LAYER, CSCCLCTDigi::Legacy, LogTrace, nhits, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, numCFEBs_, topSingleLeptonDQM_PU_cfi::pattern, quality, CSCBaseboard::runCCLUT_, CSCCLCTDigi::setHits(), and stagger.

Referenced by CSCUpgradeCathodeLCTProcessor::findLCTs(), and findLCTs().

1010  {
1011  // Assign the CLCT properties
1012  const unsigned quality = nhits[halfstrip_withstagger];
1013  const unsigned pattern = best_pid[halfstrip_withstagger];
1014  const unsigned bend = CSCPatternBank::getPatternBend(clct_pattern_[pattern]);
1015  const unsigned keyhalfstrip = halfstrip_withstagger - stagger[CSCConstants::KEY_CLCT_LAYER - 1];
1016  const unsigned cfeb = keyhalfstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
1017  const unsigned halfstrip = keyhalfstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
1018 
1019  // set the Run-2 properties
1020  CSCCLCTDigi clct(1,
1021  quality,
1022  pattern,
1023  // CLCTs are always of type halfstrip (not strip or distrip)
1024  1,
1025  bend,
1026  halfstrip,
1027  cfeb,
1028  bx,
1029  0,
1030  0,
1031  -1,
1033 
1034  // set the hit collection
1035  clct.setHits(hits);
1036 
1037  // do the CCLUT procedures for Run-3
1038  if (runCCLUT_) {
1039  cclut_->run(clct, numCFEBs_, lookupTable);
1040  }
1041 
1042  // purge the comparator digi collection from the obsolete "65535" entries...
1044 
1045  if (infoV > 1) {
1046  LogTrace("CSCCathodeLCTProcessor") << "Produce CLCT " << clct << std::endl;
1047  }
1048 
1049  return clct;
1050 }
std::unique_ptr< ComparatorCodeLUT > cclut_
CSCPatternBank::LCTPatterns clct_pattern_
void cleanComparatorContainer(CSCCLCTDigi &lct) const
#define LogTrace(id)
string quality
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
static constexpr int NUM_HALF_STRIPS_PER_CFEB
Definition: CSCConstants.h:62
static int getPatternBend(const LCTPattern &pattern)
int stagger[CSCConstants::NUM_LAYERS]
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]

◆ constructPreCLCT()

CSCCLCTPreTriggerDigi CSCCathodeLCTProcessor::constructPreCLCT ( const int  bx,
const unsigned  halfstrip,
const unsigned  index 
) const
protected

Definition at line 1052 of file CSCCathodeLCTProcessor.cc.

References best_pid, clct_pattern_, CSCConstants::CLCT_PATTERN_WIDTH, nhits, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, and CSCConstants::NUM_LAYERS.

Referenced by CSCUpgradeCathodeLCTProcessor::preTrigger(), and preTrigger().

1054  {
1056  const int halfstrip = hstrip % CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
1057  const int cfeb = hstrip / CSCConstants::NUM_HALF_STRIPS_PER_CFEB;
1058  return CSCCLCTPreTriggerDigi(1, nhits[hstrip], best_pid[hstrip], 1, bend, halfstrip, cfeb, bx_time, nPreTriggers, 0);
1059 }
CSCPatternBank::LCTPatterns clct_pattern_
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
static constexpr int NUM_HALF_STRIPS_PER_CFEB
Definition: CSCConstants.h:62
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]

◆ dumpConfigParams()

void CSCCathodeLCTProcessor::dumpConfigParams ( ) const
protected

Dump CLCT configuration parameters.

Definition at line 1081 of file CSCCathodeLCTProcessor.cc.

References drift_delay, fifo_pretrig, fifo_tbins, hit_persist, LogDebug, min_separation, nplanes_hit_pattern, nplanes_hit_pretrig, and pid_thresh_pretrig.

Referenced by CSCCathodeLCTProcessor(), run(), and setConfigParameters().

1081  {
1082  std::ostringstream strm;
1083  strm << "\n";
1084  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1085  strm << "+ CLCT configuration parameters: +\n";
1086  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1087  strm << " fifo_tbins [total number of time bins in DAQ readout] = " << fifo_tbins << "\n";
1088  strm << " fifo_pretrig [start time of cathode raw hits in DAQ readout] = " << fifo_pretrig << "\n";
1089  strm << " hit_persist [duration of signal pulse, in 25 ns bins] = " << hit_persist << "\n";
1090  strm << " drift_delay [time after pre-trigger before TMB latches LCTs] = " << drift_delay << "\n";
1091  strm << " nplanes_hit_pretrig [min. number of layers hit for pre-trigger] = " << nplanes_hit_pretrig << "\n";
1092  strm << " nplanes_hit_pattern [min. number of layers hit for trigger] = " << nplanes_hit_pattern << "\n";
1093  strm << " pid_thresh_pretrig [lower threshold on pattern id] = " << pid_thresh_pretrig << "\n";
1094  strm << " min_separation [region of busy key strips] = " << min_separation << "\n";
1095  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1096  LogDebug("CSCCathodeLCTProcessor") << strm.str();
1097 }
#define LogDebug(id)

◆ dumpDigis()

void CSCCathodeLCTProcessor::dumpDigis ( const std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const
protected

Dump half-strip digis

Definition at line 1100 of file CSCCathodeLCTProcessor.cc.

References TauDecayModes::dec, relativeConstraints::empty, LogDebug, LogTrace, CSCConstants::NUM_HALF_STRIPS_PER_CFEB, CSCConstants::NUM_LAYERS, numHalfStrips_, nano_mu_digi_cff::strip, and CSCBaseboard::theCSCName_.

Referenced by CSCUpgradeCathodeLCTProcessor::findLCTs(), and findLCTs().

1101  {
1102  LogDebug("CSCCathodeLCTProcessor") << theCSCName_ << " strip type: half-strip, numHalfStrips " << numHalfStrips_;
1103 
1104  std::ostringstream strstrm;
1105  for (int i_strip = 0; i_strip < numHalfStrips_; i_strip++) {
1106  if (i_strip % 10 == 0) {
1107  if (i_strip < 100)
1108  strstrm << i_strip / 10;
1109  else
1110  strstrm << (i_strip - 100) / 10;
1111  } else
1112  strstrm << " ";
1113  if ((i_strip + 1) % CSCConstants::NUM_HALF_STRIPS_PER_CFEB == 0)
1114  strstrm << " ";
1115  }
1116  strstrm << "\n";
1117  for (int i_strip = 0; i_strip < numHalfStrips_; i_strip++) {
1118  strstrm << i_strip % 10;
1119  if ((i_strip + 1) % CSCConstants::NUM_HALF_STRIPS_PER_CFEB == 0)
1120  strstrm << " ";
1121  }
1122  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
1123  strstrm << "\n";
1124  for (int i_strip = 0; i_strip < numHalfStrips_; i_strip++) {
1125  if (!strip[i_layer][i_strip].empty()) {
1126  std::vector<int> bx_times = strip[i_layer][i_strip];
1127  // Dump only the first in time.
1128  strstrm << std::hex << bx_times[0] << std::dec;
1129  } else {
1130  strstrm << "-";
1131  }
1132  if ((i_strip + 1) % CSCConstants::NUM_HALF_STRIPS_PER_CFEB == 0)
1133  strstrm << " ";
1134  }
1135  }
1136  LogTrace("CSCCathodeLCTProcessor") << strstrm.str();
1137 }
std::string theCSCName_
Definition: CSCBaseboard.h:104
#define LogTrace(id)
static constexpr int NUM_HALF_STRIPS_PER_CFEB
Definition: CSCConstants.h:62
#define LogDebug(id)

◆ encodeHighMultiplicityBits()

void CSCCathodeLCTProcessor::encodeHighMultiplicityBits ( )
protected

Definition at line 1282 of file CSCCathodeLCTProcessor.cc.

References nano_mu_digi_cff::bx, cathode_showers_, digiV, spr::find(), mps_fire::i, CSCDetId::iChamberType(), CSCConstants::MAX_CLCT_TBINS, minLayersCentralTBin_, CSCConstants::NUM_LAYERS, or, peakCheck_, showerNumTBins_, findQualityFiles::size, CSCBaseboard::theRing, CSCBaseboard::theStation, CSCBaseboard::theTrigChamber, and thresholds_.

Referenced by run().

1282  {
1283  //inTimeHMT_ = 0;
1284 
1285  //numer of layer with hits and number of hits for 0-15 BXs
1286  std::set<unsigned> layersWithHits[CSCConstants::MAX_CLCT_TBINS];
1287  unsigned hitsInTime[CSCConstants::MAX_CLCT_TBINS];
1288  // Calculate layers with hits
1289  for (unsigned bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
1290  hitsInTime[bx] = 0;
1291  for (unsigned i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
1292  bool atLeastOneCompHit = false;
1293  for (const auto& compdigi : digiV[i_layer]) {
1294  std::vector<int> bx_times = compdigi.getTimeBinsOn();
1295  // there is at least one comparator digi in this bx
1296  if (std::find(bx_times.begin(), bx_times.end(), bx) != bx_times.end()) {
1297  hitsInTime[bx] += 1;
1298  atLeastOneCompHit = true;
1299  }
1300  }
1301  // add this layer to the number of layers hit
1302  if (atLeastOneCompHit) {
1303  layersWithHits[bx].insert(i_layer);
1304  }
1305  }
1306  } //end of full bx loop
1307 
1308  // convert station and ring number to index
1309  // index runs from 2 to 10, subtract 2
1310  unsigned csc_idx = CSCDetId::iChamberType(theStation, theRing) - 2;
1311 
1312  // loose, nominal and tight
1313  std::vector<unsigned> station_thresholds = {
1314  thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]};
1315 
1316  //hard coded dead time as 2Bx, since showerNumTBins = 3, like firmware
1317  // for example, nhits = 0 at bx7; = 100 at bx8; = 0 at bx9
1318  //cathode HMT must be triggered at bx8, not bx7 and bx9
1319  //meanwhile we forced 2BX dead time after active shower trigger
1320  unsigned int deadtime =
1321  showerNumTBins_ - 1; // firmware hard coded dead time as 2Bx, since showerNumTBins = 3 in firmware
1322  unsigned int dead_count = 0;
1323 
1324  for (unsigned bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
1325  unsigned minbx = bx >= showerNumTBins_ / 2 ? bx - showerNumTBins_ / 2 : bx;
1326  unsigned maxbx = bx < CSCConstants::MAX_CLCT_TBINS - showerNumTBins_ / 2 ? bx + showerNumTBins_ / 2
1328  unsigned this_hitsInTime = 0;
1329  bool isPeak = true; //check whether total hits in bx is peak of nhits over time bins
1330  /*following is to count number of hits over [minbx, maxbx], showerNumTBins=3 =>[n-1, n+1]*/
1331  for (unsigned mbx = minbx; mbx <= maxbx; mbx++) {
1332  this_hitsInTime += hitsInTime[mbx];
1333  }
1334 
1336  if (hitsInTime[minbx] < hitsInTime[maxbx + 1] or
1337  (hitsInTime[minbx] == hitsInTime[maxbx + 1] and hitsInTime[bx] < hitsInTime[bx + 1]))
1338  isPeak = false; //next bx would have more hits or in the center
1339  }
1340  bool dead_status = dead_count > 0;
1341  if (dead_status)
1342  dead_count--;
1343 
1344  unsigned this_inTimeHMT = 0;
1345  // require at least nLayersWithHits for the central time bin
1346  // do nothing if there are not enough layers with hits
1347  if (layersWithHits[bx].size() >= minLayersCentralTBin_ and !dead_status and isPeak) {
1348  // assign the bits
1349  if (!station_thresholds.empty()) {
1350  for (int i = station_thresholds.size() - 1; i >= 0; i--) {
1351  if (this_hitsInTime >= station_thresholds[i]) {
1352  this_inTimeHMT = i + 1;
1353  dead_count = deadtime;
1354  break;
1355  }
1356  }
1357  }
1358  }
1359  //CLCTshower constructor with showerType_ = 2, wirehits = 0;
1361  this_inTimeHMT, false, theTrigChamber, bx, CSCShowerDigi::ShowerType::kCLCTShower, 0, this_hitsInTime);
1362  }
1363 }
size
Write out results.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
unsigned short iChamberType() const
Definition: CSCDetId.h:96
CSCShowerDigi cathode_showers_[CSCConstants::MAX_CLCT_TBINS]
const unsigned theTrigChamber
Definition: CSCBaseboard.h:78
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
Definition: Activities.doc:12
const unsigned theStation
Definition: CSCBaseboard.h:75
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
unsigned theRing
Definition: CSCBaseboard.h:80
std::vector< unsigned > thresholds_

◆ findLCTs()

std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::findLCTs ( const std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER],
const CSCL1TPLookupTableCCLUT lookupTable 
)
protectedvirtual

Reimplemented in CSCUpgradeCathodeLCTProcessor.

Definition at line 575 of file CSCCathodeLCTProcessor.cc.

References best_pid, nano_mu_digi_cff::bx, constructCLCT(), drift_delay, dumpDigis(), fifo_tbins, CSCCLCTDigi::getKeyStrip(), CSCCLCTDigi::getPattern(), CSCCLCTDigi::getQuality(), CSCCLCTDigi::getRun3Pattern(), CSCBaseboard::infoV, CSCCLCTDigi::isValid(), CSCConstants::KEY_CLCT_LAYER, LogTrace, markBusyKeys(), CSCConstants::MAX_CLCTS_PER_PROCESSOR, CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER, nhits, nplanes_hit_pattern, nplanes_hit_pretrig, numHalfStrips_, patternFinding(), preTrigger(), pulseExtension(), quality, CSCBaseboard::runCCLUT_, stagger, start_bx_shift, and thePreTriggerBXs.

Referenced by CSCUpgradeCathodeLCTProcessor::findLCTs(), and run().

577  {
578  std::vector<CSCCLCTDigi> lctList;
579 
580  if (infoV > 1)
581  dumpDigis(halfstrip);
582 
583  // Fire half-strip one-shots for hit_persist bx's (4 bx's by default).
584  pulseExtension(halfstrip);
585 
586  unsigned int start_bx = start_bx_shift;
587  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
588  // not have a full set of hits to start pattern search anyway.
589  unsigned int stop_bx = fifo_tbins - drift_delay;
590  // Allow for more than one pass over the hits in the time window.
591  while (start_bx < stop_bx) {
592  // temp CLCT objects
593  CSCCLCTDigi tempBestCLCT;
594  CSCCLCTDigi tempSecondCLCT;
595 
596  // All half-strip pattern envelopes are evaluated simultaneously, on every
597  // clock cycle.
598  int first_bx = 999;
599  bool pre_trig = preTrigger(start_bx, first_bx);
600 
601  // If any of half-strip envelopes has enough layers hit in it, TMB
602  // will pre-trigger.
603  if (pre_trig) {
604  thePreTriggerBXs.push_back(first_bx);
605  if (infoV > 1)
606  LogTrace("CSCCathodeLCTProcessor") << "..... pretrigger at bx = " << first_bx << "; waiting drift delay .....";
607 
608  // TMB latches LCTs drift_delay clocks after pretrigger.
609  // in the configuration the drift_delay is set to 2bx by default
610  // this is the time that is required for the electrons to drift to the
611  // cathode strips. 15ns drift time --> 45 ns is 3 sigma for the delay
612  // this corresponds to 2bx
613  int latch_bx = first_bx + drift_delay;
614 
615  // define a new pattern map
616  // for each key half strip, and for each pattern, store the 2D collection of fired comparator digis
617  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer>> hits_in_patterns;
618  hits_in_patterns.clear();
619 
620  // We check if there is at least one key half strip for which at least
621  // one pattern id has at least the minimum number of hits
622  bool hits_in_time = patternFinding(latch_bx, hits_in_patterns);
623  if (infoV > 1) {
624  if (hits_in_time) {
625  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
626  if (nhits[hstrip] > 0) {
627  LogTrace("CSCCathodeLCTProcessor")
628  << " bx = " << std::setw(2) << latch_bx << " --->"
629  << " halfstrip = " << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip]
630  << " nhits = " << nhits[hstrip];
631  }
632  }
633  }
634  }
635  // This trigger emulator does not have an active CFEB flag for DAQ (csc trigger hardware: AFF)
636  // This is a fundamental difference with the firmware where the TMB prepares the DAQ to
637  // read out the chamber
638 
639  // The pattern finder runs continuously, so another pre-trigger
640  // could occur already at the next bx.
641 
642  // Quality for sorting.
644  int best_halfstrip[CSCConstants::MAX_CLCTS_PER_PROCESSOR];
645  int best_quality[CSCConstants::MAX_CLCTS_PER_PROCESSOR];
646 
647  for (int ilct = 0; ilct < CSCConstants::MAX_CLCTS_PER_PROCESSOR; ilct++) {
648  best_halfstrip[ilct] = -1;
649  best_quality[ilct] = 0;
650  }
651 
652  // Calculate quality from pattern id and number of hits, and
653  // simultaneously select best-quality LCT.
654  if (hits_in_time) {
655  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
656  // The bend-direction bit pid[0] is ignored (left and right
657  // bends have equal quality).
658  quality[hstrip] = (best_pid[hstrip] & 14) | (nhits[hstrip] << 5);
659  if (quality[hstrip] > best_quality[0]) {
660  best_halfstrip[0] = hstrip;
661  best_quality[0] = quality[hstrip];
662  }
663  // temporary alias
664  const int best_hs(best_halfstrip[0]);
665  // construct a CLCT if the trigger condition has been met
666  if (best_hs >= 0 && nhits[best_hs] >= nplanes_hit_pattern) {
667  // overwrite the current best CLCT
668  tempBestCLCT = constructCLCT(first_bx, best_hs, hits_in_patterns[best_hs][best_pid[best_hs]], lookupTable);
669  }
670  }
671  }
672 
673  // If 1st best CLCT is found, look for the 2nd best.
674  if (best_halfstrip[0] >= 0) {
675  // Get the half-strip of the best CLCT in this BX that was put into the list.
676  // You do need to re-add the any stagger, because the busy keys are based on
677  // the pulse array which takes into account strip stagger!!!
678  const unsigned halfStripBestCLCT(tempBestCLCT.getKeyStrip() + stagger[CSCConstants::KEY_CLCT_LAYER - 1]);
679 
680  // Mark keys near best CLCT as busy by setting their quality to
681  // zero, and repeat the search.
682  markBusyKeys(halfStripBestCLCT, best_pid[halfStripBestCLCT], quality);
683 
684  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
685  if (quality[hstrip] > best_quality[1]) {
686  best_halfstrip[1] = hstrip;
687  best_quality[1] = quality[hstrip];
688  }
689  // temporary alias
690  const int best_hs(best_halfstrip[1]);
691  // construct a CLCT if the trigger condition has been met
692  if (best_hs >= 0 && nhits[best_hs] >= nplanes_hit_pattern) {
693  // overwrite the current second best CLCT
694  tempSecondCLCT =
695  constructCLCT(first_bx, best_hs, hits_in_patterns[best_hs][best_pid[best_hs]], lookupTable);
696  }
697  }
698 
699  // Sort bestCLCT and secondALCT by quality
700  // if qualities are the same, sort by run-2 or run-3 pattern
701  // if qualities and patterns are the same, sort by half strip number
702  bool changeOrder = false;
703 
704  unsigned qualityBest = 0, qualitySecond = 0;
705  unsigned patternBest = 0, patternSecond = 0;
706  unsigned halfStripBest = 0, halfStripSecond = 0;
707 
708  if (tempBestCLCT.isValid() and tempSecondCLCT.isValid()) {
709  qualityBest = tempBestCLCT.getQuality();
710  qualitySecond = tempSecondCLCT.getQuality();
711  if (!runCCLUT_) {
712  patternBest = tempBestCLCT.getPattern();
713  patternSecond = tempSecondCLCT.getPattern();
714  } else {
715  patternBest = tempBestCLCT.getRun3Pattern();
716  patternSecond = tempSecondCLCT.getRun3Pattern();
717  }
718  halfStripBest = tempBestCLCT.getKeyStrip();
719  halfStripSecond = tempSecondCLCT.getKeyStrip();
720 
721  if (qualitySecond > qualityBest)
722  changeOrder = true;
723  else if ((qualitySecond == qualityBest) and (int(patternSecond / 2) > int(patternBest / 2)))
724  changeOrder = true;
725  else if ((qualitySecond == qualityBest) and (int(patternSecond / 2) == int(patternBest / 2)) and
726  (halfStripSecond < halfStripBest))
727  changeOrder = true;
728  }
729 
730  CSCCLCTDigi tempCLCT;
731  if (changeOrder) {
732  tempCLCT = tempBestCLCT;
733  tempBestCLCT = tempSecondCLCT;
734  tempSecondCLCT = tempCLCT;
735  }
736 
737  // add the CLCTs to the collection
738  if (tempBestCLCT.isValid()) {
739  lctList.push_back(tempBestCLCT);
740  }
741  if (tempSecondCLCT.isValid()) {
742  lctList.push_back(tempSecondCLCT);
743  }
744  } //find CLCT, end of best_halfstrip[0] >= 0
745 
746  // If there is a trigger, CLCT pre-trigger state machine
747  // checks the number of hits that lie within a pattern template
748  // at every bx, and waits for it to drop below threshold.
749  // The search for CLCTs resumes only when the number of hits
750  // drops below threshold.
751  start_bx = fifo_tbins;
752  // Stop checking drift_delay bx's short of fifo_tbins since
753  // at later bx's we won't have a full set of hits for a
754  // pattern search anyway.
755  unsigned int stop_time = fifo_tbins - drift_delay;
756  for (unsigned int bx = latch_bx + 1; bx < stop_time; bx++) {
757  bool return_to_idle = true;
758  bool hits_in_time = patternFinding(bx, hits_in_patterns);
759  if (hits_in_time) {
760  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
761  // the dead-time is done at the pre-trigger, not at the trigger
762  if (nhits[hstrip] >= nplanes_hit_pretrig) {
763  if (infoV > 1)
764  LogTrace("CSCCathodeLCTProcessor") << " State machine busy at bx = " << bx;
765  return_to_idle = false;
766  break;
767  }
768  }
769  }
770  if (return_to_idle) {
771  if (infoV > 1)
772  LogTrace("CSCCathodeLCTProcessor") << " State machine returns to idle state at bx = " << bx;
773  start_bx = bx;
774  break;
775  }
776  }
777  } //pre_trig
778  else {
779  start_bx = first_bx + 1; // no dead time
780  }
781  }
782 
783  return lctList;
784 } // findLCTs -- TMB-07 version.
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:56
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
bool patternFinding(const unsigned int bx_time, std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &hits_in_patterns)
#define LogTrace(id)
string quality
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
CSCCLCTDigi constructCLCT(const int bx, const unsigned halfstrip_withstagger, const CSCCLCTDigi::ComparatorContainer &hits, const CSCL1TPLookupTableCCLUT *lookupTable)
static constexpr int MAX_NUM_HALF_STRIPS_RUN2_TRIGGER
Definition: CSCConstants.h:74
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
std::vector< int > thePreTriggerBXs
void dumpDigis(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const
int stagger[CSCConstants::NUM_LAYERS]
uint16_t getPattern() const
return pattern
Definition: CSCCLCTDigi.h:62
virtual bool preTrigger(const int start_bx, int &first_bx)
uint16_t getRun3Pattern() const
return pattern
Definition: CSCCLCTDigi.h:68
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]

◆ getAllShower()

std::vector< CSCShowerDigi > CSCCathodeLCTProcessor::getAllShower ( ) const

return vector of CSCShower digi

Definition at line 1268 of file CSCCathodeLCTProcessor.cc.

References cathode_showers_, and CSCConstants::MAX_CLCT_TBINS.

1268  {
1269  std::vector<CSCShowerDigi> vshowers(cathode_showers_, cathode_showers_ + CSCConstants::MAX_CLCT_TBINS);
1270  return vshowers;
1271 };
CSCShowerDigi cathode_showers_[CSCConstants::MAX_CLCT_TBINS]

◆ getBestCLCT()

CSCCLCTDigi CSCCathodeLCTProcessor::getBestCLCT ( int  bx) const

get best/second best CLCT Note: CLCT has BX shifted

Definition at line 1245 of file CSCCathodeLCTProcessor.cc.

References CSCConstants::ALCT_CLCT_OFFSET, bestCLCT, nano_mu_digi_cff::bx, CSCCLCTDigi::getBX(), CSCConstants::MAX_CLCT_TBINS, or, and CSCCLCTDigi::setBX().

1245  {
1246  if (bx >= CSCConstants::MAX_CLCT_TBINS or bx < 0)
1247  return CSCCLCTDigi();
1248  CSCCLCTDigi lct = bestCLCT[bx];
1250  return lct;
1251 }
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
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
Definition: Activities.doc:12
uint16_t getBX() const
return BX
Definition: CSCCLCTDigi.h:123
void setBX(const uint16_t bx)
set bx
Definition: CSCCLCTDigi.h:129

◆ getCLCTs()

std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::getCLCTs ( ) const

Returns vector of all found CLCTs, if any.

Definition at line 1229 of file CSCCathodeLCTProcessor.cc.

References bestCLCT, nano_mu_digi_cff::bx, sistrip::SpyUtilities::isValid(), CSCConstants::MAX_CLCT_TBINS, and secondCLCT.

Referenced by readoutCLCTs(), and run().

1229  {
1230  std::vector<CSCCLCTDigi> tmpV;
1231  for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
1232  if (bestCLCT[bx].isValid())
1233  tmpV.push_back(bestCLCT[bx]);
1234  if (secondCLCT[bx].isValid())
1235  tmpV.push_back(secondCLCT[bx]);
1236  }
1237  return tmpV;
1238 }
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]

◆ getDigis() [1/2]

bool CSCCathodeLCTProcessor::getDigis ( const CSCComparatorDigiCollection compdc)
protected

Access routines to comparator digis.

Definition at line 434 of file CSCCathodeLCTProcessor.cc.

References CSCDetId::chamberName(), digiV, CSCBaseboard::disableME1a_, relativeConstraints::empty, CSCBaseboard::infoV, CSCBaseboard::isME11_, LogTrace, CSCConstants::NUM_LAYERS, CSCBaseboard::theChamber, CSCBaseboard::theEndcap, CSCBaseboard::theRing, CSCBaseboard::theSector, CSCBaseboard::theStation, CSCBaseboard::theSubsector, and CSCBaseboard::theTrigChamber.

Referenced by run().

434  {
435  bool hasDigis = false;
436 
437  // Loop over layers and save comparator digis on each one into digiV[layer].
438  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
439  digiV[i_layer].clear();
440 
441  CSCDetId detid(theEndcap, theStation, theRing, theChamber, i_layer + 1);
442  getDigis(compdc, detid);
443 
444  if (isME11_ && !disableME1a_) {
445  CSCDetId detid_me1a(theEndcap, theStation, 4, theChamber, i_layer + 1);
446  getDigis(compdc, detid_me1a);
447  }
448 
449  if (!digiV[i_layer].empty()) {
450  hasDigis = true;
451  if (infoV > 1) {
452  LogTrace("CSCCathodeLCTProcessor") << "found " << digiV[i_layer].size() << " comparator digi(s) in layer "
453  << i_layer << " of " << detid.chamberName() << " (trig. sector " << theSector
454  << " subsector " << theSubsector << " id " << theTrigChamber << ")";
455  }
456  }
457  }
458 
459  return hasDigis;
460 }
const unsigned theEndcap
Definition: CSCBaseboard.h:74
const unsigned theSector
Definition: CSCBaseboard.h:76
#define LogTrace(id)
const unsigned theTrigChamber
Definition: CSCBaseboard.h:78
bool getDigis(const CSCComparatorDigiCollection *compdc)
unsigned theChamber
Definition: CSCBaseboard.h:81
const unsigned theStation
Definition: CSCBaseboard.h:75
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
unsigned theRing
Definition: CSCBaseboard.h:80
const unsigned theSubsector
Definition: CSCBaseboard.h:77

◆ getDigis() [2/2]

void CSCCathodeLCTProcessor::getDigis ( const CSCComparatorDigiCollection compdc,
const CSCDetId id 
)
protected

Definition at line 462 of file CSCCathodeLCTProcessor.cc.

References digiV, CSCBaseboard::disableME1a_, CSCBaseboard::gangedME1a_, CSCConstants::NUM_STRIPS_ME1A_GANGED, CSCConstants::NUM_STRIPS_ME1A_UNGANGED, CSCConstants::NUM_STRIPS_ME1B, and relativeConstraints::ring.

462  {
463  const bool me1a = (id.station() == 1) && (id.ring() == 4);
464  const CSCComparatorDigiCollection::Range rcompd = compdc->get(id);
465  for (CSCComparatorDigiCollection::const_iterator digiIt = rcompd.first; digiIt != rcompd.second; ++digiIt) {
466  const unsigned int origStrip = digiIt->getStrip();
467  const unsigned int maxStripsME1a =
469  // this special case can only be reached in MC
470  // in real data, the comparator digis have always ring==1
471  if (me1a && origStrip <= maxStripsME1a && !disableME1a_) {
472  // Move ME1/A comparators from CFEB=0 to CFEB=4 if this has not
473  // been done already.
474  CSCComparatorDigi digi_corr(
475  origStrip + CSCConstants::NUM_STRIPS_ME1B, digiIt->getComparator(), digiIt->getTimeBinWord());
476  digiV[id.layer() - 1].push_back(digi_corr);
477  } else {
478  digiV[id.layer() - 1].push_back(*digiIt);
479  }
480  }
481 }
static constexpr int NUM_STRIPS_ME1A_GANGED
Definition: CSCConstants.h:76
static constexpr int NUM_STRIPS_ME1A_UNGANGED
Definition: CSCConstants.h:77
static constexpr int NUM_STRIPS_ME1B
Definition: CSCConstants.h:78
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]

◆ getLocalShowerFlag()

bool CSCCathodeLCTProcessor::getLocalShowerFlag ( int  bx) const

Definition at line 1261 of file CSCCathodeLCTProcessor.cc.

References nano_mu_digi_cff::bx, localShowerFlag, CSCConstants::MAX_CLCT_TBINS, and or.

1261  {
1262  if (bx >= CSCConstants::MAX_CLCT_TBINS or bx < 0)
1263  return false;
1264  return localShowerFlag[bx];
1265 }
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
Definition: Activities.doc:12
bool localShowerFlag[CSCConstants::MAX_CLCT_TBINS]

◆ getSecondCLCT()

CSCCLCTDigi CSCCathodeLCTProcessor::getSecondCLCT ( int  bx) const

Definition at line 1253 of file CSCCathodeLCTProcessor.cc.

References CSCConstants::ALCT_CLCT_OFFSET, nano_mu_digi_cff::bx, CSCCLCTDigi::getBX(), CSCConstants::MAX_CLCT_TBINS, or, secondCLCT, and CSCCLCTDigi::setBX().

1253  {
1254  if (bx >= CSCConstants::MAX_CLCT_TBINS or bx < 0)
1255  return CSCCLCTDigi();
1256  CSCCLCTDigi lct = secondCLCT[bx];
1258  return lct;
1259 }
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
Definition: Activities.doc:12
uint16_t getBX() const
return BX
Definition: CSCCLCTDigi.h:123
void setBX(const uint16_t bx)
set bx
Definition: CSCCLCTDigi.h:129
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]

◆ markBusyKeys()

void CSCCathodeLCTProcessor::markBusyKeys ( const int  best_hstrip,
const int  best_patid,
int  quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER] 
)
protected

Definition at line 994 of file CSCCathodeLCTProcessor.cc.

References CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER, min_separation, and quality.

Referenced by CSCUpgradeCathodeLCTProcessor::findLCTs(), and findLCTs().

996  {
997  int nspan = min_separation;
998  int pspan = min_separation;
999 
1000  for (int hstrip = best_hstrip - nspan; hstrip <= best_hstrip + pspan; hstrip++) {
1001  if (hstrip >= 0 && hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER) {
1002  quality[hstrip] = 0;
1003  }
1004  }
1005 } // markBusyKeys -- TMB-07 version.
string quality
static constexpr int MAX_NUM_HALF_STRIPS_RUN2_TRIGGER
Definition: CSCConstants.h:74

◆ patternFinding()

bool CSCCathodeLCTProcessor::patternFinding ( const unsigned int  bx_time,
std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &  hits_in_patterns 
)
protected

Definition at line 887 of file CSCCathodeLCTProcessor.cc.

References best_pid, clct_pattern_, CSCPatternBank::clct_pattern_offset_, CSCConstants::CLCT_PATTERN_WIDTH, fifo_tbins, hit_persist, CSCBaseboard::infoV, CSCConstants::INVALID_HALF_STRIP, PulseArray::isOneShotHighAtBX(), CSCConstants::KEY_CLCT_LAYER, LogTrace, nhits, nplanes_hit_pattern, nplanes_hit_pretrig, CSCConstants::NUM_LAYERS, PulseArray::numberOfLayersAtBX(), numHalfStrips_, AlCaHLTBitMon_ParallelJobs::p, pid_thresh_pretrig, pulse_, and stagger.

Referenced by CSCUpgradeCathodeLCTProcessor::findLCTs(), findLCTs(), CSCUpgradeCathodeLCTProcessor::preTrigger(), and preTrigger().

888  {
889  if (bx_time >= fifo_tbins)
890  return false;
891 
892  unsigned layers_hit = pulse_.numberOfLayersAtBX(bx_time);
893  if (layers_hit < nplanes_hit_pretrig)
894  return false;
895 
896  for (int key_hstrip = 0; key_hstrip < numHalfStrips_; key_hstrip++) {
897  best_pid[key_hstrip] = 0;
898  nhits[key_hstrip] = 0;
899  }
900 
901  bool hit_layer[CSCConstants::NUM_LAYERS];
902 
903  // Loop over candidate key strips.
904  for (int key_hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; key_hstrip < numHalfStrips_; key_hstrip++) {
905  // Loop over patterns and look for hits matching each pattern.
906  for (unsigned int pid = clct_pattern_.size() - 1; pid >= pid_thresh_pretrig and pid < clct_pattern_.size(); pid--) {
907  layers_hit = 0;
908  // clear all layers
909  for (int ilayer = 0; ilayer < CSCConstants::NUM_LAYERS; ilayer++) {
910  hit_layer[ilayer] = false;
911  }
912 
913  // clear a single pattern!
914  CSCCLCTDigi::ComparatorContainer hits_single_pattern;
915  hits_single_pattern.resize(6);
916  for (auto& p : hits_single_pattern) {
918  }
919 
920  // clear all medians
921  double num_pattern_hits = 0., times_sum = 0.;
922  std::multiset<int> mset_for_median;
923  mset_for_median.clear();
924 
925  // Loop over halfstrips in trigger pattern mask and calculate the
926  // "absolute" halfstrip number for each.
927  for (int this_layer = 0; this_layer < CSCConstants::NUM_LAYERS; this_layer++) {
928  for (int strip_num = 0; strip_num < CSCConstants::CLCT_PATTERN_WIDTH; strip_num++) {
929  // ignore "0" half-strips in the pattern
930  if (clct_pattern_[pid][this_layer][strip_num] == 0)
931  continue;
932 
933  // the current strip is the key half-strip plus the offset (can be negative or positive)
934  int this_strip = CSCPatternBank::clct_pattern_offset_[strip_num] + key_hstrip;
935 
936  // current strip should be valid of course
937  if (this_strip >= 0 && this_strip < numHalfStrips_) {
938  if (infoV > 3) {
939  LogTrace("CSCCathodeLCTProcessor") << " In patternFinding: key_strip = " << key_hstrip << " pid = " << pid
940  << " layer = " << this_layer << " strip = " << this_strip << std::endl;
941  }
942  // Determine if "one shot" is high at this bx_time
943  if (pulse_.isOneShotHighAtBX(this_layer, this_strip, bx_time)) {
944  if (hit_layer[this_layer] == false) {
945  hit_layer[this_layer] = true;
946  layers_hit++; // determines number of layers hit
947  // add this strip in this layer to the pattern we are currently considering
948  hits_single_pattern[this_layer][strip_num] = this_strip - stagger[this_layer];
949  }
950 
951  // find at what bx did pulse on this halsfstrip & layer have started
952  // use hit_persist constraint on how far back we can go
953  int first_bx_layer = bx_time;
954  for (unsigned int dbx = 0; dbx < hit_persist; dbx++) {
955  if (pulse_.isOneShotHighAtBX(this_layer, this_strip, first_bx_layer - 1))
956  first_bx_layer--;
957  else
958  break;
959  }
960  times_sum += (double)first_bx_layer;
961  num_pattern_hits += 1.;
962  mset_for_median.insert(first_bx_layer);
963  if (infoV > 2)
964  LogTrace("CSCCathodeLCTProcessor") << " 1st bx in layer: " << first_bx_layer << " sum bx: " << times_sum
965  << " #pat. hits: " << num_pattern_hits;
966  }
967  }
968  } // end loop over strips in pretrigger pattern
969  } // end loop over layers
970 
971  // save the pattern information when a trigger was formed!
972  if (layers_hit >= nplanes_hit_pattern) {
973  hits_in_patterns[key_hstrip][pid] = hits_single_pattern;
974  }
975 
976  // determine the current best pattern!
977  if (layers_hit > nhits[key_hstrip]) {
978  best_pid[key_hstrip] = pid;
979  nhits[key_hstrip] = layers_hit;
980  // Do not loop over the other (worse) patterns if max. numbers of
981  // hits is found.
982  if (nhits[key_hstrip] == CSCConstants::NUM_LAYERS)
983  break;
984  }
985  } // end loop over pid
986  } // end loop over candidate key strips
987 
988  // At this point there exists at least one halfstrip for which at least one pattern
989  // has at least 3 layers --> definition of a pre-trigger
990  return true;
991 } // patternFinding -- TMB-07 version.
bool isOneShotHighAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:37
CSCPatternBank::LCTPatterns clct_pattern_
#define LogTrace(id)
std::vector< std::vector< uint16_t > > ComparatorContainer
Definition: CSCCLCTDigi.h:19
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
static const int clct_pattern_offset_[CSCConstants::CLCT_PATTERN_WIDTH]
static constexpr int INVALID_HALF_STRIP
Definition: CSCConstants.h:99
unsigned numberOfLayersAtBX(const unsigned bx) const
Definition: PulseArray.cc:41
int stagger[CSCConstants::NUM_LAYERS]
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]

◆ preTrigger()

bool CSCCathodeLCTProcessor::preTrigger ( const int  start_bx,
int &  first_bx 
)
protectedvirtual

Reimplemented in CSCUpgradeCathodeLCTProcessor.

Definition at line 828 of file CSCCathodeLCTProcessor.cc.

References best_pid, clearPreTriggers(), constructPreCLCT(), fifo_tbins, CSCBaseboard::infoV, ispretrig_, CSCConstants::KEY_CLCT_LAYER, LogTrace, nhits, nplanes_hit_pretrig, numHalfStrips_, patternFinding(), pid_thresh_pretrig, stagger, and thePreTriggerDigis.

Referenced by findLCTs(), and CSCUpgradeCathodeLCTProcessor::preTrigger().

828  {
829  if (infoV > 1)
830  LogTrace("CSCCathodeLCTProcessor") << "....................PreTrigger...........................";
831 
832  int nPreTriggers = 0;
833 
834  bool pre_trig = false;
835  // Now do a loop over bx times to see (if/when) track goes over threshold
836  for (unsigned int bx_time = start_bx; bx_time < fifo_tbins; bx_time++) {
837  // For any given bunch-crossing, start at the lowest keystrip and look for
838  // the number of separate layers in the pattern for that keystrip that have
839  // pulses at that bunch-crossing time. Do the same for the next keystrip,
840  // etc. Then do the entire process again for the next bunch-crossing, etc
841  // until you find a pre-trigger.
842 
843  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer>> hits_in_patterns;
844  hits_in_patterns.clear();
845 
846  bool hits_in_time = patternFinding(bx_time, hits_in_patterns);
847  if (hits_in_time) {
848  // clear the pretriggers
850 
851  for (int hstrip = stagger[CSCConstants::KEY_CLCT_LAYER - 1]; hstrip < numHalfStrips_; hstrip++) {
852  // check the properties of the pattern on this halfstrip
853  if (infoV > 1) {
854  if (nhits[hstrip] > 0) {
855  LogTrace("CSCCathodeLCTProcessor")
856  << " bx = " << std::setw(2) << bx_time << " --->"
857  << " halfstrip = " << std::setw(3) << hstrip << " best pid = " << std::setw(2) << best_pid[hstrip]
858  << " nhits = " << nhits[hstrip];
859  }
860  }
861  // a pretrigger was found
862  if (nhits[hstrip] >= nplanes_hit_pretrig && best_pid[hstrip] >= pid_thresh_pretrig) {
863  pre_trig = true;
864  ispretrig_[hstrip] = true;
865 
866  // write each pre-trigger to output
867  nPreTriggers++;
868  thePreTriggerDigis.push_back(constructPreCLCT(bx_time, hstrip, nPreTriggers));
869  }
870  }
871 
872  // upon the first pretrigger, we save first BX and exit
873  if (pre_trig) {
874  first_bx = bx_time; // bx at time of pretrigger
875  return true;
876  }
877  }
878  } // end loop over bx times
879 
880  if (infoV > 1)
881  LogTrace("CSCCathodeLCTProcessor") << "no pretrigger, returning \n";
882  first_bx = fifo_tbins;
883  return false;
884 } // preTrigger -- TMB-07 version.
bool patternFinding(const unsigned int bx_time, std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &hits_in_patterns)
#define LogTrace(id)
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
int stagger[CSCConstants::NUM_LAYERS]
bool ispretrig_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]

◆ preTriggerBXs()

std::vector<int> CSCCathodeLCTProcessor::preTriggerBXs ( ) const
inline

Definition at line 88 of file CSCCathodeLCTProcessor.h.

References thePreTriggerBXs.

88 { return thePreTriggerBXs; }
std::vector< int > thePreTriggerBXs

◆ preTriggerDigis()

std::vector<CSCCLCTPreTriggerDigi> CSCCathodeLCTProcessor::preTriggerDigis ( ) const
inline

read out CLCTs in ME1a , ME1b

Definition at line 91 of file CSCCathodeLCTProcessor.h.

References thePreTriggerDigis.

91 { return thePreTriggerDigis; }
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis

◆ pulseExtension()

void CSCCathodeLCTProcessor::pulseExtension ( const std::vector< int >  time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
protected

Definition at line 787 of file CSCCathodeLCTProcessor.cc.

References PulseArray::bitsInPulse(), PulseArray::clear(), relativeConstraints::empty, PulseArray::extend(), hit_persist, mps_fire::i, CSCBaseboard::infoV, CSCConstants::NUM_LAYERS, numHalfStrips_, pulse_, start_bx_shift, and hcalRecHitTable_cff::time.

Referenced by checkLocalShower(), CSCUpgradeCathodeLCTProcessor::findLCTs(), and findLCTs().

788  {
789  const unsigned bits_in_pulse = pulse_.bitsInPulse();
790 
791  // Clear pulse array. This array will be used as a bit representation of
792  // hit times. For example: if strip[1][2] has a value of 3, then 1 shifted
793  // left 3 will be bit pattern of pulse[1][2]. This would make the pattern
794  // look like 0000000000001000. Then add on additional bits to signify
795  // the duration of a signal (hit_persist, formerly bx_width) to simulate
796  // the TMB's drift delay. So for the same pulse[1][2] with a hit_persist
797  // of 3 would look like 0000000000111000. This is similating the digital
798  // one-shot in the TMB.
799  pulse_.clear();
800 
801  // Loop over all layers and halfstrips.
802  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
803  for (int i_strip = 0; i_strip < numHalfStrips_; i_strip++) {
804  // If there is a hit, simulate digital one-shot persistence starting
805  // in the bx of the initial hit. Fill this into pulse[][].
806  if (!time[i_layer][i_strip].empty()) {
807  std::vector<int> bx_times = time[i_layer][i_strip];
808  for (unsigned int i = 0; i < bx_times.size(); i++) {
809  // Check that min and max times are within the allowed range.
810  if (bx_times[i] < 0 || bx_times[i] + hit_persist >= bits_in_pulse) {
811  if (infoV > 0)
812  edm::LogWarning("L1CSCTPEmulatorOutOfTimeDigi")
813  << "+++ BX time of comparator digi (halfstrip = " << i_strip << " layer = " << i_layer
814  << ") bx = " << bx_times[i] << " is not within the range (0-" << bits_in_pulse
815  << "] allowed for pulse extension. Skip this digi! +++\n";
816  continue;
817  }
818  if (bx_times[i] >= start_bx_shift) {
819  pulse_.extend(i_layer, i_strip, bx_times[i], hit_persist);
820  }
821  }
822  }
823  }
824  }
825 } // pulseExtension.
void clear()
Definition: PulseArray.cc:14
unsigned bitsInPulse() const
Definition: PulseArray.cc:25
Log< level::Warning, false > LogWarning
void extend(const unsigned layer, const unsigned channel, const unsigned bx, const unsigned hit_persist)
Definition: PulseArray.cc:27

◆ readComparatorDigis()

void CSCCathodeLCTProcessor::readComparatorDigis ( std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
protected

Definition at line 483 of file CSCCathodeLCTProcessor.cc.

References digiV, fifo_tbins, hit_persist, mps_fire::i, CSCBaseboard::infoV, LogTrace, CSCConstants::NUM_LAYERS, numHalfStrips_, numStrips_, stagger, CSCBaseboard::theChamber, CSCBaseboard::theRing, and CSCBaseboard::theStation.

Referenced by run().

484  {
485  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
486  int i_digi = 0; // digi counter, for dumps.
487  for (std::vector<CSCComparatorDigi>::iterator pld = digiV[i_layer].begin(); pld != digiV[i_layer].end();
488  pld++, i_digi++) {
489  // Dump raw digi info.
490  if (infoV > 1) {
491  std::ostringstream strstrm;
492  strstrm << "Comparator digi: comparator = " << pld->getComparator() << " strip #" << pld->getStrip()
493  << " time bins on:";
494  std::vector<int> bx_times = pld->getTimeBinsOn();
495  for (unsigned int tbin = 0; tbin < bx_times.size(); tbin++)
496  strstrm << " " << bx_times[tbin];
497  LogTrace("CSCCathodeLCTProcessor") << strstrm.str();
498  }
499 
500  // Get comparator: 0/1 for left/right halfstrip for each comparator
501  // that fired.
502  int thisComparator = pld->getComparator();
503  if (thisComparator != 0 && thisComparator != 1) {
504  if (infoV >= 0)
505  edm::LogWarning("L1CSCTPEmulatorWrongInput")
506  << "+++ station " << theStation << " ring " << theRing << " chamber " << theChamber
507  << " Found comparator digi with wrong comparator value = " << thisComparator << "; skipping it... +++\n";
508  continue;
509  }
510 
511  // Get strip number.
512  int thisStrip = pld->getStrip() - 1; // count from 0
513  if (thisStrip < 0 || thisStrip >= numStrips_) {
514  if (infoV >= 0)
515  edm::LogWarning("L1CSCTPEmulatorWrongInput")
516  << "+++ station " << theStation << " ring " << theRing << " chamber " << theChamber
517  << " Found comparator digi with wrong strip number = " << thisStrip << " (max strips = " << numStrips_
518  << "); skipping it... +++\n";
519  continue;
520  }
521  // 2*strip: convert strip to 1/2 strip
522  // comp : comparator output
523  // stagger: stagger for this layer
524  int thisHalfstrip = 2 * thisStrip + thisComparator + stagger[i_layer];
525  if (thisHalfstrip >= numHalfStrips_) {
526  if (infoV >= 0)
527  edm::LogWarning("L1CSCTPEmulatorWrongInput")
528  << "+++ station " << theStation << " ring " << theRing << " chamber " << theChamber
529  << " Found wrong halfstrip number = " << thisHalfstrip << "; skipping this digi... +++\n";
530  continue;
531  }
532 
533  // Get bx times on this digi and check that they are within the bounds.
534  std::vector<int> bx_times = pld->getTimeBinsOn();
535  for (unsigned int i = 0; i < bx_times.size(); i++) {
536  // Total number of time bins in DAQ readout is given by fifo_tbins,
537  // which thus determines the maximum length of time interval.
538  //
539  // In data, only the CLCT in the time bin that was matched with L1A are read out
540  // while comparator digi is read out by 12 time bin, which includes 12 time bin info
541  // in other word, CLCTs emulated from comparator digis usually showed the OTMB behavior in 12 time bin
542  // while CLCT from data only showed 1 time bin OTMB behavior
543  // the CLCT emulated from comparator digis usually is centering at time bin 7 (BX7) and
544  // it is definitly safe to ignore any CLCTs in bx 0 or 1 and those CLCTs will never impacts on any triggers
545  if (bx_times[i] > 1 && bx_times[i] < static_cast<int>(fifo_tbins)) {
546  if (i == 0 || (i > 0 && bx_times[i] - bx_times[i - 1] >= static_cast<int>(hit_persist))) {
547  // A later hit on the same strip is ignored during the
548  // number of clocks defined by the "hit_persist" parameter
549  // (i.e., 6 bx's by default).
550  if (infoV > 1)
551  LogTrace("CSCCathodeLCTProcessor")
552  << "Comp digi: layer " << i_layer + 1 << " digi #" << i_digi + 1 << " strip " << thisStrip
553  << " halfstrip " << thisHalfstrip << " time " << bx_times[i] << " comparator " << thisComparator
554  << " stagger " << stagger[i_layer];
555  halfstrip[i_layer][thisHalfstrip].push_back(bx_times[i]);
556  } else if (i > 0) {
557  if (infoV > 1)
558  LogTrace("CSCCathodeLCTProcessor")
559  << "+++ station " << theStation << " ring " << theRing << " chamber " << theChamber
560  << " Skipping comparator digi: strip = " << thisStrip << ", layer = " << i_layer + 1
561  << ", bx = " << bx_times[i] << ", bx of previous hit = " << bx_times[i - 1];
562  }
563  } else {
564  if (infoV > 1)
565  LogTrace("CSCCathodeLCTProcessor") << "+++ station " << theStation << " ring " << theRing << " chamber "
566  << theChamber << "+++ Skipping comparator digi: strip = " << thisStrip
567  << ", layer = " << i_layer + 1 << ", bx = " << bx_times[i] << " +++";
568  }
569  }
570  }
571  }
572 }
#define LogTrace(id)
unsigned theChamber
Definition: CSCBaseboard.h:81
const unsigned theStation
Definition: CSCBaseboard.h:75
int stagger[CSCConstants::NUM_LAYERS]
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
unsigned theRing
Definition: CSCBaseboard.h:80
Log< level::Warning, false > LogWarning

◆ readoutCLCTs()

std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::readoutCLCTs ( ) const

Returns vector of CLCTs in the read-out time window, if any.

Definition at line 1141 of file CSCCathodeLCTProcessor.cc.

References nano_mu_digi_cff::bx, CSCConstants::CLCT_CENTRAL_BX, getCLCTs(), CSCBaseboard::infoV, LogDebug, CSCConstants::MAX_CLCT_TBINS, qualityControl_, readout_earliest_2, and tmb_l1a_window_size.

1141  {
1142  // temporary container for further selection
1143  std::vector<CSCCLCTDigi> tmpV;
1144 
1145  /*
1146  CLCTs in the BX window [early_tbin,...,late_tbin] are considered good for physics
1147  The central CLCT BX is time bin 7.
1148  For tmb_l1a_window_size set to 7 (Run-1, Run-2), the window is [4, 5, 6, 7, 8, 9, 10]
1149  For tmb_l1a_window_size set to 5 (Run-3), the window is [5, 6, 7, 8, 9]
1150  For tmb_l1a_window_size set to 3 (Run-4?), the window is [6, 7, 8]
1151  */
1152  const unsigned delta_tbin = tmb_l1a_window_size / 2;
1153  int early_tbin = CSCConstants::CLCT_CENTRAL_BX - delta_tbin;
1154  int late_tbin = CSCConstants::CLCT_CENTRAL_BX + delta_tbin;
1155  /*
1156  Special case for an even-numbered time-window,
1157  For instance tmb_l1a_window_size set to 6: [4, 5, 6, 7, 8, 9]
1158  */
1159  if (tmb_l1a_window_size % 2 == 0)
1160  late_tbin = CSCConstants::CLCT_CENTRAL_BX + delta_tbin - 1;
1161  const int max_late_tbin = CSCConstants::MAX_CLCT_TBINS - 1;
1162 
1163  // debugging messages when early_tbin or late_tbin has a suspicious value
1164  if (early_tbin < 0) {
1165  edm::LogWarning("CSCCathodeLCTProcessor|SuspiciousParameters")
1166  << "Early time bin (early_tbin) smaller than minimum allowed, which is 0. set early_tbin to 0.";
1167  early_tbin = 0;
1168  }
1169  if (late_tbin > max_late_tbin) {
1170  edm::LogWarning("CSCCathodeLCTProcessor|SuspiciousParameters")
1171  << "Late time bin (late_tbin) larger than maximum allowed, which is " << max_late_tbin
1172  << ". set early_tbin to max allowed";
1173  late_tbin = CSCConstants::MAX_CLCT_TBINS - 1;
1174  }
1175 
1176  // get the valid LCTs. No BX selection is done here
1177  const auto& all_clcts = getCLCTs();
1178 
1179  // Start from the vector of all found CLCTs and select those within
1180  // the CLCT*L1A coincidence window.
1181  int bx_readout = -1;
1182  for (const auto& clct : all_clcts) {
1183  // only consider valid CLCTs
1184  if (!clct.isValid())
1185  continue;
1186 
1187  const int bx = clct.getBX();
1188  // Skip CLCTs found too early relative to L1Accept.
1189  if (bx < early_tbin) {
1190  if (infoV > 1)
1191  LogDebug("CSCCathodeLCTProcessor")
1192  << " Do not report correlated CLCT on key halfstrip " << clct.getStrip() << ": found at bx " << bx
1193  << ", whereas the earliest allowed bx is " << early_tbin;
1194  continue;
1195  }
1196 
1197  // Skip CLCTs found too late relative to L1Accept.
1198  if (bx > late_tbin) {
1199  if (infoV > 1)
1200  LogDebug("CSCCathodeLCTProcessor")
1201  << " Do not report correlated CLCT on key halfstrip " << clct.getStrip() << ": found at bx " << bx
1202  << ", whereas the latest allowed bx is " << late_tbin;
1203  continue;
1204  }
1205 
1206  // If (readout_earliest_2) take only CLCTs in the earliest bx in the read-out window:
1207  if (readout_earliest_2) {
1208  // the first CLCT passes
1209  // the second CLCT passes if the BX matches to the first
1210  if (bx_readout == -1 || bx == bx_readout) {
1211  tmpV.push_back(clct);
1212  if (bx_readout == -1)
1213  bx_readout = bx;
1214  }
1215  } else
1216  tmpV.push_back(clct);
1217  }
1218 
1219  // do a final check on the CLCTs in readout
1220  qualityControl_->checkMultiplicityBX(tmpV);
1221  for (const auto& clct : tmpV) {
1222  qualityControl_->checkValid(clct);
1223  }
1224 
1225  return tmpV;
1226 }
std::unique_ptr< LCTQualityControl > qualityControl_
std::vector< CSCCLCTDigi > getCLCTs() const
Log< level::Warning, false > LogWarning
#define LogDebug(id)

◆ readoutShower()

std::vector< CSCShowerDigi > CSCCathodeLCTProcessor::readoutShower ( ) const

Returns shower bits

Definition at line 1274 of file CSCCathodeLCTProcessor.cc.

References nano_mu_digi_cff::bx, cathode_showers_, sistrip::SpyUtilities::isValid(), maxbx_readout_, and minbx_readout_.

1274  {
1275  std::vector<CSCShowerDigi> showerOut;
1276  for (unsigned bx = minbx_readout_; bx < maxbx_readout_; bx++)
1277  if (cathode_showers_[bx].isValid())
1278  showerOut.push_back(cathode_showers_[bx]);
1279  return showerOut;
1280 }
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
CSCShowerDigi cathode_showers_[CSCConstants::MAX_CLCT_TBINS]

◆ run() [1/2]

std::vector< CSCCLCTDigi > CSCCathodeLCTProcessor::run ( const CSCComparatorDigiCollection compdc,
const CSCChamber chamber,
const CSCL1TPLookupTableCCLUT lookupTable 
)

Runs the LCT processor code. Called in normal running – gets info from a collection of comparator digis.

Definition at line 199 of file CSCCathodeLCTProcessor.cc.

References CSCConstants::ALCT_CLCT_OFFSET, CSCBaseboard::cscChamber(), CSCBaseboard::disableME1a_, dumpConfigParams(), relativeConstraints::empty, encodeHighMultiplicityBits(), CSCBaseboard::gangedME1a_, CSCLayer::geometry(), getCLCTs(), getDigis(), CSCBaseboard::infoV, CSCBaseboard::isME11_, CSCChamber::layer(), CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER, CSCConstants::MAX_NUM_STRIPS_RUN1, CSCConstants::MAX_NUM_STRIPS_RUN2, nplanes_hit_pretrig, CSCConstants::NUM_LAYERS, CSCConstants::NUM_STRIPS_ME1B, CSCConstants::NUM_STRIPS_PER_CFEB, CSCLayerGeometry::numberOfStrips(), numCFEBs_, numHalfStrips_, numStrips_, or, AlCaHLTBitMon_ParallelJobs::p, qualityControl_, readComparatorDigis(), CSCLayerGeometry::stagger(), stagger, CSCBaseboard::theCSCName_, CSCBaseboard::theRing, CSCBaseboard::theSector, CSCBaseboard::theStation, CSCBaseboard::theSubsector, and CSCBaseboard::theTrigChamber.

201  {
202  // This is the version of the run() function that is called when running
203  // over the entire detector. It gets the comparator & timing info from the
204  // comparator digis and then passes them on to another run() function.
205 
206  static std::atomic<bool> config_dumped{false};
207  if ((infoV > 0) && !config_dumped) {
209  config_dumped = true;
210  }
211 
212  // Get the number of strips and stagger of layers for the given chamber.
213  // Do it only once per chamber.
214  if (numStrips_ <= 0 or numStrips_ > CSCConstants::MAX_NUM_STRIPS_RUN2) {
215  if (cscChamber) {
217 
218  // ME1/a is known to the readout hardware as strips 65-80 of ME1/1.
219  // Still need to decide whether we do any special adjustments to
220  // reconstruct LCTs in this region (3:1 ganged strips); for now, we
221  // simply allow for hits in ME1/a and apply standard reconstruction
222  // to them.
223  // For Phase2 ME1/1 is set to have 4 CFEBs in ME1/b and 3 CFEBs in ME1/a
224  if (isME11_) {
225  if (theRing == 4) {
226  edm::LogError("CSCCathodeLCTProcessor|SetupError")
227  << "+++ Invalid ring number for this processor " << theRing << " was set in the config."
228  << " +++\n"
229  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
230  }
231  if (!disableME1a_ && theRing == 1 && !gangedME1a_)
233  if (!disableME1a_ && theRing == 1 && gangedME1a_)
235  if (disableME1a_ && theRing == 1)
237  }
238 
239  numHalfStrips_ = 2 * numStrips_ + 1;
241 
243  edm::LogError("CSCCathodeLCTProcessor|SetupError")
244  << "+++ Number of strips, " << numStrips_ << " found in " << theCSCName_ << " (sector " << theSector
245  << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
246  << " exceeds max expected, " << CSCConstants::MAX_NUM_STRIPS_RUN2 << " +++\n"
247  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
248  numStrips_ = -1;
249  numHalfStrips_ = -1;
250  numCFEBs_ = -1;
251  }
252  // The strips for a given layer may be offset from the adjacent layers.
253  // This was done in order to improve resolution. We need to find the
254  // 'staggering' for each layer and make necessary conversions in our
255  // arrays. -JM
256  // In the TMB-07 firmware, half-strips in odd layers (layers are
257  // counted as ly0-ly5) are shifted by -1 half-strip, whereas in
258  // the previous firmware versions half-strips in even layers
259  // were shifted by +1 half-strip. This difference is due to a
260  // change from ly3 to ly2 in the choice of the key layer, and
261  // the intention to keep half-strips in the key layer unchanged.
262  // In the emulator, we use the old way for both cases, to avoid
263  // negative half-strip numbers. This will necessitate a
264  // subtraction of 1 half-strip for TMB-07 later on. -SV.
265  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
266  stagger[i_layer] = (cscChamber->layer(i_layer + 1)->geometry()->stagger() + 1) / 2;
267  }
268  } else {
269  edm::LogError("CSCCathodeLCTProcessor|ConfigError")
270  << " " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. "
271  << theTrigChamber << ")"
272  << " is not defined in current geometry! +++\n"
273  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
274  numStrips_ = -1;
275  numHalfStrips_ = -1;
276  numCFEBs_ = -1;
277  }
278  }
279 
280  if (numStrips_ <= 0 or 2 * (unsigned)numStrips_ > qualityControl_->get_csc_max_halfstrip(theStation, theRing)) {
281  edm::LogError("CSCCathodeLCTProcessor|ConfigError")
282  << " " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. "
283  << theTrigChamber << "):"
284  << " numStrips_ = " << numStrips_ << "; CLCT emulation skipped! +++";
285  std::vector<CSCCLCTDigi> emptyV;
286  return emptyV;
287  }
288 
289  // Get comparator digis in this chamber.
290  bool hasDigis = getDigis(compdc);
291 
292  if (hasDigis) {
293  // Get halfstrip times from comparator digis.
295  readComparatorDigis(halfStripTimes);
296 
297  // Pass arrays of halfstrips on to another run() doing the
298  // LCT search.
299  // If the number of layers containing digis is smaller than that
300  // required to trigger, quit right away. (If LCT-based digi suppression
301  // is implemented one day, this condition will have to be changed
302  // to the number of planes required to pre-trigger.)
303  unsigned int layersHit = 0;
304  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
305  for (int i_hstrip = 0; i_hstrip < CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER; i_hstrip++) {
306  if (!halfStripTimes[i_layer][i_hstrip].empty()) {
307  layersHit++;
308  break;
309  }
310  }
311  }
312  // Run the algorithm only if the probability for the pre-trigger
313  // to fire is not null. (Pre-trigger decisions are used for the
314  // strip read-out conditions in DigiToRaw.)
315  if (layersHit >= nplanes_hit_pretrig)
316  run(halfStripTimes, lookupTable);
317 
318  // Get the high multiplicity bits in this chamber
320  }
321 
322  // Return vector of CLCTs.
323  std::vector<CSCCLCTDigi> tmpV = getCLCTs();
324 
325  // shift the BX from 7 to 8
326  // the unpacked real data CLCTs have central BX at bin 7
327  // however in simulation the central BX is bin 8
328  // to make a proper comparison with ALCTs we need
329  // CLCT and ALCT to have the central BX in the same bin
330  // this shift does not affect the readout of the CLCTs
331  // emulated CLCTs put in the event should be centered at bin 7 (as in data)
332  for (auto& p : tmpV) {
333  p.setBX(p.getBX() + CSCConstants::ALCT_CLCT_OFFSET);
334  }
335 
336  return tmpV;
337 }
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:30
static constexpr int MAX_NUM_STRIPS_RUN1
Definition: CSCConstants.h:64
const unsigned theSector
Definition: CSCBaseboard.h:76
Log< level::Error, false > LogError
std::unique_ptr< LCTQualityControl > qualityControl_
std::string theCSCName_
Definition: CSCBaseboard.h:104
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
const unsigned theTrigChamber
Definition: CSCBaseboard.h:78
std::vector< CSCCLCTDigi > getCLCTs() const
int numberOfStrips() const
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
Definition: Activities.doc:12
bool getDigis(const CSCComparatorDigiCollection *compdc)
const CSCChamber * cscChamber(CSCGeometry const &) const
static constexpr int MAX_NUM_HALF_STRIPS_RUN2_TRIGGER
Definition: CSCConstants.h:74
static constexpr int MAX_NUM_STRIPS_RUN2
Definition: CSCConstants.h:65
static constexpr int NUM_STRIPS_ME1B
Definition: CSCConstants.h:78
const unsigned theStation
Definition: CSCBaseboard.h:75
int stagger[CSCConstants::NUM_LAYERS]
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc, const CSCChamber *chamber, const CSCL1TPLookupTableCCLUT *lookupTable)
unsigned theRing
Definition: CSCBaseboard.h:80
void readComparatorDigis(std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
const unsigned theSubsector
Definition: CSCBaseboard.h:77
static constexpr int NUM_STRIPS_PER_CFEB
Definition: CSCConstants.h:60

◆ run() [2/2]

void CSCCathodeLCTProcessor::run ( const std::vector< int >  halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER],
const CSCL1TPLookupTableCCLUT lookupTable 
)

Called in test mode and by the run(compdc) function; does the actual LCT finding.

Definition at line 339 of file CSCCathodeLCTProcessor.cc.

References bestCLCT, nano_mu_digi_cff::bx, CSCDetId::chamberName(), checkLocalShower(), findLCTs(), CSCBaseboard::infoV, PulseArray::initialize(), sistrip::SpyUtilities::isValid(), localShowerZone, LogDebug, CSCConstants::MAX_CLCT_TBINS, numHalfStrips_, AlCaHLTBitMon_ParallelJobs::p, pulse_, qualityControl_, secondCLCT, CSCCLCTDigi::setTrknmb(), CSCBaseboard::theChamber, CSCBaseboard::theEndcap, CSCBaseboard::theRing, CSCBaseboard::theSector, CSCBaseboard::theStation, CSCBaseboard::theSubsector, and CSCBaseboard::theTrigChamber.

341  {
342  // This version of the run() function can either be called in a standalone
343  // test, being passed the halfstrip times, or called by the
344  // run() function above. It uses the findLCTs() method to find vectors
345  // of LCT candidates. These candidates are already sorted and the best two per bx
346  // are returned.
347 
348  // initialize the pulse array.
349  // add 1 for possible stagger
351 
352  std::vector<CSCCLCTDigi> CLCTlist = findLCTs(halfstrip, lookupTable);
353 
354  for (const auto& p : CLCTlist) {
355  const int bx = p.getBX();
357  if (infoV > 0)
358  edm::LogWarning("L1CSCTPEmulatorOutOfTimeCLCT")
359  << "+++ Bx of CLCT candidate, " << bx << ", exceeds max allowed, " << CSCConstants::MAX_CLCT_TBINS - 1
360  << "; skipping it... +++\n";
361  continue;
362  }
363 
364  if (!bestCLCT[bx].isValid()) {
365  bestCLCT[bx] = p;
366  } else if (!secondCLCT[bx].isValid()) {
367  secondCLCT[bx] = p;
368  }
369  }
370 
371  for (int bx = 0; bx < CSCConstants::MAX_CLCT_TBINS; bx++) {
372  if (bestCLCT[bx].isValid()) {
373  bestCLCT[bx].setTrknmb(1);
374 
375  // check if the LCT is valid
376  qualityControl_->checkValid(bestCLCT[bx]);
377 
378  if (infoV > 0)
379  LogDebug("CSCCathodeLCTProcessor")
381  << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
382  << "\n";
383  }
384  if (secondCLCT[bx].isValid()) {
385  secondCLCT[bx].setTrknmb(2);
386 
387  // check if the LCT is valid
388  qualityControl_->checkValid(secondCLCT[bx]);
389 
390  if (infoV > 0)
391  LogDebug("CSCCathodeLCTProcessor")
393  << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
394  << "\n";
395  }
396  }
397  checkLocalShower(localShowerZone, halfstrip);
398  // Now that we have our best CLCTs, they get correlated with the best
399  // ALCTs and then get sent to the MotherBoard. -JM
400 }
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
const unsigned theEndcap
Definition: CSCBaseboard.h:74
const unsigned theSector
Definition: CSCBaseboard.h:76
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], const CSCL1TPLookupTableCCLUT *lookupTable)
std::unique_ptr< LCTQualityControl > qualityControl_
const unsigned theTrigChamber
Definition: CSCBaseboard.h:78
std::string chamberName() const
Definition: CSCDetId.cc:92
unsigned theChamber
Definition: CSCBaseboard.h:81
const unsigned theStation
Definition: CSCBaseboard.h:75
void initialize(unsigned numberOfChannels)
Definition: PulseArray.cc:5
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
unsigned theRing
Definition: CSCBaseboard.h:80
Log< level::Warning, false > LogWarning
const unsigned theSubsector
Definition: CSCBaseboard.h:77
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting CLCTs.
Definition: CSCCLCTDigi.h:162
void checkLocalShower(int zone, const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
#define LogDebug(id)

◆ setConfigParameters()

void CSCCathodeLCTProcessor::setConfigParameters ( const CSCDBL1TPParameters conf)

Sets configuration parameters obtained via EventSetup mechanism.

Definition at line 135 of file CSCCathodeLCTProcessor.cc.

References checkConfigParameters(), CSCDBL1TPParameters::clctDriftDelay(), CSCDBL1TPParameters::clctFifoPretrig(), CSCDBL1TPParameters::clctFifoTbins(), CSCDBL1TPParameters::clctHitPersist(), CSCDBL1TPParameters::clctMinSeparation(), CSCDBL1TPParameters::clctNplanesHitPattern(), CSCDBL1TPParameters::clctNplanesHitPretrig(), CSCDBL1TPParameters::clctPidThreshPretrig(), drift_delay, dumpConfigParams(), fifo_pretrig, fifo_tbins, hit_persist, CSCConstants::LCT_CENTRAL_BX, maxbx_readout_, min_separation, minbx_readout_, nplanes_hit_pattern, nplanes_hit_pretrig, pid_thresh_pretrig, and tmb_l1a_window_size.

135  {
136  static std::atomic<bool> config_dumped{false};
137 
138  fifo_tbins = conf->clctFifoTbins();
139  fifo_pretrig = conf->clctFifoPretrig();
140  hit_persist = conf->clctHitPersist();
141  drift_delay = conf->clctDriftDelay();
146 
147  // Check and print configuration parameters.
149  if (!config_dumped) {
151  config_dumped = true;
152  }
155 }
unsigned int clctNplanesHitPattern() const
unsigned int clctMinSeparation() const
unsigned int clctFifoTbins() const
unsigned int clctNplanesHitPretrig() const
unsigned int clctFifoPretrig() const
unsigned int clctPidThreshPretrig() const
unsigned int clctHitPersist() const
unsigned int clctDriftDelay() const

◆ setDefaultConfigParameters()

void CSCCathodeLCTProcessor::setDefaultConfigParameters ( )
protected

Set default values for configuration parameters.

Definition at line 119 of file CSCCathodeLCTProcessor.cc.

References def_drift_delay, def_fifo_pretrig, def_fifo_tbins, def_hit_persist, def_min_separation, def_nplanes_hit_pattern, def_nplanes_hit_pretrig, def_pid_thresh_pretrig, def_tmb_l1a_window_size, drift_delay, fifo_pretrig, fifo_tbins, hit_persist, CSCConstants::LCT_CENTRAL_BX, maxbx_readout_, min_separation, minbx_readout_, nplanes_hit_pattern, nplanes_hit_pretrig, pid_thresh_pretrig, and tmb_l1a_window_size.

119  {
120  // Set default values for configuration parameters.
132 }
static const unsigned int def_drift_delay
static const unsigned int def_fifo_tbins
static const unsigned int def_min_separation
static const unsigned int def_nplanes_hit_pretrig
static const unsigned int def_pid_thresh_pretrig
static const unsigned int def_tmb_l1a_window_size
static const unsigned int def_nplanes_hit_pattern
static const unsigned int def_fifo_pretrig
static const unsigned int def_hit_persist

Member Data Documentation

◆ best_pid

unsigned int CSCCathodeLCTProcessor::best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
protected

◆ bestCLCT

CSCCLCTDigi CSCCathodeLCTProcessor::bestCLCT[CSCConstants::MAX_CLCT_TBINS]
protected

Best LCT in this chamber, as found by the processor.

Definition at line 104 of file CSCCathodeLCTProcessor.h.

Referenced by checkLocalShower(), clear(), getBestCLCT(), getCLCTs(), and run().

◆ cathode_showers_

CSCShowerDigi CSCCathodeLCTProcessor::cathode_showers_[CSCConstants::MAX_CLCT_TBINS]
protected

◆ cclut_

std::unique_ptr<ComparatorCodeLUT> CSCCathodeLCTProcessor::cclut_
protected

Definition at line 252 of file CSCCathodeLCTProcessor.h.

Referenced by constructCLCT(), and CSCCathodeLCTProcessor().

◆ clct_pattern_

CSCPatternBank::LCTPatterns CSCCathodeLCTProcessor::clct_pattern_ = {}
protected

◆ def_drift_delay

const unsigned int CSCCathodeLCTProcessor::def_drift_delay = 2
staticprotected

Definition at line 242 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_fifo_pretrig

const unsigned int CSCCathodeLCTProcessor::def_fifo_pretrig = 7
staticprotected

Definition at line 241 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_fifo_tbins

const unsigned int CSCCathodeLCTProcessor::def_fifo_tbins = 12
staticprotected

Default values of configuration parameters.

Definition at line 241 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_hit_persist

const unsigned int CSCCathodeLCTProcessor::def_hit_persist = 6
staticprotected

Definition at line 242 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_min_separation

const unsigned int CSCCathodeLCTProcessor::def_min_separation = 10
staticprotected

Definition at line 245 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_nplanes_hit_pattern

const unsigned int CSCCathodeLCTProcessor::def_nplanes_hit_pattern = 4
staticprotected

Definition at line 244 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_nplanes_hit_pretrig

const unsigned int CSCCathodeLCTProcessor::def_nplanes_hit_pretrig = 2
staticprotected

Definition at line 243 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_pid_thresh_pretrig

const unsigned int CSCCathodeLCTProcessor::def_pid_thresh_pretrig = 2
staticprotected

Definition at line 245 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_tmb_l1a_window_size

const unsigned int CSCCathodeLCTProcessor::def_tmb_l1a_window_size = 7
staticprotected

Definition at line 246 of file CSCCathodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ digiV

std::vector<CSCComparatorDigi> CSCCathodeLCTProcessor::digiV[CSCConstants::NUM_LAYERS]
protected

◆ drift_delay

unsigned int CSCCathodeLCTProcessor::drift_delay
protected

◆ early_tbins

int CSCCathodeLCTProcessor::early_tbins
protected

VK: separate handle for early time bins

Definition at line 235 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor().

◆ fifo_pretrig

unsigned int CSCCathodeLCTProcessor::fifo_pretrig
protected

◆ fifo_tbins

unsigned int CSCCathodeLCTProcessor::fifo_tbins
protected

◆ hit_persist

unsigned int CSCCathodeLCTProcessor::hit_persist
protected

◆ ispretrig_

bool CSCCathodeLCTProcessor::ispretrig_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
protected

◆ localShowerFlag

bool CSCCathodeLCTProcessor::localShowerFlag[CSCConstants::MAX_CLCT_TBINS]
protected

Definition at line 113 of file CSCCathodeLCTProcessor.h.

Referenced by checkLocalShower(), clear(), and getLocalShowerFlag().

◆ localShowerThresh

int CSCCathodeLCTProcessor::localShowerThresh
protected

Definition at line 232 of file CSCCathodeLCTProcessor.h.

Referenced by checkLocalShower(), and CSCCathodeLCTProcessor().

◆ localShowerZone

int CSCCathodeLCTProcessor::localShowerZone
protected

Definition at line 229 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and run().

◆ maxbx_readout_

unsigned CSCCathodeLCTProcessor::maxbx_readout_
protected

◆ min_separation

unsigned int CSCCathodeLCTProcessor::min_separation
protected

◆ minbx_readout_

unsigned CSCCathodeLCTProcessor::minbx_readout_
protected

◆ minLayersCentralTBin_

unsigned CSCCathodeLCTProcessor::minLayersCentralTBin_
protected

Definition at line 212 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and encodeHighMultiplicityBits().

◆ nhits

unsigned int CSCCathodeLCTProcessor::nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
protected

◆ nplanes_hit_pattern

unsigned int CSCCathodeLCTProcessor::nplanes_hit_pattern
protected

◆ nplanes_hit_pretrig

unsigned int CSCCathodeLCTProcessor::nplanes_hit_pretrig
protected

◆ numCFEBs_

int CSCCathodeLCTProcessor::numCFEBs_
protected

Definition at line 199 of file CSCCathodeLCTProcessor.h.

Referenced by constructCLCT(), and run().

◆ numHalfStrips_

int CSCCathodeLCTProcessor::numHalfStrips_
protected

◆ numStrips_

int CSCCathodeLCTProcessor::numStrips_
protected

Definition at line 198 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), readComparatorDigis(), and run().

◆ peakCheck_

bool CSCCathodeLCTProcessor::peakCheck_
protected

check the peak of total hits and single bx hits for cathode HMT

Definition at line 216 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and encodeHighMultiplicityBits().

◆ pid_thresh_pretrig

unsigned int CSCCathodeLCTProcessor::pid_thresh_pretrig
protected

◆ pulse_

PulseArray CSCCathodeLCTProcessor::pulse_
protected

Definition at line 183 of file CSCCathodeLCTProcessor.h.

Referenced by checkLocalShower(), patternFinding(), pulseExtension(), and run().

◆ qualityControl_

std::unique_ptr<LCTQualityControl> CSCCathodeLCTProcessor::qualityControl_
protected

Definition at line 249 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), readoutCLCTs(), and run().

◆ readout_earliest_2

bool CSCCathodeLCTProcessor::readout_earliest_2
protected

VK: whether to readout only the earliest two LCTs in readout window

Definition at line 238 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and readoutCLCTs().

◆ secondCLCT

CSCCLCTDigi CSCCathodeLCTProcessor::secondCLCT[CSCConstants::MAX_CLCT_TBINS]
protected

Second best LCT in this chamber, as found by the processor.

Definition at line 107 of file CSCCathodeLCTProcessor.h.

Referenced by clear(), getCLCTs(), getSecondCLCT(), and run().

◆ showerNumTBins_

unsigned CSCCathodeLCTProcessor::showerNumTBins_
protected

Definition at line 211 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and encodeHighMultiplicityBits().

◆ stagger

int CSCCathodeLCTProcessor::stagger[CSCConstants::NUM_LAYERS]
protected

◆ start_bx_shift

int CSCCathodeLCTProcessor::start_bx_shift
protected

VK: some quick and dirty fix to reduce CLCT deadtime

Definition at line 226 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), CSCUpgradeCathodeLCTProcessor::findLCTs(), findLCTs(), and pulseExtension().

◆ thePreTriggerBXs

std::vector<int> CSCCathodeLCTProcessor::thePreTriggerBXs
protected

Definition at line 206 of file CSCCathodeLCTProcessor.h.

Referenced by clear(), findLCTs(), and preTriggerBXs().

◆ thePreTriggerDigis

std::vector<CSCCLCTPreTriggerDigi> CSCCathodeLCTProcessor::thePreTriggerDigis
protected

◆ thresholds_

std::vector<unsigned> CSCCathodeLCTProcessor::thresholds_
protected

Definition at line 210 of file CSCCathodeLCTProcessor.h.

Referenced by CSCCathodeLCTProcessor(), and encodeHighMultiplicityBits().

◆ tmb_l1a_window_size

unsigned int CSCCathodeLCTProcessor::tmb_l1a_window_size
protected