CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCCathodeLCTProcessor.h
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
2 #define L1Trigger_CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
3 
34 
35 #include <vector>
36 
38 {
39  public:
41  CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector,
42  unsigned subsector, unsigned chamber,
43  const edm::ParameterSet& conf,
44  const edm::ParameterSet& comm,
45  const edm::ParameterSet& ctmb);
46 
49 
51  void setConfigParameters(const CSCDBL1TPParameters* conf);
52 
54  void clear();
55 
58  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
59 
62  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
63  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
64 
66  bool getDigis(const CSCComparatorDigiCollection* compdc);
67  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
68 
70  enum {MAX_CLCT_BINS = 16};
71 
74 
77 
79  std::vector<CSCCLCTDigi> readoutCLCTs();
80 
82  std::vector<CSCCLCTDigi> getCLCTs();
83 
84  std::vector<int> preTriggerBXs() const {return thePreTriggerBXs;}
85 
86  static void distripStagger(int stag_triad[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
87  int stag_time[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
88  int stag_digi[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
89  int i_distrip, bool debug = false);
90 
94  void setRing(unsigned r) {theRing = r;}
95 
97  enum {NUM_PATTERN_STRIPS = 26};
98  static const int pre_hit_pattern[2][NUM_PATTERN_STRIPS];
100 
104 
106  enum {MAX_CFEBS = 5};
107 
108  // we use these next ones to address the various bits inside the array that's
109  // used to make the cathode LCTs.
112 
113  private:
118  int infoV;
119 
121  const unsigned theEndcap;
122  const unsigned theStation;
123  const unsigned theSector;
124  const unsigned theSubsector;
125  const unsigned theTrigChamber;
126 
127  // holders for easy access:
128  unsigned int theRing;
129  unsigned int theChamber;
130  bool isME11;
131 
134 
135  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
136  std::vector<int> thePreTriggerBXs;
137 
139  bool isMTCC;
140 
142  bool isTMB07;
143 
145  bool isSLHC;
146 
148  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
149  unsigned int hit_persist, drift_delay;
152  unsigned int tmb_l1a_window_size;
153 
156 
159 
162 
165  unsigned int clct_state_machine_zone; // +- around a keystrip
166  bool dynamic_state_machine_zone; //use a pattern dependent zone
167 
169  unsigned int pretrig_trig_zone;
170 
173 
176 
178  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
179  static const unsigned int def_hit_persist, def_drift_delay;
180  static const unsigned int def_nplanes_hit_pretrig;
181  static const unsigned int def_nplanes_hit_pattern;
182  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
183  static const unsigned int def_tmb_l1a_window_size;
184 
187 
189  void checkConfigParameters();
190 
192  static const int cfeb_strips[2];
193 
194  //---------------- Methods common to all firmware versions ------------------
195  void readComparatorDigis(std::vector<int>halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
196  std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
197  void readComparatorDigis(std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
198  void pulseExtension(
199  const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
200  const int nStrips,
201  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
202 
203  //------------- Functions for idealized version for MC studies --------------
204  std::vector<CSCCLCTDigi> findLCTs(
205  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
206  int stripType);
207  bool preTrigger(
208  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
209  const int stripType, const int nStrips, int& first_bx);
210  void getKeyStripData(
211  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
212  int keystrip_data[CSCConstants::NUM_HALF_STRIPS_7CFEBS][7],
213  int nStrips, int first_bx, int& best_strip, int stripType);
214  void getPattern(int pattern_num, int strip_value[NUM_PATTERN_STRIPS],
215  int bx_time, int &quality, int &bend);
216  bool hitIsGood(int hitTime, int BX);
217 
218  //-------------------- Functions for pre-2007 firmware ----------------------
219  std::vector<CSCCLCTDigi> findLCTs(
220  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
221  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
222  bool preTrigger(
223  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
224  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
225  const int stripType, const int nStrips,
226  const int start_bx, int& first_bx);
227  bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
228  const int stripType, const int nStrips,
229  const unsigned int bx_time);
230  void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
231  int keyStrip[MAX_CFEBS], unsigned int nhits[MAX_CFEBS],
232  const int stripType, const int nStrips, const int bx_time);
233  void priorityEncode(const int h_keyStrip[MAX_CFEBS],
234  const unsigned int h_nhits[MAX_CFEBS],
235  const int d_keyStrip[MAX_CFEBS],
236  const unsigned int d_nhits[MAX_CFEBS],
237  int keystrip_data[2][7]);
238  void getKeyStripData(const unsigned int h_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
239  const unsigned int d_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
240  int keystrip_data[2][7], const int first_bx);
241  void getPattern(unsigned int pattern_num,
242  const int strip_value[NUM_PATTERN_STRIPS],
243  unsigned int& quality, unsigned int& bend);
244 
245  //--------------- Functions for 2007 version of the firmware ----------------
246  std::vector<CSCCLCTDigi> findLCTs(
247  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
248  bool preTrigger(
249  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
250  const int start_bx, int& first_bx);
251  bool ptnFinding(
252  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
253  const int nStrips, const unsigned int bx_time);
254  void markBusyKeys(const int best_hstrip, const int best_patid,
255  int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
256 
260 
261  //--------------- Functions for SLHC studies ----------------
262 
263  std::vector<CSCCLCTDigi> findLCTsSLHC(
264  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
265 
267 
268  //--------------------------- Auxiliary methods -----------------------------
270  void dumpConfigParams() const;
271 
273  void dumpDigis(
274  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
275  const int stripType, const int nStrips) const;
276 
277  //--------------------------- Methods for tests -----------------------------
278  void testDistripStagger();
279  void testLCTs();
280  void printPatterns();
281  void testPatterns();
282  int findNumLayersHit(std::vector<int> stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
283 };
284 
285 #endif
void getPattern(int pattern_num, int strip_value[NUM_PATTERN_STRIPS], int bx_time, int &quality, int &bend)
static const unsigned int def_drift_delay
CSCCLCTDigi secondCLCT[MAX_CLCT_BINS]
std::vector< CSCCLCTDigi > readoutCLCTs()
static const unsigned int def_fifo_tbins
static void distripStagger(int stag_triad[CSCConstants::MAX_NUM_STRIPS_7CFEBS], int stag_time[CSCConstants::MAX_NUM_STRIPS_7CFEBS], int stag_digi[CSCConstants::MAX_NUM_STRIPS_7CFEBS], int i_distrip, bool debug=false)
bool ispretrig[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
static const int cfeb_strips[2]
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
static const unsigned int def_min_separation
CSCCLCTDigi bestCLCT[MAX_CLCT_BINS]
static const unsigned int def_nplanes_hit_pretrig
static const unsigned int def_pid_thresh_pretrig
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int stripType, const int nStrips, const unsigned int bx_time)
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS])
void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], int keyStrip[MAX_CFEBS], unsigned int nhits[MAX_CFEBS], const int stripType, const int nStrips, const int bx_time)
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int stripType, const int nStrips) const
static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][NUM_PATTERN_HALFSTRIPS+2]
static const unsigned int def_tmb_l1a_window_size
static const int pattern[CSCConstants::NUM_CLCT_PATTERNS_PRE_TMB07][NUM_PATTERN_STRIPS+1]
bool getDigis(const CSCComparatorDigiCollection *compdc)
static const unsigned int def_nplanes_hit_pattern
bool preTrigger(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int stripType, const int nStrips, int &first_bx)
bool ptnFinding(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const int nStrips, const unsigned int bx_time)
void priorityEncode(const int h_keyStrip[MAX_CFEBS], const unsigned int h_nhits[MAX_CFEBS], const int d_keyStrip[MAX_CFEBS], const unsigned int d_nhits[MAX_CFEBS], int keystrip_data[2][7])
#define debug
Definition: HDRShower.cc:19
std::vector< int > preTriggerBXs() const
static const unsigned int def_fifo_pretrig
std::vector< int > thePreTriggerBXs
static const unsigned int def_hit_persist
std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], int stripType)
int stagger[CSCConstants::NUM_LAYERS]
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS_7CFEBS]
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc)
static const int pattern2007_offset[NUM_PATTERN_HALFSTRIPS]
int findNumLayersHit(std::vector< int > stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
bool hitIsGood(int hitTime, int BX)
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
void readComparatorDigis(std::vector< int >halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], std::vector< int > distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
static const int pre_hit_pattern[2][NUM_PATTERN_STRIPS]
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])
void getKeyStripData(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], int keystrip_data[CSCConstants::NUM_HALF_STRIPS_7CFEBS][7], int nStrips, int first_bx, int &best_strip, int stripType)
std::vector< CSCCLCTDigi > findLCTsSLHC(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
std::vector< CSCCLCTDigi > getCLCTs()
void setConfigParameters(const CSCDBL1TPParameters *conf)