00001 #ifndef DataFormats_PatCandidates_TriggerCondition_h 00002 #define DataFormats_PatCandidates_TriggerCondition_h 00003 00004 00005 // -*- C++ -*- 00006 // 00007 // Package: PatCandidates 00008 // Class: pat::TriggerCondition 00009 // 00010 // $Id: TriggerCondition.h,v 1.2 2013/06/11 13:24:49 vadler Exp $ 00011 // 00025 #include <string> 00026 #include <vector> 00027 00028 #include "FWCore/Utilities/interface/InputTag.h" 00029 #include "DataFormats/Common/interface/Ref.h" 00030 #include "DataFormats/Common/interface/RefProd.h" 00031 #include "DataFormats/Common/interface/RefVector.h" 00032 #include "DataFormats/Common/interface/RefVectorIterator.h" 00033 #include "CondFormats/L1TObjects/interface/L1GtFwd.h" 00034 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" 00035 00036 namespace pat { 00037 00038 class TriggerCondition { 00039 00041 00043 std::string name_; 00045 bool accept_; 00047 L1GtConditionCategory category_; 00049 L1GtConditionType type_; 00053 std::vector< trigger::TriggerObjectType > triggerObjectTypes_; 00056 std::vector< unsigned > objectKeys_; 00057 00058 public: 00059 00061 00063 TriggerCondition(); 00065 TriggerCondition( const std::string & name ); 00067 TriggerCondition( const std::string & name, bool accept ); 00068 00070 virtual ~TriggerCondition() {}; 00071 00073 00075 void setName( const std::string & name ) { name_ = name; }; 00077 void setAccept( bool accept ) { accept_ = accept; }; 00079 void setCategory( L1GtConditionCategory category ) { category_ = category; }; 00080 void setCategory( int category ) { category_ = L1GtConditionCategory( category ); }; 00082 void setType( L1GtConditionType type ) { type_ = type; }; 00083 void setType( int type ) { type_ = L1GtConditionType( type ); }; 00085 void addTriggerObjectType( trigger::TriggerObjectType triggerObjectType ) { triggerObjectTypes_.push_back( triggerObjectType ); }; // explicitely NOT checking for existence 00086 void addTriggerObjectType( int triggerObjectType ) { addTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); }; 00088 void addObjectKey( unsigned objectKey ) { if ( ! hasObjectKey( objectKey ) ) objectKeys_.push_back( objectKey ); }; 00090 const std::string & name() const { return name_; }; 00092 bool wasAccept() const { return accept_; }; 00094 int category() const { return int( category_ ); }; 00096 int type() const { return int( type_ ); }; 00098 std::vector< int > triggerObjectTypes() const; 00100 bool hasTriggerObjectType( trigger::TriggerObjectType triggerObjectType ) const; 00101 bool hasTriggerObjectType( int triggerObjectType ) const { return hasTriggerObjectType( trigger::TriggerObjectType( triggerObjectType ) ); }; 00103 const std::vector< unsigned > & objectKeys() const { return objectKeys_; }; 00105 bool hasObjectKey( unsigned objectKey ) const; 00106 00107 }; 00108 00109 00111 typedef std::vector< TriggerCondition > TriggerConditionCollection; 00113 typedef edm::Ref< TriggerConditionCollection > TriggerConditionRef; 00115 typedef edm::RefProd< TriggerConditionCollection > TriggerConditionRefProd; 00117 typedef edm::RefVector< TriggerConditionCollection > TriggerConditionRefVector; 00119 typedef edm::RefVectorIterator< TriggerConditionCollection > TriggerConditionRefVectorIterator; 00120 00121 } 00122 00123 00124 #endif