CMS 3D CMS Logo

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

#include <CSCAnodeLCTProcessor.h>

Inheritance diagram for CSCAnodeLCTProcessor:
CSCBaseboard CSCUpgradeAnodeLCTProcessor

Public Member Functions

void clear ()
 
 CSCAnodeLCTProcessor (unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, CSCBaseboard::Parameters &conf)
 
std::vector< CSCALCTDigigetALCTs () const
 
std::vector< CSCShowerDigigetAllShower () const
 
CSCALCTDigi getBestALCT (int bx) const
 
CSCALCTDigi getSecondALCT (int bx) const
 
std::vector< CSCALCTPreTriggerDigipreTriggerDigis () const
 
std::vector< CSCALCTDigireadoutALCTs () const
 
std::vector< CSCShowerDigireadoutShower () const
 
std::vector< CSCALCTDigirun (const CSCWireDigiCollection *wiredc, CSCChamber const *chamber)
 
void run (const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
 
void setConfigParameters (const CSCDBL1TPParameters *conf)
 
 ~CSCAnodeLCTProcessor () 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 accelMode (const int key_wire)
 
std::vector< CSCALCTDigibestTrackSelector (const std::vector< CSCALCTDigi > &all_alcts)
 
void checkConfigParameters ()
 
void cleanWireContainer (CSCALCTDigi::WireContainer &wireHits) const
 
void clear (const int wire, const int pattern)
 
void dumpConfigParams () const
 
void dumpDigis (const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const
 
void encodeHighMultiplicityBits ()
 
bool getDigis (const CSCWireDigiCollection *wiredc)
 
void getDigis (const CSCWireDigiCollection *wiredc, const CSCDetId &id)
 
virtual int getTempALCTQuality (int temp_quality) const
 
virtual void ghostCancellationLogicOneWire (const int key_wire, int *ghost_cleared)
 
bool isBetterALCT (const CSCALCTDigi &lhsALCT, const CSCALCTDigi &rhsALCT) const
 
void lctSearch ()
 
void loadPatternMask ()
 
bool patternDetection (const int key_wire, std::map< int, std::map< int, CSCALCTDigi::WireContainer > > &hits_in_patterns)
 
bool preTrigger (const int key_wire, const int start_bx)
 
bool pulseExtension (const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
 
void readWireDigis (std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
 
void setDefaultConfigParameters ()
 
void setWireContainer (CSCALCTDigi &, CSCALCTDigi::WireContainer &wireHits) const
 
void showPatterns (const int key_wire)
 
void trigMode (const int key_wire)
 
- 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 accel_mode
 
CSCPatternBank::LCTPatterns alct_pattern_ = {}
 
CSCShowerDigi anode_showers_ [CSCConstants::MAX_ALCT_TBINS]
 
CSCALCTDigi bestALCT [CSCConstants::MAX_ALCT_TBINS]
 
std::vector< CSCWireDigidigiV [CSCConstants::NUM_LAYERS]
 
unsigned int drift_delay
 
int early_tbins
 
unsigned int fifo_pretrig
 
unsigned int fifo_tbins
 
int first_bx [CSCConstants::MAX_NUM_WIREGROUPS]
 
int first_bx_corrected [CSCConstants::MAX_NUM_WIREGROUPS]
 
int ghost_cancellation_bx_depth
 
bool ghost_cancellation_side_quality
 
unsigned int hit_persist
 
unsigned int l1a_window_width
 
std::vector< CSCALCTDigilct_list
 
unsigned maxbx_readout_
 
int MESelection
 
unsigned minbx_readout_
 
unsigned minLayersCentralTBin_
 
bool narrow_mask_r1
 
unsigned int nplanes_hit_accel_pattern
 
unsigned int nplanes_hit_accel_pretrig
 
unsigned int nplanes_hit_pattern
 
unsigned int nplanes_hit_pretrig
 
int numWireGroups
 
unsigned int pretrig_extra_deadtime
 
PulseArray pulse_
 
int quality [CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]
 
std::unique_ptr< LCTQualityControlqualityControl_
 
CSCALCTDigi secondALCT [CSCConstants::MAX_ALCT_TBINS]
 
unsigned showerNumTBins_
 
std::vector< CSCALCTPreTriggerDigithePreTriggerDigis
 
std::vector< unsigned > thresholds_
 
unsigned int trig_mode
 
bool use_corrected_bx
 
- 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_accel_mode = 0
 
static const unsigned int def_drift_delay = 2
 
static const unsigned int def_fifo_pretrig = 10
 
static const unsigned int def_fifo_tbins = 16
 
static const unsigned int def_l1a_window_width = 7
 
static const unsigned int def_nplanes_hit_accel_pattern = 4
 
static const unsigned int def_nplanes_hit_accel_pretrig = 2
 
static const unsigned int def_nplanes_hit_pattern = 4
 
static const unsigned int def_nplanes_hit_pretrig = 2
 
static const unsigned int def_trig_mode = 2
 

Detailed Description

This class simulates the functionality of the anode LCT card. It is run by the MotherBoard and returns up to two AnodeLCTs. It can be run either in a test mode, where it is passed an array of wire times, or in normal mode where it determines the wire times from the wire digis.

This is the simulation for the Anode LCT Processor for the Level-1 Trigger. This processor consists of several stages:

  1. Pulse extension of signals coming from wires.
  2. Pretrigger for each key-wire.
  3. Pattern detector if a pretrigger is found for the given key-wire.
  4. Ghost Cancellation Logic (GCL).
  5. Best track search and promotion.
  6. Second best track search and promotion.

The inputs to the ALCT Processor are wire digis. The output is up to two ALCT digi words.

Author
Benn Tannenbaum benn@.nosp@m.phys.nosp@m.ics.u.nosp@m.cla..nosp@m.edu 13 July 1999 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 48 of file CSCAnodeLCTProcessor.h.

Constructor & Destructor Documentation

◆ CSCAnodeLCTProcessor()

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

Normal constructor.

Definition at line 20 of file CSCAnodeLCTProcessor.cc.

References accel_mode, CSCConstants::ALCT_EMUL_TIME_OFFSET, CSCBaseboard::Parameters::alctParams(), cms::cuda::assert(), relativeConstraints::chamber, checkConfigParameters(), drift_delay, dumpConfigParams(), early_tbins, makeMuonMisalignmentScenario::endcap, fifo_pretrig, fifo_tbins, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), ghost_cancellation_bx_depth, ghost_cancellation_side_quality, hit_persist, CSCBaseboard::infoV, l1a_window_width, CSCConstants::LCT_CENTRAL_BX, loadPatternMask(), maxbx_readout_, MESelection, minbx_readout_, minLayersCentralTBin_, narrow_mask_r1, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, numWireGroups, pretrig_extra_deadtime, qualityControl_, CSCBaseboard::runPhase2_, nano_mu_digi_cff::sector, showerNumTBins_, CSCBaseboard::Parameters::showerParams(), relativeConstraints::station, nano_mu_digi_cff::subsector, CSCBaseboard::theStation, thresholds_, trig_mode, and use_corrected_bx.

27  static std::atomic<bool> config_dumped{false};
28 
29  // ALCT configuration parameters.
30  fifo_tbins = conf.alctParams().getParameter<unsigned int>("alctFifoTbins");
31  fifo_pretrig = conf.alctParams().getParameter<unsigned int>("alctFifoPretrig");
32  drift_delay = conf.alctParams().getParameter<unsigned int>("alctDriftDelay");
33  nplanes_hit_pretrig = conf.alctParams().getParameter<unsigned int>("alctNplanesHitPretrig");
34  nplanes_hit_pattern = conf.alctParams().getParameter<unsigned int>("alctNplanesHitPattern");
35  nplanes_hit_accel_pretrig = conf.alctParams().getParameter<unsigned int>("alctNplanesHitAccelPretrig");
36  nplanes_hit_accel_pattern = conf.alctParams().getParameter<unsigned int>("alctNplanesHitAccelPattern");
37  trig_mode = conf.alctParams().getParameter<unsigned int>("alctTrigMode");
38  accel_mode = conf.alctParams().getParameter<unsigned int>("alctAccelMode");
39  l1a_window_width = conf.alctParams().getParameter<unsigned int>("alctL1aWindowWidth");
40 
41  hit_persist = conf.alctParams().getParameter<unsigned int>("alctHitPersist");
42 
43  // Verbosity level, set to 0 (no print) by default.
44  infoV = conf.alctParams().getParameter<int>("verbosity");
45 
46  // separate handle for early time bins
47  early_tbins = conf.alctParams().getParameter<int>("alctEarlyTbins");
48  if (early_tbins < 0)
50 
51  // delta BX time depth for ghostCancellationLogic
52  ghost_cancellation_bx_depth = conf.alctParams().getParameter<int>("alctGhostCancellationBxDepth");
53 
54  // whether to consider ALCT candidates' qualities while doing ghostCancellationLogic on +-1 wire groups
55  ghost_cancellation_side_quality = conf.alctParams().getParameter<bool>("alctGhostCancellationSideQuality");
56 
57  // deadtime clocks after pretrigger (extra in addition to drift_delay)
58  pretrig_extra_deadtime = conf.alctParams().getParameter<unsigned int>("alctPretrigDeadtime");
59 
60  // whether to use narrow pattern mask for the rings close to the beam
61  narrow_mask_r1 = conf.alctParams().getParameter<bool>("alctNarrowMaskForR1");
62 
63  // Check and print configuration parameters.
65  if ((infoV > 0 || (runPhase2_)) && !config_dumped) {
67  config_dumped = true;
68  }
69 
70  numWireGroups = 0; // Will be set later.
71  MESelection = (theStation < 3) ? 0 : 1;
72 
73  // whether to calculate bx as corrected_bx instead of pretrigger one
74  use_corrected_bx = false;
75  if (runPhase2_) {
76  use_corrected_bx = conf.alctParams().getParameter<bool>("alctUseCorrectedBx");
77  }
78 
79  // Load appropriate pattern mask.
81 
82  // quality control of stubs
83  qualityControl_ = std::make_unique<LCTQualityControl>(endcap, station, sector, subsector, chamber, conf);
84 
85  const auto& shower = conf.showerParams().getParameterSet("anodeShower");
86  thresholds_ = shower.getParameter<std::vector<unsigned>>("showerThresholds");
87  showerNumTBins_ = shower.getParameter<unsigned>("showerNumTBins");
88  minLayersCentralTBin_ = shower.getParameter<unsigned>("minLayersCentralTBin");
92 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::unique_ptr< LCTQualityControl > qualityControl_
ParameterSet const & getParameterSet(std::string const &) const
edm::ParameterSet const & showerParams() const
Definition: CSCBaseboard.h:21
assert(be >=bs)
edm::ParameterSet const & alctParams() const
Definition: CSCBaseboard.h:23
const unsigned theStation
Definition: CSCBaseboard.h:75
unsigned int nplanes_hit_accel_pattern
std::vector< unsigned > thresholds_
unsigned int pretrig_extra_deadtime
unsigned int nplanes_hit_accel_pretrig

◆ ~CSCAnodeLCTProcessor()

CSCAnodeLCTProcessor::~CSCAnodeLCTProcessor ( )
overridedefault

Default destructor.

Member Function Documentation

◆ accelMode()

void CSCAnodeLCTProcessor::accelMode ( const int  key_wire)
protected

Definition at line 1093 of file CSCAnodeLCTProcessor.cc.

References accel_mode, CSCConstants::ALCT_ACCELERATOR_PATTERN, CSCConstants::ALCT_COLLISIONA_PATTERN, CSCBaseboard::infoV, LogTrace, and quality.

1093  {
1094  int promotionBit = 1 << 2;
1095 
1096  switch (accel_mode) {
1097  default:
1098  case 0:
1099  // Ignore accelerator muons.
1100  if (quality[key_wire][0] > 0) {
1101  quality[key_wire][0] = 0;
1102  if (infoV > 1)
1103  LogTrace("CSCAnodeLCTProcessor") << "alctMode(): accelerator track " << key_wire << " ignored"
1104  << "\n";
1105  }
1106  break;
1107  case 1:
1108  // Prefer collision muons by adding promotion bit.
1109  if (quality[key_wire][CSCConstants::ALCT_COLLISIONA_PATTERN] > 0) {
1110  quality[key_wire][CSCConstants::ALCT_COLLISIONA_PATTERN] += promotionBit;
1111  if (infoV > 1)
1112  LogTrace("CSCAnodeLCTProcessor") << "alctMode(): collision track " << key_wire << " promoted"
1113  << "\n";
1114  }
1115  break;
1116  case 2:
1117  // Prefer accelerator muons by adding promotion bit.
1118  if (quality[key_wire][CSCConstants::ALCT_ACCELERATOR_PATTERN] > 0) {
1119  quality[key_wire][CSCConstants::ALCT_ACCELERATOR_PATTERN] += promotionBit;
1120  if (infoV > 1)
1121  LogTrace("CSCAnodeLCTProcessor") << "alctMode(): accelerator track " << key_wire << " promoted"
1122  << "\n";
1123  }
1124  break;
1125  case 3:
1126  // Ignore collision muons.
1127  if (quality[key_wire][CSCConstants::ALCT_COLLISIONA_PATTERN] > 0) {
1129  if (infoV > 1)
1130  LogTrace("CSCAnodeLCTProcessor") << "alctMode(): collision track " << key_wire << " ignored"
1131  << "\n";
1132  }
1133  break;
1134  }
1135 }
#define LogTrace(id)
int quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]

◆ bestTrackSelector()

std::vector< CSCALCTDigi > CSCAnodeLCTProcessor::bestTrackSelector ( const std::vector< CSCALCTDigi > &  all_alcts)
protected

Definition at line 916 of file CSCAnodeLCTProcessor.cc.

References nano_mu_digi_cff::bx, CSCALCTDigi::getKeyWG(), CSCALCTDigi::getQuality(), mps_fire::i, CSCBaseboard::infoV, CSCALCTDigi::isValid(), sistrip::SpyUtilities::isValid(), LogTrace, CSCConstants::MAX_ALCT_TBINS, CSCConstants::MAX_ALCTS_PER_PROCESSOR, AlCaHLTBitMon_ParallelJobs::p, and nano_mu_digi_cff::wire.

Referenced by lctSearch().

916  {
919 
920  if (infoV > 1) {
921  LogTrace("CSCAnodeLCTProcessor") << all_alcts.size() << " ALCTs at the input of best-track selector: ";
922  for (const auto& p : all_alcts) {
923  if (!p.isValid())
924  continue;
925  LogTrace("CSCAnodeLCTProcessor") << p;
926  }
927  }
928 
931  for (const auto& p : all_alcts) {
932  if (!p.isValid())
933  continue;
934 
935  // Select two collision and two accelerator ALCTs with the highest
936  // quality at every bx. The search for best ALCTs is done in parallel
937  // for collision and accelerator patterns, and simultaneously for
938  // two ALCTs, tA and tB. If two or more ALCTs have equal qualities,
939  // the priority is given to the ALCT with larger wiregroup number
940  // in the search for tA (collision and accelerator), and to the ALCT
941  // with smaller wiregroup number in the search for tB.
942  int bx = p.getBX();
943  int accel = p.getAccelerator();
944  int qual = p.getQuality();
945  int wire = p.getKeyWG();
946  bool vA = tA[bx][accel].isValid();
947  bool vB = tB[bx][accel].isValid();
948  int qA = tA[bx][accel].getQuality();
949  int qB = tB[bx][accel].getQuality();
950  int wA = tA[bx][accel].getKeyWG();
951  int wB = tB[bx][accel].getKeyWG();
952  if (!vA || qual > qA || (qual == qA && wire > wA)) {
953  tA[bx][accel] = p;
954  }
955  if (!vB || qual > qB || (qual == qB && wire < wB)) {
956  tB[bx][accel] = p;
957  }
958  }
959 
960  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
961  for (int accel = 0; accel <= 1; accel++) {
962  // Best ALCT is always tA.
963  if (tA[bx][accel].isValid()) {
964  if (infoV > 2) {
965  LogTrace("CSCAnodeLCTProcessor") << "tA: " << tA[bx][accel];
966  LogTrace("CSCAnodeLCTProcessor") << "tB: " << tB[bx][accel];
967  }
968  bestALCTs[bx][accel] = tA[bx][accel];
969 
970  // If tA exists, tB exists too.
971  if (tA[bx][accel] != tB[bx][accel] && tA[bx][accel].getQuality() == tB[bx][accel].getQuality()) {
972  secondALCTs[bx][accel] = tB[bx][accel];
973  } else {
974  // Funny part: if tA and tB are the same, or the quality of tB
975  // is inferior to the quality of tA, the second best ALCT is
976  // not tB. Instead it is the largest-wiregroup ALCT among those
977  // ALCT whose qualities are lower than the quality of the best one.
978  for (const auto& p : all_alcts) {
979  if (p.isValid() && p.getAccelerator() == accel && p.getBX() == bx &&
980  p.getQuality() < bestALCTs[bx][accel].getQuality() &&
981  p.getQuality() >= secondALCTs[bx][accel].getQuality() &&
982  p.getKeyWG() >= secondALCTs[bx][accel].getKeyWG()) {
983  secondALCTs[bx][accel] = p;
984  }
985  }
986  }
987  }
988  }
989  }
990 
991  // Fill the vector with up to four best ALCTs per bx and return it.
992  std::vector<CSCALCTDigi> fourBest;
993  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
994  for (int i = 0; i < CSCConstants::MAX_ALCTS_PER_PROCESSOR; i++) {
995  if (bestALCTs[bx][i].isValid()) {
996  fourBest.push_back(bestALCTs[bx][i]);
997  }
998  }
999  for (int i = 0; i < CSCConstants::MAX_ALCTS_PER_PROCESSOR; i++) {
1000  if (secondALCTs[bx][i].isValid()) {
1001  fourBest.push_back(secondALCTs[bx][i]);
1002  }
1003  }
1004  }
1005 
1006  if (infoV > 1) {
1007  LogTrace("CSCAnodeLCTProcessor") << fourBest.size() << " ALCTs selected: ";
1008  for (const auto& p : fourBest) {
1009  LogTrace("CSCAnodeLCTProcessor") << p;
1010  }
1011  }
1012 
1013  return fourBest;
1014 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
uint16_t getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:46
#define LogTrace(id)
uint16_t getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:67

◆ checkConfigParameters()

void CSCAnodeLCTProcessor::checkConfigParameters ( )
protected

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

Definition at line 144 of file CSCAnodeLCTProcessor.cc.

References accel_mode, cms::cuda::assert(), CSCBaseboard::checkConfigParameters(), def_accel_mode, def_drift_delay, def_fifo_pretrig, def_fifo_tbins, def_l1a_window_width, def_nplanes_hit_accel_pattern, def_nplanes_hit_accel_pretrig, def_nplanes_hit_pattern, def_nplanes_hit_pretrig, def_trig_mode, drift_delay, fifo_pretrig, fifo_tbins, l1a_window_width, CSCConstants::LCT_CENTRAL_BX, CSCConstants::MAX_ALCT_TBINS, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, and trig_mode.

Referenced by CSCAnodeLCTProcessor(), and setConfigParameters().

144  {
145  // Make sure that the parameter values are within the allowed range.
146 
147  // Max expected values.
148  static const unsigned int max_fifo_tbins = 1 << 5;
149  static const unsigned int max_fifo_pretrig = 1 << 5;
150  static const unsigned int max_drift_delay = 1 << 2;
151  static const unsigned int max_nplanes_hit_pretrig = 1 << 3;
152  static const unsigned int max_nplanes_hit_pattern = 1 << 3;
153  static const unsigned int max_nplanes_hit_accel_pretrig = 1 << 3;
154  static const unsigned int max_nplanes_hit_accel_pattern = 1 << 3;
155  static const unsigned int max_trig_mode = 1 << 2;
156  static const unsigned int max_accel_mode = 1 << 2;
157  static const unsigned int max_l1a_window_width = CSCConstants::MAX_ALCT_TBINS; // 4 bits
158 
159  // Checks.
160  CSCBaseboard::checkConfigParameters(fifo_tbins, max_fifo_tbins, def_fifo_tbins, "fifo_tbins");
161  CSCBaseboard::checkConfigParameters(fifo_pretrig, max_fifo_pretrig, def_fifo_pretrig, "fifo_pretrig");
162  CSCBaseboard::checkConfigParameters(drift_delay, max_drift_delay, def_drift_delay, "drift_delay");
164  nplanes_hit_pretrig, max_nplanes_hit_pretrig, def_nplanes_hit_pretrig, "nplanes_hit_pretrig");
166  nplanes_hit_pattern, max_nplanes_hit_pattern, def_nplanes_hit_pattern, "nplanes_hit_pattern");
168  max_nplanes_hit_accel_pretrig,
170  "nplanes_hit_accel_pretrig");
172  max_nplanes_hit_accel_pattern,
174  "nplanes_hit_accel_pattern");
175  CSCBaseboard::checkConfigParameters(trig_mode, max_trig_mode, def_trig_mode, "trig_mode");
176  CSCBaseboard::checkConfigParameters(accel_mode, max_accel_mode, def_accel_mode, "accel_mode");
177  CSCBaseboard::checkConfigParameters(l1a_window_width, max_l1a_window_width, def_l1a_window_width, "l1a_window_width");
178 
180 }
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)
assert(be >=bs)
static const unsigned int def_accel_mode
static const unsigned int def_nplanes_hit_accel_pretrig
static const unsigned int def_fifo_pretrig
static const unsigned int def_nplanes_hit_pattern
static const unsigned int def_l1a_window_width
static const unsigned int def_trig_mode
static const unsigned int def_nplanes_hit_accel_pattern
unsigned int nplanes_hit_accel_pattern
static const unsigned int def_nplanes_hit_pretrig
unsigned int nplanes_hit_accel_pretrig

