CMS 3D CMS Logo

CSCMotherboard.h
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_CSCMotherboard_h
2 #define L1Trigger_CSCTriggerPrimitives_CSCMotherboard_h
3 
49 
50 class CSCMotherboard : public CSCBaseboard {
51 public:
53  CSCMotherboard(unsigned endcap,
54  unsigned station,
55  unsigned sector,
56  unsigned subsector,
57  unsigned chamber,
59 
61  ~CSCMotherboard() override = default;
62 
63  struct RunContext {
65  // access to lookup tables via eventsetup
71  };
72 
75  void run(const CSCWireDigiCollection* wiredc, const CSCComparatorDigiCollection* compdc, const RunContext&);
76 
77  /*
78  Returns vector of good correlated LCTs in the read-out time window.
79  LCTs in the BX window [early_tbins,...,late_tbins] are considered
80  good for physics. The central LCT BX is time bin 8.
81  - tmb_l1a_window_size = 7 (Run-1, Run-2) -> [5, 6, 7, 8, 9, 10, 11]
82  - tmb_l1a_window_size = 5 (Run-3) -> [6, 7, 8, 9, 10]
83  - tmb_l1a_window_size = 3 (Run-4?) -> [7, 8, 9]
84 
85  Note, this function does not have an exact counterpart in the
86  firmware. The reason is that the DAQ of LCTs is not correctly
87  simulated in CMSSW - at least the simulation of the L1-accept.
88  So, this function corresponds to both the trigger path and the
89  DAQ path in the firmware. In general, the function will return
90  LCTs that would not be used in the OMTF or EMTF emulator,
91  because they are out-of-time relative for tracking purposes. For
92  instance an LCT with BX5 would be read out by the DAQ, but would
93  likely not be used by the EMTF.
94  */
95  virtual std::vector<CSCCorrelatedLCTDigi> readoutLCTs() const;
96 
97  // LCT selection: at most 2 in each BX
98  void selectLCTs();
99 
101  std::vector<CSCShowerDigi> readoutShower() const;
102 
104  std::unique_ptr<CSCAnodeLCTProcessor> alctProc;
105 
107  std::unique_ptr<CSCCathodeLCTProcessor> clctProc;
108 
109  // VK: change to protected, to allow inheritance
110 protected:
111  std::tuple<std::vector<CSCALCTDigi>, std::vector<CSCCLCTDigi>> runCommon(const CSCWireDigiCollection* wiredc,
112  const CSCComparatorDigiCollection* compdc,
113  const RunContext& context);
114 
115  // helper function to return ALCT/CLCT with correct central BX
118 
120  unsigned int match_trig_window_size() const { return match_trig_window_size_; }
121  unsigned int match_trig_enable() const { return match_trig_enable_; }
122 
123  int preferred_bx_match(unsigned int index) const { return preferred_bx_match_[index]; }
124  bool sort_clct_bx() const { return sort_clct_bx_; }
125 
126  /*sort CLCT by quality+bending and if CLCTs from different BX have
127  same quality+bending, then rank CLCT by timing
128  */
129  void sortCLCTByQualBend(int alct_bx, std::vector<unsigned>& clctBxVector);
130 
131  bool doesALCTCrossCLCT(const CSCALCTDigi&, const CSCCLCTDigi&) const;
132 
133  // CLCT pattern number: encodes the pattern number itself
134  unsigned int encodePattern(const int clctPattern) const;
135 
138 
139  /* quality assignment */
140  std::unique_ptr<LCTQualityAssignment> qualityAssignment_;
141 
142 private:
145  void clear();
146 
148  void checkConfigParameters();
149 
150  /*
151  For valid ALCTs in the trigger time window, look for CLCTs within the
152  match-time window. Valid CLCTs are matched in-time. If a match was found
153  for the best ALCT and best CLCT, also the second best ALCT and second
154  best CLCT are sent to a correlation function "correlateLCTs" that will
155  make the best-best pair and second-second pair (if applicable).
156  */
157  void matchALCTCLCT();
158 
159  /*
160  This function matches maximum two ALCTs with maximum two CLCTs in
161  a bunch crossing. The best ALCT is considered the one with the highest
162  quality in a BX. Similarly for the best CLCT. If there is just one
163  ALCT and just one CLCT, the correlated LCT is made from those two
164  components. If there are exactly two ALCTs and two CLCTs, the best
165  LCT and second best LCT are formed from the best ALCT-CLCT combination
166  and the second best ALCT-CLCT combination. In case there is missing
167  information (e.g. second best ALCT, but no second best CLCT), information
168  is copied over.
169  */
170  void correlateLCTs(const CSCALCTDigi& bestALCT,
171  const CSCALCTDigi& secondALCT,
172  const CSCCLCTDigi& bestCLCT,
173  const CSCCLCTDigi& secondCLCT,
174  CSCCorrelatedLCTDigi& bLCT,
175  CSCCorrelatedLCTDigi& sLCT,
176  int type) const;
177 
178  /*
179  This method calculates all the TMB words and then passes them to the
180  constructor of correlated LCTs. The LCT data members are filled with
181  information from the ALCT-CLCT combination.
182  */
183  void constructLCTs(
184  const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT, int type, int trknmb, CSCCorrelatedLCTDigi& lct) const;
185 
186  /*
187  These functions copy valid ALCT/CLCT information to invalid the ALCT/CLCT
188  if present, so that we always construct the maximum number of valid LCTs
189  */
192 
194  void dumpConfigParams() const;
195 
196  /* match cathode shower and anode shower with and/or logic */
197  void matchShowers(CSCShowerDigi* anode_showers, CSCShowerDigi* cathode_showers, bool andlogic);
198 
199  /* encode high multiplicity bits for Run-3 exotic triggers */
201 
202  void setConfigParameters(const CSCDBL1TPParameters* conf);
203 
204  /* Container with sorted and selected LCTs */
205  std::vector<CSCCorrelatedLCTDigi> lctV;
206 
207  /*
208  Preferential index array in matching window, relative to the ALCT BX.
209  Where the central match BX goes first,
210  then the closest early, the closest late, etc.
211  */
212  std::vector<int> preferred_bx_match_;
213  // encode special bits for high-multiplicity triggers
214  std::vector<unsigned> showerSource_;
215 
216  /* quality control */
217  std::unique_ptr<LCTQualityControl> qualityControl_;
218 
219  /*
220  Helper class to check if an ALCT intersects with a CLCT. Normally
221  this class should not be used. It is left in the code as a potential
222  improvement for ME1/1 when unphysical LCTs are not desired. This
223  function is not implemented in the firmware.
224  */
225  std::unique_ptr<CSCALCTCrossCLCT> cscOverlap_;
226 
228 
229  unsigned int mpc_block_me1a_;
232 
235 
236  // encode special bits for high-multiplicity triggers
238 
239  unsigned minbx_readout_;
240  unsigned maxbx_readout_;
241 
244 
247 
248  // when set to true, ignore CLCTs found in later BX's
250 
252 
253  /* sort CLCT by bx if true, otherwise sort CLCT by quality+bending */
255 
257  static const unsigned int def_mpc_block_me1a;
258  static const unsigned int def_alct_trig_enable, def_clct_trig_enable;
260  static const unsigned int def_tmb_l1a_window_size;
261 };
262 #endif
LCTContainer allLCTs_
unsigned thisShowerSource_
virtual std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
unsigned maxbx_readout_
int preferred_bx_match(unsigned int index) const
unsigned int encodePattern(const int clctPattern) const
std::tuple< std::vector< CSCALCTDigi >, std::vector< CSCCLCTDigi > > runCommon(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const RunContext &context)
unsigned int tmb_l1a_window_size_
unsigned int alct_trig_enable_
static const unsigned int def_alct_trig_enable
CSCShowerDigi showers_[CSCConstants::MAX_LCT_TBINS]
static const unsigned int def_mpc_block_me1a
unsigned int match_trig_enable_
std::vector< CSCCorrelatedLCTDigi > lctV
void matchShowers(CSCShowerDigi *anode_showers, CSCShowerDigi *cathode_showers, bool andlogic)
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
static const unsigned int def_clct_trig_enable
void copyValidToInValidALCT(CSCALCTDigi &, CSCALCTDigi &) const
CSCCLCTDigi getBXShiftedCLCT(const CSCCLCTDigi &) const
unsigned minbx_readout_
~CSCMotherboard() override=default
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const RunContext &)
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, CSCCorrelatedLCTDigi &bLCT, CSCCorrelatedLCTDigi &sLCT, int type) const
const CSCDBL1TPParameters * parameters_
CSCMotherboard(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, CSCBaseboard::Parameters &conf)
std::vector< int > preferred_bx_match_
bool match_earliest_clct_only_
std::unique_ptr< CSCALCTCrossCLCT > cscOverlap_
static const unsigned int def_tmb_l1a_window_size
void dumpConfigParams() const
void checkConfigParameters()
const CSCGeometry * cscGeometry_
void copyValidToInValidCLCT(CSCCLCTDigi &, CSCCLCTDigi &) const
unsigned int match_trig_window_size_
unsigned int mpc_block_me1a_
std::vector< unsigned > showerSource_
unsigned int match_trig_window_size() const
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
bool doesALCTCrossCLCT(const CSCALCTDigi &, const CSCCLCTDigi &) const
void sortCLCTByQualBend(int alct_bx, std::vector< unsigned > &clctBxVector)
unsigned int match_trig_enable() const
static const unsigned int def_match_trig_window_size
const CSCL1TPLookupTableCCLUT * lookupTableCCLUT_
bool sort_clct_bx() const
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
void encodeHighMultiplicityBits()
unsigned int clct_trig_enable_
std::vector< CSCShowerDigi > readoutShower() const
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
void setConfigParameters(const CSCDBL1TPParameters *conf)
std::unique_ptr< LCTQualityControl > qualityControl_
static const unsigned int def_match_trig_enable
std::unique_ptr< LCTQualityAssignment > qualityAssignment_
void constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb, CSCCorrelatedLCTDigi &lct) const