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  const std::vector<l1t::Muon>* muonVec_bxm2,
89  const std::vector<l1t::Muon>* muonVec_bxm1);
90 
93  const bool receiveMuShower,
94  const int nrL1MuShower);
95 
96  void receiveExternalData(const edm::Event&, const edm::EDGetTokenT<BXVector<GlobalExtBlk>>&, const bool receiveExt);
97 
98  void fillAXOScore(int iBxInEvent, std::unique_ptr<AXOL1TLScoreBxCollection>& AxoScoreRecord);
99 
101  void init(const int numberPhysTriggers,
102  const int nrL1Mu,
103  const int nrL1MuShower,
104  const int nrL1EG,
105  const int nrL1Tau,
106  const int nrL1Jet,
107  int bxFirst,
108  int bxLast);
109 
111  void runGTL(const edm::Event& iEvent,
112  const edm::EventSetup& evSetup,
113  const TriggerMenu* m_l1GtMenu,
114  const bool produceL1GtObjectMapRecord,
115  const int iBxInEvent,
116  std::unique_ptr<GlobalObjectMapRecord>& gtObjectMapRecord, //GTO
117  const unsigned int numberPhysTriggers,
118  const int nrL1Mu,
119  const int nrL1MuShower,
120  const int nrL1EG,
121  const int nrL1Tau,
122  const int nrL1Jet);
123 
125  void runFDL(const edm::Event& iEvent,
126  const int iBxInEvent,
127  const int totalBxInEvent,
128  const unsigned int numberPhysTriggers,
129  const std::vector<double>& prescaleFactorsAlgoTrig,
130  const std::vector<unsigned int>& triggerMaskAlgoTrig,
131  const std::vector<int>& triggerMaskVetoAlgoTrig,
132  const bool algorithmTriggersUnprescaled,
133  const bool algorithmTriggersUnmasked);
134 
136  void fillAlgRecord(int iBxInEvent,
137  std::unique_ptr<GlobalAlgBlkBxCollection>& uGtAlgRecord,
138  int prescaleSet,
139  int menuUUID,
140  int firmwareUUID);
141 
143  void reset();
144  void resetMu();
145  void resetMuonShower();
146  void resetCalo();
147  void resetExternal();
148 
150  void printGmtData(const int iBxInEvent) const;
151 
153  inline const std::bitset<GlobalAlgBlk::maxPhysicsTriggers>& getDecisionWord() const { return m_gtlDecisionWord; }
154 
156  inline const std::bitset<GlobalAlgBlk::maxPhysicsTriggers>& getAlgorithmOR() const { return m_gtlAlgorithmOR; }
157 
159  inline const BXVector<const l1t::Muon*>* getCandL1Mu() const { return m_candL1Mu; }
160 
163 
165  inline const BXVector<const l1t::L1Candidate*>* getCandL1EG() const { return m_candL1EG; }
166 
169 
172 
174  inline const BXVector<const l1t::EtSum*>* getCandL1EtSum() const { return m_candL1EtSum; }
175 
178 
181 
182  inline const float getCICADAScore() const { return m_cicadaScore; }
183 
184  /* Drop individual EtSums for Now
186  inline const l1t::EtSum* getCandL1ETM() const
187  {
188  return m_candETM;
189  }
190 
192  inline const l1t::EtSum* getCandL1ETT() const
193  {
194  return m_candETT;
195  }
196 
198  inline const l1t::EtSum* getCandL1HTT() const
199  {
200  return m_candHTT;
201  }
202 
204  inline const l1t::EtSum* getCandL1HTM() const
205  {
206  return m_candHTM;
207  }
208 */
209 
210  void setBxFirst(int bx);
211  void setBxLast(int bx);
212 
215 
216  void setCICADAScore(float val) { m_cicadaScore = val; }
217 
218  public:
219  inline void setVerbosity(const int verbosity) { m_verbosity = verbosity; }
220 
221  inline void enableAXOScoreSaving(bool savescore) { m_saveAXOScore = savescore; }
222 
223  private:
224  // cached stuff
225 
226  // trigger menu
228  unsigned long long m_l1GtMenuCacheID;
229 
230  // L1 scales (phi, eta) for Mu, Calo and EnergySum objects
232  unsigned long long m_l1CaloGeometryCacheID;
233 
235  unsigned long long m_l1MuTriggerScalesCacheID;
236 
237  // conversions for eta and phi
238  // L1GtEtaPhiConversions* m_gtEtaPhiConversions;
239 
240  private:
249 
250  // BXVector<const l1t::EtSum*>* m_candETM;
251  // BXVector<const l1t::EtSum*>* m_candETT;
252  // BXVector<const l1t::EtSum*>* m_candHTM;
253  // BXVector<const l1t::EtSum*>* m_candHTT;
254 
257 
258  float m_cicadaScore = 0.0;
259 
260  std::bitset<GlobalAlgBlk::maxPhysicsTriggers> m_gtlAlgorithmOR;
261  std::bitset<GlobalAlgBlk::maxPhysicsTriggers> m_gtlDecisionWord;
262 
264 
265  //for optional software-only saving of axol1tl score
266  AXOL1TLScore m_uGtAXOScore; //score dataformat
267  float m_storedAXOScore = -999.0; //score from cond class
268  bool m_saveAXOScore = false;
269 
270  // cache of maps
271  std::vector<AlgorithmEvaluation::ConditionEvaluationMap> m_conditionResultMaps;
272 
273  unsigned int m_currentLumi;
274 
275  private:
279 
280  // Flags for the OR of all algorithms at various stages. (Single bx)
286 
287  // Counter for number of events seen by this board
288  unsigned int m_boardEventCount;
289 
290  // Information about board
293 
294  // whether we reset the prescales each lumi or not
296 
297  // start the PS counter from a random value between [1,PS] instead of PS
299 
300  // step-size in prescale counter corresponding to 10^p,
301  // where p is the precision allowed for non-integer prescales;
302  // since the introduction of L1T fractional prescales, p == 2
303  static constexpr size_t m_singlestep = 100;
304 
305  // struct to increment the prescale according to fractional prescale logic in firmware
307  size_t const prescale_count;
309 
310  PrescaleCounter(double prescale, size_t const initial_counter = 0)
311  : prescale_count(std::lround(prescale * m_singlestep)), trigger_counter(initial_counter) {
312  if (prescale_count != 0 and (prescale_count < m_singlestep or prescale < 0)) {
313  throw cms::Exception("PrescaleCounterConstructor")
314  << "invalid initialisation of PrescaleCounter: prescale = " << prescale
315  << ", prescale_count = " << prescale_count << " (< " << m_singlestep << " = m_singlestep)";
316  }
317  }
318 
319  // function to increment the prescale counter and return the decision
320  bool accept();
321  };
322 
323  // prescale counters: NumberPhysTriggers counters per bunch cross in event
324  std::vector<std::vector<PrescaleCounter>> m_prescaleCounterAlgoTrig;
325 
326  // create prescale counters, initialising trigger_counter to zero
327  static std::vector<PrescaleCounter> prescaleCounters(std::vector<double> const& prescaleFactorsAlgoTrig);
328 
329  // create prescale counters, initialising trigger_counter to a semirandom number between 0 and prescale_count - 1 inclusive
330  static std::vector<PrescaleCounter> prescaleCountersWithSemirandomInitialCounter(
331  std::vector<double> const& prescaleFactorsAlgoTrig, edm::Event const& iEvent);
332  };
333 
334 } // namespace l1t
335 
336 #endif
BXVector< const l1t::Muon * > * m_candL1Mu
Definition: GlobalBoard.h:241
BXVector< const l1t::EtSum * > * m_candL1EtSumZdc
Definition: GlobalBoard.h:247
const std::bitset< GlobalAlgBlk::maxPhysicsTriggers > & getDecisionWord() const
return decision
Definition: GlobalBoard.h:153
const std::bitset< GlobalAlgBlk::maxPhysicsTriggers > & getAlgorithmOR() const
return algorithm OR decision
Definition: GlobalBoard.h:156
const BXVector< std::shared_ptr< l1t::MuonShower > > * getCandL1MuShower() const
return global muon trigger candidate
Definition: GlobalBoard.h:162
BXVector< std::shared_ptr< l1t::MuonShower > > * m_candL1MuShower
Definition: GlobalBoard.h:242
const float getCICADAScore() const
Definition: GlobalBoard.h:182
static constexpr size_t m_singlestep
Definition: GlobalBoard.h:303
void setSemiRandomInitialPSCounters(bool val)
Definition: GlobalBoard.h:214
const BXVector< const l1t::EtSum * > * getCandL1EtSumZdc() const
pointer to ZDC EtSum data list
Definition: GlobalBoard.h:177
static std::vector< PrescaleCounter > prescaleCountersWithSemirandomInitialCounter(std::vector< double > const &prescaleFactorsAlgoTrig, edm::Event const &iEvent)
BXVector< const l1t::L1Candidate * > * m_candL1EG
Definition: GlobalBoard.h:243
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:234
unsigned long long m_l1MuTriggerScalesCacheID
Definition: GlobalBoard.h:235
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:171
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:298
void printGmtData(const int iBxInEvent) const
print received Muon dataWord
unsigned int m_currentLumi
Definition: GlobalBoard.h:273
unsigned long long m_l1GtMenuCacheID
Definition: GlobalBoard.h:228
static std::vector< PrescaleCounter > prescaleCounters(std::vector< double > const &prescaleFactorsAlgoTrig)
void enableAXOScoreSaving(bool savescore)
Definition: GlobalBoard.h:221
void setVerbosity(const int verbosity)
Definition: GlobalBoard.h:219
std::bitset< GlobalAlgBlk::maxPhysicsTriggers > m_gtlDecisionWord
Definition: GlobalBoard.h:261
int m_verbosity
verbosity level
Definition: GlobalBoard.h:277
void receiveMuonObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::Muon >> &, const bool receiveMu, const int nrL1Mu, const std::vector< l1t::Muon > *muonVec_bxm2, const std::vector< l1t::Muon > *muonVec_bxm1)
Definition: GlobalBoard.cc:376
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:288
BXVector< const l1t::EtSum * > * m_candL1EtSum
Definition: GlobalBoard.h:246
PrescaleCounter(double prescale, size_t const initial_counter=0)
Definition: GlobalBoard.h:310
const TriggerMenu * m_l1GtMenu
Definition: GlobalBoard.h:227
AXOL1TLScore m_uGtAXOScore
Definition: GlobalBoard.h:266
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:231
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:571
void reset()
clear uGT
unsigned long long m_l1CaloGeometryCacheID
Definition: GlobalBoard.h:232
const BXVector< const GlobalExtBlk * > * getCandL1External() const
pointer to External data list
Definition: GlobalBoard.h:180
BXVector< const l1t::L1Candidate * > * m_candL1Jet
Definition: GlobalBoard.h:245
std::vector< std::vector< PrescaleCounter > > m_prescaleCounterAlgoTrig
Definition: GlobalBoard.h:324
const int verbosity
void receiveExternalData(const edm::Event &, const edm::EDGetTokenT< BXVector< GlobalExtBlk >> &, const bool receiveExt)
Definition: GlobalBoard.cc:518
GlobalAlgBlk m_uGtAlgBlk
Definition: GlobalBoard.h:263
BXVector< const GlobalExtBlk * > * m_candL1External
Definition: GlobalBoard.h:248
void setBxFirst(int bx)
Definition: GlobalBoard.cc:114
float m_storedAXOScore
Definition: GlobalBoard.h:267
void setCICADAScore(float val)
Definition: GlobalBoard.h:216
const BXVector< const l1t::L1Candidate * > * getCandL1Jet() const
pointer to Jet data list
Definition: GlobalBoard.h:168
void setResetPSCountersEachLumiSec(bool val)
Definition: GlobalBoard.h:213
const BXVector< const l1t::EtSum * > * getCandL1EtSum() const
pointer to EtSum data list
Definition: GlobalBoard.h:174
const BXVector< const l1t::Muon * > * getCandL1Mu() const
return global muon trigger candidate
Definition: GlobalBoard.h:159
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:260
bool m_resetPSCountersEachLumiSec
Definition: GlobalBoard.h:295
void receiveMuonShowerObjectData(const edm::Event &, const edm::EDGetTokenT< BXVector< l1t::MuonShower >> &, const bool receiveMuShower, const int nrL1MuShower)
Definition: GlobalBoard.cc:454
const BXVector< const l1t::L1Candidate * > * getCandL1EG() const
pointer to EG data list
Definition: GlobalBoard.h:165
BXVector< const l1t::L1Candidate * > * m_candL1Tau
Definition: GlobalBoard.h:244
void fillAXOScore(int iBxInEvent, std::unique_ptr< AXOL1TLScoreBxCollection > &AxoScoreRecord)
Definition: GlobalBoard.cc:555
std::vector< AlgorithmEvaluation::ConditionEvaluationMap > m_conditionResultMaps
Definition: GlobalBoard.h:271