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 
163  unsigned int alctClctOffset;
164 
166  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
167  unsigned int hit_persist, drift_delay;
170  unsigned int tmb_l1a_window_size;
171 
174 
177 
180 
183  unsigned int clct_state_machine_zone; // +- around a keystrip
184  bool dynamic_state_machine_zone; //use a pattern dependent zone
185 
187  unsigned int pretrig_trig_zone;
188 
191 
194 
196  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
197  static const unsigned int def_hit_persist, def_drift_delay;
198  static const unsigned int def_nplanes_hit_pretrig;
199  static const unsigned int def_nplanes_hit_pattern;
200  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
201  static const unsigned int def_tmb_l1a_window_size;
202 
205 
207  void checkConfigParameters();
208 
210  static const int cfeb_strips[2];
211 
212  //---------------- Methods common to all firmware versions ------------------
213  void readComparatorDigis(std::vector<int>halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
214  std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
215  void readComparatorDigis(std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
216  void pulseExtension(
217  const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
218  const int nStrips,
219  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
220 
221  //------------- Functions for idealized version for MC studies --------------
222  std::vector<CSCCLCTDigi> findLCTs(
223  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
224  int stripType);
225  bool preTrigger(
226  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
227  const int stripType, const int nStrips, int& first_bx);
228  void getKeyStripData(
229  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
230  int keystrip_data[CSCConstants::NUM_HALF_STRIPS_7CFEBS][7],
231  int nStrips, int first_bx, int& best_strip, int stripType);
232  void getPattern(int pattern_num, int strip_value[CSCConstants::MAX_STRIPS_IN_PATTERN],
233  int bx_time, int &quality, int &bend);
234  bool hitIsGood(int hitTime, int BX);
235 
236  //-------------------- Functions for pre-2007 firmware ----------------------
237  std::vector<CSCCLCTDigi> findLCTs(
238  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
239  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
240  bool preTrigger(
241  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
242  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
243  const int stripType, const int nStrips,
244  const int start_bx, int& first_bx);
245  bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
246  const int stripType, const int nStrips,
247  const unsigned int bx_time);
248  void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
249  int keyStrip[CSCConstants::MAX_CFEBS], unsigned int nhits[CSCConstants::MAX_CFEBS],
250  const int stripType, const int nStrips, const int bx_time);
251  void priorityEncode(const int h_keyStrip[CSCConstants::MAX_CFEBS],
252  const unsigned int h_nhits[CSCConstants::MAX_CFEBS],
253  const int d_keyStrip[CSCConstants::MAX_CFEBS],
254  const unsigned int d_nhits[CSCConstants::MAX_CFEBS],
255  int keystrip_data[2][7]);
256  void getKeyStripData(const unsigned int h_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
257  const unsigned int d_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
258  int keystrip_data[2][7], const int first_bx);
259  void getPattern(unsigned int pattern_num,
260  const int strip_value[CSCConstants::MAX_STRIPS_IN_PATTERN],
261  unsigned int& quality, unsigned int& bend);
262 
263  //--------------- Functions for 2007 version of the firmware ----------------
264  std::vector<CSCCLCTDigi> findLCTs(
265  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
266  bool preTrigger(
267  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
268  const int start_bx, int& first_bx);
269  bool ptnFinding(
270  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
271  const int nStrips, const unsigned int bx_time);
272  void markBusyKeys(const int best_hstrip, const int best_patid,
273  int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
274 
278 
279  //--------------- Functions for SLHC studies ----------------
280 
281  std::vector<CSCCLCTDigi> findLCTsSLHC(
282  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
283 
285 
286  //--------------------------- Auxiliary methods -----------------------------
288  void dumpConfigParams() const;
289 
291  void dumpDigis(
292  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
293  const int stripType, const int nStrips) const;
294 
295  //--------------------------- Methods for tests -----------------------------
296  void testDistripStagger();
297  void testLCTs();
298  void printPatterns();
299  void testPatterns();
300  int findNumLayersHit(std::vector<int> stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
301 };
302 
303 #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
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
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)