CMS 3D CMS Logo

TriggerEvent.h

Go to the documentation of this file.
00001 #ifndef DataFormats_PatCandidates_TriggerEvent_h
00002 #define DataFormats_PatCandidates_TriggerEvent_h
00003 
00004 
00005 // -*- C++ -*-
00006 //
00007 // Package:    PatCandidates
00008 // Class:      pat::TriggerEvent
00009 //
00010 // $Id: TriggerEvent.h,v 1.1.2.4 2009/04/28 18:34:09 vadler Exp $
00011 //
00025 #include "DataFormats/PatCandidates/interface/TriggerPath.h"
00026 #include "DataFormats/PatCandidates/interface/TriggerFilter.h"
00027 #include "DataFormats/PatCandidates/interface/TriggerObject.h"
00028 
00029 #include <string>
00030 #include <vector>
00031 
00032 #include "FWCore/Utilities/interface/InputTag.h"
00033 #include "DataFormats/Common/interface/Handle.h"
00034 #include "DataFormats/Common/interface/OrphanHandle.h"
00035 #include "DataFormats/Candidate/interface/Candidate.h"
00036    
00037 
00038 namespace pat {
00039 
00040   class TriggerEvent {
00041     
00043       std::string nameHltTable_;
00044       bool        run_;
00045       bool        accept_;
00046       bool        error_;
00047       
00049       TriggerPathRefProd paths_;
00050       
00052       TriggerFilterRefProd filters_;
00053       
00055       TriggerObjectRefProd        objects_;
00056       TriggerObjectMatchContainer objectMatchResults_;
00057 
00058     public:
00059     
00061       TriggerEvent() { objectMatchResults_.clear(); };
00062       TriggerEvent( const std::string & nameHltTable, bool run, bool accept, bool error );
00063       virtual ~TriggerEvent() {};
00064       
00066       void setNameHltTable( const std::string & name ) { nameHltTable_ = name; };
00067       void setRun( bool run )                          { run_          = run; };
00068       void setAccept( bool accept )                    { accept_       = accept; };
00069       void setError( bool error )                      { error         = error; };
00070       std::string nameHltTable() const { return nameHltTable_; };
00071       bool        wasRun() const       { return run_; };
00072       bool        wasAccept() const    { return accept_; };
00073       bool        wasError() const     { return error_; };
00074       
00076       void setPaths( const edm::Handle< TriggerPathCollection > & handleTriggerPaths ) { paths_ = TriggerPathRefProd( handleTriggerPaths ); };
00077       const TriggerPathCollection * paths() const { return paths_.get(); };          // returns 0 if RefProd is null
00078       const TriggerPath           * path( const std::string & namePath ) const;      // returns 0 if path is not found
00079       unsigned                      indexPath( const std::string & namePath ) const; // returns size of path collection if path is not found
00080       TriggerPathRefVector          acceptedPaths() const;                           // transient
00081       
00083       void setFilters( const edm::Handle< TriggerFilterCollection > & handleTriggerFilters ) { filters_ = TriggerFilterRefProd( handleTriggerFilters ); };
00084       const TriggerFilterCollection * filters() const { return filters_.get(); };           // returns 0 if RefProd is null
00085       const TriggerFilter           * filter( const std::string & labelFilter ) const;      // returns 0 if filter is not found
00086       unsigned                        indexFilter( const std::string & labelFilter ) const; // returns size of filter collection if filter is not found
00087       TriggerFilterRefVector          acceptedFilters() const;                              // transient
00088       
00090       void setObjects( const edm::Handle< TriggerObjectCollection > & handleTriggerObjects ) { objects_ = TriggerObjectRefProd( handleTriggerObjects ); };
00091       bool addObjectMatchResult( const TriggerObjectMatchRefProd & trigMatches, const std::string & labelMatcher );               // returns 'false' if 'matcher' alreadey exists
00092       bool addObjectMatchResult( const edm::Handle< TriggerObjectMatch > & trigMatches, const std::string & labelMatcher );       // returns 'false' if 'matcher' alreadey exists
00093       bool addObjectMatchResult( const edm::OrphanHandle< TriggerObjectMatch > & trigMatches, const std::string & labelMatcher ); // returns 'false' if 'matcher' alreadey exists
00094       const TriggerObjectCollection     * objects() const { return objects_.get(); };                                             // returns 0 if RefProd is null
00095       TriggerObjectRefVector              objects( unsigned filterId ) const;                                                     // transient
00096       
00098       TriggerFilterRefVector     pathModules( const std::string & namePath, bool all = true ) const;                          // transient; setting 'all' to 'false' returns the run filters only.
00099       TriggerFilterRefVector     pathFilters( const std::string & namePath ) const;                                           // transient; only active filter modules
00100       bool                       filterInPath( const TriggerFilterRef & filterRef, const std::string & namePath ) const;      // returns 'true' if the filter was run
00101       TriggerPathRefVector       filterPaths( const TriggerFilterRef & filterRef ) const;                                     // transient
00102       std::vector< std::string > filterCollections( const std::string & labelFilter ) const;                                  // returns the used collections, not the configuration
00103       TriggerObjectRefVector     filterObjects( const std::string & labelFilter ) const;                                      // transient
00104       bool                       objectInFilter( const TriggerObjectRef & objectRef, const std::string & labelFilter ) const;
00105       TriggerFilterRefVector     objectFilters( const TriggerObjectRef & objectRef ) const;                                   // transient
00106       TriggerObjectRefVector     pathObjects( const std::string & namePath ) const;                                           // transient
00107       bool                       objectInPath( const TriggerObjectRef & objectRef, const std::string & namePath ) const;
00108       TriggerPathRefVector       objectPaths( const TriggerObjectRef & objectRef  ) const;                                    // transient
00109       
00111       std::vector< std::string >          triggerMatchers() const;
00112       const TriggerObjectMatchContainer * triggerObjectMatchResults() const { return &objectMatchResults_; };
00113       // pat::TriggerObjectMatch can contain empty references in case no match for a PAT object was found.
00114       const TriggerObjectMatch          * triggerObjectMatchResult( const std::string & labelMatcher ) const;                                                              // performs proper "range check" (better than '(*triggerObjectMatchResults())[labelMatcher]'), returns 0 if 'labelMatcher' not found
00115       // Further methods are provided by the pat::helper::TriggerMatchHelper in PhysicsTools/PatUtils/interface/TriggerHelper.h
00116       
00117   };
00118 
00119 }
00120 
00121 
00122 #endif

Generated on Tue Jun 9 17:31:01 2009 for CMSSW by  doxygen 1.5.4