Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:26

0001 //
0002 //
0003 
0004 #include "DataFormats/PatCandidates/interface/TriggerCondition.h"
0005 
0006 using namespace pat;
0007 
0008 // Constructors and Destructor
0009 
0010 // Default constructor
0011 TriggerCondition::TriggerCondition() : name_(), accept_(), category_(), type_() {
0012   triggerObjectTypes_.clear();
0013   objectKeys_.clear();
0014 }
0015 
0016 // Constructor from condition name "only"
0017 TriggerCondition::TriggerCondition(const std::string& name) : name_(name), accept_(), category_(), type_() {
0018   triggerObjectTypes_.clear();
0019   objectKeys_.clear();
0020 }
0021 
0022 // Constructor from values
0023 TriggerCondition::TriggerCondition(const std::string& name, bool accept)
0024     : name_(name), accept_(accept), category_(), type_() {
0025   triggerObjectTypes_.clear();
0026   objectKeys_.clear();
0027 }
0028 
0029 // Methods
0030 
0031 // Get the trigger object types
0032 std::vector<int> TriggerCondition::triggerObjectTypes() const {
0033   std::vector<int> triggerObjectTypes;
0034   for (size_t iT = 0; iT < triggerObjectTypes_.size(); ++iT) {
0035     triggerObjectTypes.push_back(int(triggerObjectTypes_.at(iT)));
0036   }
0037   return triggerObjectTypes;
0038 }
0039 
0040 // Checks, if a certain trigger object type is assigned
0041 bool TriggerCondition::hasTriggerObjectType(trigger::TriggerObjectType triggerObjectType) const {
0042   for (size_t iT = 0; iT < triggerObjectTypes_.size(); ++iT) {
0043     if (triggerObjectTypes_.at(iT) == triggerObjectType)
0044       return true;
0045   }
0046   return false;
0047 }
0048 
0049 // Checks, if a certain trigger object collection index is assigned
0050 bool TriggerCondition::hasObjectKey(unsigned objectKey) const {
0051   for (size_t iO = 0; iO < objectKeys_.size(); ++iO) {
0052     if (objectKeys_.at(iO) == objectKey)
0053       return true;
0054   }
0055   return false;
0056 }