Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-11 22:53:47

0001 #ifndef HLTHighLevel_h
0002 #define HLTHighLevel_h
0003 
0004 /** \class HLTHighLevel
0005  *
0006  *  
0007  *  This class is an HLTFilter (-> EDFilter) implementing filtering on
0008  *  HLT bits
0009  *
0010  *
0011  *  \author Martin Grunewald
0012  *
0013  */
0014 
0015 // C++ headers
0016 #include <vector>
0017 #include <string>
0018 #include <optional>
0019 
0020 // CMSSW headers
0021 #include "FWCore/Framework/interface/Event.h"
0022 #include "FWCore/Framework/interface/stream/EDFilter.h"
0023 #include "FWCore/Framework/interface/ESWatcher.h"
0024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0025 #include "FWCore/Utilities/interface/ESGetToken.h"
0026 #include "FWCore/Common/interface/TriggerNames.h"
0027 #include "DataFormats/Provenance/interface/ParameterSetID.h"
0028 
0029 // forward declarations
0030 namespace edm {
0031   class ConfigurationDescriptions;
0032   class TriggerResults;
0033 }  // namespace edm
0034 
0035 class AlCaRecoTriggerBits;
0036 class AlCaRecoTriggerBitsRcd;
0037 
0038 //
0039 // class declaration
0040 //
0041 
0042 class HLTHighLevel : public edm::stream::EDFilter<> {
0043 public:
0044   explicit HLTHighLevel(const edm::ParameterSet &);
0045   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0046 
0047   bool filter(edm::Event &, const edm::EventSetup &) override;
0048 
0049   /// get HLTPaths with key 'key' from EventSetup (AlCaRecoTriggerBitsRcd)
0050   std::vector<std::string> pathsFromSetup(const std::string &key,
0051                                           const edm::Event &,
0052                                           const edm::EventSetup &iSetup) const;
0053 
0054 private:
0055   /// initialize the trigger conditions (call this if the trigger paths have changed)
0056   void init(const edm::TriggerResults &results,
0057             const edm::Event &,
0058             const edm::EventSetup &iSetup,
0059             const edm::TriggerNames &triggerNames);
0060 
0061   /// HLT TriggerResults EDProduct
0062   edm::InputTag inputTag_;
0063   edm::EDGetTokenT<edm::TriggerResults> inputToken_;
0064 
0065   /// HLT trigger names
0066   edm::ParameterSetID triggerNamesID_;
0067 
0068   /// false = and-mode (all requested triggers), true = or-mode (at least one)
0069   bool andOr_;
0070 
0071   /// throw on any requested trigger being unknown
0072   bool throw_;
0073 
0074   /// stolen from HLTFilter
0075   std::string const &pathName(const edm::Event &) const;
0076   std::string const &moduleLabel() const;
0077 
0078   /// not empty => use read paths from AlCaRecoTriggerBitsRcd via this key
0079   const std::string eventSetupPathsKey_;
0080   const std::string eventSetupPathsLabel_;
0081   /// Watcher to be created and used if 'eventSetupPathsKey_' non empty:
0082   std::optional<edm::ESWatcher<AlCaRecoTriggerBitsRcd>> watchAlCaRecoTriggerBitsRcd_;
0083   /// ESGetToken to read AlCaRecoTriggerBits
0084   edm::ESGetToken<AlCaRecoTriggerBits, AlCaRecoTriggerBitsRcd> alcaRecotriggerBitsToken_;
0085 
0086   /// input patterns that will be expanded into trigger names
0087   std::vector<std::string> HLTPatterns_;
0088 
0089   /// list of required HLT triggers by HLT name
0090   std::vector<std::string> HLTPathsByName_;
0091 
0092   /// list of required HLT triggers by HLT index
0093   std::vector<unsigned int> HLTPathsByIndex_;
0094 };
0095 
0096 #endif  //HLTHighLevel_h