CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h

Go to the documentation of this file.
00001 #ifndef DataFormats_PatCandidates_TriggerObjectStandAlone_h
00002 #define DataFormats_PatCandidates_TriggerObjectStandAlone_h
00003 
00004 
00005 // -*- C++ -*-
00006 //
00007 // Package:    PatCandidates
00008 // Class:      pat::TriggerObjectStandAlone
00009 //
00010 // $Id: TriggerObjectStandAlone.h,v 1.13 2011/02/22 18:29:50 vadler Exp $
00011 //
00027 #include "DataFormats/PatCandidates/interface/TriggerObject.h"
00028 
00029 
00030 namespace pat {
00031 
00032   class TriggerObjectStandAlone : public TriggerObject {
00033 
00037 
00039       std::vector< std::string > filterLabels_;
00041       std::vector< std::string > pathNames_;
00046       std::vector< bool > pathLastFilterAccepted_;
00047 
00049 
00051       static const char wildcard_ = '*';
00052 
00054 
00056       bool hasAnyName( const std::string & name, const std::vector< std::string > & nameVec ) const;
00058       void addFilterOrCondition( const std::string & name ) { if ( ! hasFilterOrCondition( name ) ) filterLabels_.push_back( name ); };
00060       void addPathOrAlgorithm( const std::string & name, bool firing = true );
00062       std::vector< std::string > filtersOrConditions() const { return filterLabels_; };
00064       std::vector< std::string > pathsOrAlgorithms( bool firing = true ) const;
00066       bool hasFilterOrCondition( const std::string & name ) const;
00068       bool hasPathOrAlgorithm( const std::string & name, bool firing = true ) const;
00070       bool hasFiring() const { return ( pathLastFilterAccepted_.size() > 0 && pathLastFilterAccepted_.size() == pathNames_.size() ); };
00071 
00072     public:
00073 
00075 
00077       TriggerObjectStandAlone() : TriggerObject() {};
00079       TriggerObjectStandAlone( const TriggerObject & trigObj ) : TriggerObject( trigObj ) {};
00081       TriggerObjectStandAlone( const trigger::TriggerObject & trigObj ) : TriggerObject( trigObj ) {};
00083       TriggerObjectStandAlone( const reco::LeafCandidate & leafCand ) : TriggerObject( leafCand ) {};
00085       TriggerObjectStandAlone( const reco::Particle::LorentzVector & vec, int id = 0 ) : TriggerObject( vec, id ) {};
00086       TriggerObjectStandAlone( const reco::Particle::PolarLorentzVector & vec, int id = 0 ) : TriggerObject( vec, id ) {};
00087 
00089       virtual ~TriggerObjectStandAlone() {};
00090 
00092 
00094       void addFilterLabel( const std::string & filterLabel ) { addFilterOrCondition( filterLabel ); };
00096       void addConditionName( const std::string & conditionName ) { addFilterOrCondition( conditionName ); };
00098       void addPathName( const std::string & pathName, bool pathLastFilterAccepted = true ) { addPathOrAlgorithm( pathName, pathLastFilterAccepted ); };
00100       void addAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) { addPathOrAlgorithm( algorithmName, algoCondAccepted ); };
00102       std::vector< std::string > filterLabels() const { return filtersOrConditions(); };
00104       std::vector< std::string > conditionNames() const { return filtersOrConditions(); };
00106       std::vector< std::string > pathNames( bool pathLastFilterAccepted = true ) const { return pathsOrAlgorithms( pathLastFilterAccepted ); };
00108       std::vector< std::string > algorithmNames( bool algoCondAccepted = true ) const { return pathsOrAlgorithms( algoCondAccepted ); };
00110       TriggerObject triggerObject();
00112       bool hasFilterLabel( const std::string & filterLabel ) const { return hasFilterOrCondition( filterLabel ); };
00114       bool hasConditionName( const std::string & conditionName ) const { return hasFilterOrCondition( conditionName ); };
00116       bool hasPathName( const std::string & pathName, bool pathLastFilterAccepted = true ) const { return hasPathOrAlgorithm( pathName, pathLastFilterAccepted ); };
00118       bool hasAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) const { return hasPathOrAlgorithm( algorithmName, algoCondAccepted ); };
00120       virtual bool hasCollection( const std::string & collName ) const;
00121       virtual bool hasCollection( const edm::InputTag & collName ) const { return hasCollection( collName.encode() ); };
00123       bool hasPathLastFilterAccepted() const { return hasFiring(); };
00124       bool hasAlgoCondAccepted() const { return hasFiring(); };
00125 
00129 
00131       bool filter( const std::string & filterLabel ) const { return hasFilterLabel( filterLabel ); };
00133       bool cond( const std::string & conditionName ) const { return hasConditionName( conditionName ); };
00135       bool path( const std::string & pathName, unsigned pathLastFilterAccepted = 1 ) const { return hasPathName( pathName, bool( pathLastFilterAccepted ) ); };
00137       bool algo( const std::string & algorithmName, unsigned algoCondAccepted = 1 ) const { return hasAlgorithmName( algorithmName, bool( algoCondAccepted ) ); };
00139       virtual bool coll( const std::string & collName ) const { return hasCollection( collName ); };
00140 
00141   };
00142 
00143 
00145   typedef std::vector< TriggerObjectStandAlone >                      TriggerObjectStandAloneCollection;
00147   typedef edm::Ref< TriggerObjectStandAloneCollection >               TriggerObjectStandAloneRef;
00149   typedef edm::RefProd< TriggerObjectStandAloneCollection >           TriggerObjectStandAloneRefProd;
00151   typedef edm::RefVector< TriggerObjectStandAloneCollection >         TriggerObjectStandAloneRefVector;
00153   typedef edm::RefVectorIterator< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefVectorIterator;
00155   typedef edm::Association< TriggerObjectStandAloneCollection >       TriggerObjectStandAloneMatch;
00156 
00157 }
00158 
00159 
00160 #endif