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 
41 
42 #include <vector>
43 
45 public:
48  unsigned station,
49  unsigned sector,
50  unsigned subsector,
51  unsigned chamber,
52  const edm::ParameterSet& conf);
53 
55  ~CSCCathodeLCTProcessor() override = default;
56 
58  void setConfigParameters(const CSCDBL1TPParameters* conf);
59 
61 
63  void clear();
64 
67  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc);
68 
71  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
72 
74  std::vector<CSCCLCTDigi> readoutCLCTs() const;
75 
77  std::vector<CSCCLCTDigi> getCLCTs() const;
78 
81  CSCCLCTDigi getBestCLCT(int bx) const;
82  CSCCLCTDigi getSecondCLCT(int bx) const;
83 
84  /* get the flag of local shower around best CLCT at bx */
85  bool getLocalShowerFlag(int bx) const;
86 
87  std::vector<int> preTriggerBXs() const { return thePreTriggerBXs; }
88 
90  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigis() const { return thePreTriggerDigis; }
91 
92  /* get special bits for high multiplicity triggers */
93  //unsigned getInTimeHMT() const { return inTimeHMT_; }
94  //unsigned getOutTimeHMT() const { return outTimeHMT_; }
95  /* get array of high multiplicity triggers */
96  std::vector<CSCShowerDigi> getAllShower() const;
97 
99  std::vector<CSCShowerDigi> readoutShower() const;
100 
101 protected:
104 
107 
109  //CSCShowerDigi shower_;
110 
111  /* flag of shower around best CLCT in each BX */
113 
115  bool getDigis(const CSCComparatorDigiCollection* compdc);
116  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
117 
120 
122  void checkConfigParameters();
123 
124  //---------------- Methods common to all firmware versions ------------------
125  // Single-argument version for TMB07 (halfstrip-only) firmware.
126  // Takes the comparator & time info and stuffs it into halfstrip vector.
127  // Multiple hits on the same strip are allowed.
128  void readComparatorDigis(
130  void pulseExtension(
132 
133  //--------------- Functions for post-2007 version of the firmware -----------
134  virtual std::vector<CSCCLCTDigi> findLCTs(
136 
137  /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern
138  Returns true if a pretrigger was found, and the first BX of the pretrigger */
139  virtual bool preTrigger(const int start_bx, int& first_bx);
140 
141  /* For a given clock cycle, check each half-strip if a pattern matches
142  This function determines best_pid_ and nhits_ for each half-strip */
143  bool patternFinding(const unsigned int bx_time,
144  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> >& hits_in_patterns);
145 
146  void cleanComparatorContainer(CSCCLCTDigi& lct) const;
147 
148  /* Mark the half-strips around the best half-strip as busy */
149  void markBusyKeys(const int best_hstrip,
150  const int best_patid,
152 
153  // build a new CLCT trigger
154  CSCCLCTDigi constructCLCT(const int bx,
155  const unsigned halfstrip_withstagger,
157 
158  // build a new CLCT pretrigger
159  CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const;
160 
161  // resets ispretrig_
162  void clearPreTriggers();
163  //--------------------------- Auxiliary methods -----------------------------
165  void dumpConfigParams() const;
166 
168  void dumpDigis(
169  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const;
170 
171  /* check whether there is a shower around best CLCT */
172  void checkLocalShower(
173  int zone,
175 
177 
178  //--------------------------- Member variables -----------------------------
179 
181 
182  /* best pattern Id for a given half-strip */
184 
185  /* number of layers hit on a given half-strip */
187 
188  /* does a given half-strip have a pre-trigger? */
190 
191  // actual LUT used
193 
194  /* number of strips used in this processor */
198 
199  /* Is the layer in the chamber staggered? */
201 
202  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
203  std::vector<int> thePreTriggerBXs;
204  std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
205 
206  /* data members for high multiplicity triggers */
207  std::vector<unsigned> thresholds_;
208  unsigned showerNumTBins_;
210  unsigned minbx_readout_;
211  unsigned maxbx_readout_;
214 
216  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
217  unsigned int hit_persist, drift_delay;
220  unsigned int tmb_l1a_window_size;
221 
224 
225  /* define the region around best CLCT to check local shower */
227 
228  /* threshold of total hits for local shower */
230 
233 
236 
238  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
239  static const unsigned int def_hit_persist, def_drift_delay;
240  static const unsigned int def_nplanes_hit_pretrig;
241  static const unsigned int def_nplanes_hit_pattern;
242  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
243  static const unsigned int def_tmb_l1a_window_size;
244 
245  /* quality control */
246  std::unique_ptr<LCTQualityControl> qualityControl_;
247 
248  /* comparator-code lookup table algorithm */
249  std::unique_ptr<ComparatorCodeLUT> cclut_;
250 };
251 
252 #endif
std::unique_ptr< ComparatorCodeLUT > cclut_
void setESLookupTables(const CSCL1TPLookupTableCCLUT *conf)
static const unsigned int def_drift_delay
std::vector< CSCCLCTDigi > readoutCLCTs() const
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
static const unsigned int def_fifo_tbins
CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
std::vector< int > preTriggerBXs() const
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
std::vector< LCTPattern > LCTPatterns
static const unsigned int def_min_separation
CSCPatternBank::LCTPatterns clct_pattern_
bool patternFinding(const unsigned int bx_time, std::map< int, std::map< int, CSCCLCTDigi::ComparatorContainer > > &hits_in_patterns)
bool getLocalShowerFlag(int bx) const
std::unique_ptr< LCTQualityControl > qualityControl_
static const unsigned int def_nplanes_hit_pretrig
CSCShowerDigi cathode_showers_[CSCConstants::MAX_CLCT_TBINS]
std::vector< CSCShowerDigi > readoutShower() const
void cleanComparatorContainer(CSCCLCTDigi &lct) const
static const unsigned int def_pid_thresh_pretrig
string quality
std::vector< std::vector< uint16_t > > ComparatorContainer
Definition: CSCCLCTDigi.h:19
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
~CSCCathodeLCTProcessor() override=default
CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const
CSCCLCTDigi getSecondCLCT(int bx) const
std::vector< CSCCLCTDigi > getCLCTs() const
static const unsigned int def_tmb_l1a_window_size
bool getDigis(const CSCComparatorDigiCollection *compdc)
static const unsigned int def_nplanes_hit_pattern
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
void markBusyKeys(const int best_hstrip, const int best_patid, int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
static const unsigned int def_fifo_pretrig
bool localShowerFlag[CSCConstants::MAX_CLCT_TBINS]
std::vector< int > thePreTriggerBXs
static const unsigned int def_hit_persist
void dumpDigis(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const
CSCCLCTDigi getBestCLCT(int bx) const
int stagger[CSCConstants::NUM_LAYERS]
std::vector< CSCCLCTDigi > run(const CSCComparatorDigiCollection *compdc)
virtual bool preTrigger(const int start_bx, int &first_bx)
CSCCLCTDigi secondCLCT[CSCConstants::MAX_CLCT_TBINS]
std::vector< CSCComparatorDigi > digiV[CSCConstants::NUM_LAYERS]
void readComparatorDigis(std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
CSCCLCTDigi constructCLCT(const int bx, const unsigned halfstrip_withstagger, const CSCCLCTDigi::ComparatorContainer &hits)
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigis() const
std::vector< CSCShowerDigi > getAllShower() const
bool ispretrig_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
void setConfigParameters(const CSCDBL1TPParameters *conf)
void checkLocalShower(int zone, const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
std::vector< unsigned > thresholds_