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,
58  const edm::ParameterSet& conf);
59 
61  ~CSCMotherboard() override = default;
62 
65  void run(const CSCWireDigiCollection* wiredc, const CSCComparatorDigiCollection* compdc);
66 
67  /*
68  Returns vector of good correlated LCTs in the read-out time window.
69  LCTs in the BX window [early_tbins,...,late_tbins] are considered
70  good for physics. The central LCT BX is time bin 8.
71  - tmb_l1a_window_size = 7 (Run-1, Run-2) -> [5, 6, 7, 8, 9, 10, 11]
72  - tmb_l1a_window_size = 5 (Run-3) -> [6, 7, 8, 9, 10]
73  - tmb_l1a_window_size = 3 (Run-4?) -> [7, 8, 9]
74 
75  Note, this function does not have an exact counterpart in the
76  firmware. The reason is that the DAQ of LCTs is not correctly
77  simulated in CMSSW - at least the simulation of the L1-accept.
78  So, this function corresponds to both the trigger path and the
79  DAQ path in the firmware. In general, the function will return
80  LCTs that would not be used in the OMTF or EMTF emulator,
81  because they are out-of-time relative for tracking purposes. For
82  instance an LCT with BX5 would be read out by the DAQ, but would
83  likely not be used by the EMTF.
84  */
85  virtual std::vector<CSCCorrelatedLCTDigi> readoutLCTs() const;
86 
87  // LCT selection: at most 2 in each BX
88  void selectLCTs();
89 
91  std::vector<CSCShowerDigi> readoutShower() const;
92 
95  void clear();
96 
98  void setConfigParameters(const CSCDBL1TPParameters* conf);
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  // access to lookup tables via eventsetup
115 
116  /* Containers for reconstructed ALCTs and CLCTs */
117  std::vector<CSCALCTDigi> alctV;
118  std::vector<CSCCLCTDigi> clctV;
119 
122 
123  /* Container with sorted and selected LCTs */
124  std::vector<CSCCorrelatedLCTDigi> lctV;
125 
127 
128  // helper function to return ALCT/CLCT with correct central BX
131 
133  unsigned int mpc_block_me1a;
136 
139 
142 
145 
146  // when set to true, ignore CLCTs found in later BX's
148 
149  // encode special bits for high-multiplicity triggers
150  std::vector<unsigned> showerSource_;
152  unsigned minbx_readout_;
153  unsigned maxbx_readout_;
154 
156 
157  /*
158  Preferential index array in matching window, relative to the ALCT BX.
159  Where the central match BX goes first,
160  then the closest early, the closest late, etc.
161  */
162  std::vector<int> preferred_bx_match_;
163 
164  /* sort CLCT by bx if true, otherwise sort CLCT by quality+bending */
166 
168  static const unsigned int def_mpc_block_me1a;
169  static const unsigned int def_alct_trig_enable, def_clct_trig_enable;
171  static const unsigned int def_tmb_l1a_window_size;
172 
173  /* quality assignment */
174  std::unique_ptr<LCTQualityAssignment> qualityAssignment_;
175 
176  /* quality control */
177  std::unique_ptr<LCTQualityControl> qualityControl_;
178 
179  /*
180  Helper class to check if an ALCT intersects with a CLCT. Normally
181  this class should not be used. It is left in the code as a potential
182  improvement for ME1/1 when unphysical LCTs are not desired. This
183  function is not implemented in the firmware.
184  */
185  std::unique_ptr<CSCALCTCrossCLCT> cscOverlap_;
186 
188  void checkConfigParameters();
189 
190  /*sort CLCT by quality+bending and if CLCTs from different BX have
191  same quality+bending, then rank CLCT by timing
192  */
193  void sortCLCTByQualBend(int alct_bx, std::vector<unsigned>& clctBxVector);
194  /*
195  For valid ALCTs in the trigger time window, look for CLCTs within the
196  match-time window. Valid CLCTs are matched in-time. If a match was found
197  for the best ALCT and best CLCT, also the second best ALCT and second
198  best CLCT are sent to a correlation function "correlateLCTs" that will
199  make the best-best pair and second-second pair (if applicable).
200  */
201  void matchALCTCLCT();
202 
203  /*
204  This function matches maximum two ALCTs with maximum two CLCTs in
205  a bunch crossing. The best ALCT is considered the one with the highest
206  quality in a BX. Similarly for the best CLCT. If there is just one
207  ALCT and just one CLCT, the correlated LCT is made from those two
208  components. If there are exactly two ALCTs and two CLCTs, the best
209  LCT and second best LCT are formed from the best ALCT-CLCT combination
210  and the second best ALCT-CLCT combination. In case there is missing
211  information (e.g. second best ALCT, but no second best CLCT), information
212  is copied over.
213  */
214  void correlateLCTs(const CSCALCTDigi& bestALCT,
215  const CSCALCTDigi& secondALCT,
216  const CSCCLCTDigi& bestCLCT,
217  const CSCCLCTDigi& secondCLCT,
218  CSCCorrelatedLCTDigi& bLCT,
219  CSCCorrelatedLCTDigi& sLCT,
220  int type) const;
221 
222  /*
223  This method calculates all the TMB words and then passes them to the
224  constructor of correlated LCTs. The LCT data members are filled with
225  information from the ALCT-CLCT combination.
226  */
227  void constructLCTs(
228  const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT, int type, int trknmb, CSCCorrelatedLCTDigi& lct) const;
229 
230  /*
231  These functions copy valid ALCT/CLCT information to invalid the ALCT/CLCT
232  if present, so that we always construct the maximum number of valid LCTs
233  */
236 
237  bool doesALCTCrossCLCT(const CSCALCTDigi&, const CSCCLCTDigi&) const;
238 
239  // CLCT pattern number: encodes the pattern number itself
240  unsigned int encodePattern(const int clctPattern) const;
241 
243  void dumpConfigParams() const;
244 
245  /* match cathode shower and anode shower with and/or logic */
246  void matchShowers(CSCShowerDigi* anode_showers, CSCShowerDigi* cathode_showers, bool andlogic);
247 
248  /* encode high multiplicity bits for Run-3 exotic triggers */
250 };
251 #endif
LCTContainer allLCTs_
unsigned thisShowerSource_
virtual std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
unsigned maxbx_readout_
std::vector< CSCCLCTDigi > clctV
unsigned int clct_trig_enable
void setESLookupTables(const CSCL1TPLookupTableCCLUT *conf)
unsigned int encodePattern(const int clctPattern) const
unsigned int match_trig_window_size
static const unsigned int def_alct_trig_enable
CSCShowerDigi showers_[CSCConstants::MAX_LCT_TBINS]
static const unsigned int def_mpc_block_me1a
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 int mpc_block_me1a
unsigned minbx_readout_
~CSCMotherboard() override=default
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, CSCCorrelatedLCTDigi &bLCT, CSCCorrelatedLCTDigi &sLCT, int type) const
std::vector< int > preferred_bx_match_
bool match_earliest_clct_only_
CSCMotherboard(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
std::unique_ptr< CSCALCTCrossCLCT > cscOverlap_
static const unsigned int def_tmb_l1a_window_size
std::vector< CSCALCTDigi > alctV
void dumpConfigParams() const
unsigned int tmb_l1a_window_size
void checkConfigParameters()
unsigned int match_trig_enable
void copyValidToInValidCLCT(CSCCLCTDigi &, CSCCLCTDigi &) const
std::vector< unsigned > showerSource_
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
bool doesALCTCrossCLCT(const CSCALCTDigi &, const CSCCLCTDigi &) const
void sortCLCTByQualBend(int alct_bx, std::vector< unsigned > &clctBxVector)
static const unsigned int def_match_trig_window_size
unsigned int alct_trig_enable
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
const CSCL1TPLookupTableCCLUT * lookupTableCCLUT_
void encodeHighMultiplicityBits()
std::vector< CSCShowerDigi > readoutShower() const
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
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