CMS 3D CMS Logo

GenericTriggerEventFlag.h
Go to the documentation of this file.
1 #ifndef GenericTriggerEventFlag_H
2 #define GenericTriggerEventFlag_H
3 
4 
5 // -*- C++ -*-
6 //
7 // Package: CommonTools/TriggerUtils
8 // Class: GenericTriggerEventFlag
9 //
10 // $Id: GenericTriggerEventFlag.h,v 1.5 2012/01/19 20:17:34 vadler Exp $
11 //
36 
37 #include <memory>
38 #include <string>
39 
40 
42 
43  // Utility classes
45  std::unique_ptr<L1GtUtils> l1Gt_;
46  std::unique_ptr<l1t::L1TGlobalUtil> l1uGt_;
49  // Configuration parameters
50  bool andOr_;
52  unsigned verbose_;
53  bool andOrDcs_;
56  std::vector< int > dcsPartitions_;
58  bool andOrGt_;
64  std::vector< std::string > gtLogicalExpressions_;
66  bool andOrL1_;
67  bool stage2_;
70  std::vector< std::string > l1LogicalExpressionsCache_;
71  std::vector< std::string > l1LogicalExpressions_;
73  bool andOrHlt_;
77  std::vector< std::string > hltLogicalExpressionsCache_;
78  std::vector< std::string > hltLogicalExpressions_;
80  // Switches
81  bool on_;
82  bool onDcs_;
83  bool onGt_;
84  bool onL1_;
85  bool onHlt_;
86  // Member constants
89 
90  public:
91 
92  // Constructors must be called from the ED module's c'tor
93  template <typename T>
95 
96  template <typename T>
98 
100 
101  // Public methods
102  bool on() { return on_ ; }
103  bool off() { return ( ! on_ ); }
104  void initRun( const edm::Run & run, const edm::EventSetup & setup ); // To be called from beginRun() methods
105  bool accept( const edm::Event & event, const edm::EventSetup & setup ); // To be called from analyze/filter() methods
106 
107  private:
108 
109  // Private methods
110 
112 
113  // DCS
114  bool acceptDcs( const edm::Event & event );
115  bool acceptDcsPartition( const edm::Handle< DcsStatusCollection > & dcsStatus, int dcsPartition ) const;
116 
117  // GT status bits
118  bool acceptGt( const edm::Event & event );
119  bool acceptGtLogicalExpression( const edm::Event & event, std::string gtLogicalExpression );
120 
121  // L1
122  bool acceptL1( const edm::Event & event, const edm::EventSetup & setup );
123  bool acceptL1LogicalExpression( const edm::Event & event, const edm::EventSetup & setup, std::string l1LogicalExpression );
124 
125  // HLT
126  bool acceptHlt( const edm::Event & event );
127  bool acceptHltLogicalExpression( const edm::Handle< edm::TriggerResults > & hltTriggerResults, std::string hltLogicalExpression ) const;
128 
129  // Algos
130  std::string expandLogicalExpression( const std::vector< std::string > & target, const std::string & expr, bool useAnd = false ) const;
131  bool negate( std::string & word ) const;
132 
133  public:
134 
135  // Methods for expert analysis
136 
137  std::string gtDBKey() { return gtDBKey_ ; } // can be empty
138  std::string l1DBKey() { return l1DBKey_ ; } // can be empty
139  std::string hltDBKey() { return hltDBKey_; } // can be empty
140 
141  std::vector< std::string > expressionsFromDB( const std::string & key, const edm::EventSetup & setup );
142 
143 };
144 
145 template <typename T>
147  GenericTriggerEventFlag(config, iC, module) {
148 }
149 
150 template <typename T>
152  GenericTriggerEventFlag(config, iC) {
153  if ( config.exists( "andOrL1" ) )
154  if (stage2_)
155  l1uGt_.reset(new l1t::L1TGlobalUtil(config, iC));
156  else
157  l1Gt_.reset(new L1GtUtils(config, iC, false, module));
158  else {
159  l1uGt_.reset(NULL);
160  l1Gt_.reset(NULL);
161  }
162 }
163 
164 #endif
bool negate(std::string &word) const
Checks for negated words.
std::vector< int > dcsPartitions_
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtInputToken_
std::vector< std::string > gtLogicalExpressions_
std::vector< std::string > hltLogicalExpressions_
GenericTriggerEventFlag(const edm::ParameterSet &config, edm::ConsumesCollector &&iC, T &module)
bool exists(std::string const &parameterName) const
checks if a parameter exists
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
#define NULL
Definition: scimark2.h:8
edm::EDGetTokenT< edm::TriggerResults > hltInputToken_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
Definition: config.py:1
std::unique_ptr< L1GtUtils > l1Gt_
std::vector< std::string > l1LogicalExpressionsCache_
bool acceptHlt(const edm::Event &event)
Was this event accepted by the configured HLT logical expression combination?
bool acceptDcsPartition(const edm::Handle< DcsStatusCollection > &dcsStatus, int dcsPartition) const
edm::EDGetTokenT< DcsStatusCollection > dcsInputToken_
std::vector< std::string > expressionsFromDB(const std::string &key, const edm::EventSetup &setup)
Reads and returns logical expressions from DB.
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
bool acceptGtLogicalExpression(const edm::Event &event, std::string gtLogicalExpression)
Does this event fulfill this particular GT status bits&#39; logical expression?
~GenericTriggerEventFlag()
To be called from d&#39;tors by &#39;delete&#39;.
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmInputToken_
edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchDB_
bool acceptDcs(const edm::Event &event)
std::vector< std::string > hltLogicalExpressionsCache_
bool acceptL1LogicalExpression(const edm::Event &event, const edm::EventSetup &setup, std::string l1LogicalExpression)
Was this event accepted by this particular L1 algorithms&#39; logical expression?
std::vector< std::string > l1LogicalExpressions_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
std::string expandLogicalExpression(const std::vector< std::string > &target, const std::string &expr, bool useAnd=false) const
Expand wild-carded logical expressions, giving version postfixes priority.
long double T
Definition: vlib.h:208
std::unique_ptr< l1t::L1TGlobalUtil > l1uGt_
Definition: event.py:1
Definition: Run.h:42
bool acceptHltLogicalExpression(const edm::Handle< edm::TriggerResults > &hltTriggerResults, std::string hltLogicalExpression) const
Was this event accepted by this particular HLT paths&#39; logical expression?
bool acceptL1(const edm::Event &event, const edm::EventSetup &setup)
Was this event accepted by the configured L1 logical expression combination?
bool acceptGt(const edm::Event &event)
Does this event fulfill the configured GT status logical expression combination?