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