Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:08

0001 // -*- C++ -*-
0002 //
0003 // Package:     IOPool/Input
0004 // Class  :     GetTriggerNamesAnalyzer
0005 //
0006 // Implementation:
0007 //     [Notes on implementation]
0008 //
0009 // Original Author:  Christopher Jones
0010 //         Created:  Mon, 11 Sep 2023 13:00:39 GMT
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0017 #include "FWCore/Framework/interface/Event.h"
0018 #include "FWCore/Framework/interface/MakerMacros.h"
0019 #include "FWCore/Utilities/interface/EDGetToken.h"
0020 #include "FWCore/Utilities/interface/InputTag.h"
0021 #include "FWCore/Utilities/interface/Exception.h"
0022 #include "DataFormats/Common/interface/TriggerResults.h"
0023 #include "FWCore/Common/interface/TriggerNames.h"
0024 
0025 namespace edmtest {
0026   class GetTriggerNamesAnalyzer : public edm::global::EDAnalyzer<> {
0027   public:
0028     explicit GetTriggerNamesAnalyzer(edm::ParameterSet const&);
0029 
0030     void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const final;
0031 
0032   private:
0033     edm::EDGetTokenT<edm::TriggerResults> const trToken_;
0034   };
0035 }  // namespace edmtest
0036 
0037 using namespace edmtest;
0038 //
0039 // constants, enums and typedefs
0040 //
0041 
0042 //
0043 // static data member definitions
0044 //
0045 
0046 //
0047 // constructors and destructor
0048 //
0049 GetTriggerNamesAnalyzer::GetTriggerNamesAnalyzer(edm::ParameterSet const&)
0050     : trToken_(consumes(edm::InputTag("TriggerResults", "", edm::InputTag::kSkipCurrentProcess))) {}
0051 
0052 //
0053 // const member functions
0054 //
0055 void GetTriggerNamesAnalyzer::analyze(edm::StreamID, edm::Event const& iEvent, edm::EventSetup const&) const {
0056   if (iEvent.triggerNames(iEvent.get(trToken_)).triggerNames().empty()) {
0057     throw cms::Exception("TestFailed") << " trigger names is empty";
0058   }
0059 }
0060 
0061 DEFINE_FWK_MODULE(edmtest::GetTriggerNamesAnalyzer);