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 
40 
41 #include <vector>
42 
43 class CSCGeometry;
44 
46 {
47  public:
49  CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector,
50  unsigned subsector, unsigned chamber,
51  const edm::ParameterSet& conf,
52  const edm::ParameterSet& comm,
53  const edm::ParameterSet& ctmb);
54 
57 
59  void setConfigParameters(const CSCDBL1TPParameters* conf);
60 
62  void clear();
63 
64  void setCSCGeometry(const CSCGeometry *g) { csc_g = g; }
65 
68  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
69 
72  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
73  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
74 
76  bool getDigis(const CSCComparatorDigiCollection* compdc);
77  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
78 
81 
84 
86  std::vector<CSCCLCTDigi> readoutCLCTs();
87 
89  std::vector<CSCCLCTDigi> getCLCTs();
90 
91  std::vector<int> preTriggerBXs() const {return thePreTriggerBXs;}
92 
93  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigis() const {return thePreTriggerDigis; }
94 
95  static void distripStagger(int stag_triad[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
96  int stag_time[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
97  int stag_digi[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
98  int i_distrip, bool debug = false);
99 
103  void setRing(unsigned r) {theRing = r;}
104 
108 
111 
112  // we use these next ones to address the various bits inside the array that's
113  // used to make the cathode LCTs.
122 
123  private:
128  int infoV;
129 
131  const unsigned theEndcap;
132  const unsigned theStation;
133  const unsigned theSector;
134  const unsigned theSubsector;
135  const unsigned theTrigChamber;
136 
138 
139  // holders for easy access:
140  unsigned int theRing;
141  unsigned int theChamber;
142  bool isME11;
143 
146 
147  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
148  std::vector<int> thePreTriggerBXs;
149  std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
150 
152  bool isMTCC;
153 
155  bool isTMB07;
156 
158  bool isSLHC;
159 
161  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
162  unsigned int hit_persist, drift_delay;
165  unsigned int tmb_l1a_window_size;
166 
169 
172 
175 
178  unsigned int clct_state_machine_zone; // +- around a keystrip
179  bool dynamic_state_machine_zone; //use a pattern dependent zone
180 
182  unsigned int pretrig_trig_zone;
183 
186 
189 
191  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
192  static const unsigned int def_hit_persist, def_drift_delay;
193  static const unsigned int def_nplanes_hit_pretrig;
194  static const unsigned int def_nplanes_hit_pattern;
195  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
196  static const unsigned int def_tmb_l1a_window_size;
197 
200 
202  void checkConfigParameters();
203 
205  static const int cfeb_strips[2];
206 
207  //---------------- Methods common to all firmware versions ------------------
208  void readComparatorDigis(std::vector<int>halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
209  std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
210  void readComparatorDigis(std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
211  void pulseExtension(
212  const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
213  const int nStrips,
214  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
215 
216  //------------- Functions for idealized version for MC studies --------------
217  std::vector<CSCCLCTDigi> findLCTs(
218  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
219  int stripType);
220  bool preTrigger(
221  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
222  const int stripType, const int nStrips, int& first_bx);
223  void getKeyStripData(
224  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
225  int keystrip_data[CSCConstants::NUM_HALF_STRIPS_7CFEBS][7],
226  int nStrips, int first_bx, int& best_strip, int stripType);
227  void getPattern(int pattern_num, int strip_value[CSCConstants::MAX_STRIPS_IN_PATTERN],
228  int bx_time, int &quality, int &bend);
229  bool hitIsGood(int hitTime, int BX);
230 
231  //-------------------- Functions for pre-2007 firmware ----------------------
232  std::vector<CSCCLCTDigi> findLCTs(
233  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
234  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
235  bool preTrigger(
236  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
237  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
238  const int stripType, const int nStrips,
239  const int start_bx, int& first_bx);
240  bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
241  const int stripType, const int nStrips,
242  const unsigned int bx_time);
243  void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
244  int keyStrip[CSCConstants::MAX_CFEBS], unsigned int nhits[CSCConstants::MAX_CFEBS],
245  const int stripType, const int nStrips, const int bx_time);
246  void priorityEncode(const int h_keyStrip[CSCConstants::MAX_CFEBS],
247  const unsigned int h_nhits[CSCConstants::MAX_CFEBS],
248  const int d_keyStrip[CSCConstants::MAX_CFEBS],
249  const unsigned int d_nhits[CSCConstants::MAX_CFEBS],
250  int keystrip_data[2][7]);
251  void getKeyStripData(const unsigned int h_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
252  const unsigned int d_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
253  int keystrip_data[2][7], const int first_bx);
254  void getPattern(unsigned int pattern_num,
255  const int strip_value[CSCConstants::MAX_STRIPS_IN_PATTERN],
256  unsigned int& quality, unsigned int& bend);
257 
258  //--------------- Functions for 2007 version of the firmware ----------------
259  std::vector<CSCCLCTDigi> findLCTs(
260  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
261  bool preTrigger(
262  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
263  const int start_bx, int& first_bx);
264  bool ptnFinding(
265  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
266  const int nStrips, const unsigned int bx_time);
267  void markBusyKeys(const int best_hstrip, const int best_patid,
268  int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
269 
273 
274  //--------------- Functions for SLHC studies ----------------
275 
276  std::vector<CSCCLCTDigi> findLCTsSLHC(
277  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
278 
280 
281  //--------------------------- Auxiliary methods -----------------------------
283  void dumpConfigParams() const;
284 
286  void dumpDigis(
287  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
288  const int stripType, const int nStrips) const;
289 
290  //--------------------------- Methods for tests -----------------------------
291  void testDistripStagger();
292  void testLCTs();
293  void printPatterns();
294  void testPatterns();
295  int findNumLayersHit(std::vector<int> stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
296 };
297 
298 #endif
static const unsigned int def_drift_delay
static const int pattern[CSCConstants::NUM_CLCT_PATTERNS_PRE_TMB07][CSCConstants::MAX_STRIPS_IN_PATTERN+1]
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
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 int pattern2007_offset[CSCConstants::MAX_HALFSTRIPS_IN_PATTERN]
static const unsigned int def_min_separation
static const unsigned int def_nplanes_hit_pretrig
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
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[CSCConstants::MAX_CFEBS], unsigned int nhits[CSCConstants::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][CSCConstants::MAX_HALFSTRIPS_IN_PATTERN+2]
static const unsigned int def_tmb_l1a_window_size
void setCSCGeometry(const CSCGeometry *g)
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)
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
void getPattern(int pattern_num, int strip_value[CSCConstants::MAX_STRIPS_IN_PATTERN], int bx_time, int &quality, int &bend)
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[CSCConstants::MAX_CFEBS], const unsigned int h_nhits[CSCConstants::MAX_CFEBS], const int d_keyStrip[CSCConstants::MAX_CFEBS], const unsigned int d_nhits[CSCConstants::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)
int findNumLayersHit(std::vector< int > stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
bool hitIsGood(int hitTime, int BX)
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
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])
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)
static const int pre_hit_pattern[2][CSCConstants::MAX_STRIPS_IN_PATTERN]
std::vector< CSCCLCTDigi > findLCTsSLHC(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigis() const
std::vector< CSCCLCTDigi > getCLCTs()
void setConfigParameters(const CSCDBL1TPParameters *conf)