CMS 3D CMS Logo

CSCCathodeLCTProcessor.h
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
2 #define L1Trigger_CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
3 
38 
39 #include <vector>
40 
42 {
43  public:
45  CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector,
46  unsigned subsector, unsigned chamber,
47  const edm::ParameterSet& conf);
48 
51 
53  void setConfigParameters(const CSCDBL1TPParameters* conf);
54 
56  void clear();
57 
60  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
61 
64  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
65 
67  std::vector<CSCCLCTDigi> readoutCLCTs() const;
68  std::vector<CSCCLCTDigi> readoutCLCTsME1a() const;
69  std::vector<CSCCLCTDigi> readoutCLCTsME1b() const;
70 
72  std::vector<CSCCLCTDigi> getCLCTs() const;
73 
74  std::vector<int> preTriggerBXs() const {return thePreTriggerBXs;}
75 
77  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigis() const {return thePreTriggerDigis; }
78  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigisME1a() const;
79  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigisME1b() const;
80 
83 
86 
87  protected:
88 
90  bool getDigis(const CSCComparatorDigiCollection* compdc);
91  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
92 
95 
97  void checkConfigParameters();
98 
99  //---------------- Methods common to all firmware versions ------------------
100  // Single-argument version for TMB07 (halfstrip-only) firmware.
101  // Takes the comparator & time info and stuffs it into halfstrip vector.
102  // Multiple hits on the same strip are allowed.
103  void readComparatorDigis(std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
104  void pulseExtension(const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
105  const int nStrips,
106  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
107 
108  //--------------- Functions for post-2007 version of the firmware -----------
109  virtual std::vector<CSCCLCTDigi> findLCTs(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
110 
111  /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern */
112  virtual bool preTrigger(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
113  const int start_bx, int& first_bx);
114 
115  /* For a given clock cycle, check each half-strip if a pattern matches */
116  bool patternFinding(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
117  const int nStrips, const unsigned int bx_time);
118 
119  /* Mark the half-strips around the best half-strip as busy */
120  void markBusyKeys(const int best_hstrip, const int best_patid,
121  int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
122 
123  //--------------------------- Auxiliary methods -----------------------------
125  void dumpConfigParams() const;
126 
128  void dumpDigis(const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
129  const int nStrips) const;
130 
131  //--------------------------- Member variables -----------------------------
132 
133  /* best pattern Id for a given half-strip */
135 
136  /* number of layers hit on a given half-strip */
138 
140 
141  /* does a given half-strip have a pre-trigger? */
143 
144 
145  public:
147  // New set of halfstrip patterns for 2007 version of the algorithm.
148  // For the given pattern, set the unused parts of the pattern to 999.
149  // Pattern[i][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN] contains bend direction.
150  // Bend of 0 is right/straight and bend of 1 is left.
151  // Pattern[i][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+1] contains pattern maximum width
154 
155  protected:
156  // we use these next ones to address the various bits inside the array that's
157  // used to make the cathode LCTs.
166 
167  /* number of strips used in this processor */
169 
170  /* Is the layer in the chamber staggered? */
172 
173  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
174  std::vector<int> thePreTriggerBXs;
175  std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
176 
178  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
179  unsigned int hit_persist, drift_delay;
182  unsigned int tmb_l1a_window_size;
183 
186 
189 
192 
194  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
195  static const unsigned int def_hit_persist, def_drift_delay;
196  static const unsigned int def_nplanes_hit_pretrig;
197  static const unsigned int def_nplanes_hit_pattern;
198  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
199  static const unsigned int def_tmb_l1a_window_size;
200 };
201 
202 #endif
static const unsigned int def_drift_delay
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips) const
bool patternFinding(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, const unsigned int bx_time)
std::vector< CSCCLCTDigi > readoutCLCTs() const
static const unsigned int def_fifo_tbins
bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
static const int pattern2007_offset[CSCConstants::MAX_HALFSTRIPS_IN_PATTERN]
static const unsigned int def_min_separation
std::vector< CSCCLCTDigi > readoutCLCTsME1b() const
static const unsigned int def_nplanes_hit_pretrig
virtual bool preTrigger(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int start_bx, int &first_bx)
static const unsigned int def_pid_thresh_pretrig
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
void readComparatorDigis(std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
std::vector< CSCCLCTDigi > readoutCLCTsME1a() const
static const unsigned int def_tmb_l1a_window_size
bool getDigis(const CSCComparatorDigiCollection *compdc)
static const unsigned int def_nplanes_hit_pattern
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigisME1b() const
std::vector< CSCCLCTDigi > getCLCTs() const
double pulse(double x, double y, double z, double t)
std::vector< int > preTriggerBXs() const
static const unsigned int def_fifo_pretrig
std::vector< int > thePreTriggerBXs
static const unsigned int def_hit_persist
int stagger[CSCConstants::NUM_LAYERS]
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc)
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigisME1a() const
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigis() const
void setConfigParameters(const CSCDBL1TPParameters *conf)