CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h

Go to the documentation of this file.
00001 #ifndef GenericTriggerEventFlag_H
00002 #define GenericTriggerEventFlag_H
00003 
00004 
00005 // -*- C++ -*-
00006 //
00007 // Package:    CommonTools/TriggerUtils
00008 // Class:      GenericTriggerEventFlag
00009 //
00010 // $Id: GenericTriggerEventFlag.h,v 1.6 2012/01/20 18:18:11 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 "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h"
00031 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00032 
00033 #include <string>
00034 
00035 
00036 class GenericTriggerEventFlag {
00037 
00038     // Utility classes
00039     edm::ESWatcher< AlCaRecoTriggerBitsRcd > * watchDB_;
00040     L1GtUtils                                  l1Gt_;
00041     HLTConfigProvider                          hltConfig_;
00042     bool                                       hltConfigInit_;
00043     // Configuration parameters
00044     bool        andOr_;
00045     std::string dbLabel_;
00046     unsigned    verbose_;
00047     bool               andOrDcs_;
00048     edm::InputTag      dcsInputTag_;
00049     std::vector< int > dcsPartitions_;
00050     bool               errorReplyDcs_;
00051     bool                       andOrGt_;
00052     edm::InputTag              gtInputTag_;
00053     edm::InputTag              gtEvmInputTag_;
00054     std::string                gtDBKey_;
00055     std::vector< std::string > gtLogicalExpressions_;
00056     bool                       errorReplyGt_;
00057     bool                       andOrL1_;
00058     bool                       l1BeforeMask_;
00059     std::string                l1DBKey_;
00060     std::vector< std::string > l1LogicalExpressionsCache_;
00061     std::vector< std::string > l1LogicalExpressions_;
00062     bool                       errorReplyL1_;
00063     bool                       andOrHlt_;
00064     edm::InputTag              hltInputTag_;
00065     std::string                hltDBKey_;
00066     std::vector< std::string > hltLogicalExpressionsCache_;
00067     std::vector< std::string > hltLogicalExpressions_;
00068     bool                       errorReplyHlt_;
00069     // Switches
00070     bool on_;
00071     bool onDcs_;
00072     bool onGt_;
00073     bool onL1_;
00074     bool onHlt_;
00075     // Member constants
00076     const std::string configError_;
00077     const std::string emptyKeyError_;
00078 
00079   public:
00080 
00081     // Constructors and destructor
00082     GenericTriggerEventFlag( const edm::ParameterSet & config ); // To be called from the ED module's c'tor
00083     ~GenericTriggerEventFlag();
00084 
00085     // Public methods
00086     bool on()  { return     on_  ; }
00087     bool off() { return ( ! on_ ); }
00088     void initRun( const edm::Run & run, const edm::EventSetup & setup );    // To be called from beginRun() methods
00089     bool accept( const edm::Event & event, const edm::EventSetup & setup ); // To be called from analyze/filter() methods
00090 
00091   private:
00092 
00093     // Private methods
00094 
00095     // DCS
00096     bool acceptDcs( const edm::Event & event );
00097     bool acceptDcsPartition( const edm::Handle< DcsStatusCollection > & dcsStatus, int dcsPartition ) const;
00098 
00099     // GT status bits
00100     bool acceptGt( const edm::Event & event );
00101     bool acceptGtLogicalExpression( const edm::Event & event, std::string gtLogicalExpression );
00102 
00103     // L1
00104     bool acceptL1( const edm::Event & event, const edm::EventSetup & setup );
00105     bool acceptL1LogicalExpression( const edm::Event & event, std::string l1LogicalExpression );
00106 
00107     // HLT
00108     bool acceptHlt( const edm::Event & event );
00109     bool acceptHltLogicalExpression( const edm::Handle< edm::TriggerResults > & hltTriggerResults, std::string hltLogicalExpression ) const;
00110 
00111     // Algos
00112     std::string expandLogicalExpression( const std::vector< std::string > & target, const std::string & expr, bool useAnd = false ) const;
00113     bool negate( std::string & word ) const;
00114 
00115   public:
00116 
00117     // Methods for expert analysis
00118 
00119     std::string gtDBKey()  { return gtDBKey_ ; } // can be empty
00120     std::string l1DBKey()  { return l1DBKey_ ; } // can be empty
00121     std::string hltDBKey() { return hltDBKey_; } // can be empty
00122 
00123     std::vector< std::string > expressionsFromDB( const std::string & key, const edm::EventSetup & setup );
00124 
00125 };
00126 
00127 
00128 #endif