CMS 3D CMS Logo

TriggerSelector.h
Go to the documentation of this file.
1 #ifndef DQMServices_StreamerIO_TriggerSelector_h
2 #define DQMServices_StreamerIO_TriggerSelector_h
3 
9 
10 #include <vector>
11 #include <string>
12 
13 namespace dqmservices {
20  public:
21  typedef std::vector<std::string> Strings;
22 
27  TriggerSelector(Strings const& pathspecs, Strings const& names);
28 
34  TriggerSelector(edm::ParameterSet const& pset, Strings const& triggernames, bool old_ = false);
35 
39  TriggerSelector(std::string const& expression, Strings const& triggernames);
40 
42 
46  bool wantAll() const {
47  // if (useOld_) return eventSelector_->wantAll();
48  return acceptAll_;
49  }
50 
54  bool acceptEvent(edm::TriggerResults const&) const;
55 
56  /*
57  * Takes array of trigger results and a number of triggers in array and
58  * returns
59  * if it passes selection
60  */
61  bool acceptEvent(unsigned char const*, int) const;
62 
63  /*
64  * Returns if HLTGlobalStatus passes selection
65  */
66  bool returnStatus(edm::HLTGlobalStatus const& trStatus) const { return masterElement_->returnStatus(trStatus); }
67 
68  /*
69  * Does XMl compatible formatting of the selection string
70  */
72 
73  /*
74  * Obsolete: Returns SelectedEvents vector from ParameterSet
75  */
76  static std::vector<std::string> getEventSelectionVString(edm::ParameterSet const& pset);
77 
78  private:
79  bool acceptAll_;
80 
81  /*
82  * Starts parsing selection string
83  */
84  void init(std::string const& path, Strings const& triggernames);
85 
86  /*
87  * Removes extra spaces from string
88  */
90 
91  /*
92  * Class used for storing internal representation of the selection string
93  */
94  class TreeElement {
95  enum TreeOperator { NonInit = 0, AND = 1, OR = 2, NOT = 3, BR = 4 };
96 
97  public:
98  /*
99  * Parser of selection string. Splits string into tokens and initializes new
100  * elements to parse them.
101  */
102  TreeElement(std::string const& inputString, Strings const& tr, TreeElement* parentElement = nullptr);
103  ~TreeElement();
104 
105  /*
106  * Returns selection status of current element calculated recursively from
107  * it's child elements
108  */
109  bool returnStatus(edm::HLTGlobalStatus const& trStatus) const;
110 
111  /*
112  * Returns operator type of the element
113  */
114  TreeOperator op() const { return op_; }
115 
116  /*
117  * Returns parent element
118  */
119  TreeElement* parent() const { return parent_; }
120 
121  private:
123  std::vector<TreeElement*> children_;
125  int trigBit_;
126  };
127 
128  std::shared_ptr<TreeElement> masterElement_;
129 
130  // keep a copy of initialization string
132 
133  std::shared_ptr<edm::EventSelector> eventSelector_;
134  bool useOld_;
135 
136  static const bool debug_ = false;
137  };
138 } // namespace dqmservices
139 
140 #endif
dqmservices::TriggerSelector::TreeElement::children_
std::vector< TreeElement * > children_
Definition: TriggerSelector.h:123
dqmservices::TriggerSelector::TreeElement::parent_
TreeElement * parent_
Definition: TriggerSelector.h:122
dqmservices::TriggerSelector::TreeElement::op
TreeOperator op() const
Definition: TriggerSelector.h:114
input
static const std::string input
Definition: EdmProvDump.cc:48
dqmservices
Definition: DQMFileIterator.cc:18
TriggerResults.h
edm::HLTGlobalStatus
Definition: HLTGlobalStatus.h:25
dqmservices::TriggerSelector::TreeElement::parent
TreeElement * parent() const
Definition: TriggerSelector.h:119
dqmservices::TriggerSelector
Definition: TriggerSelector.h:19
dqmservices::TriggerSelector::Strings
std::vector< std::string > Strings
Definition: TriggerSelector.h:21
HLTPathStatus.h
dqmservices::TriggerSelector::TreeElement::NOT
Definition: TriggerSelector.h:95
dqmservices::TriggerSelector::getEventSelectionVString
static std::vector< std::string > getEventSelectionVString(edm::ParameterSet const &pset)
Definition: TriggerSelector.cc:90
EventSelector.h
dqmservices::TriggerSelector::TreeElement::TreeElement
TreeElement(std::string const &inputString, Strings const &tr, TreeElement *parentElement=nullptr)
Definition: TriggerSelector.cc:133
dqmservices::TriggerSelector::TreeElement::trigBit_
int trigBit_
Definition: TriggerSelector.h:125
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
dqmservices::TriggerSelector::TreeElement::TreeOperator
TreeOperator
Definition: TriggerSelector.h:95
dqmservices::TriggerSelector::trim
static std::string trim(std::string input)
Definition: TriggerSelector.cc:322
dqmservices::TriggerSelector::~TriggerSelector
~TriggerSelector()
Definition: TriggerSelector.h:41
dqmservices::TriggerSelector::masterElement_
std::shared_ptr< TreeElement > masterElement_
Definition: TriggerSelector.h:128
dqmservices::TriggerSelector::returnStatus
bool returnStatus(edm::HLTGlobalStatus const &trStatus) const
Definition: TriggerSelector.h:66
dqmservices::TriggerSelector::TreeElement::returnStatus
bool returnStatus(edm::HLTGlobalStatus const &trStatus) const
Definition: TriggerSelector.cc:349
dqmservices::TriggerSelector::expression_
std::string expression_
Definition: TriggerSelector.h:131
dqmservices::TriggerSelector::TriggerSelector
TriggerSelector(Strings const &pathspecs, Strings const &names)
Definition: TriggerSelector.cc:16
dqmservices::TriggerSelector::makeXMLString
static std::string makeXMLString(std::string const &input)
Definition: TriggerSelector.cc:335
edm::ParameterSet
Definition: ParameterSet.h:47
dqmservices::TriggerSelector::useOld_
bool useOld_
Definition: TriggerSelector.h:134
dqmservices::TriggerSelector::acceptAll_
bool acceptAll_
Definition: TriggerSelector.h:79
dqmservices::TriggerSelector::wantAll
bool wantAll() const
Definition: TriggerSelector.h:46
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
dqmservices::TriggerSelector::eventSelector_
std::shared_ptr< edm::EventSelector > eventSelector_
Definition: TriggerSelector.h:133
dqmservices::TriggerSelector::TreeElement::NonInit
Definition: TriggerSelector.h:95
dqmservices::TriggerSelector::TreeElement::AND
Definition: TriggerSelector.h:95
dqmservices::TriggerSelector::TreeElement::OR
Definition: TriggerSelector.h:95
dqmservices::TriggerSelector::acceptEvent
bool acceptEvent(edm::TriggerResults const &) const
Definition: TriggerSelector.cc:94
dqmservices::TriggerSelector::TreeElement::BR
Definition: TriggerSelector.h:95
dqmservices::TriggerSelector::TreeElement::op_
TreeOperator op_
Definition: TriggerSelector.h:124
ParameterSetID.h
dqmservices::TriggerSelector::init
void init(std::string const &path, Strings const &triggernames)
Definition: TriggerSelector.cc:62
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
dqmservices::TriggerSelector::TreeElement::~TreeElement
~TreeElement()
Definition: TriggerSelector.cc:387
ParameterSet.h
dqmservices::TriggerSelector::TreeElement
Definition: TriggerSelector.h:94
edm::TriggerResults
Definition: TriggerResults.h:35
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
dqmservices::TriggerSelector::debug_
static const bool debug_
Definition: TriggerSelector.h:136