CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 special bits for high multiplicity triggers */
91  unsigned getInTimeHMT() const { return inTimeHMT_; }
92  unsigned getOutTimeHMT() const { return outTimeHMT_; }
93 
96 
97 protected:
104 
107 
109 
111 
113  bool getDigis(const CSCWireDigiCollection* wiredc);
114  void getDigis(const CSCWireDigiCollection* wiredc, const CSCDetId& id);
115 
118 
121 
123  std::vector<CSCWireDigi> digiV[CSCConstants::NUM_LAYERS];
124 
125  std::vector<CSCALCTDigi> lct_list;
126 
127  std::vector<CSCALCTPreTriggerDigi> thePreTriggerDigis;
128 
129  /* data members for high multiplicity triggers */
131  const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]);
132  unsigned inTimeHMT_;
133  unsigned outTimeHMT_;
134  std::vector<unsigned> thresholds_;
140 
146 
148  unsigned int hit_persist;
149 
152 
155 
159 
162 
165 
168 
170  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
171  static const unsigned int def_drift_delay;
173  static const unsigned int def_nplanes_hit_accel_pretrig;
174  static const unsigned int def_nplanes_hit_accel_pattern;
175  static const unsigned int def_trig_mode, def_accel_mode;
176  static const unsigned int def_l1a_window_width;
177 
178  /* quality control */
179  std::unique_ptr<LCTQualityControl> qualityControl_;
180 
183 
185  void loadPatternMask();
186 
189 
191  void checkConfigParameters();
192 
194  void clear(const int wire, const int pattern);
195 
196  /* Gets wire times from the wire digis and fills wire[][] vector */
197  void readWireDigis(std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]);
198 
199  /* A pulse array will be used as a bit representation of hit times.
200  For example: if a keywire has a bx_time of 3, then 1 shifted
201  left 3 will be bit pattern 0000000000001000. Bits are then added to
202  signify the duration of a signal (hit_persist, formerly bx_width). So
203  for the pulse with a hit_persist of 6 will look like 0000000111111000. */
204  bool pulseExtension(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]);
205 
206  /* Check that there are nplanes_hit_pretrig or more layers hit in collision
207  or accelerator patterns for a particular key_wire. If so, return
208  true and the PatternDetection process will start. */
209  bool preTrigger(const int key_wire, const int start_bx);
210 
211  /* See if there is a pattern that satisfies nplanes_hit_pattern number of
212  layers hit for either the accelerator or collision patterns. Use
213  the pattern with the best quality. */
214  bool patternDetection(const int key_wire,
215  std::map<int, std::map<int, CSCALCTDigi::WireContainer> >& hits_in_patterns);
216 
217  // remove the invalid wires from the container
218  void cleanWireContainer(CSCALCTDigi::WireContainer& wireHits) const;
219 
220  // set the wire hit container
222 
223  /* In older versions of the ALCT emulation, the ghost cancellation was performed after
224  the ALCTs were found. In December 2018 it became clear that during the study of data
225  and emulation comparison on 2018 data, a small disagreement between data and emulation
226  was found. The changes we implemented then allow re-triggering on one wiregroup after
227  some dead time once an earlier ALCT was constructed built on this wiregroup. Before this
228  commit the ALCT processor would prohibit the wiregroup from triggering in one event after
229  an ALCT was found on that wiregroup. In the firwmare, the wiregroup with ALCT is only dead
230  for a few BX before it can be triggered by next muon. The implementation of ghost cancellation
231  logic wqas changed to accommodate the re-triggering change while the idea of the ghost
232  cancellation logic is kept the same.
233  */
234  virtual void ghostCancellationLogicOneWire(const int key_wire, int* ghost_cleared);
235 
236  virtual int getTempALCTQuality(int temp_quality) const;
237 
238  void lctSearch();
239  /* Function which enables/disables either collision or accelerator tracks.
240  The function uses the trig_mode parameter to decide. */
241  void trigMode(const int key_wire);
242 
243  /* Function which gives a preference either to the collision patterns
244  or accelerator patterns. The function uses the accel_mode parameter
245  to decide. */
246  void accelMode(const int key_wire);
247 
248  /* Selects two collision and two accelerator ALCTs per time bin with
249  the best quality. */
250  std::vector<CSCALCTDigi> bestTrackSelector(const std::vector<CSCALCTDigi>& all_alcts);
251 
252  /* This method should have been an overloaded > operator, but we
253  have to keep it here since need to check values in quality[][]
254  array modified according to accel_mode parameter. */
255  bool isBetterALCT(const CSCALCTDigi& lhsALCT, const CSCALCTDigi& rhsALCT) const;
256 
258  void dumpConfigParams() const;
259 
261  void dumpDigis(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const;
262 
263  void showPatterns(const int key_wire);
264 };
265 
266 #endif
unsigned getOutTimeHMT() const
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
CSCALCTDigi getSecondALCT(int bx) const
unsigned getInTimeHMT() const
bool getDigis(const CSCWireDigiCollection *wiredc)
void encodeHighMultiplicityBits(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS])
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
bool isBetterALCT(const CSCALCTDigi &lhsALCT, const CSCALCTDigi &rhsALCT) const
void setConfigParameters(const CSCDBL1TPParameters *conf)
void trigMode(const int key_wire)
void dumpDigis(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIREGROUPS]) const
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< CSCALCTDigi > getALCTs() const
std::vector< CSCALCTDigi > readoutALCTs() 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)
void cleanWireContainer(CSCALCTDigi::WireContainer &wireHits) const
CSCALCTDigi secondALCT[CSCConstants::MAX_ALCT_TBINS]
virtual int getTempALCTQuality(int temp_quality) const
static const unsigned int def_l1a_window_width
CSCPatternBank::LCTPatterns alct_pattern_
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)
static const unsigned int def_nplanes_hit_accel_pattern
CSCShowerDigi readoutShower() const
void setWireContainer(CSCALCTDigi &, CSCALCTDigi::WireContainer &wireHits) const
std::vector< CSCALCTDigi > bestTrackSelector(const std::vector< CSCALCTDigi > &all_alcts)
CSCALCTDigi bestALCT[CSCConstants::MAX_ALCT_TBINS]
virtual void ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared)
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 > run(const CSCWireDigiCollection *wiredc)
std::vector< CSCALCTPreTriggerDigi > preTriggerDigis() const
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
CSCALCTDigi getBestALCT(int bx) const