File indexing completed on 2024-04-06 12:10:15
0001 #ifndef DQMServices_StreamerIO_TriggerSelector_h
0002 #define DQMServices_StreamerIO_TriggerSelector_h
0003
0004 #include <memory>
0005 #include <string>
0006 #include <vector>
0007
0008 namespace edm {
0009 class EventSelector;
0010 class HLTGlobalStatus;
0011 class TriggerResults;
0012 }
0013
0014 namespace dqmservices {
0015
0016
0017
0018
0019
0020 class TriggerSelector {
0021 public:
0022 typedef std::vector<std::string> Strings;
0023
0024
0025
0026
0027 TriggerSelector(Strings const& pathspecs, Strings const& names);
0028
0029
0030
0031
0032 TriggerSelector(std::string const& expression, Strings const& triggernames);
0033
0034 ~TriggerSelector() = default;
0035
0036
0037
0038
0039 bool wantAll() const { return acceptAll_; }
0040
0041
0042
0043
0044 bool acceptEvent(edm::TriggerResults const&) const;
0045
0046
0047
0048
0049
0050
0051 bool acceptEvent(unsigned char const*, int) const;
0052
0053
0054
0055
0056 bool returnStatus(edm::HLTGlobalStatus const& trStatus) const { return masterElement_->returnStatus(trStatus); }
0057
0058
0059
0060
0061 static std::string makeXMLString(std::string const& input);
0062
0063 private:
0064 bool acceptAll_;
0065
0066
0067
0068
0069 void init(std::string const& path, Strings const& triggernames);
0070
0071
0072
0073
0074 static std::string trim(std::string input);
0075
0076
0077
0078
0079 class TreeElement {
0080 enum TreeOperator { NonInit = 0, AND = 1, OR = 2, NOT = 3, BR = 4 };
0081
0082 public:
0083
0084
0085
0086
0087 TreeElement(std::string const& inputString, Strings const& tr, TreeElement* parentElement = nullptr);
0088 ~TreeElement();
0089
0090
0091
0092
0093
0094 bool returnStatus(edm::HLTGlobalStatus const& trStatus) const;
0095
0096
0097
0098
0099 TreeOperator op() const { return op_; }
0100
0101
0102
0103
0104 TreeElement* parent() const { return parent_; }
0105
0106 private:
0107 TreeElement* parent_;
0108 std::vector<TreeElement*> children_;
0109 TreeOperator op_;
0110 int trigBit_;
0111 };
0112
0113 std::shared_ptr<TreeElement> masterElement_;
0114
0115
0116 std::string expression_;
0117
0118 std::shared_ptr<edm::EventSelector> eventSelector_;
0119 bool useOld_;
0120
0121 static const bool debug_ = false;
0122 };
0123
0124 }
0125
0126 #endif