CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  std::vector<int> preTriggerBXs() const { return thePreTriggerBXs; }
85 
87  std::vector<CSCCLCTPreTriggerDigi> preTriggerDigis() const { return thePreTriggerDigis; }
88 
89  /* get special bits for high multiplicity triggers */
90  unsigned getInTimeHMT() const { return inTimeHMT_; }
91  unsigned getOutTimeHMT() const { return outTimeHMT_; }
92 
95 
96 protected:
99 
102 
104 
106  bool getDigis(const CSCComparatorDigiCollection* compdc);
107  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
108 
111 
113  void checkConfigParameters();
114 
115  //---------------- Methods common to all firmware versions ------------------
116  // Single-argument version for TMB07 (halfstrip-only) firmware.
117  // Takes the comparator & time info and stuffs it into halfstrip vector.
118  // Multiple hits on the same strip are allowed.
119  void readComparatorDigis(
120  std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
121  void pulseExtension(
122  const std::vector<int> time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
123 
124  //--------------- Functions for post-2007 version of the firmware -----------
125  virtual std::vector<CSCCLCTDigi> findLCTs(
126  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
127 
128  /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern
129  Returns true if a pretrigger was found, and the first BX of the pretrigger */
130  virtual bool preTrigger(const int start_bx, int& first_bx);
131 
132  /* For a given clock cycle, check each half-strip if a pattern matches
133  This function determines best_pid_ and nhits_ for each half-strip */
134  bool patternFinding(const unsigned int bx_time,
135  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> >& hits_in_patterns);
136 
137  void cleanComparatorContainer(CSCCLCTDigi& lct) const;
138 
139  /* Mark the half-strips around the best half-strip as busy */
140  void markBusyKeys(const int best_hstrip,
141  const int best_patid,
142  int quality[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
143 
144  // build a new CLCT trigger
145  CSCCLCTDigi constructCLCT(const int bx,
146  const unsigned halfstrip_withstagger,
148 
149  // build a new CLCT pretrigger
150  CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const;
151 
152  // resets ispretrig_
153  void clearPreTriggers();
154  //--------------------------- Auxiliary methods -----------------------------
156  void dumpConfigParams() const;
157 
159  void dumpDigis(
160  const std::vector<int> strip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const;
161 
162  //--------------------------- Member variables -----------------------------
163 
165 
166  /* best pattern Id for a given half-strip */
168 
169  /* number of layers hit on a given half-strip */
171 
172  /* does a given half-strip have a pre-trigger? */
174 
175  // actual LUT used
177 
178  /* number of strips used in this processor */
182 
183  /* Is the layer in the chamber staggered? */
185 
186  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
187  std::vector<int> thePreTriggerBXs;
188  std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
189 
190  /* data members for high multiplicity triggers */
192  const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]);
193  unsigned inTimeHMT_;
194  unsigned outTimeHMT_;
195  std::vector<unsigned> thresholds_;
201 
203  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
204  unsigned int hit_persist, drift_delay;
207  unsigned int tmb_l1a_window_size;
208 
211 
214 
217 
219  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
220  static const unsigned int def_hit_persist, def_drift_delay;
221  static const unsigned int def_nplanes_hit_pretrig;
222  static const unsigned int def_nplanes_hit_pattern;
223  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
224  static const unsigned int def_tmb_l1a_window_size;
225 
226  /* quality control */
227  std::unique_ptr<LCTQualityControl> qualityControl_;
228 
229  /* comparator-code lookup table algorithm */
230  std::unique_ptr<ComparatorCodeLUT> cclut_;
231 };
232 
233 #endif
std::unique_ptr< ComparatorCodeLUT > cclut_
void setESLookupTables(const CSCL1TPLookupTableCCLUT *conf)
static const unsigned int def_drift_delay
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) const
CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]
std::vector< CSCCLCTDigi > readoutCLCTs() const
static const unsigned int def_fifo_tbins
CSCCathodeLCTProcessor(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
uint32_t const *__restrict__ Quality * quality
CSCShowerDigi readoutShower() const
void pulseExtension(const std::vector< int > time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
std::vector< LCTPattern > LCTPatterns
unsigned getOutTimeHMT() const
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)
std::unique_ptr< LCTQualityControl > qualityControl_
static const unsigned int def_nplanes_hit_pretrig
static const unsigned int def_pid_thresh_pretrig
std::vector< std::vector< uint16_t > > ComparatorContainer
Definition: CSCCLCTDigi.h:19
unsigned int nhits[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
~CSCCathodeLCTProcessor() override=default
CSCCLCTDigi getSecondCLCT(int bx) const
static const unsigned int def_tmb_l1a_window_size
bool getDigis(const CSCComparatorDigiCollection *compdc)
static const unsigned int def_nplanes_hit_pattern
CSCCLCTDigi getBestCLCT(int bx) const
CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const
std::vector< CSCCLCTPreTriggerDigi > thePreTriggerDigis
unsigned getInTimeHMT() const
std::vector< CSCCLCTDigi > getCLCTs() const
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])
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]
void cleanComparatorContainer(CSCCLCTDigi &lct) const
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)
void encodeHighMultiplicityBits(const std::vector< int > halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER])
std::vector< CSCCLCTPreTriggerDigi > preTriggerDigis() const
bool ispretrig_[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
void setConfigParameters(const CSCDBL1TPParameters *conf)
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
std::vector< unsigned > thresholds_