CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 "boost/shared_ptr.hpp"
11 
12 #include <vector>
13 #include <string>
14 
15 namespace dqmservices {
22  {
23  public:
24 
25  typedef std::vector<std::string> Strings;
26 
30  TriggerSelector(Strings const& pathspecs,
31  Strings const& names);
32 
38  Strings const& triggernames, bool old_ = false);
39 
43  TriggerSelector(std::string const& expression, Strings const& triggernames);
44 
46 
50  bool wantAll() const {
51  // if (useOld_) return eventSelector_->wantAll();
52  return acceptAll_;
53  }
54 
58  bool acceptEvent(edm::TriggerResults const&) const;
59 
60  /*
61  * Takes array of trigger results and a number of triggers in array and returns
62  * if it passes selection
63  */
64  bool acceptEvent(unsigned char const*, int) const;
65 
66  /*
67  * Returns if HLTGlobalStatus passes selection
68  */
69  bool returnStatus(edm::HLTGlobalStatus const& trStatus) const {
70  return masterElement_->returnStatus(trStatus);
71  }
72 
73  /*
74  * Does XMl compatible formatting of the selection string
75  */
77 
78  /*
79  * Obsolete: Returns SelectedEvents vector from ParameterSet
80  */
81  static std::vector<std::string>
83 
84  private:
85 
86  bool acceptAll_;
87 
88  /*
89  * Starts parsing selection string
90  */
91  void init(std::string const& path, Strings const& triggernames);
92 
93  /*
94  * Removes extra spaces from string
95  */
97 
98  /*
99  * Class used for storing internal representation of the selection string
100  */
101  class TreeElement {
102 
104  NonInit = 0,
105  AND = 1,
106  OR = 2,
107  NOT = 3,
108  BR = 4
109  };
110 
111  public:
112 
113  /*
114  * Parser of selection string. Splits string into tokens and initializes new elements to parse them.
115  */
116  TreeElement(std::string const& inputString,Strings const& tr,TreeElement* parentElement = NULL);
117  ~TreeElement();
118 
119  /*
120  * Returns selection status of current element calculated recursively from it's child elements
121  */
122  bool returnStatus(edm::HLTGlobalStatus const& trStatus) const;
123 
124  /*
125  * Returns operator type of the element
126  */
127  TreeOperator op() const {return op_;}
128 
129  /*
130  * Returns parent element
131  */
132  TreeElement * parent() const {return parent_;}
133 
134  private:
135 
137  std::vector<TreeElement*> children_;
139  int trigBit_;
140  };
141 
142  boost::shared_ptr<TreeElement> masterElement_;
143 
144  //keep a copy of initialization string
146 
147  boost::shared_ptr<edm::EventSelector> eventSelector_;
148  bool useOld_;
149 
150  static const bool debug_ = false;
151 
152  };
153 
154 }
155 
156 #endif
157 
static const HistoName names[]
bool returnStatus(edm::HLTGlobalStatus const &trStatus) const
static std::string trim(std::string input)
#define NULL
Definition: scimark2.h:8
boost::shared_ptr< TreeElement > masterElement_
static std::string const input
Definition: EdmProvDump.cc:43
static std::string makeXMLString(std::string const &input)
tuple path
else: Piece not in the list, fine.
TriggerSelector(Strings const &pathspecs, Strings const &names)
boost::shared_ptr< edm::EventSelector > eventSelector_
void init(std::string const &path, Strings const &triggernames)
static std::vector< std::string > getEventSelectionVString(edm::ParameterSet const &pset)
bool acceptEvent(edm::TriggerResults const &) const
std::vector< TreeElement * > children_
TreeElement(std::string const &inputString, Strings const &tr, TreeElement *parentElement=NULL)
std::vector< std::string > Strings
bool returnStatus(edm::HLTGlobalStatus const &trStatus) const