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