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 CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
2 #define CSCTriggerPrimitives_CSCCathodeLCTProcessor_h
3 
29 #include <vector>
35 
37 {
38  public:
40  CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector,
41  unsigned subsector, unsigned chamber,
42  const edm::ParameterSet& conf,
43  const edm::ParameterSet& comm,
44  const edm::ParameterSet& ctmb);
45 
48 
50  void setConfigParameters(const CSCDBL1TPParameters* conf);
51 
53  void clear();
54 
57  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
58 
61  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
62  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
63 
65  bool getDigis(const CSCComparatorDigiCollection* compdc);
66  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
67 
69  enum {MAX_CLCT_BINS = 16};
70 
73 
76 
78  std::vector<CSCCLCTDigi> readoutCLCTs();
79 
81  std::vector<CSCCLCTDigi> getCLCTs();
82 
83  std::vector<int> preTriggerBXs() const {return thePreTriggerBXs;}
84 
85  static void distripStagger(int stag_triad[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
86  int stag_time[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
87  int stag_digi[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
88  int i_distrip, bool debug = false);
89 
93  void setRing(unsigned r) {theRing = r;}
94 
96  enum {NUM_PATTERN_STRIPS = 26};
97  static const int pre_hit_pattern[2][NUM_PATTERN_STRIPS];
99 
103 
105  enum {MAX_CFEBS = 5};
106 
107  // we use these next ones to address the various bits inside the array that's
108  // used to make the cathode LCTs.
111 
112  private:
117  int infoV;
118 
120  const unsigned theEndcap;
121  const unsigned theStation;
122  const unsigned theSector;
123  const unsigned theSubsector;
124  const unsigned theTrigChamber;
125 
126  // holders for easy access:
127  unsigned int theRing;
128  unsigned int theChamber;
129  bool isME11;
130 
133 
134  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
135  std::vector<int> thePreTriggerBXs;
136 
138  bool isMTCC;
139 
141  bool isTMB07;
142 
144  bool isSLHC;
145 
147  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
148  unsigned int hit_persist, drift_delay;
151  unsigned int tmb_l1a_window_size;
152 
155 
158 
161 
164  unsigned int clct_state_machine_zone; // +- around a keystrip
165  bool dynamic_state_machine_zone; //use a pattern dependent zone
166 
168  unsigned int pretrig_trig_zone;
169 
172 
175 
177  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
178  static const unsigned int def_hit_persist, def_drift_delay;
179  static const unsigned int def_nplanes_hit_pretrig;
180  static const unsigned int def_nplanes_hit_pattern;
181  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
182  static const unsigned int def_tmb_l1a_window_size;
183 
186 
188  void checkConfigParameters();
189 
191  static const int cfeb_strips[2];
192 
193  //---------------- Methods common to all firmware versions ------------------
194  void readComparatorDigis(std::vector<int>halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
195  std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
196  void readComparatorDigis(std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
197  void pulseExtension(
198  const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
199  const int nStrips,
200  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
201 
202  //------------- Functions for idealized version for MC studies --------------
203  std::vector<CSCCLCTDigi> findLCTs(
204  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
205  int stripType);
206  bool preTrigger(
207  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
208  const int stripType, const int nStrips, int& first_bx);
209  void getKeyStripData(
210  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
211  int keystrip_data[CSCConstants::NUM_HALF_STRIPS_7CFEBS][7],
212  int nStrips, int first_bx, int& best_strip, int stripType);
213  void getPattern(int pattern_num, int strip_value[NUM_PATTERN_STRIPS],
214  int bx_time, int &quality, int &bend);
215  bool hitIsGood(int hitTime, int BX);
216 
217  //-------------------- Functions for pre-2007 firmware ----------------------
218  std::vector<CSCCLCTDigi> findLCTs(
219  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
220  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
221  bool preTrigger(
222  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
223  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
224  const int stripType, const int nStrips,
225  const int start_bx, int& first_bx);
226  bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
227  const int stripType, const int nStrips,
228  const unsigned int bx_time);
229  void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
230  int keyStrip[MAX_CFEBS], unsigned int nhits[MAX_CFEBS],
231  const int stripType, const int nStrips, const int bx_time);
232  void priorityEncode(const int h_keyStrip[MAX_CFEBS],
233  const unsigned int h_nhits[MAX_CFEBS],
234  const int d_keyStrip[MAX_CFEBS],
235  const unsigned int d_nhits[MAX_CFEBS],
236  int keystrip_data[2][7]);
237  void getKeyStripData(const unsigned int h_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
238  const unsigned int d_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
239  int keystrip_data[2][7], const int first_bx);
240  void getPattern(unsigned int pattern_num,
241  const int strip_value[NUM_PATTERN_STRIPS],
242  unsigned int& quality, unsigned int& bend);
243 
244  //--------------- Functions for 2007 version of the firmware ----------------
245  std::vector<CSCCLCTDigi> findLCTs(
246  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
247  bool preTrigger(
248  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
249  const int start_bx, int& first_bx);
250  bool ptnFinding(
251  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
252  const int nStrips, const unsigned int bx_time);
253  void markBusyKeys(const int best_hstrip, const int best_patid,
254  int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
255 
259 
260  //--------------- Functions for SLHC studies ----------------
261 
262  std::vector<CSCCLCTDigi> findLCTsSLHC(
263  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
264 
266 
267  //--------------------------- Auxiliary methods -----------------------------
269  void dumpConfigParams() const;
270 
272  void dumpDigis(
273  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
274  const int stripType, const int nStrips) const;
275 
276  //--------------------------- Methods for tests -----------------------------
277  void testDistripStagger();
278  void testLCTs();
279  void printPatterns();
280  void testPatterns();
281  int findNumLayersHit(std::vector<int> stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
282 };
283 
284 #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)
tuple conf
Definition: dbtoconf.py:185
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)