◆ cleanWireContainer()

void CSCAnodeLCTProcessor::cleanWireContainer ( CSCALCTDigi::WireContainer wireHits) const
protected

Definition at line 1361 of file CSCAnodeLCTProcessor.cc.

References mps_fire::i, CSCConstants::INVALID_WIREGROUP, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by setWireContainer().

1361  {
1362  for (auto& p : wireHits) {
1363  p.erase(std::remove_if(p.begin(), p.end(), [](unsigned i) -> bool { return i == CSCConstants::INVALID_WIREGROUP; }),
1364  p.end());
1365  }
1366 }

◆ clear() [1/2]

void CSCAnodeLCTProcessor::clear ( void  )

Clears the LCT containers.

Definition at line 182 of file CSCAnodeLCTProcessor.cc.

References anode_showers_, bestALCT, nano_mu_digi_cff::bx, CSCShowerDigi::clear(), CSCALCTDigi::clear(), lct_list, CSCConstants::MAX_ALCT_TBINS, and secondALCT.

182  {
183  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
184  bestALCT[bx].clear();
185  secondALCT[bx].clear();
186  anode_showers_[bx].clear(); //?
187  }
188  lct_list.clear();
189 }
CSCShowerDigi anode_showers_[CSCConstants::MAX_ALCT_TBINS]
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:60
std::vector< CSCALCTDigi > lct_list
CSCALCTDigi secondALCT[CSCConstants::MAX_ALCT_TBINS]
CSCALCTDigi bestALCT[CSCConstants::MAX_ALCT_TBINS]
void clear()
clear this Shower

◆ clear() [2/2]

void CSCAnodeLCTProcessor::clear ( const int  wire,
const int  pattern 
)
protected

◆ dumpConfigParams()

void CSCAnodeLCTProcessor::dumpConfigParams ( ) const
protected

Dump ALCT configuration parameters.

Definition at line 1138 of file CSCAnodeLCTProcessor.cc.

References accel_mode, drift_delay, fifo_pretrig, fifo_tbins, l1a_window_width, LogDebug, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, and trig_mode.

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

1138  {
1139  std::ostringstream strm;
1140  strm << "\n";
1141  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1142  strm << "+ ALCT configuration parameters: +\n";
1143  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1144  strm << " fifo_tbins [total number of time bins in DAQ readout] = " << fifo_tbins << "\n";
1145  strm << " fifo_pretrig [start time of anode raw hits in DAQ readout] = " << fifo_pretrig << "\n";
1146  strm << " drift_delay [drift delay after pre-trigger, in 25 ns bins] = " << drift_delay << "\n";
1147  strm << " nplanes_hit_pretrig [min. number of layers hit for pre-trigger] = " << nplanes_hit_pretrig << "\n";
1148  strm << " nplanes_hit_pattern [min. number of layers hit for trigger] = " << nplanes_hit_pattern << "\n";
1149  strm << " nplanes_hit_accel_pretrig [min. number of layers hit for accel."
1150  << " pre-trig.] = " << nplanes_hit_accel_pretrig << "\n";
1151  strm << " nplanes_hit_accel_pattern [min. number of layers hit for accel."
1152  << " trigger] = " << nplanes_hit_accel_pattern << "\n";
1153  strm << " trig_mode [enabling/disabling collision/accelerator tracks] = " << trig_mode << "\n";
1154  strm << " accel_mode [preference to collision/accelerator tracks] = " << accel_mode << "\n";
1155  strm << " l1a_window_width [L1Accept window width, in 25 ns bins] = " << l1a_window_width << "\n";
1156  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1157  LogDebug("CSCAnodeLCTProcessor") << strm.str();
1158 }
unsigned int nplanes_hit_accel_pattern
unsigned int nplanes_hit_accel_pretrig
#define LogDebug(id)

