File indexing completed on 2024-04-06 12:04:56
0001 #ifndef DataFormats_PatCandidates_TriggerPath_h
0002 #define DataFormats_PatCandidates_TriggerPath_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #include <string>
0022 #include <vector>
0023 #include <type_traits>
0024
0025 #include "DataFormats/Common/interface/Ref.h"
0026 #include "DataFormats/Common/interface/RefProd.h"
0027 #include "DataFormats/Common/interface/RefVector.h"
0028 #include "DataFormats/Common/interface/RefVectorIterator.h"
0029
0030 namespace pat {
0031
0032
0033 typedef std::pair<bool, std::string> L1Seed;
0034
0035 typedef std::vector<L1Seed> L1SeedCollection;
0036
0037 class TriggerPath {
0038
0039
0040
0041 std::string name_;
0042
0043 unsigned index_;
0044
0045 double prescale_;
0046
0047 bool run_;
0048
0049 bool accept_;
0050
0051 bool error_;
0052
0053
0054
0055
0056 std::vector<std::string> modules_;
0057
0058
0059
0060
0061 std::vector<unsigned> filterIndices_;
0062
0063 unsigned lastActiveFilterSlot_;
0064
0065
0066 unsigned l3Filters_;
0067
0068 L1SeedCollection l1Seeds_;
0069
0070 public:
0071
0072
0073
0074 TriggerPath();
0075
0076 TriggerPath(const std::string& name);
0077
0078 TriggerPath(const std::string& name,
0079 unsigned index,
0080 double prescale,
0081 bool run,
0082 bool accept,
0083 bool error,
0084 unsigned lastActiveFilterSlot,
0085 unsigned l3Filters = 0);
0086
0087
0088 virtual ~TriggerPath() = default;
0089
0090
0091
0092
0093 void setName(const std::string& name) { name_ = name; };
0094
0095 void setIndex(unsigned index) { index_ = index; };
0096
0097 void setPrescale(double prescale) { prescale_ = prescale; };
0098
0099 void setRun(bool run) { run_ = run; };
0100
0101 void setAccept(bool accept) { accept_ = accept; };
0102
0103 void setError(bool error) { error_ = error; };
0104
0105 void setLastActiveFilterSlot(unsigned lastActiveFilterSlot) { lastActiveFilterSlot_ = lastActiveFilterSlot; };
0106
0107 void setL3Filters(unsigned l3Filters) { l3Filters_ = l3Filters; };
0108
0109 void addModule(const std::string& name) { modules_.push_back(name); };
0110
0111 void addFilterIndex(const unsigned index) { filterIndices_.push_back(index); };
0112
0113 void addL1Seed(const L1Seed& seed) { l1Seeds_.push_back(seed); };
0114 void addL1Seed(bool decision, const std::string& expression) { l1Seeds_.push_back(L1Seed(decision, expression)); };
0115
0116 const std::string& name() const { return name_; };
0117
0118 unsigned index() const { return index_; };
0119
0120 template <typename T = unsigned int>
0121 T prescale() const {
0122 static_assert(std::is_same_v<T, double>,
0123 "\n\tPlease use prescale<double>"
0124 "\n\t(other types for prescales are not supported anymore by pat::TriggerPath");
0125 return prescale_;
0126 };
0127
0128 bool wasRun() const { return run_; };
0129
0130 bool wasAccept() const { return accept_; };
0131
0132 bool wasError() const { return error_; };
0133
0134 unsigned lastActiveFilterSlot() const { return lastActiveFilterSlot_; };
0135
0136
0137 unsigned l3Filters() const { return l3Filters_; };
0138
0139
0140 bool xTrigger() const { return (l3Filters_ > 2); };
0141
0142 const std::vector<std::string>& modules() const { return modules_; };
0143
0144 const std::vector<unsigned>& filterIndices() const { return filterIndices_; };
0145
0146
0147
0148 int indexModule(const std::string& name) const;
0149
0150 const L1SeedCollection& l1Seeds() const { return l1Seeds_; };
0151
0152 std::vector<std::string> l1Seeds(const bool decision) const;
0153
0154 std::vector<std::string> acceptedL1Seeds() const { return l1Seeds(true); };
0155
0156 std::vector<std::string> failedL1Seeds() const { return l1Seeds(false); };
0157 };
0158
0159
0160 typedef std::vector<TriggerPath> TriggerPathCollection;
0161
0162 typedef edm::Ref<TriggerPathCollection> TriggerPathRef;
0163
0164 typedef edm::RefProd<TriggerPathCollection> TriggerPathRefProd;
0165
0166 typedef edm::RefVector<TriggerPathCollection> TriggerPathRefVector;
0167
0168 typedef edm::RefVectorIterator<TriggerPathCollection> TriggerPathRefVectorIterator;
0169
0170 }
0171
0172 #endif