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,
53 
55  ~CSCCathodeLCTProcessor() override = default;
56 
58  void setConfigParameters(const CSCDBL1TPParameters* conf);
59 
61  void clear();
62 
65  std::vector<CSCCLCTDigi> run(const CSCComparatorDigiCollection* compdc,
66  const CSCChamber* chamber,
67  const CSCL1TPLookupTableCCLUT* lookupTable);
68 
71  void run(const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER],
72  const CSCL1TPLookupTableCCLUT* lookupTable);
73 
75  std::vector<CSCCLCTDigi> readoutCLCTs() const;
76 
78  std::vector<CSCCLCTDigi> getCLCTs() const;
79 
82  CSCCLCTDigi getBestCLCT(int bx) const;
83  CSCCLCTDigi getSecondCLCT(int bx) const;
84 
85  /* get the flag of local shower around best CLCT at bx */
86  bool getLocalShowerFlag(int bx) const;
87 
88  std::vector<int> preTriggerBXs() const { return thePreTriggerBXs; }
89 
91  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigis() const { return thePreTriggerDigis; }
92 
93  /* get special bits for high multiplicity triggers */
94  //unsigned getInTimeHMT() const { return inTimeHMT_; }
95  //unsigned getOutTimeHMT() const { return outTimeHMT_; }
96  /* get array of high multiplicity triggers */
97  std::vector<CSCShowerDigi> getAllShower() const;
98 
100  std::vector<CSCShowerDigi> readoutShower() const;
101 
102 protected:
105 
108 
110  //CSCShowerDigi shower_;
111 
112  /* flag of shower around best CLCT in each BX */
114 
116  bool getDigis(const CSCComparatorDigiCollection* compdc);
117  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
118 
121 
123  void checkConfigParameters();
124 
125  //---------------- Methods common to all firmware versions ------------------
126  // Single-argument version for TMB07 (halfstrip-only) firmware.
127  // Takes the comparator & time info and stuffs it into halfstrip vector.
128  // Multiple hits on the same strip are allowed.
129  void readComparatorDigis(
131  void pulseExtension(
133 
134  //--------------- Functions for post-2007 version of the firmware -----------
135  virtual std::vector<CSCCLCTDigi> findLCTs(
137  const CSCL1TPLookupTableCCLUT* lookupTable);
138 
139  /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern
140  Returns true if a pretrigger was found, and the first BX of the pretrigger */
141  virtual bool preTrigger(const int start_bx, int& first_bx);
142 
143  /* For a given clock cycle, check each half-strip if a pattern matches
144  This function determines best_pid_ and nhits_ for each half-strip */
145  bool patternFinding(const unsigned int bx_time,
146  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> >& hits_in_patterns);
147 
148  void cleanComparatorContainer(CSCCLCTDigi& lct) const;
149 
150  /* Mark the half-strips around the best half-strip as busy */
151  void markBusyKeys(const int best_hstrip,
152  const int best_patid,
154 
155  // build a new CLCT trigger
156  CSCCLCTDigi constructCLCT(const int bx,
157  const unsigned halfstrip_withstagger,
159  const CSCL1TPLookupTableCCLUT* lookupTable);
160 
161  // build a new CLCT pretrigger
162  CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const;
163 
164  // resets ispretrig_
165  void clearPreTriggers();
166  //--------------------------- Auxiliary methods -----------------------------
168  void dumpConfigParams() const;
169 
171  void dumpDigis(
172  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const;
173 
174  /* check whether there is a shower around best CLCT */
175  void checkLocalShower(
176  int zone,
178 
180 
181  //--------------------------- Member variables -----------------------------
182 
184 
185  /* best pattern Id for a given half-strip */
187 
188  /* number of layers hit on a given half-strip */
190 
191  /* does a given half-strip have a pre-trigger? */
193 
194  // actual LUT used
196 
197  /* number of strips used in this processor */
201 
202  /* Is the layer in the chamber staggered? */
204 
205  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
206  std::vector<int> thePreTriggerBXs;
207  std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
208 
209  /* data members for high multiplicity triggers */
210  std::vector<unsigned> thresholds_;
211  unsigned showerNumTBins_;
213  unsigned minbx_readout_;
214  unsigned maxbx_readout_;
217 
219  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
220  unsigned int hit_persist, drift_delay;
223  unsigned int tmb_l1a_window_size;
224 
227 
228  /* define the region around best CLCT to check local shower */
230 
231  /* threshold of total hits for local shower */
233 
236 
239 
241  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
242  static const unsigned int def_hit_persist, def_drift_delay;
243  static const unsigned int def_nplanes_hit_pretrig;
244  static const unsigned int def_nplanes_hit_pattern;
245  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
246  static const unsigned int def_tmb_l1a_window_size;
247 
248  /* quality control */
249  std::unique_ptr<LCTQualityControl> qualityControl_;
250 
251  /* comparator-code lookup table algorithm */
252  std::unique_ptr<ComparatorCodeLUT> cclut_;
253 };
254 
255 #endif
std::unique_ptr< ComparatorCodeLUT > cclut_
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
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)
virtual std::vector< CSCCLCTDigi > findLCTs(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER], const CSCL1TPLookupTableCCLUT *lookupTable)
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
CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, CSCBaseboard::Parameters &conf)
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 constructCLCT(const int bx, const unsigned halfstrip_withstagger, const CSCCLCTDigi::ComparatorContainer &hits, const CSCL1TPLookupTableCCLUT *lookupTable)
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
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, const CSCChamber *chamber, const CSCL1TPLookupTableCCLUT *lookupTable)
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])
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_