◆ dumpDigis()

void CSCAnodeLCTProcessor::dumpDigis ( const std::vector< int >  wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const
protected

Dump digis on wire groups.

Definition at line 1161 of file CSCAnodeLCTProcessor.cc.

References TauDecayModes::dec, relativeConstraints::empty, LogDebug, LogTrace, CSCConstants::NUM_LAYERS, numWireGroups, CSCBaseboard::theCSCName_, and nano_mu_digi_cff::wire.

Referenced by pulseExtension().

1162  {
1163  LogDebug("CSCAnodeLCTProcessor") << theCSCName_ << " nWiregroups " << numWireGroups;
1164 
1165  std::ostringstream strstrm;
1166  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
1167  if (i_wire % 10 == 0) {
1168  if (i_wire < 100)
1169  strstrm << i_wire / 10;
1170  else
1171  strstrm << (i_wire - 100) / 10;
1172  } else
1173  strstrm << " ";
1174  }
1175  strstrm << "\n";
1176  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
1177  strstrm << i_wire % 10;
1178  }
1179  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
1180  strstrm << "\n";
1181  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
1182  if (!wire[i_layer][i_wire].empty()) {
1183  std::vector<int> bx_times = wire[i_layer][i_wire];
1184  strstrm << std::hex << bx_times[0] << std::dec;
1185  } else {
1186  strstrm << ".";
1187  }
1188  }
1189  }
1190  LogTrace("CSCAnodeLCTProcessor") << strstrm.str();
1191 }
std::string theCSCName_
Definition: CSCBaseboard.h:104
#define LogTrace(id)
#define LogDebug(id)

◆ encodeHighMultiplicityBits()

void CSCAnodeLCTProcessor::encodeHighMultiplicityBits ( )
protected

Definition at line 1376 of file CSCAnodeLCTProcessor.cc.

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

Referenced by run().

1376  {
1377  //numer of layer with hits and number of hits for 0-15 BXs
1378  std::set<unsigned> layersWithHits[CSCConstants::MAX_ALCT_TBINS];
1379  unsigned hitsInTime[CSCConstants::MAX_ALCT_TBINS];
1380  // Calculate layers with hits
1381  for (unsigned bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
1382  hitsInTime[bx] = 0;
1383  for (unsigned i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
1384  bool atLeastOneWGHit = false;
1385  for (const auto& wd : digiV[i_layer]) {
1386  std::vector<int> bx_times = wd.getTimeBinsOn();
1387  // there is at least one wiregroup in this bx
1388  if (std::find(bx_times.begin(), bx_times.end(), bx) != bx_times.end()) {
1389  hitsInTime[bx] += 1;
1390  atLeastOneWGHit = true;
1391  }
1392  }
1393  // add this layer to the number of layers hit
1394  if (atLeastOneWGHit) {
1395  layersWithHits[bx].insert(i_layer);
1396  }
1397  }
1398  } //end of full bx loop
1399 
1400  // convert station and ring number to index
1401  // index runs from 2 to 10, subtract 2
1402  unsigned csc_idx = CSCDetId::iChamberType(theStation, theRing) - 2;
1403 
1404  // loose, nominal and tight
1405  std::vector<unsigned> station_thresholds = {
1406  thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]};
1407 
1408  for (unsigned bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
1409  unsigned minbx = bx >= showerNumTBins_ / 2 ? bx - showerNumTBins_ / 2 : bx;
1410  unsigned maxbx = bx < CSCConstants::MAX_ALCT_TBINS - showerNumTBins_ / 2 ? bx + showerNumTBins_ / 2
1412  unsigned this_hitsInTime = 0;
1413  for (unsigned mbx = minbx; mbx <= maxbx; mbx++) {
1414  this_hitsInTime += hitsInTime[mbx];
1415  }
1416 
1417  unsigned this_inTimeHMT = 0;
1418  // require at least nLayersWithHits for the central time bin
1419  // do nothing if there are not enough layers with hits
1420  if (layersWithHits[bx].size() >= minLayersCentralTBin_) {
1421  // assign the bits
1422  if (!station_thresholds.empty()) {
1423  for (int i = station_thresholds.size() - 1; i >= 0; i--) {
1424  if (this_hitsInTime >= station_thresholds[i]) {
1425  this_inTimeHMT = i + 1;
1426  break;
1427  }
1428  }
1429  }
1430  }
1431  //ALCT shower construction with showerType_=1, comparatorhits_= 0;
1433  this_inTimeHMT, false, theTrigChamber, bx, CSCShowerDigi::ShowerType::kALCTShower, this_hitsInTime, 0);
1434  }
1435 }
size
Write out results.
CSCShowerDigi anode_showers_[CSCConstants::MAX_ALCT_TBINS]
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
const unsigned theTrigChamber
Definition: CSCBaseboard.h:78
const unsigned theStation
Definition: CSCBaseboard.h:75
unsigned theRing
Definition: CSCBaseboard.h:80
std::vector< unsigned > thresholds_
std::vector< CSCWireDigi > digiV[CSCConstants::NUM_LAYERS]

◆ getALCTs()

std::vector< CSCALCTDigi > CSCAnodeLCTProcessor::getALCTs ( ) const

Returns vector of all found ALCTs, if any.

Definition at line 1270 of file CSCAnodeLCTProcessor.cc.

References bestALCT, nano_mu_digi_cff::bx, sistrip::SpyUtilities::isValid(), CSCConstants::MAX_ALCT_TBINS, and secondALCT.

Referenced by readoutALCTs(), and run().

1270  {
1271  std::vector<CSCALCTDigi> tmpV;
1272  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
1273  if (bestALCT[bx].isValid())
1274  tmpV.push_back(bestALCT[bx]);
1275  if (secondALCT[bx].isValid())
1276  tmpV.push_back(secondALCT[bx]);
1277  }
1278  return tmpV;
1279 }
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
CSCALCTDigi secondALCT[CSCConstants::MAX_ALCT_TBINS]
CSCALCTDigi bestALCT[CSCConstants::MAX_ALCT_TBINS]

◆ getAllShower()

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

return vector of CSCShower digi

Definition at line 1294 of file CSCAnodeLCTProcessor.cc.

References anode_showers_, and CSCConstants::MAX_ALCT_TBINS.

1294  {
1295  std::vector<CSCShowerDigi> vshowers(anode_showers_, anode_showers_ + CSCConstants::MAX_ALCT_TBINS);
1296  return vshowers;
1297 };
CSCShowerDigi anode_showers_[CSCConstants::MAX_ALCT_TBINS]

◆ getBestALCT()

CSCALCTDigi CSCAnodeLCTProcessor::getBestALCT ( int  bx) const

Return best/second best ALCTs

Definition at line 1281 of file CSCAnodeLCTProcessor.cc.

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

1281  {
1282  if (bx >= CSCConstants::MAX_CLCT_TBINS or bx < 0)
1283  return CSCALCTDigi();
1284  return bestALCT[bx];
1285 }
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
CSCALCTDigi bestALCT[CSCConstants::MAX_ALCT_TBINS]

◆ getDigis() [1/2]

bool CSCAnodeLCTProcessor::getDigis ( const CSCWireDigiCollection wiredc)
protected

Access routines to wire digis.

Definition at line 391 of file CSCAnodeLCTProcessor.cc.

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

Referenced by run().

391  {
392  // Routine for getting digis and filling digiV vector.
393  bool hasDigis = false;
394 
395  // Loop over layers and save wire digis on each one into digiV[layer].
396  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
397  digiV[i_layer].clear();
398 
399  CSCDetId detid(theEndcap, theStation, theRing, theChamber, i_layer + 1);
400  getDigis(wiredc, detid);
401 
402  // If this is ME1/1, fetch digis in corresponding ME1/A (ring=4) as well.
403  if (isME11_ && !disableME1a_) {
404  CSCDetId detid_me1a(theEndcap, theStation, 4, theChamber, i_layer + 1);
405  getDigis(wiredc, detid_me1a);
406  }
407 
408  if (!digiV[i_layer].empty()) {
409  hasDigis = true;
410  if (infoV > 1) {
411  LogTrace("CSCAnodeLCTProcessor") << "found " << digiV[i_layer].size() << " wire digi(s) in layer " << i_layer
412  << " of " << theCSCName_ << " (trig. sector " << theSector << " subsector "
413  << theSubsector << " id " << theTrigChamber << ")";
414  for (const auto& wd : digiV[i_layer]) {
415  LogTrace("CSCAnodeLCTProcessor") << " " << wd;
416  }
417  }
418  }
419  }
420 
421  return hasDigis;
422 }
const unsigned theEndcap
Definition: CSCBaseboard.h:74
bool getDigis(const CSCWireDigiCollection *wiredc)
const unsigned theSector
Definition: CSCBaseboard.h:76
std::string theCSCName_
Definition: CSCBaseboard.h:104
#define LogTrace(id)
const unsigned theTrigChamber
Definition: CSCBaseboard.h:78
unsigned theChamber
Definition: CSCBaseboard.h:81
const unsigned theStation
Definition: CSCBaseboard.h:75
unsigned theRing
Definition: CSCBaseboard.h:80
std::vector< CSCWireDigi > digiV[CSCConstants::NUM_LAYERS]
const unsigned theSubsector
Definition: CSCBaseboard.h:77

◆ getDigis() [2/2]

void CSCAnodeLCTProcessor::getDigis ( const CSCWireDigiCollection wiredc,
const CSCDetId id 
)
protected

Definition at line 424 of file CSCAnodeLCTProcessor.cc.

References digiV.

424  {
425  CSCWireDigiCollection::Range rwired = wiredc->get(id);
426  for (CSCWireDigiCollection::const_iterator digiIt = rwired.first; digiIt != rwired.second; ++digiIt) {
427  digiV[id.layer() - 1].push_back(*digiIt);
428  }
429 }
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
std::vector< CSCWireDigi > digiV[CSCConstants::NUM_LAYERS]

◆ getSecondALCT()

CSCALCTDigi CSCAnodeLCTProcessor::getSecondALCT ( int  bx) const

Definition at line 1287 of file CSCAnodeLCTProcessor.cc.

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

1287  {
1288  if (bx >= CSCConstants::MAX_CLCT_TBINS or bx < 0)
1289  return CSCALCTDigi();
1290  return secondALCT[bx];
1291 }
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
CSCALCTDigi secondALCT[CSCConstants::MAX_ALCT_TBINS]

◆ getTempALCTQuality()

int CSCAnodeLCTProcessor::getTempALCTQuality ( int  temp_quality) const
protectedvirtual

Reimplemented in CSCUpgradeAnodeLCTProcessor.

Definition at line 1351 of file CSCAnodeLCTProcessor.cc.

Referenced by patternDetection().

1351  {
1352  int Q;
1353  if (temp_quality > 3)
1354  Q = temp_quality - 3;
1355  else
1356  Q = 0; // quality code 0 is valid!
1357 
1358  return Q;
1359 }

◆ ghostCancellationLogicOneWire()

void CSCAnodeLCTProcessor::ghostCancellationLogicOneWire ( const int  key_wire,
int *  ghost_cleared 
)
protectedvirtual

Reimplemented in CSCUpgradeAnodeLCTProcessor.

Definition at line 771 of file CSCAnodeLCTProcessor.cc.

References CSCConstants::ALCT_ACCELERATOR_PATTERN, dt, first_bx, ghost_cancellation_bx_depth, ghost_cancellation_side_quality, CSCBaseboard::infoV, lct_list, LogTrace, AlCaHLTBitMon_ParallelJobs::p, and quality.

Referenced by run().

