CMS 3D CMS Logo

L1GtUtils.h
Go to the documentation of this file.
1 #ifndef GlobalTriggerAnalyzer_L1GtUtils_h
2 #define GlobalTriggerAnalyzer_L1GtUtils_h
3 
18 // system include files
19 #include <memory>
20 #include <string>
21 #include <utility>
22 
23 // user include files
25 
29 
32 
34 
36 
37 // forward declarations
40 class L1GtTriggerMask;
41 class L1GtTriggerMenu;
42 
45 
46 // class declaration
47 
48 class L1GtUtils {
49 
50 public:
51 
52  // Using this constructor will require InputTags to be specified in the configuration
56 
57  L1GtUtils(edm::ParameterSet const& pset,
59  bool useL1GtTriggerMenuLite);
60 
61  // Using this constructor will cause it to look for valid InputTags in
62  // the following ways in the specified order until they are found.
63  // 1. The configuration
64  // 2. Search all products from the preferred input tags for the required type
65  // 3. Search all products from any other process for the required type
66  template <typename T>
67  L1GtUtils(edm::ParameterSet const& pset,
69  bool useL1GtTriggerMenuLite,
70  T& module);
71 
72  template <typename T>
73  L1GtUtils(edm::ParameterSet const& pset,
75  bool useL1GtTriggerMenuLite,
76  T& module);
77 
78  // Using this constructor will cause it to look for valid InputTags in
79  // the following ways in the specified order until they are found.
80  // 1. The constructor arguments
81  // 2. The configuration
82  // 3. Search all products from the preferred input tags for the required type
83  // 4. Search all products from any other process for the required type
84  template <typename T>
85  L1GtUtils(edm::ParameterSet const& pset,
87  bool useL1GtTriggerMenuLite,
88  T& module,
92 
93  template <typename T>
94  L1GtUtils(edm::ParameterSet const& pset,
96  bool useL1GtTriggerMenuLite,
97  T& module,
98  edm::InputTag const& l1GtRecordInputTag,
99  edm::InputTag const& l1GtReadoutRecordInputTag,
100  edm::InputTag const& l1GtTriggerMenuLiteInputTag);
101 
103  virtual ~L1GtUtils();
104 
107  }
108 
109 public:
110 
113  };
114 
131 
132  public:
134 
137 
140 
141  public:
142 
144  inline bool isValid() {
146  }
147 
150  const int logicalExpressionRunUpdate(const edm::Run&,
151  const edm::EventSetup&, const std::string&);
152  //
154  const int logicalExpressionRunUpdate(const edm::Run&,
155  const edm::EventSetup&);
156 
158 
159  inline const std::vector<L1GtLogicParser::OperandToken>& expL1Triggers() {
160  return m_expL1Triggers;
161  }
162  const std::vector<std::pair<std::string, bool> >& decisionsBeforeMask();
163  const std::vector<std::pair<std::string, bool> >& decisionsAfterMask();
164  const std::vector<std::pair<std::string, int> >& prescaleFactors();
165  const std::vector<std::pair<std::string, int> >& triggerMasks();
166 
167  const std::vector<std::pair<std::string, int> >& errorCodes(
168  const edm::Event&);
169 
170  private:
171 
174  bool initialize();
175 
177  void reset(const std::vector<std::pair<std::string, bool> >&) const;
178  void reset(const std::vector<std::pair<std::string, int> >&) const;
179 
180  void l1Results(const edm::Event& iEvent);
181 
182  private:
183 
185 
188 
190 
191  private:
192 
193  // private members
194 
197 
200 
203 
206 
207  std::vector<L1GtLogicParser::OperandToken> m_expL1Triggers;
209 
211  std::vector<L1GtUtils::TriggerCategory> m_expTriggerCategory;
212 
215 
218  std::vector<bool> m_expTriggerInMenu;
219 
221  std::vector<std::pair<std::string, bool> > m_decisionsBeforeMask;
222  std::vector<std::pair<std::string, bool> > m_decisionsAfterMask;
223  std::vector<std::pair<std::string, int> > m_prescaleFactors;
224  std::vector<std::pair<std::string, int> > m_triggerMasks;
225  std::vector<std::pair<std::string, int> > m_errorCodes;
226 
227  };
228 
229 public:
230 
232 
233  // enum to string for TriggerCategory
234  const std::string triggerCategory(const TriggerCategory&) const;
235 
238 
240 
243 
245 
247  void getL1GtRunCache(const edm::Run&, const edm::EventSetup&, const bool,
248  const bool);
249 
251  void getL1GtRunCache(const edm::Event&, const edm::EventSetup&, const bool,
252  const bool);
253 
262 
263  const bool l1AlgoTechTrigBitNumber(const std::string& nameAlgoTechTrig,
264  TriggerCategory& trigCategory, int& bitNumber) const;
265 
271 
272  const bool l1TriggerNameFromBit(const int& bitNumber,
273  const TriggerCategory& trigCategory, std::string& aliasL1Trigger,
274  std::string& nameL1Trigger) const;
275 
286 
287  const int l1Results(const edm::Event& iEvent,
288  const std::string& nameAlgoTechTrig,
290  int& prescaleFactor, int& triggerMask) const;
291 
301 
303  const bool decisionBeforeMask(const edm::Event& iEvent,
304  const std::string& nameAlgoTechTrig, int& errorCode) const;
305 
307  const bool decisionAfterMask(const edm::Event& iEvent,
308  const std::string& nameAlgoTechTrig, int& errorCode) const;
309 
312  const bool decision(const edm::Event& iEvent,
313  const std::string& nameAlgoTechTrig, int& errorCode) const;
314 
316  const int prescaleFactor(const edm::Event& iEvent,
317  const std::string& nameAlgoTechTrig, int& errorCode) const;
318 
320  const int triggerMask(const edm::Event& iEvent,
321  const std::string& nameAlgoTechTrig, int& errorCode) const;
322 
325  const int triggerMask(const std::string& nameAlgoTechTrig, int& errorCode) const;
326 
331 
332  const int prescaleFactorSetIndex(const edm::Event& iEvent,
333  const TriggerCategory& trigCategory, int& errorCode) const;
334 
335 
339 
340  const std::vector<int>& prescaleFactorSet(const edm::Event& iEvent,
341  const TriggerCategory& trigCategory, int& errorCode);
342 
343 
346  const std::vector<unsigned int>& triggerMaskSet(
347  const TriggerCategory& trigCategory, int& errorCode);
348 
349 
351  const std::string& l1TriggerMenu() const;
352 
355 
357  const L1GtTriggerMenu* ptrL1TriggerMenuEventSetup(int& errorCode);
358 
360  const L1GtTriggerMenuLite* ptrL1GtTriggerMenuLite(int& errorCode);
361 
364  const bool availableL1Configuration(int& errorCode, int& l1ConfCode) const;
365 
366 private:
367 
368  static const std::string EmptyString;
369  static const int L1GtNotValidError;
370 
374  const bool trigResult(const DecisionWord& decWord, const int bitNumber,
375  const std::string& nameAlgoTechTrig,
376  const TriggerCategory& trigCategory, int& errorCode) const;
377 
378 private:
379 
380  L1GtUtils();
381 
383 
386  unsigned long long m_l1GtStableParCacheID;
387 
390 
393 
396  unsigned long long m_l1GtPfAlgoCacheID;
397 
399  unsigned long long m_l1GtPfTechCacheID;
400 
401  const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrig;
402  const std::vector<std::vector<int> >* m_prescaleFactorsTechTrig;
403 
406  unsigned long long m_l1GtTmAlgoCacheID;
407 
409  unsigned long long m_l1GtTmTechCacheID;
410 
412  unsigned long long m_l1GtTmVetoAlgoCacheID;
413 
415  unsigned long long m_l1GtTmVetoTechCacheID;
416 
417  const std::vector<unsigned int>* m_triggerMaskAlgoTrig;
418  const std::vector<unsigned int>* m_triggerMaskTechTrig;
419 
420  const std::vector<unsigned int>* m_triggerMaskVetoAlgoTrig;
421  const std::vector<unsigned int>* m_triggerMaskVetoTechTrig;
422 
423  // trigger menu
425  unsigned long long m_l1GtMenuCacheID;
426 
430 
432 
434 
435 
438 
442 
443  const std::vector<unsigned int>* m_triggerMaskAlgoTrigLite;
444  const std::vector<unsigned int>* m_triggerMaskTechTrigLite;
445 
446  const std::vector<std::vector<int> >* m_prescaleFactorsAlgoTrigLite;
447  const std::vector<std::vector<int> >* m_prescaleFactorsTechTrigLite;
448 
450 
453 
456 
457 private:
458 
460  unsigned int m_physicsDaqPartition;
461 
462  std::vector<unsigned int> m_triggerMaskSet;
463  std::vector<int> m_prescaleFactorSet;
464 
468 
469  std::unique_ptr<L1GtUtilsHelper> m_l1GtUtilsHelper;
470 };
471 
472 template <typename T>
476  T& module) :
477  L1GtUtils(pset, iC, useL1GtTriggerMenuLite, module) { }
478 
479 template <typename T>
483  T& module) :
484  L1GtUtils() {
485  m_l1GtUtilsHelper.reset(new L1GtUtilsHelper(pset,
486  iC,
487  useL1GtTriggerMenuLite,
488  module));
489 }
490 
491 template <typename T>
495  T& module,
499  L1GtUtils(pset, iC, useL1GtTriggerMenuLite, module, l1GtRecordInputTag,
500  l1GtReadoutRecordInputTag, l1GtTriggerMenuLiteInputTag) { }
501 
502 template <typename T>
506  T& module,
510  L1GtUtils() {
511  m_l1GtUtilsHelper.reset(new L1GtUtilsHelper(pset,
512  iC,
513  useL1GtTriggerMenuLite,
514  module,
515  l1GtRecordInputTag,
516  l1GtReadoutRecordInputTag,
517  l1GtTriggerMenuLiteInputTag));
518 }
519 
520 #endif /*GlobalTriggerAnalyzer_L1GtUtils_h*/
bool m_retrieveL1GtTriggerMenuLite
Definition: L1GtUtils.h:467
edm::RunID m_runIDCache
run cache ID
Definition: L1GtUtils.h:455
bool m_validLogicalExpression
true if the logical expression uses accepted L1GtLogicParser operators
Definition: L1GtUtils.h:202
const bool l1TriggerNameFromBit(const int &bitNumber, const TriggerCategory &trigCategory, std::string &aliasL1Trigger, std::string &nameL1Trigger) const
Definition: L1GtUtils.cc:503
void l1Results(const edm::Event &iEvent)
Definition: L1GtUtils.cc:2408
LogicalExpressionL1Results(const std::string &, L1GtUtils &)
constructor(s)
Definition: L1GtUtils.cc:2075
std::vector< std::pair< std::string, bool > > m_decisionsBeforeMask
Definition: L1GtUtils.h:221
std::vector< unsigned int > m_triggerMaskSet
Definition: L1GtUtils.h:462
unsigned long long m_l1GtMenuCacheID
Definition: L1GtUtils.h:425
const std::vector< unsigned int > * m_triggerMaskAlgoTrig
Definition: L1GtUtils.h:417
const int logicalExpressionRunUpdate(const edm::Run &, const edm::EventSetup &, const std::string &)
Definition: L1GtUtils.cc:2197
std::vector< L1GtLogicParser::OperandToken > m_expL1Triggers
Definition: L1GtUtils.h:207
const L1GtTriggerMenuLite * ptrL1GtTriggerMenuLite(int &errorCode)
return a pointer to the L1GtTriggerMenuLite product
Definition: L1GtUtils.cc:1911
int m_l1ConfCode
code for L1 trigger configuration
Definition: L1GtUtils.h:196
const std::vector< unsigned int > * m_triggerMaskTechTrig
Definition: L1GtUtils.h:418
const L1GtTriggerMask * m_l1GtTmVetoTech
Definition: L1GtUtils.h:414
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:376
const int prescaleFactorSetIndex(const edm::Event &iEvent, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:1458
const bool availableL1Configuration(int &errorCode, int &l1ConfCode) const
Definition: L1GtUtils.cc:1948
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrigLite
Definition: L1GtUtils.h:446
virtual ~L1GtUtils()
destructor
Definition: L1GtUtils.cc:94
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks & veto masks
Definition: L1GtUtils.h:405
const AlgorithmMap * m_algorithmMap
Definition: L1GtUtils.h:427
const std::vector< std::pair< std::string, int > > & prescaleFactors()
Definition: L1GtUtils.cc:2340
const bool decision(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
Definition: L1GtUtils.cc:1208
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1GtUtils.h:402
const L1GtStableParameters * m_l1GtStablePar
event setup cached stuff
Definition: L1GtUtils.h:385
unsigned long long m_l1GtPfAlgoCacheID
Definition: L1GtUtils.h:396
const std::vector< unsigned int > & triggerMaskSet(const TriggerCategory &trigCategory, int &errorCode)
Definition: L1GtUtils.cc:1734
const std::vector< std::pair< std::string, int > > & triggerMasks()
Definition: L1GtUtils.cc:2353
const std::string & l1TriggerMenu() const
return the L1 trigger menu name
Definition: L1GtUtils.cc:1833
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1GtUtils.h:401
const L1GtTriggerMenuLite::L1TriggerMap * m_algorithmAliasMapLite
Definition: L1GtUtils.h:440
std::map< unsigned int, std::string > L1TriggerMap
map containing the physics algorithms or the technical triggers
const L1GtTriggerMenuLite::L1TriggerMap * m_algorithmMapLite
Definition: L1GtUtils.h:439
unsigned long long m_l1GtTmVetoTechCacheID
Definition: L1GtUtils.h:415
const std::vector< std::pair< std::string, bool > > & decisionsAfterMask()
Definition: L1GtUtils.cc:2327
std::vector< std::pair< std::string, int > > m_errorCodes
Definition: L1GtUtils.h:225
std::vector< std::pair< std::string, int > > m_triggerMasks
Definition: L1GtUtils.h:224
std::vector< std::pair< std::string, int > > m_prescaleFactors
Definition: L1GtUtils.h:223
const std::vector< std::pair< std::string, bool > > & decisionsBeforeMask()
Definition: L1GtUtils.cc:2314
int iEvent
Definition: GenABIO.cc:224
const std::string & l1TriggerMenuImplementation() const
return the L1 trigger menu implementation
Definition: L1GtUtils.cc:1858
const AlgorithmMap * m_algorithmAliasMap
Definition: L1GtUtils.h:428
unsigned long long m_l1GtTmTechCacheID
Definition: L1GtUtils.h:409
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrigLite
Definition: L1GtUtils.h:447
const L1GtTriggerMask * m_l1GtTmVetoAlgo
Definition: L1GtUtils.h:411
std::vector< bool > DecisionWord
typedefs
static const std::string EmptyString
Definition: L1GtUtils.h:368
const std::string triggerCategory(const TriggerCategory &) const
public methods
Definition: L1GtUtils.cc:100
std::string m_logicalExpression
private members as input parameters
Definition: L1GtUtils.h:187
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
Definition: L1GtUtils.h:395
unsigned long long m_l1GtTmAlgoCacheID
Definition: L1GtUtils.h:406
static void fillDescription(edm::ParameterSetDescription &desc)
unsigned int m_numberTechnicalTriggers
number of technical triggers
Definition: L1GtUtils.h:392
std::vector< bool > m_expTriggerInMenu
Definition: L1GtUtils.h:218
const std::vector< L1GtLogicParser::OperandToken > & expL1Triggers()
list of triggers in the logical expression, trigger decisions, prescale factors and masks...
Definition: L1GtUtils.h:159
bool m_retrieveL1EventSetup
flags to check which method was used to retrieve L1 trigger configuration
Definition: L1GtUtils.h:466
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:121
unsigned int m_physicsDaqPartition
index of physics DAQ partition
Definition: L1GtUtils.h:460
unsigned int m_numberAlgorithmTriggers
number of algorithm triggers
Definition: L1GtUtils.h:389
const int triggerMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1238
bool m_l1ResultsAlreadyCalled
set to true if the method l1Results was called once
Definition: L1GtUtils.h:205
const std::vector< int > & prescaleFactorSet(const edm::Event &iEvent, const TriggerCategory &trigCategory, int &errorCode)
Definition: L1GtUtils.cc:1662
bool m_expBitsTechTrigger
flag true, if the logical expression is built from technical trigger bits
Definition: L1GtUtils.h:214
std::vector< L1GtUtils::TriggerCategory > m_expTriggerCategory
trigger category for each L1 trigger in the logical expression
Definition: L1GtUtils.h:211
const L1GtTriggerMask * m_l1GtTmTech
Definition: L1GtUtils.h:408
const L1GtTriggerMenuLite * m_l1GtMenuLite
L1GtTriggerMenuLite cached stuff.
Definition: L1GtUtils.h:437
const bool decisionBeforeMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision before trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1178
void reset(const std::vector< std::pair< std::string, bool > > &) const
reset for each L1 trigger the value from pair.second
Definition: L1GtUtils.cc:2392
const L1GtPrescaleFactors * m_l1GtPfTech
Definition: L1GtUtils.h:398
const AlgorithmMap * m_technicalTriggerMap
Definition: L1GtUtils.h:429
static void fillDescription(edm::ParameterSetDescription &desc)
Definition: L1GtUtils.h:105
const std::vector< unsigned int > * m_triggerMaskVetoAlgoTrig
Definition: L1GtUtils.h:420
std::unique_ptr< L1GtUtilsHelper > m_l1GtUtilsHelper
Definition: L1GtUtils.h:469
const std::vector< unsigned int > * m_triggerMaskTechTrigLite
Definition: L1GtUtils.h:444
static const bool useL1GtTriggerMenuLite(true)
bool m_l1GtMenuLiteValid
Definition: L1GtUtils.h:449
const std::vector< unsigned int > * m_triggerMaskAlgoTrigLite
Definition: L1GtUtils.h:443
bool m_beginRunCache
flag for call of getL1GtRunCache in beginRun
Definition: L1GtUtils.h:452
const bool trigResult(const DecisionWord &decWord, const int bitNumber, const std::string &nameAlgoTechTrig, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:2052
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:319
bool m_validL1Configuration
true if valid L1 configuration - if not, reset all quantities and return
Definition: L1GtUtils.h:199
const L1GtTriggerMenu * m_l1GtMenu
Definition: L1GtUtils.h:424
unsigned long long m_l1GtPfTechCacheID
Definition: L1GtUtils.h:399
static const int L1GtNotValidError
Definition: L1GtUtils.h:369
std::vector< std::pair< std::string, bool > > m_decisionsAfterMask
Definition: L1GtUtils.h:222
bool m_l1EventSetupValid
Definition: L1GtUtils.h:431
unsigned long long m_l1GtTmVetoAlgoCacheID
Definition: L1GtUtils.h:412
std::vector< int > m_prescaleFactorSet
Definition: L1GtUtils.h:463
const L1GtTriggerMenu * ptrL1TriggerMenuEventSetup(int &errorCode)
return a pointer to the L1 trigger menu from event setup
Definition: L1GtUtils.cc:1883
const bool decisionAfterMask(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return decision after trigger mask for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1193
long double T
Definition: vlib.h:208
unsigned long long m_l1GtStableParCacheID
Definition: L1GtUtils.h:386
const L1GtTriggerMenuLite::L1TriggerMap * m_technicalTriggerMapLite
Definition: L1GtUtils.h:441
bool isValid()
return true if the logical expression is syntactically correct
Definition: L1GtUtils.h:144
Definition: Run.h:45
const std::vector< unsigned int > * m_triggerMaskVetoTechTrig
Definition: L1GtUtils.h:421
void retrieveL1GtTriggerMenuLite(const edm::Run &)
retrieve L1GtTriggerMenuLite (per run product) and cache it to improve the speed
Definition: L1GtUtils.cc:279
const std::vector< std::pair< std::string, int > > & errorCodes(const edm::Event &)
Definition: L1GtUtils.cc:2366
const int prescaleFactor(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1223