CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/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.15 2011/05/25 07:14:27 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_;
00050       std::vector< bool > pathL3FilterAccepted_;
00051 
00053 
00055       static const char wildcard_ = '*';
00056 
00058 
00060       bool hasAnyName( const std::string & name, const std::vector< std::string > & nameVec ) const;
00062       void addFilterOrCondition( const std::string & name ) { if ( ! hasFilterOrCondition( name ) ) filterLabels_.push_back( name ); };
00064       void addPathOrAlgorithm( const std::string & name, bool pathLastFilterAccepted, bool pathL3FilterAccepted );
00066       std::vector< std::string > filtersOrConditions() const { return filterLabels_; };
00068       std::vector< std::string > pathsOrAlgorithms( bool pathLastFilterAccepted, bool pathL3FilterAccepted ) const;
00070       bool hasFilterOrCondition( const std::string & name ) const;
00072       bool hasPathOrAlgorithm( const std::string & name, bool pathLastFilterAccepted, bool pathL3FilterAccepted ) const;
00074       bool hasLastFilter() const { return ( pathLastFilterAccepted_.size() > 0 && pathLastFilterAccepted_.size() == pathNames_.size() ); };
00075       bool hasL3Filter() const { return ( pathL3FilterAccepted_.size() > 0 && pathL3FilterAccepted_.size() == pathNames_.size() ); };
00076 
00077     public:
00078 
00080 
00082       TriggerObjectStandAlone();
00084       TriggerObjectStandAlone( const TriggerObject & trigObj );
00086       TriggerObjectStandAlone( const trigger::TriggerObject & trigObj );
00088       TriggerObjectStandAlone( const reco::LeafCandidate & leafCand );
00090       TriggerObjectStandAlone( const reco::Particle::LorentzVector & vec, int id = 0 );
00091       TriggerObjectStandAlone( const reco::Particle::PolarLorentzVector & vec, int id = 0 );
00092 
00094       virtual ~TriggerObjectStandAlone() {};
00095 
00097 
00099       void addFilterLabel( const std::string & filterLabel ) { addFilterOrCondition( filterLabel ); };
00101       void addConditionName( const std::string & conditionName ) { addFilterOrCondition( conditionName ); };
00103       void addPathName( const std::string & pathName, bool pathLastFilterAccepted = true, bool pathL3FilterAccepted = true ) { addPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
00105       void addAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) { addPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
00107       std::vector< std::string > filterLabels() const { return filtersOrConditions(); };
00109       std::vector< std::string > conditionNames() const { return filtersOrConditions(); };
00111       std::vector< std::string > pathNames( bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true ) const { return pathsOrAlgorithms( pathLastFilterAccepted, pathL3FilterAccepted ); };
00113       std::vector< std::string > algorithmNames( bool algoCondAccepted = true ) const { return pathsOrAlgorithms( algoCondAccepted, false ); };
00115       TriggerObject triggerObject();
00117       bool hasFilterLabel( const std::string & filterLabel ) const { return hasFilterOrCondition( filterLabel ); };
00119       bool hasConditionName( const std::string & conditionName ) const { return hasFilterOrCondition( conditionName ); };
00121       bool hasPathName( const std::string & pathName, bool pathLastFilterAccepted = false, bool pathL3FilterAccepted = true ) const { return hasPathOrAlgorithm( pathName, pathLastFilterAccepted, pathL3FilterAccepted ); };
00123       bool hasAlgorithmName( const std::string & algorithmName, bool algoCondAccepted = true ) const { return hasPathOrAlgorithm( algorithmName, algoCondAccepted, false ); };
00125       virtual bool hasCollection( const std::string & collName ) const;
00126       virtual bool hasCollection( const edm::InputTag & collName ) const { return hasCollection( collName.encode() ); };
00128       bool hasPathLastFilterAccepted() const { return hasLastFilter(); };
00129       bool hasAlgoCondAccepted() const { return hasLastFilter(); };
00130       bool hasPathL3FilterAccepted() const { return hasL3Filter(); };
00131 
00135 
00137       bool filter( const std::string & filterLabel ) const { return hasFilterLabel( filterLabel ); };
00139       bool cond( const std::string & conditionName ) const { return hasConditionName( conditionName ); };
00141       bool path( const std::string & pathName, unsigned pathLastFilterAccepted = 0, unsigned pathL3FilterAccepted = 1 ) const { return hasPathName( pathName, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) ); };
00143       bool algo( const std::string & algorithmName, unsigned algoCondAccepted = 1 ) const { return hasAlgorithmName( algorithmName, bool( algoCondAccepted ) ); };
00145       virtual bool coll( const std::string & collName ) const { return hasCollection( collName ); };
00146 
00147   };
00148 
00149 
00151   typedef std::vector< TriggerObjectStandAlone >                      TriggerObjectStandAloneCollection;
00153   typedef edm::Ref< TriggerObjectStandAloneCollection >               TriggerObjectStandAloneRef;
00155   typedef edm::RefProd< TriggerObjectStandAloneCollection >           TriggerObjectStandAloneRefProd;
00157   typedef edm::RefVector< TriggerObjectStandAloneCollection >         TriggerObjectStandAloneRefVector;
00159   typedef edm::RefVectorIterator< TriggerObjectStandAloneCollection > TriggerObjectStandAloneRefVectorIterator;
00161   typedef edm::Association< TriggerObjectStandAloneCollection >       TriggerObjectStandAloneMatch;
00162 
00163 }
00164 
00165 
00166 #endif