CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 //
00002 // $Id: TriggerCondition.cc,v 1.2 2011/11/30 13:39:45 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 , category_()
00020 , type_()
00021 {
00022   triggerObjectTypes_.clear();
00023   objectKeys_.clear();
00024 }
00025 
00026 
00027 // Constructor from condition name "only"
00028 TriggerCondition::TriggerCondition( const std::string & name ) :
00029   name_( name )
00030 , accept_()
00031 , category_()
00032 , type_()
00033 {
00034   triggerObjectTypes_.clear();
00035   objectKeys_.clear();
00036 }
00037 
00038 
00039 // Constructor from values
00040 TriggerCondition::TriggerCondition( const std::string & name, bool accept ) :
00041   name_( name )
00042 , accept_( accept )
00043 , category_()
00044 , type_()
00045 {
00046   triggerObjectTypes_.clear();
00047   objectKeys_.clear();
00048 }
00049 
00050 
00051 // Methods
00052 
00053 
00054 // Get the trigger object types
00055 std::vector< int > TriggerCondition::triggerObjectTypes() const
00056 {
00057   std::vector< int > triggerObjectTypes;
00058   for ( size_t iT = 0; iT < triggerObjectTypes_.size(); ++iT ) {
00059     triggerObjectTypes.push_back( int( triggerObjectTypes_.at( iT ) ) );
00060   }
00061   return triggerObjectTypes;
00062 }
00063 
00064 
00065 // Checks, if a certain trigger object type is assigned
00066 bool TriggerCondition::hasTriggerObjectType( trigger::TriggerObjectType triggerObjectType ) const
00067 {
00068   for ( size_t iT = 0; iT < triggerObjectTypes_.size(); ++iT ) {
00069     if ( triggerObjectTypes_.at( iT ) == triggerObjectType ) return true;
00070   }
00071   return false;
00072 }
00073 
00074 
00075 // Checks, if a certain trigger object collection index is assigned
00076 bool TriggerCondition::hasObjectKey( unsigned objectKey ) const
00077 {
00078   for ( size_t iO = 0; iO < objectKeys_.size(); ++iO ) {
00079     if ( objectKeys_.at( iO ) == objectKey ) return true;
00080   }
00081   return false;
00082 }