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 
39 
40 #include <vector>
41 
42 class CSCGeometry;
43 
45 {
46  public:
48  CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector,
49  unsigned subsector, unsigned chamber,
50  const edm::ParameterSet& conf,
51  const edm::ParameterSet& comm,
52  const edm::ParameterSet& ctmb);
53 
56 
58  void setConfigParameters(const CSCDBL1TPParameters* conf);
59 
61  void clear();
62 
63  void setCSCGeometry(const CSCGeometry *g) { csc_g = g; }
64 
67  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
68 
71  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
72  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
73 
75  bool getDigis(const CSCComparatorDigiCollection* compdc);
76  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
77 
80 
83 
85  std::vector<CSCCLCTDigi> readoutCLCTs();
86 
88  std::vector<CSCCLCTDigi> getCLCTs();
89 
90  std::vector<int> preTriggerBXs() const {return thePreTriggerBXs;}
91 
92  static void distripStagger(int stag_triad[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
93  int stag_time[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
94  int stag_digi[CSCConstants::MAX_NUM_STRIPS_7CFEBS],
95  int i_distrip, bool debug = false);
96 
100  void setRing(unsigned r) {theRing = r;}
101 
105 
108 
109  // we use these next ones to address the various bits inside the array that's
110  // used to make the cathode LCTs.
119 
120  private:
125  int infoV;
126 
128  const unsigned theEndcap;
129  const unsigned theStation;
130  const unsigned theSector;
131  const unsigned theSubsector;
132  const unsigned theTrigChamber;
133 
135 
136  // holders for easy access:
137  unsigned int theRing;
138  unsigned int theChamber;
139  bool isME11;
140 
143 
144  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
145  std::vector<int> thePreTriggerBXs;
146 
148  bool isMTCC;
149 
151  bool isTMB07;
152 
154  bool isSLHC;
155 
157  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
158  unsigned int hit_persist, drift_delay;
161  unsigned int tmb_l1a_window_size;
162 
165 
168 
171 
174  unsigned int clct_state_machine_zone; // +- around a keystrip
175  bool dynamic_state_machine_zone; //use a pattern dependent zone
176 
178  unsigned int pretrig_trig_zone;
179 
182 
185 
187  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
188  static const unsigned int def_hit_persist, def_drift_delay;
189  static const unsigned int def_nplanes_hit_pretrig;
190  static const unsigned int def_nplanes_hit_pattern;
191  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
192  static const unsigned int def_tmb_l1a_window_size;
193 
196 
198  void checkConfigParameters();
199 
201  static const int cfeb_strips[2];
202 
203  //---------------- Methods common to all firmware versions ------------------
204  void readComparatorDigis(std::vector<int>halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
205  std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
206  void readComparatorDigis(std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
207  void pulseExtension(
208  const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
209  const int nStrips,
210  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
211 
212  //------------- Functions for idealized version for MC studies --------------
213  std::vector<CSCCLCTDigi> findLCTs(
214  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
215  int stripType);
216  bool preTrigger(
217  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
218  const int stripType, const int nStrips, int& first_bx);
219  void getKeyStripData(
220  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
221  int keystrip_data[CSCConstants::NUM_HALF_STRIPS_7CFEBS][7],
222  int nStrips, int first_bx, int& best_strip, int stripType);
223  void getPattern(int pattern_num, int strip_value[CSCConstants::MAX_STRIPS_IN_PATTERN],
224  int bx_time, int &quality, int &bend);
225  bool hitIsGood(int hitTime, int BX);
226 
227  //-------------------- Functions for pre-2007 firmware ----------------------
228  std::vector<CSCCLCTDigi> findLCTs(
229  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
230  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
231  bool preTrigger(
232  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
233  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
234  const int stripType, const int nStrips,
235  const int start_bx, int& first_bx);
236  bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
237  const int stripType, const int nStrips,
238  const unsigned int bx_time);
239  void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
240  int keyStrip[CSCConstants::MAX_CFEBS], unsigned int nhits[CSCConstants::MAX_CFEBS],
241  const int stripType, const int nStrips, const int bx_time);
242  void priorityEncode(const int h_keyStrip[CSCConstants::MAX_CFEBS],
243  const unsigned int h_nhits[CSCConstants::MAX_CFEBS],
244  const int d_keyStrip[CSCConstants::MAX_CFEBS],
245  const unsigned int d_nhits[CSCConstants::MAX_CFEBS],
246  int keystrip_data[2][7]);
247  void getKeyStripData(const unsigned int h_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
248  const unsigned int d_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
249  int keystrip_data[2][7], const int first_bx);
250  void getPattern(unsigned int pattern_num,
251  const int strip_value[CSCConstants::MAX_STRIPS_IN_PATTERN],
252  unsigned int& quality, unsigned int& bend);
253 
254  //--------------- Functions for 2007 version of the firmware ----------------
255  std::vector<CSCCLCTDigi> findLCTs(
256  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
257  bool preTrigger(
258  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
259  const int start_bx, int& first_bx);
260  bool ptnFinding(
261  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
262  const int nStrips, const unsigned int bx_time);
263  void markBusyKeys(const int best_hstrip, const int best_patid,
264  int quality[CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
265 
269 
270  //--------------- Functions for SLHC studies ----------------
271 
272  std::vector<CSCCLCTDigi> findLCTsSLHC(
273  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
274 
276 
277  //--------------------------- Auxiliary methods -----------------------------
279  void dumpConfigParams() const;
280 
282  void dumpDigis(
283  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS],
284  const int stripType, const int nStrips) const;
285 
286  //--------------------------- Methods for tests -----------------------------
287  void testDistripStagger();
288  void testLCTs();
289  void printPatterns();
290  void testPatterns();
291  int findNumLayersHit(std::vector<int> stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
292 };
293 
294 #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)
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< CSCCLCTDigi > getCLCTs()
void setConfigParameters(const CSCDBL1TPParameters *conf)