test
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],
62  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
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],
86  int stag_time[CSCConstants::MAX_NUM_STRIPS],
87  int stag_digi[CSCConstants::MAX_NUM_STRIPS],
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],
195  std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
196  void readComparatorDigis(std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
197  void pulseExtension(
198  const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
199  const int nStrips,
200  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
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],
205  int stripType);
206  bool preTrigger(
207  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
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],
211  int keystrip_data[CSCConstants::NUM_HALF_STRIPS][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],
220  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
221  bool preTrigger(
222  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
223  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
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],
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],
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],
238  const unsigned int d_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
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]);
247  bool preTrigger(
248  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
249  const int start_bx, int& first_bx);
250  bool ptnFinding(
251  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
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]);
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]);
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],
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]);
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
std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], int stripType)
static const int cfeb_strips[2]
int first_bx_corrected[CSCConstants::NUM_HALF_STRIPS]
void getKeyStripData(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], int keystrip_data[CSCConstants::NUM_HALF_STRIPS][7], int nStrips, int first_bx, int &best_strip, int stripType)
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::NUM_HALF_STRIPS])
void readComparatorDigis(std::vector< int >halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], std::vector< int > distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS])
int findNumLayersHit(std::vector< int > stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS])
void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], int keyStrip[MAX_CFEBS], unsigned int nhits[MAX_CFEBS], const int stripType, const int nStrips, const int bx_time)
static const unsigned int def_min_separation
std::vector< CSCCLCTDigi > findLCTsSLHC(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS])
CSCCLCTDigi bestCLCT[MAX_CLCT_BINS]
static const unsigned int def_nplanes_hit_pretrig
static const unsigned int def_pid_thresh_pretrig
static void distripStagger(int stag_triad[CSCConstants::MAX_NUM_STRIPS], int stag_time[CSCConstants::MAX_NUM_STRIPS], int stag_digi[CSCConstants::MAX_NUM_STRIPS], int i_distrip, bool debug=false)
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
tuple conf
Definition: dbtoconf.py:185
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], const int stripType, const int nStrips) const
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])
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], const int nStrips, unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS])
#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
int stagger[CSCConstants::NUM_LAYERS]
unsigned int best_pid[CSCConstants::NUM_HALF_STRIPS]
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc)
static const int pattern2007_offset[NUM_PATTERN_HALFSTRIPS]
bool hitIsGood(int hitTime, int BX)
unsigned int nhits[CSCConstants::NUM_HALF_STRIPS]
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
static const int pre_hit_pattern[2][NUM_PATTERN_STRIPS]
bool ptnFinding(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], const int nStrips, const unsigned int bx_time)
std::vector< CSCCLCTDigi > getCLCTs()
void setConfigParameters(const CSCDBL1TPParameters *conf)
bool ispretrig[CSCConstants::NUM_HALF_STRIPS]
bool preTrigger(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], const int stripType, const int nStrips, int &first_bx)
bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS], const int stripType, const int nStrips, const unsigned int bx_time)