CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/DataFormats/PatCandidates/interface/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.16 2011/11/30 13:42:55 vadler Exp $
00011 //
00026 #include "DataFormats/PatCandidates/interface/TriggerAlgorithm.h"
00027 #include "DataFormats/PatCandidates/interface/TriggerCondition.h"
00028 #include "DataFormats/PatCandidates/interface/TriggerPath.h"
00029 #include "DataFormats/PatCandidates/interface/TriggerFilter.h"
00030 #include "DataFormats/PatCandidates/interface/TriggerObject.h"
00031 
00032 #include <string>
00033 #include <vector>
00034 #include <boost/cstdint.hpp>
00035 
00036 #include "FWCore/Utilities/interface/InputTag.h"
00037 #include "DataFormats/Common/interface/Handle.h"
00038 #include "DataFormats/Common/interface/OrphanHandle.h"
00039 #include "DataFormats/Candidate/interface/Candidate.h"
00040 
00041 
00042 namespace pat {
00043 
00044   class TriggerEvent {
00045 
00047 
00049       std::string nameL1Menu_;
00051       std::string nameHltTable_;
00053       bool run_;
00055       bool accept_;
00057       bool error_;
00059       bool physDecl_;
00061       boost::uint32_t lhcFill_;
00064       boost::uint16_t beamMode_;
00066       boost::uint16_t beamMomentum_;
00068       boost::uint32_t intensityBeam1_;
00070       boost::uint32_t intensityBeam2_;
00073       boost::uint16_t bstMasterStatus_;
00075       boost::uint32_t turnCount_;
00077       float bCurrentStart_;
00079       float bCurrentStop_;
00081       float bCurrentAvg_;
00082 
00085       TriggerAlgorithmRefProd algorithms_;
00087       TriggerConditionRefProd conditions_;
00089       TriggerPathRefProd paths_;
00091       TriggerFilterRefProd filters_;
00093       TriggerObjectRefProd objects_;
00095       TriggerObjectMatchContainer objectMatchResults_;
00096 
00097     public:
00098 
00100 
00102       TriggerEvent();
00104       TriggerEvent( const std::string & nameHltTable, bool run = true, bool accept = true, bool error = false, bool physDecl = true );
00106       TriggerEvent( const std::string & nameL1Menu, const std::string & nameHltTable, bool run = true, bool accept = true, bool error = false, bool physDecl = true );
00107 
00109       virtual ~TriggerEvent() {};
00110 
00112 
00115       void setNameL1Menu( const std::string & name ) { nameL1Menu_  = name; };
00117       void setNameHltTable( const std::string & name ) { nameHltTable_ = name; };
00119       void setRun( bool run ) { run_ = run; };
00121       void setAccept( bool accept ) { accept_ = accept; };
00123       void setError( bool error ) { error = error; };
00125       void setPhysDecl( bool physDecl ) { physDecl_ = physDecl; };
00127       void setLhcFill( boost::uint32_t lhcFill )  { lhcFill_  = lhcFill; };
00129       void setBeamMode( boost::uint16_t beamMode ) { beamMode_  = beamMode; };
00131       void setBeamMomentum( boost::uint16_t beamMomentum ) { beamMomentum_ = beamMomentum; };
00133       void setIntensityBeam1( boost::uint32_t intensityBeam1 ) { intensityBeam1_ = intensityBeam1; };
00135       void setIntensityBeam2( boost::uint32_t intensityBeam2 ) { intensityBeam2_ = intensityBeam2; };
00137       void setBstMasterStatus( boost::uint16_t bstMasterStatus ) { bstMasterStatus_ = bstMasterStatus; };
00139       void setTurnCount( boost::uint32_t turnCount ) { turnCount_ = turnCount; };
00141       void setBCurrentStart( float bCurrentStart )  { bCurrentStart_ = bCurrentStart; };
00143       void setBCurrentStop( float bCurrentStop ) { bCurrentStop_ = bCurrentStop; };
00145       void setBCurrentAvg( float bCurrentAvg ) { bCurrentAvg_  = bCurrentAvg; };
00147       std::string nameL1Menu() const { return nameL1Menu_; };
00149       std::string nameHltTable() const { return nameHltTable_; };
00151       bool wasRun() const { return run_; };
00153       bool wasAccept() const { return accept_; };
00155       bool wasError() const { return error_; };
00157       bool wasPhysDecl() const { return physDecl_; };
00159       boost::uint32_t lhcFill() const { return lhcFill_; };
00161       boost::uint16_t beamMode() const { return beamMode_; };
00163       boost::uint16_t beamMomentum() const { return beamMomentum_; };
00165       boost::uint32_t intensityBeam1() const { return intensityBeam1_; };
00167       boost::uint32_t intensityBeam2() const { return intensityBeam2_; };
00169       boost::uint16_t bstMasterStatus() const { return bstMasterStatus_; };
00171       boost::uint32_t turnCount() const { return turnCount_; };
00173       float bCurrentStart() const { return bCurrentStart_; };
00175       float bCurrentStop() const { return bCurrentStop_; };
00177       float bCurrentAvg() const { return bCurrentAvg_; };
00178 
00181       void setAlgorithms( const edm::Handle< TriggerAlgorithmCollection > & handleTriggerAlgorithms ) { algorithms_ = TriggerAlgorithmRefProd( handleTriggerAlgorithms ); };
00184       const TriggerAlgorithmCollection * algorithms() const { return algorithms_.get(); };
00187       const TriggerAlgorithmRefVector algorithmRefs() const;
00190       const TriggerAlgorithm * algorithm( const std::string & nameAlgorithm ) const;
00193       const TriggerAlgorithmRef algorithmRef( const std::string & nameAlgorithm ) const;
00196       std::string nameAlgorithm( const unsigned bitAlgorithm, const bool techAlgorithm = true ) const;
00199       unsigned indexAlgorithm( const std::string & nameAlgorithm ) const;
00201       TriggerAlgorithmRefVector acceptedAlgorithms() const;
00203       TriggerAlgorithmRefVector acceptedAlgorithmsGtl() const;
00205       TriggerAlgorithmRefVector techAlgorithms() const;
00207       TriggerAlgorithmRefVector acceptedTechAlgorithms() const;
00209       TriggerAlgorithmRefVector acceptedTechAlgorithmsGtl() const;
00211       TriggerAlgorithmRefVector physAlgorithms() const;
00213       TriggerAlgorithmRefVector acceptedPhysAlgorithms() const;
00215       TriggerAlgorithmRefVector acceptedPhysAlgorithmsGtl() const;
00216 
00219       void setConditions( const edm::Handle< TriggerConditionCollection > & handleTriggerConditions ) { conditions_ = TriggerConditionRefProd( handleTriggerConditions ); };
00222       const TriggerConditionCollection * conditions() const { return conditions_.get(); };
00225       const TriggerConditionRefVector conditionRefs() const;
00228       const TriggerCondition * condition( const std::string & nameCondition ) const;
00231       const TriggerConditionRef conditionRef( const std::string & nameCondition ) const;
00234       unsigned indexCondition( const std::string & nameCondition ) const;
00236       TriggerConditionRefVector acceptedConditions() const;
00237 
00240       void setPaths( const edm::Handle< TriggerPathCollection > & handleTriggerPaths ) { paths_ = TriggerPathRefProd( handleTriggerPaths ); };
00243       const TriggerPathCollection * paths() const { return paths_.get(); };
00246       const TriggerPathRefVector pathRefs() const;
00249       const TriggerPath * path( const std::string & namePath ) const;
00252       const TriggerPathRef pathRef( const std::string & namePath ) const;
00255       unsigned indexPath( const std::string & namePath ) const;
00257       TriggerPathRefVector acceptedPaths() const;
00258 
00261       void setFilters( const edm::Handle< TriggerFilterCollection > & handleTriggerFilters ) { filters_ = TriggerFilterRefProd( handleTriggerFilters ); };
00264       const TriggerFilterCollection * filters() const { return filters_.get(); };
00267       const TriggerFilterRefVector filterRefs() const;
00270       const TriggerFilter * filter( const std::string & labelFilter ) const;
00273       const TriggerFilterRef filterRef( const std::string & labelFilter ) const;
00276       unsigned indexFilter( const std::string & labelFilter ) const;
00278       TriggerFilterRefVector acceptedFilters() const;
00279 
00282       void setObjects( const edm::Handle< TriggerObjectCollection > & handleTriggerObjects ) { objects_ = TriggerObjectRefProd( handleTriggerObjects ); };
00285       const TriggerObjectCollection * objects() const { return objects_.get(); };
00288       const TriggerObjectRefVector objectRefs() const;
00290       TriggerObjectRefVector objects( trigger::TriggerObjectType triggerObjectType ) const;
00291       TriggerObjectRefVector objects( int                        triggerObjectType ) const { return objects( trigger::TriggerObjectType( triggerObjectType ) ); }; // for backward compatibility
00292 
00295       TriggerConditionRefVector algorithmConditions( const std::string & nameAlgorithm ) const;
00297       bool conditionInAlgorithm( const TriggerConditionRef & conditionRef, const std::string & nameAlgorithm ) const;
00299       TriggerAlgorithmRefVector conditionAlgorithms( const TriggerConditionRef & conditionRef ) const;
00301       std::vector< std::string > conditionCollections( const std::string & nameAlgorithm ) const;
00303       TriggerObjectRefVector conditionObjects( const std::string & nameCondition ) const;
00305       bool objectInCondition( const TriggerObjectRef & objectRef, const std::string & nameCondition ) const;
00307       TriggerConditionRefVector objectConditions( const TriggerObjectRef & objectRef ) const;
00309       TriggerObjectRefVector algorithmObjects( const std::string & nameAlgorithm ) const;
00311       bool objectInAlgorithm( const TriggerObjectRef & objectRef, const std::string & nameAlgorithm ) const;
00313       TriggerAlgorithmRefVector objectAlgorithms( const TriggerObjectRef & objectRef  ) const;
00314 
00318       TriggerFilterRefVector pathModules( const std::string & namePath, bool all = true ) const;
00320       TriggerFilterRefVector pathFilters( const std::string & namePath, bool firing = true ) const;
00322       bool filterInPath( const TriggerFilterRef & filterRef, const std::string & namePath, bool firing = true ) const;
00324       TriggerPathRefVector filterPaths( const TriggerFilterRef & filterRef, bool firing = true ) const;
00326       std::vector< std::string > filterCollections( const std::string & labelFilter ) const;
00328       TriggerObjectRefVector filterObjects( const std::string & labelFilter ) const;
00330       bool objectInFilter( const TriggerObjectRef & objectRef, const std::string & labelFilter ) const;
00332       TriggerFilterRefVector objectFilters( const TriggerObjectRef & objectRef, bool firing = true ) const;
00334       TriggerObjectRefVector pathObjects( const std::string & namePath, bool firing = true ) const;
00336       bool objectInPath( const TriggerObjectRef & objectRef, const std::string & namePath, bool firing = true ) const;
00338       TriggerPathRefVector objectPaths( const TriggerObjectRef & objectRef, bool firing = true  ) const;
00339 
00342       bool addObjectMatchResult( const TriggerObjectMatchRefProd               & trigMatches, const std::string & labelMatcher );
00343       bool addObjectMatchResult( const edm::Handle< TriggerObjectMatch >       & trigMatches, const std::string & labelMatcher ) { return addObjectMatchResult( TriggerObjectMatchRefProd( trigMatches ), labelMatcher ); };
00344       bool addObjectMatchResult( const edm::OrphanHandle< TriggerObjectMatch > & trigMatches, const std::string & labelMatcher ) { return addObjectMatchResult( TriggerObjectMatchRefProd( trigMatches ), labelMatcher ); };
00346       std::vector< std::string > triggerMatchers() const;
00348       const TriggerObjectMatchContainer * triggerObjectMatchResults() const { return &objectMatchResults_; };
00352       const TriggerObjectMatch * triggerObjectMatchResult( const std::string & labelMatcher ) const;
00353 
00355 
00356   };
00357 
00358 }
00359 
00360 
00361 #endif