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