File indexing completed on 2024-04-06 12:19:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
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 }
0036
0037 using namespace edmtest;
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 GetTriggerNamesAnalyzer::GetTriggerNamesAnalyzer(edm::ParameterSet const&)
0050 : trToken_(consumes(edm::InputTag("TriggerResults", "", edm::InputTag::kSkipCurrentProcess))) {}
0051
0052
0053
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);