CMS 3D CMS Logo

CSCAnodeLCTProcessor.h
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_CSCAnodeLCTProcessor_h
2 #define L1Trigger_CSCTriggerPrimitives_CSCAnodeLCTProcessor_h
3 
45 
46 #include <vector>
47 
49 public:
52  unsigned station,
53  unsigned sector,
54  unsigned subsector,
55  unsigned chamber,
56  const edm::ParameterSet& conf);
57 
59  ~CSCAnodeLCTProcessor() override = default;
60 
62  void setConfigParameters(const CSCDBL1TPParameters* conf);
63 
65  void clear();
66 
67  // This is the main routine for normal running. It gets wire times
68  // from the wire digis and then passes them on to another run() function.
69  std::vector<CSCALCTDigi> run(const CSCWireDigiCollection* wiredc);
70 
71  // This version of the run() function can either be called in a standalone
72  // test, being passed the time array, or called by the run() function above.
73  // It gets wire times from an input array and then loops over the keywires.
74  // All found LCT candidates are sorted and the best two are retained.
75  void run(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]);
76 
78  std::vector<CSCALCTDigi> readoutALCTs() const;
79 
81  std::vector<CSCALCTDigi> getALCTs() const;
82 
84  std::vector<CSCALCTPreTriggerDigi> preTriggerDigis() const { return thePreTriggerDigis; }
85 
87  CSCALCTDigi getBestALCT(int bx) const;
88  CSCALCTDigi getSecondALCT(int bx) const;
89 
90  /* get array of high multiplicity triggers */
91  std::vector<CSCShowerDigi> getAllShower() const;
92 
94  std::vector<CSCShowerDigi> readoutShower() const;
95 
96 protected:
103 
106 
108 
110 
112  bool getDigis(const CSCWireDigiCollection* wiredc);
113  void getDigis(const CSCWireDigiCollection* wiredc, const CSCDetId& id);
114 
117 
120 
122  std::vector<CSCWireDigi> digiV[CSCConstants::NUM_LAYERS];
123 
124  std::vector<CSCALCTDigi> lct_list;
125 
126  std::vector<CSCALCTPreTriggerDigi> thePreTriggerDigis;
127 
128  /* data members for high multiplicity triggers */
130  std::vector<unsigned> thresholds_;
131  unsigned showerNumTBins_;
133  unsigned minbx_readout_;
134  unsigned maxbx_readout_;
135 
141 
143  unsigned int hit_persist;
144 
147 
150 
154 
157 
160 
163 
165  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
166  static const unsigned int def_drift_delay;
168  static const unsigned int def_nplanes_hit_accel_pretrig;
169  static const unsigned int def_nplanes_hit_accel_pattern;
170  static const unsigned int def_trig_mode, def_accel_mode;
171  static const unsigned int def_l1a_window_width;
172 
173  /* quality control */
174  std::unique_ptr<LCTQualityControl> qualityControl_;
175 
178 
180  void loadPatternMask();
181 
184 
186  void checkConfigParameters();
187 
189  void clear(const int wire, const int pattern);
190 
191  /* Gets wire times from the wire digis and fills wire[][] vector */
193 
194  /* A pulse array will be used as a bit representation of hit times.
195  For example: if a keywire has a bx_time of 3, then 1 shifted
196  left 3 will be bit pattern 0000000000001000. Bits are then added to
197  signify the duration of a signal (hit_persist, formerly bx_width). So
198  for the pulse with a hit_persist of 6 will look like 0000000111111000. */
200 
201  /* Check that there are nplanes_hit_pretrig or more layers hit in collision
202  or accelerator patterns for a particular key_wire. If so, return
203  true and the PatternDetection process will start. */
204  bool preTrigger(const int key_wire, const int start_bx);
205 
206  /* See if there is a pattern that satisfies nplanes_hit_pattern number of
207  layers hit for either the accelerator or collision patterns. Use
208  the pattern with the best quality. */
209  bool patternDetection(const int key_wire,
210  std::map<int, std::map<int, CSCALCTDigi::WireContainer> >& hits_in_patterns);
211 
212  // remove the invalid wires from the container
213  void cleanWireContainer(CSCALCTDigi::WireContainer& wireHits) const;
214 
215  // set the wire hit container
217 
218  /* In older versions of the ALCT emulation, the ghost cancellation was performed after
219  the ALCTs were found. In December 2018 it became clear that during the study of data
220  and emulation comparison on 2018 data, a small disagreement between data and emulation
221  was found. The changes we implemented then allow re-triggering on one wiregroup after
222  some dead time once an earlier ALCT was constructed built on this wiregroup. Before this
223  commit the ALCT processor would prohibit the wiregroup from triggering in one event after
224  an ALCT was found on that wiregroup. In the firwmare, the wiregroup with ALCT is only dead
225  for a few BX before it can be triggered by next muon. The implementation of ghost cancellation
226  logic wqas changed to accommodate the re-triggering change while the idea of the ghost
227  cancellation logic is kept the same.
228  */
229  virtual void ghostCancellationLogicOneWire(const int key_wire, int* ghost_cleared);
230 
231  virtual int getTempALCTQuality(int temp_quality) const;
232 
233  void lctSearch();
234  /* Function which enables/disables either collision or accelerator tracks.
235  The function uses the trig_mode parameter to decide. */
236  void trigMode(const int key_wire);
237 
238  /* Function which gives a preference either to the collision patterns
239  or accelerator patterns. The function uses the accel_mode parameter
240  to decide. */
241  void accelMode(const int key_wire);
242 
243  /* Selects two collision and two accelerator ALCTs per time bin with
244  the best quality. */
245  std::vector<CSCALCTDigi> bestTrackSelector(const std::vector<CSCALCTDigi>& all_alcts);
246 
247  /* This method should have been an overloaded > operator, but we
248  have to keep it here since need to check values in quality[][]
249  array modified according to accel_mode parameter. */
250  bool isBetterALCT(const CSCALCTDigi& lhsALCT, const CSCALCTDigi& rhsALCT) const;
251 
253  void dumpConfigParams() const;
254 
256  void dumpDigis(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const;
257 
258  void showPatterns(const int key_wire);
259 };
260 
261 #endif
CSCShowerDigi anode_showers_[CSCConstants::MAX_ALCT_TBINS]
void showPatterns(const int key_wire)
std::unique_ptr< LCTQualityControl > qualityControl_
static const unsigned int def_drift_delay
static const unsigned int def_fifo_tbins
bool getDigis(const CSCWireDigiCollection *wiredc)
bool pulseExtension(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
int first_bx_corrected[CSCConstants::MAX_NUM_WIREGROUPS]
std::vector< CSCALCTPreTriggerDigi > thePreTriggerDigis
std::vector< LCTPattern > LCTPatterns
void setConfigParameters(const CSCDBL1TPParameters *conf)
void trigMode(const int key_wire)
static const unsigned int def_accel_mode
std::vector< CSCALCTDigi > lct_list
static const unsigned int def_nplanes_hit_accel_pretrig
static const unsigned int def_fifo_pretrig
std::vector< CSCShowerDigi > readoutShower() const
void accelMode(const int key_wire)
static const unsigned int def_nplanes_hit_pattern
bool preTrigger(const int key_wire, const int start_bx)
CSCALCTDigi secondALCT[CSCConstants::MAX_ALCT_TBINS]
static const unsigned int def_l1a_window_width
CSCPatternBank::LCTPatterns alct_pattern_
CSCALCTDigi getSecondALCT(int bx) const
static const unsigned int def_trig_mode
std::vector< std::vector< uint16_t > > WireContainer
Definition: CSCALCTDigi.h:21
bool patternDetection(const int key_wire, std::map< int, std::map< int, CSCALCTDigi::WireContainer > > &hits_in_patterns)
std::vector< CSCShowerDigi > getAllShower() const
static const unsigned int def_nplanes_hit_accel_pattern
bool isBetterALCT(const CSCALCTDigi &lhsALCT, const CSCALCTDigi &rhsALCT) const
void cleanWireContainer(CSCALCTDigi::WireContainer &wireHits) const
std::vector< CSCALCTDigi > bestTrackSelector(const std::vector< CSCALCTDigi > &all_alcts)
CSCALCTDigi getBestALCT(int bx) const
CSCALCTDigi bestALCT[CSCConstants::MAX_ALCT_TBINS]
virtual void ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared)
std::vector< CSCALCTDigi > getALCTs() const
void setWireContainer(CSCALCTDigi &, CSCALCTDigi::WireContainer &wireHits) const
virtual int getTempALCTQuality(int temp_quality) const
void dumpDigis(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const
int first_bx[CSCConstants::MAX_NUM_WIREGROUPS]
unsigned int nplanes_hit_accel_pattern
int quality[CSCConstants::MAX_NUM_WIREGROUPS][CSCConstants::NUM_ALCT_PATTERNS]
std::vector< CSCALCTDigi > readoutALCTs() const
std::vector< CSCALCTDigi > run(const CSCWireDigiCollection *wiredc)
std::vector< unsigned > thresholds_
void readWireDigis(std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
unsigned int pretrig_extra_deadtime
std::vector< CSCWireDigi > digiV[CSCConstants::NUM_LAYERS]
CSCAnodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
~CSCAnodeLCTProcessor() override=default
static const unsigned int def_nplanes_hit_pretrig
unsigned int nplanes_hit_accel_pretrig
std::vector< CSCALCTPreTriggerDigi > preTriggerDigis() const