CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtUtils.h
Go to the documentation of this file.
1 #ifndef GlobalTriggerAnalyzer_L1GtUtils_h
2 #define GlobalTriggerAnalyzer_L1GtUtils_h
3 
20 // system include files
21 #include <string>
22 #include <utility>
23 
24 // user include files
25 
27 
31 
34 
36 
37 // forward declarations
40 class L1GtTriggerMask;
41 class L1GtTriggerMenu;
42 
45 
46 // class declaration
47 
48 class L1GtUtils {
49 
50 public:
51 
53  explicit L1GtUtils();
54 
56  virtual ~L1GtUtils();
57 
58 public:
59 
62  };
63 
80 
81  public:
83 
87 
91  const edm::InputTag&, const edm::InputTag&);
92 
95 
96  public:
97 
99  inline bool isValid() {
101  }
102 
105  const int logicalExpressionRunUpdate(const edm::Run&,
106  const edm::EventSetup&, const std::string&);
107  //
109  const int logicalExpressionRunUpdate(const edm::Run&,
110  const edm::EventSetup&);
111 
113 
114  inline const std::vector<L1GtLogicParser::OperandToken>& expL1Triggers() {
115  return m_expL1Triggers;
116  }
117  const std::vector<std::pair<std::string, bool> >& decisionsBeforeMask();
118  const std::vector<std::pair<std::string, bool> >& decisionsAfterMask();
119  const std::vector<std::pair<std::string, int> >& prescaleFactors();
120  const std::vector<std::pair<std::string, int> >& triggerMasks();
121 
122  const std::vector<std::pair<std::string, int> >& errorCodes(
123  const edm::Event&);
124 
125  private:
126 
129  bool initialize();
130 
132  void reset(const std::vector<std::pair<std::string, bool> >&) const;
133  void reset(const std::vector<std::pair<std::string, int> >&) const;
134 
135  void
136  l1Results(const edm::Event& iEvent,
137  const edm::InputTag& l1GtRecordInputTag,
138  const edm::InputTag& l1GtReadoutRecordInputTag);
139 
140  private:
141 
143 
146 
148 
151 
152  private:
153 
154  // private members
155 
158 
161 
164 
168 
171 
172  std::vector<L1GtLogicParser::OperandToken> m_expL1Triggers;
174 
176  std::vector<L1GtUtils::TriggerCategory> m_expTriggerCategory;
177 
180 
183  std::vector<bool> m_expTriggerInMenu;
184 
186  std::vector<std::pair<std::string, bool> > m_decisionsBeforeMask;
187  std::vector<std::pair<std::string, bool> > m_decisionsAfterMask;
188  std::vector<std::pair<std::string, int> > m_prescaleFactors;
189  std::vector<std::pair<std::string, int> > m_triggerMasks;
190  std::vector<std::pair<std::string, int> > m_errorCodes;
191 
192  };
193 
194 public:
195 
197 
198  // enum to string for TriggerCategory
199  const std::string triggerCategory(const TriggerCategory&) const;
200 
203 
205 
209 
211 
214  void getL1GtRunCache(const edm::Run&, const edm::EventSetup&, const bool,
215  const bool, const edm::InputTag&);
217  void getL1GtRunCache(const edm::Run&, const edm::EventSetup&, const bool,
218  const bool);
219 
222  void getL1GtRunCache(const edm::Event&, const edm::EventSetup&, const bool,
223  const bool, const edm::InputTag&);
225  void getL1GtRunCache(const edm::Event&, const edm::EventSetup&, const bool,
226  const bool);
227 
232  edm::InputTag& l1GtRecordInputTag,
233  edm::InputTag& l1GtReadoutRecordInputTag) const;
234 
236  void getL1GtTriggerMenuLiteInputTag(const edm::Run& iRun,
237  edm::InputTag& l1GtTriggerMenuLiteInputTag) const;
238 
242  }
243 
246  }
247 
250  }
251 
260 
261  const bool l1AlgoTechTrigBitNumber(const std::string& nameAlgoTechTrig,
262  TriggerCategory& trigCategory, int& bitNumber) const;
263 
269 
270  const bool l1TriggerNameFromBit(const int& bitNumber,
271  const TriggerCategory& trigCategory, std::string& aliasL1Trigger,
272  std::string& nameL1Trigger) const;
273 
286 
287  const int
288  l1Results(const edm::Event& iEvent,
289  const edm::InputTag& l1GtRecordInputTag,
290  const edm::InputTag& l1GtReadoutRecordInputTag,
291  const std::string& nameAlgoTechTrig,
293  int& prescaleFactor, int& triggerMask) const;
294 
306 
307  const int
308  l1Results(const edm::Event& iEvent,
309  const std::string& nameAlgoTechTrig,
311  int& prescaleFactor, int& triggerMask) const;
312 
327 
329  const bool decisionBeforeMask(const edm::Event& iEvent,
330  const edm::InputTag& l1GtRecordInputTag,
331  const edm::InputTag& l1GtReadoutRecordInputTag,
332  const std::string& nameAlgoTechTrig, int& errorCode) const;
333 
334  const bool decisionBeforeMask(const edm::Event& iEvent,
335  const std::string& nameAlgoTechTrig, int& errorCode) const;
336 
338  const bool decisionAfterMask(const edm::Event& iEvent,
339  const edm::InputTag& l1GtRecordInputTag,
340  const edm::InputTag& l1GtReadoutRecordInputTag,
341  const std::string& nameAlgoTechTrig, int& errorCode) const;
342 
343  const bool decisionAfterMask(const edm::Event& iEvent,
344  const std::string& nameAlgoTechTrig, int& errorCode) const;
345 
348  const bool decision(const edm::Event& iEvent,
349  const edm::InputTag& l1GtRecordInputTag,
350  const edm::InputTag& l1GtReadoutRecordInputTag,
351  const std::string& nameAlgoTechTrig, int& errorCode) const;
352 
353  const bool decision(const edm::Event& iEvent,
354  const std::string& nameAlgoTechTrig, int& errorCode) const;
355 
357  const int prescaleFactor(const edm::Event& iEvent,
358  const edm::InputTag& l1GtRecordInputTag,
359  const edm::InputTag& l1GtReadoutRecordInputTag,
360  const std::string& nameAlgoTechTrig, int& errorCode) const;
361 
362  const int prescaleFactor(const edm::Event& iEvent,
363  const std::string& nameAlgoTechTrig, int& errorCode) const;
364 
366  const int triggerMask(const edm::Event& iEvent,
367  const edm::InputTag& l1GtRecordInputTag,
368  const edm::InputTag& l1GtReadoutRecordInputTag,
369  const std::string& nameAlgoTechTrig, int& errorCode) const;
370 
371  const int triggerMask(const edm::Event& iEvent,
372  const std::string& nameAlgoTechTrig, int& errorCode) const;
373 
376  const int
377  triggerMask(const std::string& nameAlgoTechTrig, int& errorCode) const;
378 
383 
384  const int prescaleFactorSetIndex(const edm::Event& iEvent,
385  const edm::InputTag& l1GtRecordInputTag,
386  const edm::InputTag& l1GtReadoutRecordInputTag,
387  const TriggerCategory& trigCategory, int& errorCode) const;
388 
389  const int prescaleFactorSetIndex(const edm::Event& iEvent,
390  const TriggerCategory& trigCategory, int& errorCode) const;
391 
392 
396 
397  const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent,
398  const edm::InputTag& l1GtRecordInputTag,
399  const edm::InputTag& l1GtReadoutRecordInputTag,
400  const TriggerCategory& trigCategory, int& errorCode);
401 
402  const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent,
403  const TriggerCategory& trigCategory, int& errorCode);
404 
405 
408  const std::vector<unsigned int>& triggerMaskSet(
409  const TriggerCategory& trigCategory, int& errorCode);
410 
411 
413  const std::string& l1TriggerMenu() const;
414 
417 
419  const L1GtTriggerMenu* ptrL1TriggerMenuEventSetup(int& errorCode);
420 
422  const L1GtTriggerMenuLite* ptrL1GtTriggerMenuLite(int& errorCode);
423 
426  const bool availableL1Configuration(int& errorCode, int& l1ConfCode) const;
427 
428 private:
429 
430  static const std::string EmptyString;
431  static const int L1GtNotValidError;
432 
436  const bool trigResult(const DecisionWord& decWord, const int bitNumber,
437  const std::string& nameAlgoTechTrig,
438  const TriggerCategory& trigCategory, int& errorCode) const;
439 
440 private:
441 
443 
446  unsigned long long m_l1GtStableParCacheID;
447 
450 
453 
456  unsigned long long m_l1GtPfAlgoCacheID;
457 
459  unsigned long long m_l1GtPfTechCacheID;
460 
461  const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
462  const std::vector<std::vector<int> >* m_prescaleFactorsTechTrig;
463 
466  unsigned long long m_l1GtTmAlgoCacheID;
467 
469  unsigned long long m_l1GtTmTechCacheID;
470 
472  unsigned long long m_l1GtTmVetoAlgoCacheID;
473 
475  unsigned long long m_l1GtTmVetoTechCacheID;
476 
477  const std::vector<unsigned int>* m_triggerMaskAlgoTrig;
478  const std::vector<unsigned int>* m_triggerMaskTechTrig;
479 
480  const std::vector<unsigned int>* m_triggerMaskVetoAlgoTrig;
481  const std::vector<unsigned int>* m_triggerMaskVetoTechTrig;
482 
483  // trigger menu
485  unsigned long long m_l1GtMenuCacheID;
486 
490 
492 
494 
495 
498 
502 
503  const std::vector<unsigned int>* m_triggerMaskAlgoTrigLite;
504  const std::vector<unsigned int>* m_triggerMaskTechTrigLite;
505 
506  const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrigLite;
507  const std::vector<std::vector<int> >* m_prescaleFactorsTechTrigLite;
508 
510 
513 
515 
519 
523 
524 
525 private:
526 
528  unsigned int m_physicsDaqPartition;
529 
530  std::vector<unsigned int> m_triggerMaskSet;
531  std::vector<int> m_prescaleFactorSet;
532 
536 
537 };
538 
539 #endif /*GlobalTriggerAnalyzer_L1GtUtils_h*/
bool m_retrieveL1GtTriggerMenuLite
Definition: L1GtUtils.h:535
edm::RunID m_runIDCache
run cache ID
Definition: L1GtUtils.h:521
bool m_validLogicalExpression
true if the logical expression uses accepted L1GtLogicParser operators
Definition: L1GtUtils.h:163
const bool l1TriggerNameFromBit(const int &bitNumber, const TriggerCategory &trigCategory, std::string &aliasL1Trigger, std::string &nameL1Trigger) const
Definition: L1GtUtils.cc:677
const bool decisionAfterMask(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision after trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1413
LogicalExpressionL1Results(const std::string &, L1GtUtils &)
constructor(s)
Definition: L1GtUtils.cc:2422
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
Definition: L1GtUtils.h:186
const int l1Results(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, bool &decisionBeforeMask, bool &decisionAfterMask, int &prescaleFactor, int &triggerMask) const
Definition: L1GtUtils.cc:887
std::vector< unsigned int > m_triggerMaskSet
Definition: L1GtUtils.h:530
unsigned long long m_l1GtMenuCacheID
Definition: L1GtUtils.h:485
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
Definition: L1GtUtils.h:477
const int logicalExpressionRunUpdate(const edm::Run &, const edm::EventSetup &, const std::string &)
Definition: L1GtUtils.cc:2580
const edm::InputTag & provL1GtReadoutRecordInputTag()
Definition: L1GtUtils.h:244
edm::InputTag m_provL1GtReadoutRecordInputTag
Definition: L1GtUtils.h:517
std::vector< L1GtLogicParser::OperandToken > m_expL1Triggers
Definition: L1GtUtils.h:172
void retrieveL1GtTriggerMenuLite(const edm::Run &, const edm::InputTag &)
retrieve L1GtTriggerMenuLite (per run product) and cache it to improve the speed
Definition: L1GtUtils.cc:271
const L1GtTriggerMenuLite * ptrL1GtTriggerMenuLite(int &errorCode)
return a pointer to the L1GtTriggerMenuLite product
Definition: L1GtUtils.cc:2258
int m_l1ConfCode
code for L1 trigger configuration
Definition: L1GtUtils.h:157
const std::vector< unsigned int > * m_triggerMaskTechTrig
Definition: L1GtUtils.h:478
void l1Results(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag)
Definition: L1GtUtils.cc:2799
const L1GtTriggerMask * m_l1GtTmVetoTech
Definition: L1GtUtils.h:474
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
const bool l1AlgoTechTrigBitNumber(const std::string &nameAlgoTechTrig, TriggerCategory &trigCategory, int &bitNumber) const
Definition: L1GtUtils.cc:550
TriggerCategory
Definition: L1GtUtils.h:60
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
Definition: L1GtUtils.cc:2295
edm::InputTag m_provL1GtTriggerMenuLiteInputTag
Definition: L1GtUtils.h:518
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrigLite
Definition: L1GtUtils.h:506
const edm::InputTag & provL1GtRecordInputTag()
return the input tags found from provenance
Definition: L1GtUtils.h:240
virtual ~L1GtUtils()
destructor
Definition: L1GtUtils.cc:86
const edm::InputTag & provL1GtTriggerMenuLiteInputTag()
Definition: L1GtUtils.h:248
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks &amp; veto masks
Definition: L1GtUtils.h:465
const AlgorithmMap * m_algorithmMap
Definition: L1GtUtils.h:487
const std::vector< std::pair< std::string, int > > & prescaleFactors()
Definition: L1GtUtils.cc:2723
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1GtUtils.h:462
const L1GtStableParameters * m_l1GtStablePar
event setup cached stuff
Definition: L1GtUtils.h:445
unsigned long long m_l1GtPfAlgoCacheID
Definition: L1GtUtils.h:456
const std::vector< unsigned int > & triggerMaskSet(const TriggerCategory &trigCategory, int &errorCode)
Definition: L1GtUtils.cc:2081
const std::vector< std::pair< std::string, int > > & triggerMasks()
Definition: L1GtUtils.cc:2736
const std::string & l1TriggerMenu() const
return the L1 trigger menu name
Definition: L1GtUtils.cc:2180
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1GtUtils.h:461
const bool decisionBeforeMask(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision before trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1376
const L1GtTriggerMenuLite::L1TriggerMap * m_algorithmAliasMapLite
Definition: L1GtUtils.h:500
std::map< unsigned int, std::string > L1TriggerMap
map containing the physics algorithms or the technical triggers
const L1GtTriggerMenuLite::L1TriggerMap * m_algorithmMapLite
Definition: L1GtUtils.h:499
unsigned long long m_l1GtTmVetoTechCacheID
Definition: L1GtUtils.h:475
const std::vector< std::pair< std::string, bool > > & decisionsAfterMask()
Definition: L1GtUtils.cc:2710
std::vector< std::pair< std::string, int > > m_errorCodes
Definition: L1GtUtils.h:190
void getL1GtRecordInputTag(const edm::Event &iEvent, edm::InputTag &l1GtRecordInputTag, edm::InputTag &l1GtReadoutRecordInputTag) const
Definition: L1GtUtils.cc:429
std::vector< std::pair< std::string, int > > m_triggerMasks
Definition: L1GtUtils.h:189
std::vector< std::pair< std::string, int > > m_prescaleFactors
Definition: L1GtUtils.h:188
const std::vector< std::pair< std::string, bool > > & decisionsBeforeMask()
Definition: L1GtUtils.cc:2697
int iEvent
Definition: GenABIO.cc:243
const bool decision(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
Definition: L1GtUtils.cc:1450
edm::InputTag m_provL1GtRecordInputTag
cached input tags from provenance - they are updated once per run only
Definition: L1GtUtils.h:516
edm::RunID m_provRunIDCache
Definition: L1GtUtils.h:522
const std::string & l1TriggerMenuImplementation() const
return the L1 trigger menu implementation
Definition: L1GtUtils.cc:2205
const AlgorithmMap * m_algorithmAliasMap
Definition: L1GtUtils.h:488
unsigned long long m_l1GtTmTechCacheID
Definition: L1GtUtils.h:469
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrigLite
Definition: L1GtUtils.h:507
const L1GtTriggerMask * m_l1GtTmVetoAlgo
Definition: L1GtUtils.h:471
std::vector< bool > DecisionWord
typedefs
static const std::string EmptyString
Definition: L1GtUtils.h:430
const std::string triggerCategory(const TriggerCategory &) const
public methods
Definition: L1GtUtils.cc:92
std::string m_logicalExpression
private members as input parameters
Definition: L1GtUtils.h:145
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
Definition: L1GtUtils.h:455
unsigned long long m_l1GtTmAlgoCacheID
Definition: L1GtUtils.h:466
const std::vector< int > & prescaleFactorSet(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const TriggerCategory &trigCategory, int &errorCode)
Definition: L1GtUtils.cc:1986
unsigned int m_numberTechnicalTriggers
number of technical triggers
Definition: L1GtUtils.h:452
std::vector< bool > m_expTriggerInMenu
Definition: L1GtUtils.h:183
void getL1GtTriggerMenuLiteInputTag(const edm::Run &iRun, edm::InputTag &l1GtTriggerMenuLiteInputTag) const
get the input tag for L1GtTriggerMenuLite
Definition: L1GtUtils.cc:496
const std::vector< L1GtLogicParser::OperandToken > & expL1Triggers()
list of triggers in the logical expression, trigger decisions, prescale factors and masks...
Definition: L1GtUtils.h:114
bool m_retrieveL1EventSetup
flags to check which method was used to retrieve L1 trigger configuration
Definition: L1GtUtils.h:534
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:113
unsigned int m_physicsDaqPartition
index of physics DAQ partition
Definition: L1GtUtils.h:528
unsigned int m_numberAlgorithmTriggers
number of algorithm triggers
Definition: L1GtUtils.h:449
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:170
bool m_expBitsTechTrigger
flag true, if the logical expression is built from technical trigger bits
Definition: L1GtUtils.h:179
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool, const edm::InputTag &)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:313
std::vector< L1GtUtils::TriggerCategory > m_expTriggerCategory
trigger category for each L1 trigger in the logical expression
Definition: L1GtUtils.h:176
const L1GtTriggerMask * m_l1GtTmTech
Definition: L1GtUtils.h:468
const L1GtTriggerMenuLite * m_l1GtMenuLite
L1GtTriggerMenuLite cached stuff.
Definition: L1GtUtils.h:497
void reset(const std::vector< std::pair< std::string, bool > > &) const
reset for each L1 trigger the value from pair.second
Definition: L1GtUtils.cc:2783
const L1GtPrescaleFactors * m_l1GtPfTech
Definition: L1GtUtils.h:458
const AlgorithmMap * m_technicalTriggerMap
Definition: L1GtUtils.h:489
const std::vector< unsigned int > * m_triggerMaskVetoAlgoTrig
Definition: L1GtUtils.h:480
const std::vector< unsigned int > * m_triggerMaskTechTrigLite
Definition: L1GtUtils.h:504
bool m_l1GtMenuLiteValid
Definition: L1GtUtils.h:509
const std::vector< unsigned int > * m_triggerMaskAlgoTrigLite
Definition: L1GtUtils.h:503
bool m_beginRunCache
flag for call of getL1GtRunCache in beginRun
Definition: L1GtUtils.h:512
const int prescaleFactorSetIndex(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:1762
const int triggerMask(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1522
const bool trigResult(const DecisionWord &decWord, const int bitNumber, const std::string &nameAlgoTechTrig, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:2399
bool m_validL1Configuration
true if valid L1 configuration - if not, reset all quantities and return
Definition: L1GtUtils.h:160
const L1GtTriggerMenu * m_l1GtMenu
Definition: L1GtUtils.h:484
unsigned long long m_l1GtPfTechCacheID
Definition: L1GtUtils.h:459
static const int L1GtNotValidError
Definition: L1GtUtils.h:431
std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
Definition: L1GtUtils.h:187
bool m_l1EventSetupValid
Definition: L1GtUtils.h:491
unsigned long long m_l1GtTmVetoAlgoCacheID
Definition: L1GtUtils.h:472
std::vector< int > m_prescaleFactorSet
Definition: L1GtUtils.h:531
const L1GtTriggerMenu * ptrL1TriggerMenuEventSetup(int &errorCode)
return a pointer to the L1 trigger menu from event setup
Definition: L1GtUtils.cc:2230
const int prescaleFactor(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1487
unsigned long long m_l1GtStableParCacheID
Definition: L1GtUtils.h:446
L1GtUtils()
constructor
Definition: L1GtUtils.cc:50
const L1GtTriggerMenuLite::L1TriggerMap * m_technicalTriggerMapLite
Definition: L1GtUtils.h:501
bool isValid()
return true if the logical expression is syntactically correct
Definition: L1GtUtils.h:99
Definition: Run.h:36
const std::vector< unsigned int > * m_triggerMaskVetoTechTrig
Definition: L1GtUtils.h:481
const std::vector< std::pair< std::string, int > > & errorCodes(const edm::Event &)
Definition: L1GtUtils.cc:2749