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