File indexing completed on 2024-09-07 04:35:56
0001 #ifndef DataFormats_PatCandidates_TriggerAlgorithm_h
0002 #define DataFormats_PatCandidates_TriggerAlgorithm_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
0024 #include "DataFormats/Common/interface/Ref.h"
0025 #include "DataFormats/Common/interface/RefProd.h"
0026 #include "DataFormats/Common/interface/RefVector.h"
0027 #include "DataFormats/Common/interface/RefVectorIterator.h"
0028
0029 namespace pat {
0030
0031 class TriggerAlgorithm {
0032
0033
0034
0035 std::string name_;
0036
0037 std::string alias_;
0038
0039 std::string logic_;
0040
0041 bool tech_;
0042
0043 unsigned bit_;
0044
0045 bool gtlResult_;
0046
0047 unsigned prescale_;
0048
0049 bool mask_;
0050
0051 bool decisionBeforeMask_;
0052
0053 bool decisionAfterMask_;
0054
0055
0056 std::vector<unsigned> conditionKeys_;
0057
0058 public:
0059
0060
0061
0062 TriggerAlgorithm();
0063
0064 TriggerAlgorithm(const std::string& name);
0065
0066 TriggerAlgorithm(const std::string& name,
0067 const std::string& alias,
0068 bool tech,
0069 unsigned bit,
0070 unsigned prescale,
0071 bool mask,
0072 bool decisionBeforeMask,
0073 bool decisionAfterMask);
0074 TriggerAlgorithm(const std::string& name,
0075 const std::string& alias,
0076 bool tech,
0077 unsigned bit,
0078 bool gtlResult,
0079 unsigned prescale,
0080 bool mask,
0081 bool decisionBeforeMask,
0082 bool decisionAfterMask);
0083
0084
0085 virtual ~TriggerAlgorithm() {}
0086
0087
0088
0089
0090 void setName(const std::string& name) { name_ = name; };
0091
0092 void setAlias(const std::string& alias) { alias_ = alias; };
0093
0094 void setLogicalExpression(const std::string& expression) { logic_ = expression; };
0095
0096 void setTechTrigger(bool tech) { tech_ = tech; };
0097
0098 void setBit(unsigned bit) { bit_ = bit; };
0099
0100 void setGtlResult(bool gtlResult) { gtlResult_ = gtlResult; };
0101
0102 void setPrescale(unsigned prescale) { prescale_ = prescale; };
0103
0104 void setMask(bool mask) { mask_ = mask; };
0105
0106 void setDecisionBeforeMask(bool decisionBeforeMask) { decisionBeforeMask_ = decisionBeforeMask; };
0107
0108 void setDecisionAfterMas(bool decisionAfterMask) { decisionAfterMask_ = decisionAfterMask; };
0109
0110 void addConditionKey(unsigned conditionKey) {
0111 if (!hasConditionKey(conditionKey))
0112 conditionKeys_.push_back(conditionKey);
0113 };
0114
0115 const std::string& name() const { return name_; };
0116
0117 const std::string& alias() const { return alias_; };
0118
0119 const std::string& logicalExpression() const { return logic_; };
0120
0121 bool techTrigger() const { return tech_; };
0122
0123 unsigned bit() const { return bit_; };
0124
0125 bool gtlResult() const { return gtlResult_; };
0126
0127 unsigned prescale() const { return prescale_; };
0128
0129 bool mask() const { return mask_; };
0130
0131 bool decisionBeforeMask() const { return decisionBeforeMask_; };
0132
0133 bool decisionAfterMask() const { return decisionAfterMask_; };
0134
0135
0136 bool decision() const { return decisionAfterMask(); };
0137
0138 const std::vector<unsigned>& conditionKeys() const { return conditionKeys_; };
0139
0140 bool hasConditionKey(unsigned conditionKey) const;
0141 };
0142
0143
0144 typedef std::vector<TriggerAlgorithm> TriggerAlgorithmCollection;
0145
0146 typedef edm::Ref<TriggerAlgorithmCollection> TriggerAlgorithmRef;
0147
0148 typedef edm::RefProd<TriggerAlgorithmCollection> TriggerAlgorithmRefProd;
0149
0150 typedef edm::RefVector<TriggerAlgorithmCollection> TriggerAlgorithmRefVector;
0151
0152 typedef edm::RefVectorIterator<TriggerAlgorithmCollection> TriggerAlgorithmRefVectorIterator;
0153
0154 }
0155
0156 #endif