File indexing completed on 2024-09-07 04:35:56
0001 #ifndef DataFormats_PatCandidates_TriggerCondition_h
0002 #define DataFormats_PatCandidates_TriggerCondition_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 "FWCore/Utilities/interface/InputTag.h"
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 #include "DataFormats/L1GlobalTrigger/interface/L1GtDefinitions.h"
0030 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
0031
0032 namespace pat {
0033
0034 class TriggerCondition {
0035
0036
0037
0038 std::string name_;
0039
0040 bool accept_;
0041
0042 L1GtConditionCategory category_;
0043
0044 L1GtConditionType type_;
0045
0046
0047
0048 std::vector<trigger::TriggerObjectType> triggerObjectTypes_;
0049
0050
0051 std::vector<unsigned> objectKeys_;
0052
0053 public:
0054
0055
0056
0057 TriggerCondition();
0058
0059 TriggerCondition(const std::string& name);
0060
0061 TriggerCondition(const std::string& name, bool accept);
0062
0063
0064 virtual ~TriggerCondition() {}
0065
0066
0067
0068
0069 void setName(const std::string& name) { name_ = name; };
0070
0071 void setAccept(bool accept) { accept_ = accept; };
0072
0073 void setCategory(L1GtConditionCategory category) { category_ = category; };
0074 void setCategory(int category) { category_ = L1GtConditionCategory(category); };
0075
0076 void setType(L1GtConditionType type) { type_ = type; };
0077 void setType(int type) { type_ = L1GtConditionType(type); };
0078
0079 void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType) {
0080 triggerObjectTypes_.push_back(triggerObjectType);
0081 };
0082 void addTriggerObjectType(int triggerObjectType) {
0083 addTriggerObjectType(trigger::TriggerObjectType(triggerObjectType));
0084 };
0085
0086 void addObjectKey(unsigned objectKey) {
0087 if (!hasObjectKey(objectKey))
0088 objectKeys_.push_back(objectKey);
0089 };
0090
0091 const std::string& name() const { return name_; };
0092
0093 bool wasAccept() const { return accept_; };
0094
0095 int category() const { return int(category_); };
0096
0097 int type() const { return int(type_); };
0098
0099 std::vector<int> triggerObjectTypes() const;
0100
0101 bool hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const;
0102 bool hasTriggerObjectType(int triggerObjectType) const {
0103 return hasTriggerObjectType(trigger::TriggerObjectType(triggerObjectType));
0104 };
0105
0106 const std::vector<unsigned>& objectKeys() const { return objectKeys_; };
0107
0108 bool hasObjectKey(unsigned objectKey) const;
0109 };
0110
0111
0112 typedef std::vector<TriggerCondition> TriggerConditionCollection;
0113
0114 typedef edm::Ref<TriggerConditionCollection> TriggerConditionRef;
0115
0116 typedef edm::RefProd<TriggerConditionCollection> TriggerConditionRefProd;
0117
0118 typedef edm::RefVector<TriggerConditionCollection> TriggerConditionRefVector;
0119
0120 typedef edm::RefVectorIterator<TriggerConditionCollection> TriggerConditionRefVectorIterator;
0121
0122 }
0123
0124 #endif