771  {
772  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
773  ghost_cleared[i_pattern] = 0;
774  if (key_wire == 0)
775  continue; //ignore
776 
777  // Non-empty wire group.
778  int qual_this = quality[key_wire][i_pattern];
779  if (qual_this > 0) {
780  // Previous wire.
781  //int qual_prev = (key_wire > 0) ? quality[key_wire-1][i_pattern] : 0;
782  //previous ALCTs were pushed to lct_list, stop use the array quality[key_wire-1][i_pattern]
783  for (auto& p : lct_list) {
784  //ignore whether ALCT is valid or not in ghost cancellation
785  //if wiregroup 10, 11, 12 all have trigger and same quality, only wiregroup 10 can keep the trigger
786  //this met with firmware
787  if (not(p.getKeyWG() == key_wire - 1 and 1 - p.getAccelerator() == i_pattern))
788  continue;
789 
790  bool ghost_cleared_prev = false;
791  int qual_prev = p.getQuality();
792  int first_bx_prev = p.getBX();
793  if (infoV > 1)
794  LogTrace("CSCAnodeLCTProcessor")
795  << "ghost concellation logic "
796  << ((i_pattern == CSCConstants::ALCT_ACCELERATOR_PATTERN) ? "Accelerator" : "Collision") << " key_wire "
797  << key_wire << " quality " << qual_this << " bx " << first_bx[key_wire] << " previous key_wire "
798  << key_wire - 1 << " quality " << qual_prev << " bx " << first_bx[key_wire - 1];
799 
800  //int dt = first_bx[key_wire] - first_bx[key_wire-1];
801  int dt = first_bx[key_wire] - first_bx_prev;
802  // Cancel this wire
803  // 1) If the candidate at the previous wire is at the same bx
804  // clock and has better quality (or equal quality - this has
805  // been implemented only in 2004).
806  // 2) If the candidate at the previous wire is up to 4 clocks
807  // earlier, regardless of quality.
808  if (dt == 0) {
809  if (qual_prev >= qual_this)
810  ghost_cleared[i_pattern] = 1;
811  else if (qual_prev < qual_this)
812  ghost_cleared_prev = true;
813  } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
814  if ((!ghost_cancellation_side_quality) || (qual_prev > qual_this))
815  ghost_cleared[i_pattern] = 1;
816  } else if (dt < 0 && dt * (-1) <= ghost_cancellation_bx_depth) {
817  if ((!ghost_cancellation_side_quality) || (qual_prev < qual_this))
818  ghost_cleared_prev = true;
819  }
820 
821  if (ghost_cleared[i_pattern] == 1) {
822  if (infoV > 1)
823  LogTrace("CSCAnodeLCTProcessor")
824  << ((i_pattern == CSCConstants::ALCT_ACCELERATOR_PATTERN) ? "Accelerator" : "Collision")
825  << " pattern ghost cancelled on key_wire " << key_wire << " q=" << qual_this << " by wire "
826  << key_wire - 1 << " q=" << qual_prev;
827  //cancellation for key_wire is done when ALCT is created and pushed to lct_list
828  }
829 
830  if (ghost_cleared_prev) {
831  if (infoV > 1)
832  LogTrace("CSCAnodeLCTProcessor")
833  << ((i_pattern == CSCConstants::ALCT_ACCELERATOR_PATTERN) ? "Accelerator" : "Collision")
834  << " pattern ghost cancelled on key_wire " << key_wire - 1 << " q=" << qual_prev << " by wire "
835  << key_wire << " q=" << qual_this;
836  p.setValid(0); //clean prev ALCT
837  }
838  }
839 
840  } // if qual_this > 0
841  } //i_pattern
842 }
float dt
Definition: AMPTWrapper.h:136
#define LogTrace(id)
std::vector< CSCALCTDigi > lct_list
int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]
int quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]

◆ isBetterALCT()

bool CSCAnodeLCTProcessor::isBetterALCT ( const CSCALCTDigi lhsALCT,
const CSCALCTDigi rhsALCT 
) const
protected

Definition at line 1016 of file CSCAnodeLCTProcessor.cc.

References accel_mode, CSCALCTDigi::getAccelerator(), CSCALCTDigi::getBX(), CSCALCTDigi::getQuality(), and CSCALCTDigi::isValid().

Referenced by lctSearch().

1016  {
1017  bool returnValue = false;
1018 
1019  if (lhsALCT.isValid() && !rhsALCT.isValid()) {
1020  return true;
1021  }
1022 
1023  // ALCTs found at earlier bx times are ranked higher than ALCTs found at
1024  // later bx times regardless of the quality.
1025  if (lhsALCT.getBX() < rhsALCT.getBX()) {
1026  returnValue = true;
1027  }
1028  if (lhsALCT.getBX() != rhsALCT.getBX()) {
1029  return returnValue;
1030  }
1031 
1032  // First check the quality of ALCTs.
1033  const int qual1 = lhsALCT.getQuality();
1034  const int qual2 = rhsALCT.getQuality();
1035  if (qual1 > qual2) {
1036  returnValue = true;
1037  }
1038  // If qualities are the same, check accelerator bits of both ALCTs.
1039  // If they are not the same, rank according to accel_mode value.
1040  // If they are the same, keep the track selector assignment.
1041  //else if (qual1 == qual2 &&
1042  // lhsALCT.getAccelerator() != rhsALCT.getAccelerator() &&
1043  // quality[lhsALCT.getKeyWG()][1-lhsALCT.getAccelerator()] >
1044  // quality[rhsALCT.getKeyWG()][1-rhsALCT.getAccelerator()])
1045  // {returnValue = true;}
1046  else if (qual1 == qual2 && lhsALCT.getAccelerator() != rhsALCT.getAccelerator()) {
1047  if ((accel_mode == 0 || accel_mode == 1) && rhsALCT.getAccelerator() == 0)
1048  returnValue = true;
1049  if ((accel_mode == 2 || accel_mode == 3) && lhsALCT.getAccelerator() == 0)
1050  returnValue = true;
1051  }
1052 
1053  return returnValue;
1054 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
uint16_t getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:73
uint16_t getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:46
uint16_t getAccelerator() const
Definition: CSCALCTDigi.h:53

◆ lctSearch()

void CSCAnodeLCTProcessor::lctSearch ( )
protected

Definition at line 844 of file CSCAnodeLCTProcessor.cc.

References bestALCT, bestTrackSelector(), nano_mu_digi_cff::bx, CSCALCTDigi::getFullBX(), CSCBaseboard::infoV, isBetterALCT(), sistrip::SpyUtilities::isValid(), CSCConstants::LCT_CENTRAL_BX, lct_list, LogDebug, LogTrace, CSCConstants::MAX_ALCT_TBINS, AlCaHLTBitMon_ParallelJobs::p, qualityControl_, secondALCT, CSCALCTDigi::setTrknmb(), CSCBaseboard::theChamber, CSCBaseboard::theCSCName_, CSCBaseboard::theEndcap, CSCBaseboard::theRing, CSCBaseboard::theSector, CSCBaseboard::theStation, CSCBaseboard::theSubsector, and CSCBaseboard::theTrigChamber.

Referenced by run().

844  {
845  // Best track selector selects two collision and two accelerator ALCTs
846  // with the best quality per time bin.
847  const std::vector<CSCALCTDigi>& fourBest = bestTrackSelector(lct_list);
848 
849  if (infoV > 0) {
850  int n_alct_all = 0, n_alct = 0;
851  for (const auto& p : lct_list) {
852  if (p.isValid() && p.getBX() == CSCConstants::LCT_CENTRAL_BX)
853  n_alct_all++;
854  }
855  for (const auto& p : fourBest) {
856  if (p.isValid() && p.getBX() == CSCConstants::LCT_CENTRAL_BX)
857  n_alct++;
858  }
859 
860  LogTrace("CSCAnodeLCTProcessor") << "alct_count E:" << theEndcap << "S:" << theStation << "R:" << theRing
861  << "C:" << theChamber << " all " << n_alct_all << " found " << n_alct;
862  }
863 
864  // Select two best of four per time bin, based on quality and
865  // accel_mode parameter.
866  for (const auto& p : fourBest) {
867  const int bx = p.getBX();
869  if (infoV > 0)
870  edm::LogWarning("CSCAnodeLCTProcessor|OutOfTimeALCT")
871  << "+++ Bx of ALCT candidate, " << bx << ", exceeds max allowed, " << CSCConstants::MAX_ALCT_TBINS - 1
872  << "; skipping it... +++\n";
873  continue;
874  }
875 
876  if (isBetterALCT(p, bestALCT[bx])) {
878  secondALCT[bx] = bestALCT[bx];
879  }
880  bestALCT[bx] = p;
881  } else if (isBetterALCT(p, secondALCT[bx])) {
882  secondALCT[bx] = p;
883  }
884  }
885 
886  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
887  if (bestALCT[bx].isValid()) {
888  bestALCT[bx].setTrknmb(1);
889 
890  // check if the best ALCT is valid
891  qualityControl_->checkValidReadout(bestALCT[bx]);
892 
893  if (infoV > 0) {
894  LogDebug("CSCAnodeLCTProcessor") << bestALCT[bx] << " fullBX = " << bestALCT[bx].getFullBX() << " found in "
895  << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector
896  << " trig id. " << theTrigChamber << ")"
897  << "\n";
898  }
899  if (secondALCT[bx].isValid()) {
900  secondALCT[bx].setTrknmb(2);
901 
902  // check if the second best ALCT is valid
903  qualityControl_->checkValidReadout(secondALCT[bx]);
904 
905  if (infoV > 0) {
906  LogDebug("CSCAnodeLCTProcessor")
907  << secondALCT[bx] << " fullBX = " << secondALCT[bx].getFullBX() << " found in " << theCSCName_
908  << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
909  << "\n";
910  }
911  }
912  }
913  }
914 }
std::unique_ptr< LCTQualityControl > qualityControl_
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
std::string theCSCName_
Definition: CSCBaseboard.h:104
#define LogTrace(id)
std::vector< CSCALCTDigi > lct_list
const unsigned theTrigChamber
Definition: CSCBaseboard.h:78
unsigned theChamber
Definition: CSCBaseboard.h:81
CSCALCTDigi secondALCT[CSCConstants::MAX_ALCT_TBINS]
uint16_t getFullBX() const
return 12-bit full BX.
Definition: CSCALCTDigi.h:85
bool isBetterALCT(const CSCALCTDigi &lhsALCT, const CSCALCTDigi &rhsALCT) const
const unsigned theStation
Definition: CSCBaseboard.h:75
std::vector< CSCALCTDigi > bestTrackSelector(const std::vector< CSCALCTDigi > &all_alcts)
CSCALCTDigi bestALCT[CSCConstants::MAX_ALCT_TBINS]
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting ALCTs.
Definition: CSCALCTDigi.h:82
unsigned theRing
Definition: CSCBaseboard.h:80
Log< level::Warning, false > LogWarning
const unsigned theSubsector
Definition: CSCBaseboard.h:77
#define LogDebug(id)

◆ loadPatternMask()

void CSCAnodeLCTProcessor::loadPatternMask ( )
protected

Load pattern mask defined by configuration into pattern_mask

Definition at line 94 of file CSCAnodeLCTProcessor.cc.

References alct_pattern_, CSCPatternBank::alct_pattern_legacy_, CSCPatternBank::alct_pattern_r1_, narrow_mask_r1, and CSCBaseboard::theRing.

Referenced by CSCAnodeLCTProcessor().

94  {
95  // Load appropriate pattern mask.
96  if (narrow_mask_r1 && (theRing == 1 || theRing == 4)) {
98  } else {
100  }
101 }
static const LCTPatterns alct_pattern_r1_
CSCPatternBank::LCTPatterns alct_pattern_
static const LCTPatterns alct_pattern_legacy_
unsigned theRing
Definition: CSCBaseboard.h:80

◆ patternDetection()

bool CSCAnodeLCTProcessor::patternDetection ( const int  key_wire,
std::map< int, std::map< int, CSCALCTDigi::WireContainer > > &  hits_in_patterns 
)
protected

Definition at line 626 of file CSCAnodeLCTProcessor.cc.

References funct::abs(), CSCConstants::ALCT_ACCELERATOR_PATTERN, CSCConstants::ALCT_COLLISIONA_PATTERN, CSCConstants::ALCT_COLLISIONB_PATTERN, CSCPatternBank::alct_keywire_offset_, alct_pattern_, CSCConstants::ALCT_PATTERN_WIDTH, drift_delay, first_bx, first_bx_corrected, getTempALCTQuality(), hit_persist, CSCBaseboard::infoV, CSCConstants::INVALID_WIREGROUP, PulseArray::isOneShotHighAtBX(), LogTrace, MESelection, nplanes_hit_accel_pattern, nplanes_hit_pattern, CSCConstants::NUM_ALCT_PATTERNS, CSCConstants::NUM_LAYERS, numWireGroups, AlCaHLTBitMon_ParallelJobs::p, pulse_, quality, AlCaHLTBitMon_QueryRunRegistry::string, and trigMode().

Referenced by run().

