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  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  /* get array of high multiplicity triggers */
93  std::vector<CSCShowerDigi> getAllShower() const;
94 
96  std::vector<CSCShowerDigi> readoutShower() const;
97 
98 protected:
101 
104 
106  //CSCShowerDigi shower_;
107 
109  bool getDigis(const CSCComparatorDigiCollection* compdc);
110  void getDigis(const CSCComparatorDigiCollection* compdc, const CSCDetId& id);
111 
114 
116  void checkConfigParameters();
117 
118  //---------------- Methods common to all firmware versions ------------------
119  // Single-argument version for TMB07 (halfstrip-only) firmware.
120  // Takes the comparator & time info and stuffs it into halfstrip vector.
121  // Multiple hits on the same strip are allowed.
122  void readComparatorDigis(
124  void pulseExtension(
126 
127  //--------------- Functions for post-2007 version of the firmware -----------
128  virtual std::vector<CSCCLCTDigi> findLCTs(
130 
131  /* Check all half-strip pattern envelopes simultaneously, on every clock cycle, for a matching pattern
132  Returns true if a pretrigger was found, and the first BX of the pretrigger */
133  virtual bool preTrigger(const int start_bx, int& first_bx);
134 
135  /* For a given clock cycle, check each half-strip if a pattern matches
136  This function determines best_pid_ and nhits_ for each half-strip */
137  bool patternFinding(const unsigned int bx_time,
138  std::map<int, std::map<int, CSCCLCTDigi::ComparatorContainer> >& hits_in_patterns);
139 
140  void cleanComparatorContainer(CSCCLCTDigi& lct) const;
141 
142  /* Mark the half-strips around the best half-strip as busy */
143  void markBusyKeys(const int best_hstrip,
144  const int best_patid,
146 
147  // build a new CLCT trigger
148  CSCCLCTDigi constructCLCT(const int bx,
149  const unsigned halfstrip_withstagger,
151 
152  // build a new CLCT pretrigger
153  CSCCLCTPreTriggerDigi constructPreCLCT(const int bx, const unsigned halfstrip, const unsigned index) const;
154 
155  // resets ispretrig_
156  void clearPreTriggers();
157  //--------------------------- Auxiliary methods -----------------------------
159  void dumpConfigParams() const;
160 
162  void dumpDigis(
164 
165  //--------------------------- Member variables -----------------------------
166 
168 
169  /* best pattern Id for a given half-strip */
171 
172  /* number of layers hit on a given half-strip */
174 
175  /* does a given half-strip have a pre-trigger? */
177 
178  // actual LUT used
180 
181  /* number of strips used in this processor */
185 
186  /* Is the layer in the chamber staggered? */
188 
189  std::vector<CSCComparatorDigi> digiV[CSCConstants::NUM_LAYERS];
190  std::vector<int> thePreTriggerBXs;
191  std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;
192 
193  /* data members for high multiplicity triggers */
195  std::vector<unsigned> thresholds_;
196  unsigned showerNumTBins_;
198  unsigned minbx_readout_;
199  unsigned maxbx_readout_;
202 
204  unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode.
205  unsigned int hit_persist, drift_delay;
208  unsigned int tmb_l1a_window_size;
209 
212 
215 
218 
220  static const unsigned int def_fifo_tbins, def_fifo_pretrig;
221  static const unsigned int def_hit_persist, def_drift_delay;
222  static const unsigned int def_nplanes_hit_pretrig;
223  static const unsigned int def_nplanes_hit_pattern;
224  static const unsigned int def_pid_thresh_pretrig, def_min_separation;
225  static const unsigned int def_tmb_l1a_window_size;
226 
227  /* quality control */
228  std::unique_ptr<LCTQualityControl> qualityControl_;
229 
230  /* comparator-code lookup table algorithm */
231  std::unique_ptr<ComparatorCodeLUT> cclut_;
232 };
233 
234 #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)
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
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
void dumpDigis(const std::vector< int > strip[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]) 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])
static const unsigned int def_fifo_pretrig
std::vector< int > thePreTriggerBXs
static const unsigned int def_hit_persist
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]
string quality
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)
unsigned int best_pid[CSCConstants::MAX_NUM_HALF_STRIPS_RUN2_TRIGGER]
std::vector< unsigned > thresholds_