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 
41 
42 #include <vector>
43 
45 {
46  public:
48  CSCAnodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector,
49  unsigned subsector, unsigned chamber,
50  const edm::ParameterSet& conf);
51 
54 
56  void setConfigParameters(const CSCDBL1TPParameters* conf);
57 
59  void clear();
60 
61  // This is the main routine for normal running. It gets wire times
62  // from the wire digis and then passes them on to another run() function.
63  std::vector<CSCALCTDigi> run(const CSCWireDigiCollection* wiredc);
64 
65  // This version of the run() function can either be called in a standalone
66  // test, being passed the time array, or called by the run() function above.
67  // It gets wire times from an input array and then loops over the keywires.
68  // All found LCT candidates are sorted and the best two are retained.
69  void run(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]);
70 
72  std::vector<CSCALCTDigi> readoutALCTs();
73 
75  std::vector<CSCALCTDigi> getALCTs();
76 
81 
88 
91 
92  protected:
94  bool getDigis(const CSCWireDigiCollection* wiredc);
95  void getDigis(const CSCWireDigiCollection* wiredc, const CSCDetId& id);
96 
99 
103  std::vector<CSCWireDigi> digiV[CSCConstants::NUM_LAYERS];
105 
106  std::vector<CSCALCTDigi> lct_list;
107 
113 
115  unsigned int hit_persist;
116 
119 
122 
126 
129 
132 
135 
136 
138  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
139  static const unsigned int def_drift_delay;
141  static const unsigned int def_nplanes_hit_accel_pretrig;
142  static const unsigned int def_nplanes_hit_accel_pattern;
143  static const unsigned int def_trig_mode, def_accel_mode;
144  static const unsigned int def_l1a_window_width;
145 
148 
150  void loadPatternMask();
151 
154 
156  void checkConfigParameters();
157 
159  void clear(const int wire, const int pattern);
160 
161  /* Gets wire times from the wire digis and fills wire[][] vector */
162  void readWireDigis(std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]);
163 
164  /* A pulse array will be used as a bit representation of hit times.
165  For example: if a keywire has a bx_time of 3, then 1 shifted
166  left 3 will be bit pattern 0000000000001000. Bits are then added to
167  signify the duration of a signal (hit_persist, formerly bx_width). So
168  for the pulse with a hit_persist of 6 will look like 0000000111111000. */
169  bool pulseExtension(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]);
170 
171  /* Check that there are nplanes_hit_pretrig or more layers hit in collision
172  or accelerator patterns for a particular key_wire. If so, return
173  true and the PatternDetection process will start. */
174  bool preTrigger(const int key_wire, const int start_bx);
175 
176  /* See if there is a pattern that satisfies nplanes_hit_pattern number of
177  layers hit for either the accelerator or collision patterns. Use
178  the pattern with the best quality. */
179  bool patternDetection(const int key_wire);
180 
181  /* This function looks for LCTs on the previous and next wires. If one
182  exists and it has a better quality and a bx_time up to 4 clocks earlier
183  than the present, then the present LCT is cancelled. The present LCT
184  also gets cancelled if it has the same quality as the one on the
185  previous wire (this has not been done in 2003 test beam). The
186  cancellation is done separately for collision and accelerator patterns. */
187  virtual void ghostCancellationLogic();
188 
189  virtual void ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared);
190 
191  virtual int getTempALCTQuality(int temp_quality) const;
192 
193  void lctSearch();
194  /* Function which enables/disables either collision or accelerator tracks.
195  The function uses the trig_mode parameter to decide. */
196  void trigMode(const int key_wire);
197 
198  /* Function which gives a preference either to the collision patterns
199  or accelerator patterns. The function uses the accel_mode parameter
200  to decide. */
201  void accelMode(const int key_wire);
202 
203  /* Selects two collision and two accelerator ALCTs per time bin with
204  the best quality. */
205  std::vector<CSCALCTDigi>
206  bestTrackSelector(const std::vector<CSCALCTDigi>& all_alcts);
207 
208  /* This method should have been an overloaded > operator, but we
209  have to keep it here since need to check values in quality[][]
210  array modified according to accel_mode parameter. */
211  bool isBetterALCT(const CSCALCTDigi& lhsALCT, const CSCALCTDigi& rhsALCT) const;
212 
214  void dumpConfigParams() const;
215 
217  void dumpDigis(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const;
218 
219  void showPatterns(const int key_wire);
220 };
221 
222 #endif
void showPatterns(const int key_wire)
void readWireDigis(std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES])
int quality[CSCConstants::MAX_NUM_WIRES][3]
int first_bx_corrected[CSCConstants::MAX_NUM_WIRES]
static const unsigned int def_drift_delay
static const unsigned int def_fifo_tbins
bool getDigis(const CSCWireDigiCollection *wiredc)
bool isBetterALCT(const CSCALCTDigi &lhsALCT, const CSCALCTDigi &rhsALCT) const
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 int pattern_envelope[CSCConstants::NUM_ALCT_PATTERNS][CSCConstants::MAX_WIRES_IN_PATTERN]
virtual void ghostCancellationLogic()
static const unsigned int def_nplanes_hit_accel_pretrig
static const unsigned int def_fifo_pretrig
void accelMode(const int key_wire)
int pattern_mask[CSCConstants::NUM_ALCT_PATTERNS][CSCConstants::MAX_WIRES_IN_PATTERN]
static const unsigned int def_nplanes_hit_pattern
bool preTrigger(const int key_wire, const int start_bx)
bool pulseExtension(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES])
CSCALCTDigi secondALCT[CSCConstants::MAX_ALCT_TBINS]
virtual int getTempALCTQuality(int temp_quality) const
static const unsigned int def_l1a_window_width
static const int pattern_mask_open[CSCConstants::NUM_ALCT_PATTERNS][CSCConstants::MAX_WIRES_IN_PATTERN]
static const unsigned int def_trig_mode
static const unsigned int def_nplanes_hit_accel_pattern
std::vector< CSCALCTDigi > readoutALCTs()
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_WIRES]
void dumpDigis(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const
unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]
bool patternDetection(const int key_wire)
static const int pattern_mask_r1[CSCConstants::NUM_ALCT_PATTERNS][CSCConstants::MAX_WIRES_IN_PATTERN]
unsigned int nplanes_hit_accel_pattern
std::vector< CSCALCTDigi > run(const CSCWireDigiCollection *wiredc)
unsigned int pretrig_extra_deadtime
std::vector< CSCWireDigi > digiV[CSCConstants::NUM_LAYERS]
std::vector< CSCALCTDigi > getALCTs()
static const unsigned int def_nplanes_hit_pretrig
unsigned int nplanes_hit_accel_pretrig