627  {
628  bool trigger = false;
629  bool hit_layer[CSCConstants::NUM_LAYERS];
630  unsigned int temp_quality;
631  int this_wire, delta_wire;
632  // If nplanes_hit_accel_pattern is 0, the firmware uses the value
633  // of nplanes_hit_pattern instead.
634  const unsigned int nplanes_hit_pattern_acc =
636  const unsigned int pattern_thresh[CSCConstants::NUM_ALCT_PATTERNS] = {
637  nplanes_hit_pattern_acc, nplanes_hit_pattern, nplanes_hit_pattern};
638  const std::string ptn_label[] = {"Accelerator", "CollisionA", "CollisionB"};
639 
640  for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS; i_pattern++) {
641  temp_quality = 0;
642 
643  // initialize the hit layers
644  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++)
645  hit_layer[i_layer] = false;
646 
647  // clear a single pattern!
648  CSCALCTDigi::WireContainer hits_single_pattern;
649  hits_single_pattern.clear();
650  hits_single_pattern.resize(CSCConstants::NUM_LAYERS);
651  for (auto& p : hits_single_pattern) {
653  }
654 
655  double num_pattern_hits = 0., times_sum = 0.;
656  std::multiset<int> mset_for_median;
657  mset_for_median.clear();
658 
659  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
660  for (int i_wire = 0; i_wire < CSCConstants::ALCT_PATTERN_WIDTH; i_wire++) {
661  // check if the hit is valid
662  if (alct_pattern_[i_pattern][i_layer][i_wire]) {
664  this_wire = delta_wire + key_wire;
665  if ((this_wire >= 0) && (this_wire < numWireGroups)) {
666  // Wait a drift_delay time later and look for layers hit in
667  // the pattern.
668  if (pulse_.isOneShotHighAtBX(i_layer, this_wire, first_bx[key_wire] + drift_delay)) {
669  // store hits in the temporary pattern vector
670  hits_single_pattern[i_layer][i_wire] = this_wire;
671 
672  // If layer has never had a hit before, then increment number
673  // of layer hits.
674  if (!hit_layer[i_layer]) {
675  temp_quality++;
676  // keep track of which layers already had hits.
677  hit_layer[i_layer] = true;
678  if (infoV > 1)
679  LogTrace("CSCAnodeLCTProcessor")
680  << "bx_time: " << first_bx[key_wire] << " pattern: " << i_pattern << " keywire: " << key_wire
681  << " layer: " << i_layer << " quality: " << temp_quality;
682  }
683 
684  // for averaged time use only the closest WGs around the key WG
685  if (abs(delta_wire) < 2) {
686  // find at what bx did pulse on this wire&layer start
687  // use hit_pesrist constraint on how far back we can go
688  int first_bx_layer = first_bx[key_wire] + drift_delay;
689  for (unsigned int dbx = 0; dbx < hit_persist; dbx++) {
690  if (pulse_.isOneShotHighAtBX(i_layer, this_wire, first_bx_layer - 1)) {
691  first_bx_layer--;
692  } else
693  break;
694  }
695  times_sum += (double)first_bx_layer;
696  num_pattern_hits += 1.;
697  mset_for_median.insert(first_bx_layer);
698  if (infoV > 2)
699  LogTrace("CSCAnodeLCTProcessor") << " 1st bx in layer: " << first_bx_layer << " sum bx: " << times_sum
700  << " #pat. hits: " << num_pattern_hits;
701  }
702  }
703  }
704  }
705  }
706  }
707 
708  // calculate median
709  const int sz = mset_for_median.size();
710  if (sz > 0) {
711  std::multiset<int>::iterator im = mset_for_median.begin();
712  if (sz > 1)
713  std::advance(im, sz / 2 - 1);
714  if (sz == 1)
715  first_bx_corrected[key_wire] = *im;
716  else if ((sz % 2) == 1)
717  first_bx_corrected[key_wire] = *(++im);
718  else
719  first_bx_corrected[key_wire] = ((*im) + (*(++im))) / 2;
720 
721 #if defined(EDM_ML_DEBUG)
722  if (infoV > 1) {
723  auto lt = LogTrace("CSCAnodeLCTProcessor")
724  << "bx=" << first_bx[key_wire] << " bx_cor=" << first_bx_corrected[key_wire] << " bxset=";
725  for (im = mset_for_median.begin(); im != mset_for_median.end(); im++) {
726  lt << " " << *im;
727  }
728  }
729 #endif
730  }
731 
732  // save the pattern information when a trigger was formed!
733  if (temp_quality >= pattern_thresh[i_pattern]) {
734  trigger = true;
735  hits_in_patterns[key_wire][i_pattern] = hits_single_pattern;
736 
737  // Quality definition changed on 22 June 2007: it no longer depends
738  // on pattern_thresh.
739  temp_quality = getTempALCTQuality(temp_quality);
740 
741  if (i_pattern == CSCConstants::ALCT_ACCELERATOR_PATTERN) {
742  // Accelerator pattern
743  quality[key_wire][CSCConstants::ALCT_ACCELERATOR_PATTERN] = temp_quality;
744  } else {
745  // Only one collision pattern (of the best quality) is reported
746  if (static_cast<int>(temp_quality) > quality[key_wire][CSCConstants::ALCT_COLLISIONA_PATTERN]) {
747  quality[key_wire][CSCConstants::ALCT_COLLISIONA_PATTERN] = temp_quality; //real quality
748  quality[key_wire][CSCConstants::ALCT_COLLISIONB_PATTERN] = i_pattern - 1; // pattern, left or right
749  }
750  }
751  if (infoV > 1) {
752  LogTrace("CSCAnodeLCTProcessor") << "Pattern found; keywire: " << key_wire << " type: " << ptn_label[i_pattern]
753  << " quality: " << temp_quality << "\n";
754  }
755  }
756  }
757  if (infoV > 1 && quality[key_wire][CSCConstants::ALCT_COLLISIONA_PATTERN] > 0) {
759  LogTrace("CSCAnodeLCTProcessor") << "Collision Pattern A is chosen"
760  << "\n";
761  else if (quality[key_wire][CSCConstants::ALCT_COLLISIONB_PATTERN] == 1)
762  LogTrace("CSCAnodeLCTProcessor") << "Collision Pattern B is chosen"
763  << "\n";
764  }
765 
766  trigMode(key_wire);
767 
768  return trigger;
769 }
static const int alct_keywire_offset_[2][CSCConstants::ALCT_PATTERN_WIDTH]
bool isOneShotHighAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:37
int first_bx_corrected[CSCConstants::MAX_NUM_WIREGROUPS]
void trigMode(const int key_wire)
#define LogTrace(id)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CSCPatternBank::LCTPatterns alct_pattern_
std::vector< std::vector< uint16_t > > WireContainer
Definition: CSCALCTDigi.h:21
virtual int getTempALCTQuality(int temp_quality) const
int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]
unsigned int nplanes_hit_accel_pattern
int quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]

◆ preTrigger()

bool CSCAnodeLCTProcessor::preTrigger ( const int  key_wire,
const int  start_bx 
)
protected

Definition at line 559 of file CSCAnodeLCTProcessor.cc.

References CSCPatternBank::alct_keywire_offset_, alct_pattern_, CSCConstants::ALCT_PATTERN_WIDTH, drift_delay, fifo_tbins, first_bx, CSCBaseboard::infoV, PulseArray::isOneShotHighAtBX(), LogTrace, MESelection, nplanes_hit_accel_pretrig, nplanes_hit_pretrig, CSCConstants::NUM_ALCT_PATTERNS, CSCConstants::NUM_LAYERS, numWireGroups, pulse_, and thePreTriggerDigis.

Referenced by run().

559  {
560  int nPreTriggers = 0;
561 
562  unsigned int layers_hit;
563  bool hit_layer[CSCConstants::NUM_LAYERS];
564  int this_wire;
565  // If nplanes_hit_accel_pretrig is 0, the firmware uses the value
566  // of nplanes_hit_pretrig instead.
567  const unsigned int nplanes_hit_pretrig_acc =
569  const unsigned int pretrig_thresh[CSCConstants::NUM_ALCT_PATTERNS] = {
570  nplanes_hit_pretrig_acc, nplanes_hit_pretrig, nplanes_hit_pretrig};
571 
572  // Loop over bx times, accelerator and collision patterns to
573  // look for pretrigger.
574  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
575  // not have a full set of hits to start pattern search anyway.
576  unsigned int stop_bx = fifo_tbins - drift_delay;
577  for (unsigned int bx_time = start_bx; bx_time < stop_bx; bx_time++) {
578  for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS; i_pattern++) {
579  // initialize the hit layers
580  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++)
581  hit_layer[i_layer] = false;
582  layers_hit = 0;
583 
584  // now run over all layers and wires
585  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
586  for (int i_wire = 0; i_wire < CSCConstants::ALCT_PATTERN_WIDTH; i_wire++) {
587  // check if the hit is valid
588  if (alct_pattern_[i_pattern][i_layer][i_wire]) {
589  this_wire = CSCPatternBank::alct_keywire_offset_[MESelection][i_wire] + key_wire;
590  if ((this_wire >= 0) && (this_wire < numWireGroups)) {
591  // Perform bit operation to see if pulse is 1 at a certain bx_time.
592  if (pulse_.isOneShotHighAtBX(i_layer, this_wire, bx_time)) {
593  // Store number of layers hit.
594  if (!hit_layer[i_layer]) {
595  hit_layer[i_layer] = true;
596  layers_hit++;
597  }
598 
599  // See if number of layers hit is greater than or equal to
600  // pretrig_thresh.
601  if (layers_hit >= pretrig_thresh[i_pattern]) {
602  first_bx[key_wire] = bx_time;
603  if (infoV > 1) {
604  LogTrace("CSCAnodeLCTProcessor") << "Pretrigger was satisfied for wire: " << key_wire
605  << " pattern: " << i_pattern << " bx_time: " << bx_time;
606  }
607  // make a new pre-trigger
608  nPreTriggers++;
609  // make a new pre-trigger digi
610  // useful for calculating DAQ rates
611  thePreTriggerDigis.emplace_back(
612  CSCALCTPreTriggerDigi(1, layers_hit - 3, 0, 0, this_wire, bx_time, nPreTriggers));
613  return true;
614  }
615  }
616  }
617  }
618  }
619  }
620  }
621  }
622  // If the pretrigger was never satisfied, then return false.
623  return false;
624 }
static const int alct_keywire_offset_[2][CSCConstants::ALCT_PATTERN_WIDTH]
bool isOneShotHighAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:37
std::vector< CSCALCTPreTriggerDigi > thePreTriggerDigis
#define LogTrace(id)
CSCPatternBank::LCTPatterns alct_pattern_
int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]
unsigned int nplanes_hit_accel_pretrig

◆ preTriggerDigis()

std::vector<CSCALCTPreTriggerDigi> CSCAnodeLCTProcessor::preTriggerDigis ( ) const
inline

read out pre-ALCTs

Definition at line 84 of file CSCAnodeLCTProcessor.h.

References thePreTriggerDigis.

84 { return thePreTriggerDigis; }
std::vector< CSCALCTPreTriggerDigi > thePreTriggerDigis

◆ pulseExtension()

bool CSCAnodeLCTProcessor::pulseExtension ( const std::vector< int >  wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
protected

Definition at line 488 of file CSCAnodeLCTProcessor.cc.

References PulseArray::bitsInPulse(), PulseArray::clear(), dumpDigis(), relativeConstraints::empty, PulseArray::extend(), first_bx, first_bx_corrected, hit_persist, mps_fire::i, CSCBaseboard::infoV, dqmiolumiharvest::j, LogTrace, CSCConstants::NUM_LAYERS, numWireGroups, PulseArray::oneShotAtBX(), pulse_, quality, and nano_mu_digi_cff::wire.

Referenced by run().

489  {
490  bool chamber_empty = true;
491  int i_wire, i_layer, digi_num;
492 
493  const unsigned bits_in_pulse = pulse_.bitsInPulse();
494 
495  // Clear pulse array. This array will be used as a bit representation of
496  // hit times. For example: if strip[1][2] has a value of 3, then 1 shifted
497  // left 3 will be bit pattern of pulse[1][2]. This would make the pattern
498  // look like 0000000000001000. Then add on additional bits to signify
499  // the duration of a signal (hit_persist, formerly bx_width) to simulate
500  // the TMB's drift delay. So for the same pulse[1][2] with a hit_persist
501  // of 3 would look like 0000000000111000. This is similating the digital
502  // one-shot in the TMB.
503  pulse_.clear();
504 
505  for (i_wire = 0; i_wire < numWireGroups; i_wire++) {
506  first_bx[i_wire] = -999;
507  first_bx_corrected[i_wire] = -999;
508  for (int j = 0; j < 3; j++)
509  quality[i_wire][j] = -999;
510  }
511 
512  for (i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
513  digi_num = 0;
514  for (i_wire = 0; i_wire < numWireGroups; i_wire++) {
515  if (!wire[i_layer][i_wire].empty()) {
516  std::vector<int> bx_times = wire[i_layer][i_wire];
517  for (unsigned int i = 0; i < bx_times.size(); i++) {
518  // Check that min and max times are within the allowed range.
519  if (bx_times[i] < 0 || bx_times[i] + hit_persist >= bits_in_pulse) {
520  if (infoV > 0)
521  edm::LogWarning("CSCAnodeLCTProcessor|OutOfTimeDigi")
522  << "+++ BX time of wire digi (wire = " << i_wire << " layer = " << i_layer << ") bx = " << bx_times[i]
523  << " is not within the range (0-" << bits_in_pulse
524  << "] allowed for pulse extension. Skip this digi! +++\n";
525  continue;
526  }
527 
528  // Found at least one in-time digi; set chamber_empty to false
529  if (chamber_empty)
530  chamber_empty = false;
531 
532  // make the pulse
533  pulse_.extend(i_layer, i_wire, bx_times[i], hit_persist);
534 
535  // Debug information.
536  if (infoV > 1) {
537  LogTrace("CSCAnodeLCTProcessor") << "Wire digi: layer " << i_layer << " digi #" << ++digi_num
538  << " wire group " << i_wire << " time " << bx_times[i];
539  if (infoV > 2) {
540  std::ostringstream strstrm;
541  for (int i = 1; i <= 32; i++) {
542  strstrm << pulse_.oneShotAtBX(i_layer, i_wire, 32 - i);
543  }
544  LogTrace("CSCAnodeLCTProcessor") << " Pulse: " << strstrm.str();
545  }
546  }
547  }
548  }
549  }
550  }
551 
552  if (infoV > 1 && !chamber_empty) {
553  dumpDigis(wire);
554  }
555 
556  return chamber_empty;
557 }
void clear()
Definition: PulseArray.cc:14
int first_bx_corrected[CSCConstants::MAX_NUM_WIREGROUPS]
#define LogTrace(id)
bool oneShotAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:33
unsigned bitsInPulse() const
Definition: PulseArray.cc:25
void dumpDigis(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const
Log< level::Warning, false > LogWarning
int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]
int quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]
void extend(const unsigned layer, const unsigned channel, const unsigned bx, const unsigned hit_persist)
Definition: PulseArray.cc:27

