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 
31 #include <vector>
37 
39 {
40  public:
42  CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector,
43  unsigned subsector, unsigned chamber,
44  const edm::ParameterSet& conf,
45  const edm::ParameterSet& comm);
46 
49 
51  void setConfigParameters(const CSCDBL1TPParameters* conf);
52 
54  void clear();
55 
58  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
59 
62  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
63  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
64 
66  bool getDigis(const CSCComparatorDigiCollection* compdc);
67  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
68 
70  enum {MAX_CLCT_BINS = 16};
71 
74 
77 
79  std::vector<CSCCLCTDigi> readoutCLCTs();
80 
82  std::vector<CSCCLCTDigi> getCLCTs();
83 
84  std::vector<int> preTriggerBXs() const {return thePreTriggerBXs;}
85 
86  static void distripStagger(int stag_triad[CSCConstants::MAX_NUM_STRIPS],
87  int stag_time[CSCConstants::MAX_NUM_STRIPS],
88  int stag_digi[CSCConstants::MAX_NUM_STRIPS],
89  int i_distrip, bool debug = false);
90 
92  enum {NUM_PATTERN_STRIPS = 26};
93  static const int pre_hit_pattern[2][NUM_PATTERN_STRIPS];
95 
99 
101  enum {MAX_CFEBS = 5};
102 
103  // we use these next ones to address the various bits inside the array that's
104  // used to make the cathode LCTs.
107 
108  private:
113  int infoV;
114 
116  const unsigned theEndcap;
117  const unsigned theStation;
118  const unsigned theSector;
119  const unsigned theSubsector;
120  const unsigned theTrigChamber;
121 
124 
125  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
126  std::vector<int> thePreTriggerBXs;
127 
129  bool isMTCC;
130 
132  bool isTMB07;
133 
135  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
136  unsigned int hit_persist, drift_delay;
139 
141  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
142  static const unsigned int def_hit_persist, def_drift_delay;
143  static const unsigned int def_nplanes_hit_pretrig;
144  static const unsigned int def_nplanes_hit_pattern;
145  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
146 
149 
151  void checkConfigParameters();
152 
154  static const int cfeb_strips[2];
155 
156  //---------------- Methods common to all firmware versions ------------------
157  void readComparatorDigis(std::vector<int>halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
158  std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
159  void readComparatorDigis(std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
160  void pulseExtension(
161  const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
162  const int nStrips,
163  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
164 
165  //------------- Functions for idealized version for MC studies --------------
166  std::vector<CSCCLCTDigi> findLCTs(
167  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
168  int stripType);
169  bool preTrigger(
170  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
171  const int stripType, const int nStrips, int& first_bx);
172  void getKeyStripData(
173  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
174  int keystrip_data[CSCConstants::NUM_HALF_STRIPS][7],
175  int nStrips, int first_bx, int& best_strip, int stripType);
176  void getPattern(int pattern_num, int strip_value[NUM_PATTERN_STRIPS],
177  int bx_time, int &quality, int &bend);
178  bool hitIsGood(int hitTime, int BX);
179 
180  //-------------------- Functions for pre-2007 firmware ----------------------
181  std::vector<CSCCLCTDigi> findLCTs(
182  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
183  const std::vector<int> distrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
184  bool preTrigger(
185  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
186  unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
187  const int stripType, const int nStrips,
188  const int start_bx, int& first_bx);
189  bool preTrigLookUp(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
190  const int stripType, const int nStrips,
191  const unsigned int bx_time);
192  void latchLCTs(const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
193  int keyStrip[MAX_CFEBS], unsigned int nhits[MAX_CFEBS],
194  const int stripType, const int nStrips, const int bx_time);
195  void priorityEncode(const int h_keyStrip[MAX_CFEBS],
196  const unsigned int h_nhits[MAX_CFEBS],
197  const int d_keyStrip[MAX_CFEBS],
198  const unsigned int d_nhits[MAX_CFEBS],
199  int keystrip_data[2][7]);
200  void getKeyStripData(const unsigned int h_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
201  const unsigned int d_pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
202  int keystrip_data[2][7], const int first_bx);
203  void getPattern(unsigned int pattern_num,
204  const int strip_value[NUM_PATTERN_STRIPS],
205  unsigned int& quality, unsigned int& bend);
206 
207  //--------------- Functions for 2007 version of the firmware ----------------
208  std::vector<CSCCLCTDigi> findLCTs(
209  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
210  bool preTrigger(
211  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
212  const int start_bx, int& first_bx);
213  bool ptnFinding(
214  const unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
215  const int nStrips, const unsigned int bx_time);
216  void markBusyKeys(const int best_hstrip, const int best_patid,
217  int quality[CSCConstants::NUM_HALF_STRIPS]);
218 
221 
222  //--------------------------- Auxiliary methods -----------------------------
224  void dumpConfigParams() const;
225 
227  void dumpDigis(
228  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS],
229  const int stripType, const int nStrips) const;
230 
231  //--------------------------- Methods for tests -----------------------------
232  void testDistripStagger();
233  void testLCTs();
234  void printPatterns();
235  void testPatterns();
236  int findNumLayersHit(std::vector<int> stripsHit[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS]);
237 };
238 
239 #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]
static const int pattern2007[CSCConstants::NUM_CLCT_PATTERNS][NUM_PATTERN_HALFSTRIPS+1]
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)
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
static const int cfeb_strips[2]
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
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 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])
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]
#define debug
Definition: MEtoEDMFormat.h:34
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 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)