00001 #ifndef DataFormats_PatCandidates_TriggerEvent_h
00002 #define DataFormats_PatCandidates_TriggerEvent_h
00003
00004
00005
00006
00007
00008
00009
00010
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(); };
00078 const TriggerPath * path( const std::string & namePath ) const;
00079 unsigned indexPath( const std::string & namePath ) const;
00080 TriggerPathRefVector acceptedPaths() const;
00081
00083 void setFilters( const edm::Handle< TriggerFilterCollection > & handleTriggerFilters ) { filters_ = TriggerFilterRefProd( handleTriggerFilters ); };
00084 const TriggerFilterCollection * filters() const { return filters_.get(); };
00085 const TriggerFilter * filter( const std::string & labelFilter ) const;
00086 unsigned indexFilter( const std::string & labelFilter ) const;
00087 TriggerFilterRefVector acceptedFilters() const;
00088
00090 void setObjects( const edm::Handle< TriggerObjectCollection > & handleTriggerObjects ) { objects_ = TriggerObjectRefProd( handleTriggerObjects ); };
00091 bool addObjectMatchResult( const TriggerObjectMatchRefProd & trigMatches, const std::string & labelMatcher );
00092 bool addObjectMatchResult( const edm::Handle< TriggerObjectMatch > & trigMatches, const std::string & labelMatcher );
00093 bool addObjectMatchResult( const edm::OrphanHandle< TriggerObjectMatch > & trigMatches, const std::string & labelMatcher );
00094 const TriggerObjectCollection * objects() const { return objects_.get(); };
00095 TriggerObjectRefVector objects( unsigned filterId ) const;
00096
00098 TriggerFilterRefVector pathModules( const std::string & namePath, bool all = true ) const;
00099 TriggerFilterRefVector pathFilters( const std::string & namePath ) const;
00100 bool filterInPath( const TriggerFilterRef & filterRef, const std::string & namePath ) const;
00101 TriggerPathRefVector filterPaths( const TriggerFilterRef & filterRef ) const;
00102 std::vector< std::string > filterCollections( const std::string & labelFilter ) const;
00103 TriggerObjectRefVector filterObjects( const std::string & labelFilter ) const;
00104 bool objectInFilter( const TriggerObjectRef & objectRef, const std::string & labelFilter ) const;
00105 TriggerFilterRefVector objectFilters( const TriggerObjectRef & objectRef ) const;
00106 TriggerObjectRefVector pathObjects( const std::string & namePath ) const;
00107 bool objectInPath( const TriggerObjectRef & objectRef, const std::string & namePath ) const;
00108 TriggerPathRefVector objectPaths( const TriggerObjectRef & objectRef ) const;
00109
00111 std::vector< std::string > triggerMatchers() const;
00112 const TriggerObjectMatchContainer * triggerObjectMatchResults() const { return &objectMatchResults_; };
00113
00114 const TriggerObjectMatch * triggerObjectMatchResult( const std::string & labelMatcher ) const;
00115
00116
00117 };
00118
00119 }
00120
00121
00122 #endif