◆ readoutALCTs()

std::vector< CSCALCTDigi > CSCAnodeLCTProcessor::readoutALCTs ( ) const

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

Definition at line 1195 of file CSCAnodeLCTProcessor.cc.

References nano_mu_digi_cff::bx, early_tbins, fifo_pretrig, getALCTs(), CSCBaseboard::infoV, l1a_window_width, CSCConstants::LCT_CENTRAL_BX, LogDebug, CSCConstants::MAX_ALCT_TBINS, AlCaHLTBitMon_ParallelJobs::p, and qualityControl_.

1195  {
1196  std::vector<CSCALCTDigi> tmpV;
1197 
1198  // The number of LCT bins in the read-out is given by the
1199  // l1a_window_width parameter, but made even by setting the LSB of
1200  // l1a_window_width to 0.
1201  const int lct_bins = l1a_window_width;
1202  static std::atomic<int> late_tbins{early_tbins + lct_bins};
1203 
1204  static std::atomic<int> ifois{0};
1205  if (ifois == 0) {
1206  if (infoV >= 0 && early_tbins < 0) {
1207  edm::LogWarning("CSCAnodeLCTProcessor|SuspiciousParameters")
1208  << "+++ fifo_pretrig = " << fifo_pretrig << "; in-time ALCTs are not getting read-out!!! +++"
1209  << "\n";
1210  }
1211 
1212  if (late_tbins > CSCConstants::MAX_ALCT_TBINS - 1) {
1213  if (infoV >= 0)
1214  edm::LogWarning("CSCAnodeLCTProcessor|SuspiciousParameters")
1215  << "+++ Allowed range of time bins, [0-" << late_tbins << "] exceeds max allowed, "
1216  << CSCConstants::MAX_ALCT_TBINS - 1 << " +++\n"
1217  << "+++ Set late_tbins to max allowed +++\n";
1218  late_tbins = CSCConstants::MAX_ALCT_TBINS - 1;
1219  }
1220  ifois = 1;
1221  }
1222 
1223  // Start from the vector of all found ALCTs and select those within
1224  // the ALCT*L1A coincidence window.
1225  const std::vector<CSCALCTDigi>& all_alcts = getALCTs();
1226  for (const auto& p : all_alcts) {
1227  if (!p.isValid())
1228  continue;
1229 
1230  int bx = p.getBX();
1231  // Skip ALCTs found too early relative to L1Accept.
1232  if (bx <= early_tbins) {
1233  if (infoV > 1)
1234  LogDebug("CSCAnodeLCTProcessor") << " Do not report ALCT on keywire " << p.getKeyWG() << ": found at bx " << bx
1235  << ", whereas the earliest allowed bx is " << early_tbins + 1;
1236  continue;
1237  }
1238 
1239  // Skip ALCTs found too late relative to L1Accept.
1240  if (bx > late_tbins) {
1241  if (infoV > 1)
1242  LogDebug("CSCAnodeLCTProcessor") << " Do not report ALCT on keywire " << p.getKeyWG() << ": found at bx " << bx
1243  << ", whereas the latest allowed bx is " << late_tbins;
1244  continue;
1245  }
1246 
1247  tmpV.push_back(p);
1248  }
1249 
1250  // shift the BX from 8 to 3
1251  // ALCTs in real data have the central BX in bin 3
1252  // which is the middle of the 7BX wide L1A window
1253  // ALCTs used in the TMB emulator have central BX at bin 8
1254  // but right before we put emulated ALCTs in the event, we shift the BX
1255  // by -5 to make sure they are compatible with real data ALCTs!
1256  for (auto& p : tmpV) {
1257  p.setBX(p.getBX() - (CSCConstants::LCT_CENTRAL_BX - l1a_window_width / 2));
1258  }
1259 
1260  // do a final check on the ALCTs in readout
1261  qualityControl_->checkMultiplicityBX(tmpV);
1262  for (const auto& alct : tmpV) {
1263  qualityControl_->checkValid(alct);
1264  }
1265 
1266  return tmpV;
1267 }
std::unique_ptr< LCTQualityControl > qualityControl_
std::vector< CSCALCTDigi > getALCTs() const
Log< level::Warning, false > LogWarning
#define LogDebug(id)

◆ readoutShower()

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

Returns shower bits

Definition at line 1300 of file CSCAnodeLCTProcessor.cc.

References anode_showers_, nano_mu_digi_cff::bx, sistrip::SpyUtilities::isValid(), l1a_window_width, CSCConstants::LCT_CENTRAL_BX, maxbx_readout_, l1tnanotables_cff::minBX, and minbx_readout_.

1300  {
1301  unsigned minBXdiff = 2 * l1a_window_width; //impossible value
1302  unsigned minBX = 0;
1303  std::vector<CSCShowerDigi> showerOut;
1304  for (unsigned bx = minbx_readout_; bx < maxbx_readout_; bx++) {
1307  if (anode_showers_[bx].isValid() and bx_diff < minBXdiff) {
1308  minBXdiff = bx_diff;
1309  minBX = bx;
1310  }
1311  }
1312 
1313  for (unsigned bx = minbx_readout_; bx < maxbx_readout_; bx++)
1314  if (bx == minBX)
1315  showerOut.push_back(anode_showers_[bx]);
1316  return showerOut;
1317 }
CSCShowerDigi anode_showers_[CSCConstants::MAX_ALCT_TBINS]
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)

◆ readWireDigis()

void CSCAnodeLCTProcessor::readWireDigis ( std::vector< int >  wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
protected

Definition at line 431 of file CSCAnodeLCTProcessor.cc.

References digiV, fifo_tbins, mps_fire::i, CSCBaseboard::infoV, LogTrace, CSCConstants::NUM_LAYERS, numWireGroups, and nano_mu_digi_cff::wire.

Referenced by run().

432  {
433  // Loop over all 6 layers.
434  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
435  // Loop over all digis in the layer and find the wireGroup and bx
436  // time for each.
437  for (const auto& wd : digiV[i_layer]) {
438  int i_wire = wd.getWireGroup() - 1;
439  std::vector<int> bx_times = wd.getTimeBinsOn();
440 
441  // Check that the wires and times are appropriate.
442  if (i_wire < 0 || i_wire >= numWireGroups) {
443  if (infoV >= 0)
444  edm::LogWarning("CSCAnodeLCTProcessor|WrongInput")
445  << "+++ Found wire digi with wrong wire number = " << i_wire << " (max wires = " << numWireGroups
446  << "); skipping it... +++\n";
447  continue;
448  }
449  // Accept digis in expected time window. Total number of time
450  // bins in DAQ readout is given by fifo_tbins, which thus
451  // determines the maximum length of time interval. Anode raw
452  // hits in DAQ readout start (fifo_pretrig - 6) clocks before
453  // L1Accept. If times earlier than L1Accept were recorded, we
454  // use them since they can modify the ALCTs found later, via
455  // ghost-cancellation logic.
456  int last_time = -999;
457  if (bx_times.size() == fifo_tbins) {
458  wire[i_layer][i_wire].push_back(0);
459  wire[i_layer][i_wire].push_back(6);
460  } else {
461  for (unsigned int i = 0; i < bx_times.size(); i++) {
462  // Find rising edge change
463  if (i > 0 && bx_times[i] == (bx_times[i - 1] + 1))
464  continue;
465  if (bx_times[i] < static_cast<int>(fifo_tbins)) {
466  if (infoV > 2)
467  LogTrace("CSCAnodeLCTProcessor")
468  << "Digi on layer " << i_layer << " wire " << i_wire << " at time " << bx_times[i];
469 
470  // Finally save times of hit wires. One shot module will
471  // not restart if a new pulse comes before the expiration
472  // of the 6-bx period.
473  if (last_time < 0 || ((bx_times[i] - last_time) >= 6)) {
474  wire[i_layer][i_wire].push_back(bx_times[i]);
475  last_time = bx_times[i];
476  }
477  } else {
478  if (infoV > 1)
479  LogTrace("CSCAnodeLCTProcessor") << "+++ Skipping wire digi: wire = " << i_wire << " layer = " << i_layer
480  << ", bx = " << bx_times[i] << " +++";
481  }
482  }
483  }
484  }
485  }
486 }
#define LogTrace(id)
Log< level::Warning, false > LogWarning
std::vector< CSCWireDigi > digiV[CSCConstants::NUM_LAYERS]

◆ run() [1/2]

std::vector< CSCALCTDigi > CSCAnodeLCTProcessor::run ( const CSCWireDigiCollection wiredc,
CSCChamber const *  chamber 
)

Definition at line 201 of file CSCAnodeLCTProcessor.cc.

References CSCBaseboard::cscChamber(), dumpConfigParams(), relativeConstraints::empty, encodeHighMultiplicityBits(), CSCLayer::geometry(), getALCTs(), getDigis(), CSCBaseboard::infoV, CSCChamber::layer(), CSCConstants::MAX_NUM_WIREGROUPS, nplanes_hit_accel_pattern, nplanes_hit_pattern, CSCConstants::NUM_LAYERS, CSCLayerGeometry::numberOfWireGroups(), numWireGroups, or, qualityControl_, readWireDigis(), CSCBaseboard::runPhase2_, CSCBaseboard::theCSCName_, CSCBaseboard::theRing, CSCBaseboard::theSector, CSCBaseboard::theStation, CSCBaseboard::theSubsector, and CSCBaseboard::theTrigChamber.

