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  void setAXOL1TLModelVersion(std::string axol1tlModelVersion);
208 
209  public:
210  inline void setVerbosity(const int verbosity) { m_verbosity = verbosity; }
211 
212  private:
213  // cached stuff
214 
215  // trigger menu
217  unsigned long long m_l1GtMenuCacheID;
218 
219  // L1 scales (phi, eta) for Mu, Calo and EnergySum objects
221  unsigned long long m_l1CaloGeometryCacheID;
222 
224  unsigned long long m_l1MuTriggerScalesCacheID;
225 
226  // conversions for eta and phi
227  // L1GtEtaPhiConversions* m_gtEtaPhiConversions;
228 
229  private:
238 
239  // BXVector<const l1t::EtSum*>* m_candETM;
240  // BXVector<const l1t::EtSum*>* m_candETT;
241  // BXVector<const l1t::EtSum*>* m_candHTM;
242  // BXVector<const l1t::EtSum*>* m_candHTT;
243 
246 
248 
249  std::bitset<GlobalAlgBlk::maxPhysicsTriggers> m_gtlAlgorithmOR;
250  std::bitset<GlobalAlgBlk::maxPhysicsTriggers> m_gtlDecisionWord;
251 
253 
254  // cache of maps
255  std::vector<AlgorithmEvaluation::ConditionEvaluationMap> m_conditionResultMaps;
256 
257  unsigned int m_currentLumi;
258 
259  private:
263 
264  // Flags for the OR of all algorithms at various stages. (Single bx)
270 
271  // Counter for number of events seen by this board
272  unsigned int m_boardEventCount;
273 
274  // Information about board
277 
278  // whether we reset the prescales each lumi or not
280 
281  // start the PS counter from a random value between [1,PS] instead of PS
283 
284  // step-size in prescale counter corresponding to 10^p,
285  // where p is the precision allowed for non-integer prescales;
286  // since the introduction of L1T fractional prescales, p == 2
287  static constexpr size_t m_singlestep = 100;
288 
289  // struct to increment the prescale according to fractional prescale logic in firmware
291  size_t const prescale_count;
293 
294  PrescaleCounter(double prescale, size_t const initial_counter = 0)
295  : prescale_count(std::lround(prescale * m_singlestep)), trigger_counter(initial_counter) {
296  if (prescale_count != 0 and (prescale_count < m_singlestep or prescale < 0)) {
297  throw cms::Exception("PrescaleCounterConstructor")
298  << "invalid initialisation of PrescaleCounter: prescale = " << prescale
299  << ", prescale_count = " << prescale_count << " (< " << m_singlestep << " = m_singlestep)";
300  }
301  }
302 
303  // function to increment the prescale counter and return the decision
304  bool accept();
305  };
306 
307  // prescale counters: NumberPhysTriggers counters per bunch cross in event
308  std::vector<std::vector<PrescaleCounter>> m_prescaleCounterAlgoTrig;
309 
310  // create prescale counters, initialising trigger_counter to zero
311  static std::vector<PrescaleCounter> prescaleCounters(std::vector<double> const& prescaleFactorsAlgoTrig);
312 
313  // create prescale counters, initialising trigger_counter to a semirandom number between 0 and prescale_count - 1 inclusive
314  static std::vector<PrescaleCounter> prescaleCountersWithSemirandomInitialCounter(
315  std::vector<double> const& prescaleFactorsAlgoTrig, edm::Event const& iEvent);
316  };
317 
318 } // namespace l1t
319 
320 #endif
BXVector< const l1t::Muon * > * m_candL1Mu
Definition: GlobalBoard.h:230
BXVector< const l1t::EtSum * > * m_candL1EtSumZdc
Definition: GlobalBoard.h:236
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:231
static constexpr size_t m_singlestep
Definition: GlobalBoard.h:287
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
void setAXOL1TLModelVersion(std::string axol1tlModelVersion)
Definition: GlobalBoard.cc:116
static std::vector< PrescaleCounter > prescaleCountersWithSemirandomInitialCounter(std::vector< double > const &prescaleFactorsAlgoTrig, edm::Event const &iEvent)
BXVector< const l1t::L1Candidate * > * m_candL1EG
Definition: GlobalBoard.h:232
std::string m_axol1tlModelVersion
Definition: GlobalBoard.h:247
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:223
unsigned long long m_l1MuTriggerScalesCacheID
Definition: GlobalBoard.h:224
delete x;
Definition: CaloConfig.h:22
void setBxLast(int bx)
Definition: GlobalBoard.cc:113
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)
bool m_semiRandomInitialPSCounters
Definition: GlobalBoard.h:282
void printGmtData(const int iBxInEvent) const
print received Muon dataWord
unsigned int m_currentLumi
Definition: GlobalBoard.h:257
unsigned long long m_l1GtMenuCacheID
Definition: GlobalBoard.h:217
static std::vector< PrescaleCounter > prescaleCounters(std::vector< double > const &prescaleFactorsAlgoTrig)
void setVerbosity(const int verbosity)
Definition: GlobalBoard.h:210
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlDecisionWord
Definition: GlobalBoard.h:250
int m_verbosity
verbosity level
Definition: GlobalBoard.h:261
int iEvent
Definition: GenABIO.cc:224
unsigned int m_boardEventCount
Definition: GlobalBoard.h:272
BXVector< const l1t::EtSum * > * m_candL1EtSum
Definition: GlobalBoard.h:235
PrescaleCounter(double prescale, size_t const initial_counter=0)
Definition: GlobalBoard.h:294
const TriggerMenu * m_l1GtMenu
Definition: GlobalBoard.h:216
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:220
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:501
void reset()
clear uGT
unsigned long long m_l1CaloGeometryCacheID
Definition: GlobalBoard.h:221
const BXVector< const GlobalExtBlk * > * getCandL1External() const
pointer to External data list
Definition: GlobalBoard.h:173
BXVector< const l1t::L1Candidate * > * m_candL1Jet
Definition: GlobalBoard.h:234
std::vector< std::vector< PrescaleCounter > > m_prescaleCounterAlgoTrig
Definition: GlobalBoard.h:308
const int verbosity
void receiveExternalData(const edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk >> &, const bool receiveExt)
Definition: GlobalBoard.cc:464
GlobalAlgBlk m_uGtAlgBlk
Definition: GlobalBoard.h:252
BXVector< const GlobalExtBlk * > * m_candL1External
Definition: GlobalBoard.h:237
void setBxFirst(int bx)
Definition: GlobalBoard.cc:111
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:146
virtual ~GlobalBoard()
Definition: GlobalBoard.cc:99
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:120
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlAlgorithmOR
Definition: GlobalBoard.h:249
bool m_resetPSCountersEachLumiSec
Definition: GlobalBoard.h:279
void receiveMuonShowerObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::MuonShower >> &, const bool receiveMuShower, const int nrL1MuShower)
Definition: GlobalBoard.cc:400
void receiveMuonObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon >> &, const bool receiveMu, const int nrL1Mu)
Definition: GlobalBoard.cc:353
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:233
std::vector< AlgorithmEvaluation::ConditionEvaluationMap > m_conditionResultMaps
Definition: GlobalBoard.h:255