CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DataFormats/PatCandidates/src/TriggerCondition.cc

Go to the documentation of this file.
00001 //
00002 // $Id: TriggerCondition.cc,v 1.1 2011/02/22 18:33:05 vadler Exp $
00003 //
00004 
00005 
00006 #include "DataFormats/PatCandidates/interface/TriggerCondition.h"
00007 
00008 
00009 using namespace pat;
00010 
00011 
00012 // Constructors and Destructor
00013 
00014 
00015 // Default constructor
00016 TriggerCondition::TriggerCondition() :
00017   name_()
00018 , accept_()
00019 {
00020   triggerObjectTypes_.clear();
00021   objectKeys_.clear();
00022 }
00023 
00024 
00025 // Constructor from condition name "only"
00026 TriggerCondition::TriggerCondition( const std::string & name ) :
00027   name_( name )
00028 , accept_()
00029 {
00030   triggerObjectTypes_.clear();
00031   objectKeys_.clear();
00032 }
00033 
00034 
00035 // Constructor from values
00036 TriggerCondition::TriggerCondition( const std::string & name, bool accept ) :
00037   name_( name )
00038 , accept_( accept )
00039 {
00040   triggerObjectTypes_.clear();
00041   objectKeys_.clear();
00042 }
00043 
00044 
00045 // Methods
00046 
00047 
00048 // Get the trigger object types
00049 std::vector< int > TriggerCondition::triggerObjectTypes() const
00050 {
00051   std::vector< int > triggerObjectTypes;
00052   for ( size_t iT = 0; iT < triggerObjectTypes_.size(); ++iT ) {
00053     triggerObjectTypes.push_back( int( triggerObjectTypes_.at( iT ) ) );
00054   }
00055   return triggerObjectTypes;
00056 }
00057 
00058 
00059 // Checks, if a certain trigger object type is assigned
00060 bool TriggerCondition::hasTriggerObjectType( trigger::TriggerObjectType triggerObjectType ) const
00061 {
00062   for ( size_t iT = 0; iT < triggerObjectTypes_.size(); ++iT ) {
00063     if ( triggerObjectTypes_.at( iT ) == triggerObjectType ) return true;
00064   }
00065   return false;
00066 }
00067 
00068 
00069 // Checks, if a certain trigger object collection index is assigned
00070 bool TriggerCondition::hasObjectKey( unsigned objectKey ) const
00071 {
00072   for ( size_t iO = 0; iO < objectKeys_.size(); ++iO ) {
00073     if ( objectKeys_.at( iO ) == objectKey ) return true;
00074   }
00075   return false;
00076 }