201  {
202  static std::atomic<bool> config_dumped{false};
203  if ((infoV > 0 || (runPhase2_)) && !config_dumped) {
205  config_dumped = true;
206  }
207 
208  // Get the number of wire groups for the given chamber. Do it only once
209  // per chamber.
210  if (numWireGroups <= 0 or numWireGroups > CSCConstants::MAX_NUM_WIREGROUPS) {
211  if (cscChamber) {
214  edm::LogError("CSCAnodeLCTProcessor|SetupError")
215  << "+++ Number of wire groups, " << numWireGroups << " found in " << theCSCName_ << " (sector " << theSector
216  << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
217  << " exceeds max expected, " << CSCConstants::MAX_NUM_WIREGROUPS << " +++\n"
218  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
219  numWireGroups = -1;
220  }
221  } else {
222  edm::LogError("CSCAnodeLCTProcessor|SetupError")
223  << "+++ " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. "
224  << theTrigChamber << ")"
225  << " is not defined in current geometry! +++\n"
226  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
227  numWireGroups = -1;
228  }
229  }
230 
231  if (numWireGroups <= 0 or (unsigned) numWireGroups > qualityControl_->get_csc_max_wiregroup(theStation, theRing)) {
232  edm::LogError("CSCAnodeLCTProcessor|SetupError")
233  << "+++ " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. "
234  << theTrigChamber << "):"
235  << " numWireGroups = " << numWireGroups << "; ALCT emulation skipped! +++";
236  std::vector<CSCALCTDigi> emptyV;
237  return emptyV;
238  }
239 
240  // Get wire digis in this chamber from wire digi collection.
241  bool hasDigis = getDigis(wiredc);
242 
243  if (hasDigis) {
244  // First get wiregroup times from the wire digis.
245  std::vector<int> wireGroupTimes[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS];
246  readWireDigis(wireGroupTimes);
247 
248  // Pass an array of wire times on to another run() doing the LCT search.
249  // If the number of layers containing digis is smaller than that
250  // required to trigger, quit right away.
251  const unsigned int min_layers =
255 
256  unsigned int layersHit = 0;
257  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
258  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
259  if (!wireGroupTimes[i_layer][i_wire].empty()) {
260  layersHit++;
261  break;
262  }
263  }
264  }
265  if (layersHit >= min_layers)
266  run(wireGroupTimes);
267  // Get the high multiplicity bits in this chamber
269  }
270 
271  // Return vector of all found ALCTs.
272  return getALCTs();
273 }
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:30
std::unique_ptr< LCTQualityControl > qualityControl_
bool getDigis(const CSCWireDigiCollection *wiredc)
const unsigned theSector
Definition: CSCBaseboard.h:76
Log< level::Error, false > LogError
std::string theCSCName_
Definition: CSCBaseboard.h:104
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
const unsigned theTrigChamber
Definition: CSCBaseboard.h:78
int numberOfWireGroups() 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
const CSCChamber * cscChamber(CSCGeometry const &) const
std::vector< CSCALCTDigi > run(const CSCWireDigiCollection *wiredc, CSCChamber const *chamber)
const unsigned theStation
Definition: CSCBaseboard.h:75
std::vector< CSCALCTDigi > getALCTs() const
unsigned theRing
Definition: CSCBaseboard.h:80
unsigned int nplanes_hit_accel_pattern
void readWireDigis(std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
const unsigned theSubsector
Definition: CSCBaseboard.h:77

◆ run() [2/2]

void CSCAnodeLCTProcessor::run ( const std::vector< int >  wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])

Definition at line 275 of file CSCAnodeLCTProcessor.cc.

References CSCConstants::ALCT_COLLISIONA_PATTERN, CSCConstants::ALCT_COLLISIONB_PATTERN, nano_mu_digi_cff::bx, drift_delay, fifo_tbins, first_bx, first_bx_corrected, ghostCancellationLogicOneWire(), CSCBaseboard::infoV, PulseArray::initialize(), lct_list, lctSearch(), LogTrace, CSCConstants::MAX_ALCT_TBINS, numWireGroups, patternDetection(), pretrig_extra_deadtime, preTrigger(), pulse_, pulseExtension(), quality, qualityControl_, setWireContainer(), showPatterns(), CSCBaseboard::theRing, CSCBaseboard::theStation, use_corrected_bx, validateGeometry_cfg::valid, and nano_mu_digi_cff::wire.

275  {
276  bool trigger = false;
277 
278  // initialize the pulse array.
280 
281  // Check if there are any in-time hits and do the pulse extension.
282  bool chamber_empty = pulseExtension(wire);
283 
284  // define a new pattern map
285  // for each key wiregroup, and for each pattern, store the 2D collection of fired wiregroup digis
286  std::map<int, std::map<int, CSCALCTDigi::WireContainer>> hits_in_patterns;
287  hits_in_patterns.clear();
288 
289  // Only do the rest of the processing if chamber is not empty.
290  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
291  // not have a full set of hits to start pattern search anyway.
292  unsigned int stop_bx = fifo_tbins - drift_delay;
293  if (!chamber_empty) {
294  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
295  // extra check to make sure only valid wires are processed
296  const unsigned max_wire = qualityControl_->get_csc_max_wiregroup(theStation, theRing);
297  if (unsigned(i_wire) >= max_wire)
298  continue;
299 
300  unsigned int start_bx = 0;
301  // Allow for more than one pass over the hits in the time window.
302  while (start_bx < stop_bx) {
303  if (preTrigger(i_wire, start_bx)) {
304  if (infoV > 2)
305  showPatterns(i_wire);
306  if (patternDetection(i_wire, hits_in_patterns)) {
307  trigger = true;
308  int ghost_cleared[2] = {0, 0};
309  /*
310  In older versions of the ALCT emulation, the ghost cancellation was performed after
311  the ALCTs were found. In December 2018, it became clear that during the study of data
312  and emulation comparison on 2018 data, a small disagreement between data and emulation
313  was found. The changes we implemented then allow re-triggering on one wiregroup after
314  some dead time once an earlier ALCT was constructed built on this wiregroup. Before this
315  commit the ALCT processor would prohibit the wiregroup from triggering in one event after
316  an ALCT was found on that wiregroup. In the firwmare, the wiregroup with ALCT is only dead
317  for a few BX before it can be triggered by next muon. The implementation of ghost cancellation
318  logic was changed to accommodate the re-triggering change while the idea of ghost cancellation
319  logic is kept the same.
320  */
321  ghostCancellationLogicOneWire(i_wire, ghost_cleared);
322 
323  int bx = (use_corrected_bx) ? first_bx_corrected[i_wire] : first_bx[i_wire];
325  edm::LogError("CSCAnodeLCTProcessor")
326  << " bx of valid trigger : " << bx << " > max allowed value " << CSCConstants::MAX_ALCT_TBINS;
327 
328  //acceleration mode
329  if (quality[i_wire][0] > 0 and bx < CSCConstants::MAX_ALCT_TBINS) {
330  int valid = (ghost_cleared[0] == 0) ? 1 : 0; //cancelled, valid=0, otherwise it is 1
331  CSCALCTDigi newALCT(valid, quality[i_wire][0], 1, 0, i_wire, bx);
332 
333  // set the wire digis for this pattern
334  setWireContainer(newALCT, hits_in_patterns[i_wire][0]);
335 
336  lct_list.emplace_back(newALCT);
337  if (infoV > 1)
338  LogTrace("CSCAnodeLCTProcessor") << "Add one ALCT to list " << lct_list.back();
339  }
340 
341  //collision mode
343  int valid = (ghost_cleared[CSCConstants::ALCT_COLLISIONA_PATTERN] == 0)
344  ? 1
345  : 0; //cancelled, valid=0, otherwise it is 1
346 
347  CSCALCTDigi newALCT(valid,
349  0,
351  i_wire,
352  bx);
353 
354  // set the wire digis for this pattern
355  setWireContainer(newALCT, hits_in_patterns[i_wire][CSCConstants::ALCT_COLLISIONA_PATTERN]);
356 
357  lct_list.emplace_back(newALCT);
358  if (infoV > 1)
359  LogTrace("CSCAnodeLCTProcessor") << "Add one ALCT to list " << lct_list.back();
360  }
361 
362  //break;
363  // Assume that the earliest time when another pre-trigger can
364  // occur in case pattern detection failed is bx_pretrigger+4:
365  // this seems to match the data.
366  start_bx = first_bx[i_wire] + drift_delay + pretrig_extra_deadtime;
367  } else {
368  //only pretrigger, no trigger ==> no dead time, continue to find next pretrigger
369  start_bx = first_bx[i_wire] + 1;
370  }
371  } else { //no pretrigger, skip this wiregroup
372  break;
373  }
374  } // end of while
375  }
376  }
377 
378  // Do the rest only if there is at least one trigger candidate.
379  if (trigger) {
380  /* In Run-1 and Run-2, the ghost cancellation was done after the trigger.
381  In the firmware however, the ghost cancellation is done during the trigger
382  on each wiregroup in parallel. For Run-3 and beyond, the ghost cancellation is
383  implemented per wiregroup earlier in the code. See function
384  "ghostCancellationLogicOneWire". There used to be a function ghostCancellationLogic
385  call here.
386  */
387  lctSearch();
388  }
389 }
void showPatterns(const int key_wire)
std::unique_ptr< LCTQualityControl > qualityControl_
bool pulseExtension(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
int first_bx_corrected[CSCConstants::MAX_NUM_WIREGROUPS]
Log< level::Error, false > LogError
#define LogTrace(id)
std::vector< CSCALCTDigi > lct_list
bool preTrigger(const int key_wire, const int start_bx)
bool patternDetection(const int key_wire, std::map< int, std::map< int, CSCALCTDigi::WireContainer > > &hits_in_patterns)
const unsigned theStation
Definition: CSCBaseboard.h:75
void initialize(unsigned numberOfChannels)
Definition: PulseArray.cc:5
virtual void ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared)
void setWireContainer(CSCALCTDigi &, CSCALCTDigi::WireContainer &wireHits) const
unsigned theRing
Definition: CSCBaseboard.h:80
int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]
int quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]
unsigned int pretrig_extra_deadtime

◆ setConfigParameters()

void CSCAnodeLCTProcessor::setConfigParameters ( const CSCDBL1TPParameters conf)

Sets configuration parameters obtained via EventSetup mechanism.

Definition at line 120 of file CSCAnodeLCTProcessor.cc.

References accel_mode, CSCDBL1TPParameters::alctAccelMode(), CSCDBL1TPParameters::alctDriftDelay(), CSCDBL1TPParameters::alctFifoPretrig(), CSCDBL1TPParameters::alctFifoTbins(), CSCDBL1TPParameters::alctL1aWindowWidth(), CSCDBL1TPParameters::alctNplanesHitAccelPattern(), CSCDBL1TPParameters::alctNplanesHitAccelPretrig(), CSCDBL1TPParameters::alctNplanesHitPattern(), CSCDBL1TPParameters::alctNplanesHitPretrig(), CSCDBL1TPParameters::alctTrigMode(), checkConfigParameters(), drift_delay, dumpConfigParams(), fifo_pretrig, fifo_tbins, l1a_window_width, CSCConstants::LCT_CENTRAL_BX, maxbx_readout_, minbx_readout_, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, and trig_mode.

120  {
121  static std::atomic<bool> config_dumped{false};
122 
123  fifo_tbins = conf->alctFifoTbins();
124  fifo_pretrig = conf->alctFifoPretrig();
125  drift_delay = conf->alctDriftDelay();
130  trig_mode = conf->alctTrigMode();
131  accel_mode = conf->alctAccelMode();
133 
134  // Check and print configuration parameters.
136  if (!config_dumped) {
138  config_dumped = true;
139  }
142 }
unsigned int alctAccelMode() const
unsigned int alctFifoTbins() const
unsigned int alctTrigMode() const
unsigned int alctNplanesHitPattern() const
unsigned int alctNplanesHitPretrig() const
unsigned int alctL1aWindowWidth() const
unsigned int alctNplanesHitAccelPretrig() const
unsigned int alctDriftDelay() const
unsigned int alctNplanesHitAccelPattern() const
unsigned int alctFifoPretrig() const
unsigned int nplanes_hit_accel_pattern
unsigned int nplanes_hit_accel_pretrig

◆ setDefaultConfigParameters()

void CSCAnodeLCTProcessor::setDefaultConfigParameters ( )
protected

Set default values for configuration parameters.

Definition at line 103 of file CSCAnodeLCTProcessor.cc.

References accel_mode, def_accel_mode, def_drift_delay, def_fifo_pretrig, def_fifo_tbins, def_l1a_window_width, def_nplanes_hit_accel_pattern, def_nplanes_hit_accel_pretrig, def_nplanes_hit_pattern, def_nplanes_hit_pretrig, def_trig_mode, drift_delay, fifo_pretrig, fifo_tbins, l1a_window_width, CSCConstants::LCT_CENTRAL_BX, maxbx_readout_, minbx_readout_, nplanes_hit_accel_pattern, nplanes_hit_accel_pretrig, nplanes_hit_pattern, nplanes_hit_pretrig, and trig_mode.

103  {
104  // Set default values for configuration parameters.
117 }
static const unsigned int def_drift_delay
static const unsigned int def_fifo_tbins
static const unsigned int def_accel_mode
static const unsigned int def_nplanes_hit_accel_pretrig
static const unsigned int def_fifo_pretrig
static const unsigned int def_nplanes_hit_pattern
static const unsigned int def_l1a_window_width
static const unsigned int def_trig_mode
static const unsigned int def_nplanes_hit_accel_pattern
unsigned int nplanes_hit_accel_pattern
static const unsigned int def_nplanes_hit_pretrig
unsigned int nplanes_hit_accel_pretrig

◆ setWireContainer()

void CSCAnodeLCTProcessor::setWireContainer ( CSCALCTDigi alct,
CSCALCTDigi::WireContainer wireHits 
) const
protected

Definition at line 1368 of file CSCAnodeLCTProcessor.cc.

References cleanWireContainer(), and CSCALCTDigi::setHits().

