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:
72  const bool receiveEG,
73  const int nrL1EG,
74  const bool receiveTau,
75  const int nrL1Tau,
76  const bool receiveJet,
77  const int nrL1Jet,
78  const bool receiveEtSums,
79  const bool receiveEtSumsZdc);
80 
83  const bool receiveMu,
84  const int nrL1Mu);
85 
88  const bool receiveMuShower,
89  const int nrL1MuShower);
90 
91  void receiveExternalData(const edm::Event&, const edm::EDGetTokenT<BXVector<GlobalExtBlk>>&, const bool receiveExt);
92 
94  void init(const int numberPhysTriggers,
95  const int nrL1Mu,
96  const int nrL1MuShower,
97  const int nrL1EG,
98  const int nrL1Tau,
99  const int nrL1Jet,
100  int bxFirst,
101  int bxLast);
102 
104  void runGTL(const edm::Event& iEvent,
105  const edm::EventSetup& evSetup,
106  const TriggerMenu* m_l1GtMenu,
107  const bool produceL1GtObjectMapRecord,
108  const int iBxInEvent,
109  std::unique_ptr<GlobalObjectMapRecord>& gtObjectMapRecord, //GTO
110  const unsigned int numberPhysTriggers,
111  const int nrL1Mu,
112  const int nrL1MuShower,
113  const int nrL1EG,
114  const int nrL1Tau,
115  const int nrL1Jet);
116 
118  void runFDL(const edm::Event& iEvent,
119  const int iBxInEvent,
120  const int totalBxInEvent,
121  const unsigned int numberPhysTriggers,
122  const std::vector<double>& prescaleFactorsAlgoTrig,
123  const std::vector<unsigned int>& triggerMaskAlgoTrig,
124  const std::vector<int>& triggerMaskVetoAlgoTrig,
125  const bool algorithmTriggersUnprescaled,
126  const bool algorithmTriggersUnmasked);
127 
129  void fillAlgRecord(int iBxInEvent,
130  std::unique_ptr<GlobalAlgBlkBxCollection>& uGtAlgRecord,
131  int prescaleSet,
132  int menuUUID,
133  int firmwareUUID);
134 
136  void reset();
137  void resetMu();
138  void resetMuonShower();
139  void resetCalo();
140  void resetExternal();
141 
143  void printGmtData(const int iBxInEvent) const;
144 
146  inline const std::bitset<GlobalAlgBlk::maxPhysicsTriggers>& getDecisionWord() const { return m_gtlDecisionWord; }
147 
149  inline const std::bitset<GlobalAlgBlk::maxPhysicsTriggers>& getAlgorithmOR() const { return m_gtlAlgorithmOR; }
150 
152  inline const BXVector<const l1t::Muon*>* getCandL1Mu() const { return m_candL1Mu; }
153 
156 
158  inline const BXVector<const l1t::L1Candidate*>* getCandL1EG() const { return m_candL1EG; }
159 
162 
165 
167  inline const BXVector<const l1t::EtSum*>* getCandL1EtSum() const { return m_candL1EtSum; }
168 
171 
174 
175  /* Drop individual EtSums for Now
177  inline const l1t::EtSum* getCandL1ETM() const
178  {
179  return m_candETM;
180  }
181 
183  inline const l1t::EtSum* getCandL1ETT() const
184  {
185  return m_candETT;
186  }
187 
189  inline const l1t::EtSum* getCandL1HTT() const
190  {
191  return m_candHTT;
192  }
193 
195  inline const l1t::EtSum* getCandL1HTM() const
196  {
197  return m_candHTM;
198  }
199 */
200 
201  void setBxFirst(int bx);
202  void setBxLast(int bx);
203 
206 
207  public:
208  inline void setVerbosity(const int verbosity) { m_verbosity = verbosity; }
209 
210  private:
211  // cached stuff
212 
213  // trigger menu
215  unsigned long long m_l1GtMenuCacheID;
216 
217  // L1 scales (phi, eta) for Mu, Calo and EnergySum objects
219  unsigned long long m_l1CaloGeometryCacheID;
220 
222  unsigned long long m_l1MuTriggerScalesCacheID;
223 
224  // conversions for eta and phi
225  // L1GtEtaPhiConversions* m_gtEtaPhiConversions;
226 
227  private:
236 
237  // BXVector<const l1t::EtSum*>* m_candETM;
238  // BXVector<const l1t::EtSum*>* m_candETT;
239  // BXVector<const l1t::EtSum*>* m_candHTM;
240  // BXVector<const l1t::EtSum*>* m_candHTT;
241 
244 
245  std::bitset<GlobalAlgBlk::maxPhysicsTriggers> m_gtlAlgorithmOR;
246  std::bitset<GlobalAlgBlk::maxPhysicsTriggers> m_gtlDecisionWord;
247 
249 
250  // cache of maps
251  std::vector<AlgorithmEvaluation::ConditionEvaluationMap> m_conditionResultMaps;
252 
253  unsigned int m_currentLumi;
254 
255  private:
259 
260  // Flags for the OR of all algorithms at various stages. (Single bx)
266 
267  // Counter for number of events seen by this board
268  unsigned int m_boardEventCount;
269 
270  // Information about board
273 
274  // whether we reset the prescales each lumi or not
276 
277  // start the PS counter from a random value between [1,PS] instead of PS
279 
280  // step-size in prescale counter corresponding to 10^p,
281  // where p is the precision allowed for non-integer prescales;
282  // since the introduction of L1T fractional prescales, p == 2
283  static constexpr size_t m_singlestep = 100;
284 
285  // struct to increment the prescale according to fractional prescale logic in firmware
287  size_t const prescale_count;
289 
290  PrescaleCounter(double prescale, size_t const initial_counter = 0)
291  : prescale_count(std::lround(prescale * m_singlestep)), trigger_counter(initial_counter) {
292  if (prescale_count != 0 and (prescale_count < m_singlestep or prescale < 0)) {
293  throw cms::Exception("PrescaleCounterConstructor")
294  << "invalid initialisation of PrescaleCounter: prescale = " << prescale
295  << ", prescale_count = " << prescale_count << " (< " << m_singlestep << " = m_singlestep)";
296  }
297  }
298 
299  // function to increment the prescale counter and return the decision
300  bool accept();
301  };
302 
303  // prescale counters: NumberPhysTriggers counters per bunch cross in event
304  std::vector<std::vector<PrescaleCounter>> m_prescaleCounterAlgoTrig;
305 
306  // create prescale counters, initialising trigger_counter to zero
307  static std::vector<PrescaleCounter> prescaleCounters(std::vector<double> const& prescaleFactorsAlgoTrig);
308 
309  // create prescale counters, initialising trigger_counter to a semirandom number between 0 and prescale_count - 1 inclusive
310  static std::vector<PrescaleCounter> prescaleCountersWithSemirandomInitialCounter(
311  std::vector<double> const& prescaleFactorsAlgoTrig, edm::Event const& iEvent);
312  };
313 
314 } // namespace l1t
315 
316 #endif
BXVector< const l1t::Muon * > * m_candL1Mu
Definition: GlobalBoard.h:228
BXVector< const l1t::EtSum * > * m_candL1EtSumZdc
Definition: GlobalBoard.h:234
const std::bitset< GlobalAlgBlk::maxPhysicsTriggers > & getDecisionWord() const
return decision
Definition: GlobalBoard.h:146
const std::bitset< GlobalAlgBlk::maxPhysicsTriggers > & getAlgorithmOR() const
return algorithm OR decision
Definition: GlobalBoard.h:149
const BXVector< std::shared_ptr< l1t::MuonShower > > * getCandL1MuShower() const
return global muon trigger candidate
Definition: GlobalBoard.h:155
BXVector< std::shared_ptr< l1t::MuonShower > > * m_candL1MuShower
Definition: GlobalBoard.h:229
static constexpr size_t m_singlestep
Definition: GlobalBoard.h:283
void setSemiRandomInitialPSCounters(bool val)
Definition: GlobalBoard.h:205
const BXVector< const l1t::EtSum * > * getCandL1EtSumZdc() const
pointer to ZDC EtSum data list
Definition: GlobalBoard.h:170
static std::vector< PrescaleCounter > prescaleCountersWithSemirandomInitialCounter(std::vector< double > const &prescaleFactorsAlgoTrig, edm::Event const &iEvent)
BXVector< const l1t::L1Candidate * > * m_candL1EG
Definition: GlobalBoard.h:230
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:221
unsigned long long m_l1MuTriggerScalesCacheID
Definition: GlobalBoard.h:222
delete x;
Definition: CaloConfig.h:22
void setBxLast(int bx)
Definition: GlobalBoard.cc:111
const BXVector< const l1t::L1Candidate * > * getCandL1Tau() const
pointer to Tau data list
Definition: GlobalBoard.h:164
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:985
bool m_semiRandomInitialPSCounters
Definition: GlobalBoard.h:278
void printGmtData(const int iBxInEvent) const
print received Muon dataWord
unsigned int m_currentLumi
Definition: GlobalBoard.h:253
unsigned long long m_l1GtMenuCacheID
Definition: GlobalBoard.h:215
static std::vector< PrescaleCounter > prescaleCounters(std::vector< double > const &prescaleFactorsAlgoTrig)
void setVerbosity(const int verbosity)
Definition: GlobalBoard.h:208
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlDecisionWord
Definition: GlobalBoard.h:246
int m_verbosity
verbosity level
Definition: GlobalBoard.h:257
int iEvent
Definition: GenABIO.cc:224
unsigned int m_boardEventCount
Definition: GlobalBoard.h:268
BXVector< const l1t::EtSum * > * m_candL1EtSum
Definition: GlobalBoard.h:233
PrescaleCounter(double prescale, size_t const initial_counter=0)
Definition: GlobalBoard.h:290
const TriggerMenu * m_l1GtMenu
Definition: GlobalBoard.h:214
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:218
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:494
void reset()
clear uGT
unsigned long long m_l1CaloGeometryCacheID
Definition: GlobalBoard.h:219
const BXVector< const GlobalExtBlk * > * getCandL1External() const
pointer to External data list
Definition: GlobalBoard.h:173
BXVector< const l1t::L1Candidate * > * m_candL1Jet
Definition: GlobalBoard.h:232
std::vector< std::vector< PrescaleCounter > > m_prescaleCounterAlgoTrig
Definition: GlobalBoard.h:304
const int verbosity
void receiveExternalData(const edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk >> &, const bool receiveExt)
Definition: GlobalBoard.cc:457
GlobalAlgBlk m_uGtAlgBlk
Definition: GlobalBoard.h:248
BXVector< const GlobalExtBlk * > * m_candL1External
Definition: GlobalBoard.h:235
void setBxFirst(int bx)
Definition: GlobalBoard.cc:109
const BXVector< const l1t::L1Candidate * > * getCandL1Jet() const
pointer to Jet data list
Definition: GlobalBoard.h:161
void setResetPSCountersEachLumiSec(bool val)
Definition: GlobalBoard.h:204
const BXVector< const l1t::EtSum * > * getCandL1EtSum() const
pointer to EtSum data list
Definition: GlobalBoard.h:167
const BXVector< const l1t::Muon * > * getCandL1Mu() const
return global muon trigger candidate
Definition: GlobalBoard.h:152
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 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, const bool receiveEtSumsZdc)
receive data from Global Muon Trigger
Definition: GlobalBoard.cc:139
virtual ~GlobalBoard()
Definition: GlobalBoard.cc:97
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:113
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlAlgorithmOR
Definition: GlobalBoard.h:245
bool m_resetPSCountersEachLumiSec
Definition: GlobalBoard.h:275
void receiveMuonShowerObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::MuonShower >> &, const bool receiveMuShower, const int nrL1MuShower)
Definition: GlobalBoard.cc:393
void receiveMuonObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon >> &, const bool receiveMu, const int nrL1Mu)
Definition: GlobalBoard.cc:346
const BXVector< const l1t::L1Candidate * > * getCandL1EG() const
pointer to EG data list
Definition: GlobalBoard.h:158
BXVector< const l1t::L1Candidate * > * m_candL1Tau
Definition: GlobalBoard.h:231
std::vector< AlgorithmEvaluation::ConditionEvaluationMap > m_conditionResultMaps
Definition: GlobalBoard.h:251