00001 #ifndef GenericTriggerEventFlag_H 00002 #define GenericTriggerEventFlag_H 00003 00004 00005 // -*- C++ -*- 00006 // 00007 // Package: CommonTools/RecoUtils 00008 // Class: GenericTriggerEventFlag 00009 // 00010 // $Id: GenericTriggerEventFlag.h,v 1.3 2010/05/12 14:12:17 vadler Exp $ 00011 // 00023 #include "FWCore/Framework/interface/Run.h" 00024 #include "FWCore/Framework/interface/Event.h" 00025 #include "FWCore/Framework/interface/EventSetup.h" 00026 #include "FWCore/Framework/interface/ESWatcher.h" 00027 #include "CondFormats/DataRecord/interface/AlCaRecoTriggerBitsRcd.h" 00028 #include "DataFormats/Common/interface/TriggerResults.h" 00029 #include "DataFormats/Scalers/interface/DcsStatus.h" 00030 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" 00031 #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h" 00032 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" 00033 00034 00035 class GenericTriggerEventFlag { 00036 00037 // Utility classes 00038 edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchDB_; 00039 L1GtUtils l1Gt_; 00040 HLTConfigProvider hltConfig_; 00041 bool hltConfigInit_; 00042 // Configuration parameters 00043 bool andOr_; 00044 unsigned verbose_; 00045 bool andOrDcs_; 00046 edm::InputTag dcsInputTag_; 00047 std::vector< int > dcsPartitions_; 00048 bool errorReplyDcs_; 00049 bool andOrGt_; 00050 edm::InputTag gtInputTag_; 00051 std::string gtDBKey_; 00052 std::vector< std::string > gtLogicalExpressions_; 00053 bool errorReplyGt_; 00054 bool andOrL1_; 00055 std::string l1DBKey_; 00056 std::vector< std::string > l1LogicalExpressions_; 00057 bool errorReplyL1_; 00058 bool andOrHlt_; 00059 edm::InputTag hltInputTag_; 00060 std::string hltDBKey_; 00061 std::vector< std::string > hltLogicalExpressions_; 00062 bool errorReplyHlt_; 00063 // Switches 00064 bool on_; 00065 bool onDcs_; 00066 bool onGt_; 00067 bool onL1_; 00068 bool onHlt_; 00069 // Member constants 00070 const std::string configError_; 00071 00072 public: 00073 00074 // Constructors and destructor 00075 GenericTriggerEventFlag( const edm::ParameterSet & config ); // To be called from the ED module's c'tor 00076 ~GenericTriggerEventFlag(); 00077 00078 // Public methods 00079 bool on() { return on_ ; } 00080 bool off() { return ( ! on_ ); } 00081 void initRun( const edm::Run & run, const edm::EventSetup & setup ); // To be called from beginRun() methods 00082 bool accept( const edm::Event & event, const edm::EventSetup & setup ); // To be called from analyze/filter() methods 00083 00084 private: 00085 00086 // Private methods 00087 00088 // DCS 00089 bool acceptDcs( const edm::Event & event ); 00090 bool acceptDcsPartition( const edm::Handle< DcsStatusCollection > & dcsStatus, int dcsPartition ) const; 00091 00092 // GT status bits 00093 bool acceptGt( const edm::Event & event ); 00094 bool acceptGtLogicalExpression( const edm::Handle< L1GlobalTriggerReadoutRecord > & gtReadoutRecord, std::string gtLogicalExpression ); 00095 00096 // L1 00097 bool acceptL1( const edm::Event & event, const edm::EventSetup & setup ); 00098 bool acceptL1LogicalExpression( const edm::Event & event, std::string l1LogicalExpression ); 00099 00100 // HLT 00101 bool acceptHlt( const edm::Event & event ); 00102 bool acceptHltLogicalExpression( const edm::Handle< edm::TriggerResults > & hltTriggerResults, std::string hltLogicalExpression ) const; 00103 00104 // Algos 00105 std::vector< std::string > expressionsFromDB( const std::string & key, const edm::EventSetup & setup ); 00106 bool negate( std::string & word ) const; 00107 00108 }; 00109 00110 00111 #endif