Referenced by run().

1368  {
1369  // clean the wire digi container
1370  cleanWireContainer(wireHits);
1371 
1372  // set the hit container
1373  alct.setHits(wireHits);
1374 }
void setHits(const WireContainer &hits)
Definition: CSCALCTDigi.h:120
void cleanWireContainer(CSCALCTDigi::WireContainer &wireHits) const

◆ showPatterns()

void CSCAnodeLCTProcessor::showPatterns ( const int  key_wire)
protected

Definition at line 1322 of file CSCAnodeLCTProcessor.cc.

References CSCPatternBank::alct_keywire_offset_, alct_pattern_, CSCConstants::ALCT_PATTERN_WIDTH, mps_fire::i, LogTrace, MESelection, CSCConstants::NUM_ALCT_PATTERNS, CSCConstants::NUM_LAYERS, numWireGroups, PulseArray::oneShotAtBX(), and pulse_.

Referenced by run().

1322  {
1323  /* Method to test the pretrigger */
1324  for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS; i_pattern++) {
1325  std::ostringstream strstrm_header;
1326  LogTrace("CSCAnodeLCTProcessor") << "\n"
1327  << "Pattern: " << i_pattern << " Key wire: " << key_wire;
1328  for (int i = 1; i <= 32; i++) {
1329  strstrm_header << ((32 - i) % 10);
1330  }
1331  LogTrace("CSCAnodeLCTProcessor") << strstrm_header.str();
1332  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
1333  for (int i_wire = 0; i_wire < CSCConstants::ALCT_PATTERN_WIDTH; i_wire++) {
1334  // check if the hit is valid
1335  if (alct_pattern_[i_pattern][i_layer][i_wire]) {
1336  std::ostringstream strstrm_pulse;
1337  int this_wire = CSCPatternBank::alct_keywire_offset_[MESelection][i_wire] + key_wire;
1338  if (this_wire >= 0 && this_wire < numWireGroups) {
1339  for (int i = 1; i <= 32; i++) {
1340  strstrm_pulse << pulse_.oneShotAtBX(i_layer, this_wire, 32 - i);
1341  }
1342  LogTrace("CSCAnodeLCTProcessor") << strstrm_pulse.str() << " on layer " << i_layer << " wire " << this_wire;
1343  }
1344  }
1345  }
1346  }
1347  LogTrace("CSCAnodeLCTProcessor") << "-------------------------------------------";
1348  }
1349 }
static const int alct_keywire_offset_[2][CSCConstants::ALCT_PATTERN_WIDTH]
#define LogTrace(id)
bool oneShotAtBX(const unsigned layer, const unsigned channel, const unsigned bx) const
Definition: PulseArray.cc:33
CSCPatternBank::LCTPatterns alct_pattern_

◆ trigMode()

void CSCAnodeLCTProcessor::trigMode ( const int  key_wire)
protected

Definition at line 1056 of file CSCAnodeLCTProcessor.cc.

References CSCConstants::ALCT_ACCELERATOR_PATTERN, CSCConstants::ALCT_COLLISIONA_PATTERN, CSCBaseboard::infoV, LogTrace, quality, and trig_mode.

Referenced by patternDetection().

1056  {
1057  switch (trig_mode) {
1058  default:
1059  case 0:
1060  // Enables both collision and accelerator tracks
1061  break;
1062  case 1:
1063  // Disables collision tracks
1064  if (quality[key_wire][CSCConstants::ALCT_COLLISIONA_PATTERN] > 0) {
1066  if (infoV > 1)
1067  LogTrace("CSCAnodeLCTProcessor") << "trigMode(): collision track " << key_wire << " disabled"
1068  << "\n";
1069  }
1070  break;
1071  case 2:
1072  // Disables accelerator tracks
1073  if (quality[key_wire][CSCConstants::ALCT_ACCELERATOR_PATTERN] > 0) {
1075  if (infoV > 1)
1076  LogTrace("CSCAnodeLCTProcessor") << "trigMode(): accelerator track " << key_wire << " disabled"
1077  << "\n";
1078  }
1079  break;
1080  case 3:
1081  // Disables collision track if there is an accelerator track found
1082  // in the same wire group at the same time
1083  if (quality[key_wire][0] > 0 && quality[key_wire][CSCConstants::ALCT_COLLISIONA_PATTERN] > 0) {
1085  if (infoV > 1)
1086  LogTrace("CSCAnodeLCTProcessor") << "trigMode(): collision track " << key_wire << " disabled"
1087  << "\n";
1088  }
1089  break;
1090  }
1091 }
#define LogTrace(id)
int quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]

Member Data Documentation

◆ accel_mode

unsigned int CSCAnodeLCTProcessor::accel_mode
protected

◆ alct_pattern_

CSCPatternBank::LCTPatterns CSCAnodeLCTProcessor::alct_pattern_ = {}
protected

Chosen pattern mask.

Definition at line 177 of file CSCAnodeLCTProcessor.h.

Referenced by loadPatternMask(), patternDetection(), preTrigger(), and showPatterns().

◆ anode_showers_

CSCShowerDigi CSCAnodeLCTProcessor::anode_showers_[CSCConstants::MAX_ALCT_TBINS]
protected

◆ bestALCT

CSCALCTDigi CSCAnodeLCTProcessor::bestALCT[CSCConstants::MAX_ALCT_TBINS]
protected

Best LCTs in this chamber, as found by the processor. In old ALCT algorithms, up to two best ALCT per Level-1 accept window had been reported. In the ALCT-2006 algorithms, up to two best ALCTs PER EVERY TIME BIN in Level-1 accept window are reported.

Definition at line 102 of file CSCAnodeLCTProcessor.h.

Referenced by clear(), getALCTs(), getBestALCT(), and lctSearch().

◆ def_accel_mode

const unsigned int CSCAnodeLCTProcessor::def_accel_mode = 0
staticprotected

Definition at line 170 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_drift_delay

const unsigned int CSCAnodeLCTProcessor::def_drift_delay = 2
staticprotected

Definition at line 166 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_fifo_pretrig

const unsigned int CSCAnodeLCTProcessor::def_fifo_pretrig = 10
staticprotected

Definition at line 165 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_fifo_tbins

const unsigned int CSCAnodeLCTProcessor::def_fifo_tbins = 16
staticprotected

Default values of configuration parameters.

Definition at line 165 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_l1a_window_width

const unsigned int CSCAnodeLCTProcessor::def_l1a_window_width = 7
staticprotected

Definition at line 171 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_nplanes_hit_accel_pattern

const unsigned int CSCAnodeLCTProcessor::def_nplanes_hit_accel_pattern = 4
staticprotected

Definition at line 169 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_nplanes_hit_accel_pretrig

const unsigned int CSCAnodeLCTProcessor::def_nplanes_hit_accel_pretrig = 2
staticprotected

Definition at line 168 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_nplanes_hit_pattern

const unsigned int CSCAnodeLCTProcessor::def_nplanes_hit_pattern = 4
staticprotected

Definition at line 167 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_nplanes_hit_pretrig

const unsigned int CSCAnodeLCTProcessor::def_nplanes_hit_pretrig = 2
staticprotected

Definition at line 167 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ def_trig_mode

const unsigned int CSCAnodeLCTProcessor::def_trig_mode = 2
staticprotected

Definition at line 170 of file CSCAnodeLCTProcessor.h.

Referenced by checkConfigParameters(), and setDefaultConfigParameters().

◆ digiV

std::vector<CSCWireDigi> CSCAnodeLCTProcessor::digiV[CSCConstants::NUM_LAYERS]
protected

Definition at line 122 of file CSCAnodeLCTProcessor.h.

Referenced by encodeHighMultiplicityBits(), getDigis(), and readWireDigis().

◆ drift_delay

unsigned int CSCAnodeLCTProcessor::drift_delay
protected

◆ early_tbins

int CSCAnodeLCTProcessor::early_tbins
protected

Phase2: separate handle for early time bins

Definition at line 146 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), and readoutALCTs().

◆ fifo_pretrig

unsigned int CSCAnodeLCTProcessor::fifo_pretrig
protected

◆ fifo_tbins

unsigned int CSCAnodeLCTProcessor::fifo_tbins
protected

◆ first_bx

int CSCAnodeLCTProcessor::first_bx[CSCConstants::MAX_NUM_WIREGROUPS]
protected

◆ first_bx_corrected

int CSCAnodeLCTProcessor::first_bx_corrected[CSCConstants::MAX_NUM_WIREGROUPS]
protected

◆ ghost_cancellation_bx_depth

int CSCAnodeLCTProcessor::ghost_cancellation_bx_depth
protected

Phase2: delta BX time depth for ghostCancellationLogic

Definition at line 149 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), CSCUpgradeAnodeLCTProcessor::ghostCancellationLogicOneWire(), and ghostCancellationLogicOneWire().

◆ ghost_cancellation_side_quality

bool CSCAnodeLCTProcessor::ghost_cancellation_side_quality
protected

Phase2: whether to consider ALCT candidates' qualities while doing ghostCancellationLogic on +-1 wire groups

Definition at line 153 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), CSCUpgradeAnodeLCTProcessor::ghostCancellationLogicOneWire(), and ghostCancellationLogicOneWire().

◆ hit_persist

unsigned int CSCAnodeLCTProcessor::hit_persist
protected

Phase2: hit persistency length

Definition at line 143 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), patternDetection(), and pulseExtension().

◆ l1a_window_width

unsigned int CSCAnodeLCTProcessor::l1a_window_width
protected

◆ lct_list

std::vector<CSCALCTDigi> CSCAnodeLCTProcessor::lct_list
protected

◆ maxbx_readout_

unsigned CSCAnodeLCTProcessor::maxbx_readout_
protected

◆ MESelection

int CSCAnodeLCTProcessor::MESelection
protected

◆ minbx_readout_

unsigned CSCAnodeLCTProcessor::minbx_readout_
protected

◆ minLayersCentralTBin_

unsigned CSCAnodeLCTProcessor::minLayersCentralTBin_
protected

Definition at line 132 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), and encodeHighMultiplicityBits().

◆ narrow_mask_r1

bool CSCAnodeLCTProcessor::narrow_mask_r1
protected

Phase2: whether to use narrow pattern mask for the rings close to the beam

Definition at line 162 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), and loadPatternMask().

◆ nplanes_hit_accel_pattern

unsigned int CSCAnodeLCTProcessor::nplanes_hit_accel_pattern
protected

◆ nplanes_hit_accel_pretrig

unsigned int CSCAnodeLCTProcessor::nplanes_hit_accel_pretrig
protected

◆ nplanes_hit_pattern

unsigned int CSCAnodeLCTProcessor::nplanes_hit_pattern
protected

◆ nplanes_hit_pretrig

unsigned int CSCAnodeLCTProcessor::nplanes_hit_pretrig
protected

◆ numWireGroups

int CSCAnodeLCTProcessor::numWireGroups
protected

◆ pretrig_extra_deadtime

unsigned int CSCAnodeLCTProcessor::pretrig_extra_deadtime
protected

Phase2: deadtime clocks after pretrigger (extra in addition to drift_delay)

Definition at line 156 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), and run().

◆ pulse_

PulseArray CSCAnodeLCTProcessor::pulse_
protected

◆ quality

int CSCAnodeLCTProcessor::quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]
protected

◆ qualityControl_

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

Definition at line 174 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), lctSearch(), readoutALCTs(), and run().

◆ secondALCT

CSCALCTDigi CSCAnodeLCTProcessor::secondALCT[CSCConstants::MAX_ALCT_TBINS]
protected

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

Definition at line 105 of file CSCAnodeLCTProcessor.h.

Referenced by clear(), getALCTs(), getSecondALCT(), and lctSearch().

◆ showerNumTBins_

unsigned CSCAnodeLCTProcessor::showerNumTBins_
protected

Definition at line 131 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), and encodeHighMultiplicityBits().

◆ thePreTriggerDigis

std::vector<CSCALCTPreTriggerDigi> CSCAnodeLCTProcessor::thePreTriggerDigis
protected

Definition at line 126 of file CSCAnodeLCTProcessor.h.

Referenced by preTrigger(), and preTriggerDigis().

◆ thresholds_

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

Definition at line 130 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), and encodeHighMultiplicityBits().

◆ trig_mode

unsigned int CSCAnodeLCTProcessor::trig_mode
protected

◆ use_corrected_bx

bool CSCAnodeLCTProcessor::use_corrected_bx
protected

Phase2: whether to use corrected_bx instead of pretrigger BX

Definition at line 159 of file CSCAnodeLCTProcessor.h.

Referenced by CSCAnodeLCTProcessor(), CSCUpgradeAnodeLCTProcessor::ghostCancellationLogicOneWire(), and run().