CMS 3D CMS Logo

GlobalBoard.h
Go to the documentation of this file.
1 #ifndef GtBoard_h
2 #define GtBoard_h
3 
15 // system include files
16 #include <bitset>
17 #include <cassert>
18 #include <vector>
19 #include <cmath>
20 #include <memory>
21 
22 // user include files
25 
27 
29 
30 // Trigger Objects
38 
39 // Objects to produce for the output record.
42 
45 
46 // forward declarations
47 class TriggerMenu;
48 class L1CaloGeometry;
49 class L1MuTriggerScales;
50 //class L1GtEtaPhiConversions;
51 
52 // class declaration
53 
54 namespace l1t {
55 
56  class GlobalBoard {
57  public:
58  // constructors
59  GlobalBoard();
60 
61  // destructor
62  virtual ~GlobalBoard();
63 
64  public:
71  const bool receiveEG,
72  const int nrL1EG,
73  const bool receiveTau,
74  const int nrL1Tau,
75  const bool receiveJet,
76  const int nrL1Jet,
77  const bool receiveEtSums);
78 
81  const bool receiveMu,
82  const int nrL1Mu);
83 
86  const bool receiveMuShower,
87  const int nrL1MuShower);
88 
89  void receiveExternalData(const edm::Event&, const edm::EDGetTokenT<BXVector<GlobalExtBlk>>&, const bool receiveExt);
90 
92  void init(const int numberPhysTriggers,
93  const int nrL1Mu,
94  const int nrL1MuShower,
95  const int nrL1EG,
96  const int nrL1Tau,
97  const int nrL1Jet,
98  int bxFirst,
99  int bxLast);
100 
102  void runGTL(const edm::Event& iEvent,
103  const edm::EventSetup& evSetup,
104  const TriggerMenu* m_l1GtMenu,
105  const bool produceL1GtObjectMapRecord,
106  const int iBxInEvent,
107  std::unique_ptr<GlobalObjectMapRecord>& gtObjectMapRecord, //GTO
108  const unsigned int numberPhysTriggers,
109  const int nrL1Mu,
110  const int nrL1MuShower,
111  const int nrL1EG,
112  const int nrL1Tau,
113  const int nrL1Jet);
114 
116  void runFDL(const edm::Event& iEvent,
117  const int iBxInEvent,
118  const int totalBxInEvent,
119  const unsigned int numberPhysTriggers,
120  const std::vector<double>& prescaleFactorsAlgoTrig,
121  const std::vector<unsigned int>& triggerMaskAlgoTrig,
122  const std::vector<int>& triggerMaskVetoAlgoTrig,
123  const bool algorithmTriggersUnprescaled,
124  const bool algorithmTriggersUnmasked);
125 
127  void fillAlgRecord(int iBxInEvent,
128  std::unique_ptr<GlobalAlgBlkBxCollection>& uGtAlgRecord,
129  int prescaleSet,
130  int menuUUID,
131  int firmwareUUID);
132 
134  void reset();
135  void resetMu();
136  void resetMuonShower();
137  void resetCalo();
138  void resetExternal();
139 
141  void printGmtData(const int iBxInEvent) const;
142 
144  inline const std::bitset<GlobalAlgBlk::maxPhysicsTriggers>& getDecisionWord() const { return m_gtlDecisionWord; }
145 
147  inline const std::bitset<GlobalAlgBlk::maxPhysicsTriggers>& getAlgorithmOR() const { return m_gtlAlgorithmOR; }
148 
150  inline const BXVector<const l1t::Muon*>* getCandL1Mu() const { return m_candL1Mu; }
151 
154 
156  inline const BXVector<const l1t::L1Candidate*>* getCandL1EG() const { return m_candL1EG; }
157 
160 
163 
165  inline const BXVector<const l1t::EtSum*>* getCandL1EtSum() const { return m_candL1EtSum; }
166 
169 
170  /* Drop individual EtSums for Now
172  inline const l1t::EtSum* getCandL1ETM() const
173  {
174  return m_candETM;
175  }
176 
178  inline const l1t::EtSum* getCandL1ETT() const
179  {
180  return m_candETT;
181  }
182 
184  inline const l1t::EtSum* getCandL1HTT() const
185  {
186  return m_candHTT;
187  }
188 
190  inline const l1t::EtSum* getCandL1HTM() const
191  {
192  return m_candHTM;
193  }
194 */
195 
196  void setBxFirst(int bx);
197  void setBxLast(int bx);
198 
201 
202  public:
203  inline void setVerbosity(const int verbosity) { m_verbosity = verbosity; }
204 
205  private:
206  // cached stuff
207 
208  // trigger menu
210  unsigned long long m_l1GtMenuCacheID;
211 
212  // L1 scales (phi, eta) for Mu, Calo and EnergySum objects
214  unsigned long long m_l1CaloGeometryCacheID;
215 
217  unsigned long long m_l1MuTriggerScalesCacheID;
218 
219  // conversions for eta and phi
220  // L1GtEtaPhiConversions* m_gtEtaPhiConversions;
221 
222  private:
230 
231  // BXVector<const l1t::EtSum*>* m_candETM;
232  // BXVector<const l1t::EtSum*>* m_candETT;
233  // BXVector<const l1t::EtSum*>* m_candHTM;
234  // BXVector<const l1t::EtSum*>* m_candHTT;
235 
238 
239  std::bitset<GlobalAlgBlk::maxPhysicsTriggers> m_gtlAlgorithmOR;
240  std::bitset<GlobalAlgBlk::maxPhysicsTriggers> m_gtlDecisionWord;
241 
243 
244  // cache of maps
245  std::vector<AlgorithmEvaluation::ConditionEvaluationMap> m_conditionResultMaps;
246 
247  unsigned int m_currentLumi;
248 
249  private:
253 
254  // Flags for the OR of all algorithms at various stages. (Single bx)
260 
261  // Counter for number of events seen by this board
262  unsigned int m_boardEventCount;
263 
264  // Information about board
267 
268  // whether we reset the prescales each lumi or not
270 
271  // start the PS counter from a random value between [1,PS] instead of PS
273 
274  // step-size in prescale counter corresponding to 10^p,
275  // where p is the precision allowed for non-integer prescales;
276  // since the introduction of L1T fractional prescales, p == 2
277  static constexpr size_t m_singlestep = 100;
278 
279  // struct to increment the prescale according to fractional prescale logic in firmware
281  size_t const prescale_count;
283 
284  PrescaleCounter(double prescale, size_t const initial_counter = 0)
285  : prescale_count(std::lround(prescale * m_singlestep)), trigger_counter(initial_counter) {
286  if (prescale_count != 0 and (prescale_count < m_singlestep or prescale < 0)) {
287  throw cms::Exception("PrescaleCounterConstructor")
288  << "invalid initialisation of PrescaleCounter: prescale = " << prescale
289  << ", prescale_count = " << prescale_count << " (< " << m_singlestep << " = m_singlestep)";
290  }
291  }
292 
293  // function to increment the prescale counter and return the decision
294  bool accept();
295  };
296 
297  // prescale counters: NumberPhysTriggers counters per bunch cross in event
298  std::vector<std::vector<PrescaleCounter>> m_prescaleCounterAlgoTrig;
299 
300  // create prescale counters, initialising trigger_counter to zero
301  static std::vector<PrescaleCounter> prescaleCounters(std::vector<double> const& prescaleFactorsAlgoTrig);
302 
303  // create prescale counters, initialising trigger_counter to a semirandom number between 0 and prescale_count - 1 inclusive
304  static std::vector<PrescaleCounter> prescaleCountersWithSemirandomInitialCounter(
305  std::vector<double> const& prescaleFactorsAlgoTrig, edm::Event const& iEvent);
306  };
307 
308 } // namespace l1t
309 
310 #endif
BXVector< const l1t::Muon * > * m_candL1Mu
Definition: GlobalBoard.h:223
const std::bitset< GlobalAlgBlk::maxPhysicsTriggers > & getDecisionWord() const
return decision
Definition: GlobalBoard.h:144
const std::bitset< GlobalAlgBlk::maxPhysicsTriggers > & getAlgorithmOR() const
return algorithm OR decision
Definition: GlobalBoard.h:147
const BXVector< std::shared_ptr< l1t::MuonShower > > * getCandL1MuShower() const
return global muon trigger candidate
Definition: GlobalBoard.h:153
BXVector< std::shared_ptr< l1t::MuonShower > > * m_candL1MuShower
Definition: GlobalBoard.h:224
static constexpr size_t m_singlestep
Definition: GlobalBoard.h:277
void setSemiRandomInitialPSCounters(bool val)
Definition: GlobalBoard.h:200
static std::vector< PrescaleCounter > prescaleCountersWithSemirandomInitialCounter(std::vector< double > const &prescaleFactorsAlgoTrig, edm::Event const &iEvent)
BXVector< const l1t::L1Candidate * > * m_candL1EG
Definition: GlobalBoard.h:225
void fillAlgRecord(int iBxInEvent, std::unique_ptr< GlobalAlgBlkBxCollection > &uGtAlgRecord, int prescaleSet, int menuUUID, int firmwareUUID)
Fill the Daq Records.
const L1MuTriggerScales * m_l1MuTriggerScales
Definition: GlobalBoard.h:216
unsigned long long m_l1MuTriggerScalesCacheID
Definition: GlobalBoard.h:217
delete x;
Definition: CaloConfig.h:22
void setBxLast(int bx)
Definition: GlobalBoard.cc:104
const BXVector< const l1t::L1Candidate * > * getCandL1Tau() const
pointer to Tau data list
Definition: GlobalBoard.h:162
void runFDL(const edm::Event &iEvent, const int iBxInEvent, const int totalBxInEvent, const unsigned int numberPhysTriggers, const std::vector< double > &prescaleFactorsAlgoTrig, const std::vector< unsigned int > &triggerMaskAlgoTrig, const std::vector< int > &triggerMaskVetoAlgoTrig, const bool algorithmTriggersUnprescaled, const bool algorithmTriggersUnmasked)
run the uGT FDL (Apply Prescales and Veto)
Definition: GlobalBoard.cc:936
bool m_semiRandomInitialPSCounters
Definition: GlobalBoard.h:272
void printGmtData(const int iBxInEvent) const
print received Muon dataWord
unsigned int m_currentLumi
Definition: GlobalBoard.h:247
unsigned long long m_l1GtMenuCacheID
Definition: GlobalBoard.h:210
static std::vector< PrescaleCounter > prescaleCounters(std::vector< double > const &prescaleFactorsAlgoTrig)
void setVerbosity(const int verbosity)
Definition: GlobalBoard.h:203
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlDecisionWord
Definition: GlobalBoard.h:240
int m_verbosity
verbosity level
Definition: GlobalBoard.h:251
int iEvent
Definition: GenABIO.cc:224
unsigned int m_boardEventCount
Definition: GlobalBoard.h:262
BXVector< const l1t::EtSum * > * m_candL1EtSum
Definition: GlobalBoard.h:228
PrescaleCounter(double prescale, size_t const initial_counter=0)
Definition: GlobalBoard.h:284
const TriggerMenu * m_l1GtMenu
Definition: GlobalBoard.h:209
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const L1CaloGeometry * m_l1CaloGeometry
Definition: GlobalBoard.h:213
void runGTL(const edm::Event &iEvent, const edm::EventSetup &evSetup, const TriggerMenu *m_l1GtMenu, const bool produceL1GtObjectMapRecord, const int iBxInEvent, std::unique_ptr< GlobalObjectMapRecord > &gtObjectMapRecord, const unsigned int numberPhysTriggers, const int nrL1Mu, const int nrL1MuShower, const int nrL1EG, const int nrL1Tau, const int nrL1Jet)
run the uGT GTL (Conditions and Algorithms)
Definition: GlobalBoard.cc:458
void reset()
clear uGT
unsigned long long m_l1CaloGeometryCacheID
Definition: GlobalBoard.h:214
const BXVector< const GlobalExtBlk * > * getCandL1External() const
pointer to Tau data list
Definition: GlobalBoard.h:168
BXVector< const l1t::L1Candidate * > * m_candL1Jet
Definition: GlobalBoard.h:227
std::vector< std::vector< PrescaleCounter > > m_prescaleCounterAlgoTrig
Definition: GlobalBoard.h:298
const int verbosity
void receiveExternalData(const edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk >> &, const bool receiveExt)
Definition: GlobalBoard.cc:420
GlobalAlgBlk m_uGtAlgBlk
Definition: GlobalBoard.h:242
BXVector< const GlobalExtBlk * > * m_candL1External
Definition: GlobalBoard.h:229
void setBxFirst(int bx)
Definition: GlobalBoard.cc:102
const BXVector< const l1t::L1Candidate * > * getCandL1Jet() const
pointer to Jet data list
Definition: GlobalBoard.h:159
void setResetPSCountersEachLumiSec(bool val)
Definition: GlobalBoard.h:199
const BXVector< const l1t::EtSum * > * getCandL1EtSum() const
pointer to Tau data list
Definition: GlobalBoard.h:165
const BXVector< const l1t::Muon * > * getCandL1Mu() const
return global muon trigger candidate
Definition: GlobalBoard.h:150
virtual ~GlobalBoard()
Definition: GlobalBoard.cc:90
void init(const int numberPhysTriggers, const int nrL1Mu, const int nrL1MuShower, const int nrL1EG, const int nrL1Tau, const int nrL1Jet, int bxFirst, int bxLast)
initialize the class (mainly reserve)
Definition: GlobalBoard.cc:106
void receiveCaloObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::EGamma >> &, const edm::EDGetTokenT< BXVector< l1t::Tau >> &, const edm::EDGetTokenT< BXVector< l1t::Jet >> &, const edm::EDGetTokenT< BXVector< l1t::EtSum >> &, const bool receiveEG, const int nrL1EG, const bool receiveTau, const int nrL1Tau, const bool receiveJet, const int nrL1Jet, const bool receiveEtSums)
receive data from Global Muon Trigger
Definition: GlobalBoard.cc:131
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlAlgorithmOR
Definition: GlobalBoard.h:239
bool m_resetPSCountersEachLumiSec
Definition: GlobalBoard.h:269
void receiveMuonShowerObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::MuonShower >> &, const bool receiveMuShower, const int nrL1MuShower)
Definition: GlobalBoard.cc:367
void receiveMuonObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon >> &, const bool receiveMu, const int nrL1Mu)
Definition: GlobalBoard.cc:319
const BXVector< const l1t::L1Candidate * > * getCandL1EG() const
pointer to EG data list
Definition: GlobalBoard.h:156
BXVector< const l1t::L1Candidate * > * m_candL1Tau
Definition: GlobalBoard.h:226
std::vector< AlgorithmEvaluation::ConditionEvaluationMap > m_conditionResultMaps
Definition: GlobalBoard.h:245