File indexing completed on 2024-04-06 12:06:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <memory>
0010 #include <vector>
0011 #include <map>
0012 #include <set>
0013
0014
0015 #include "DPGAnalysis/Skims/interface/HLTInspect.h"
0016
0017 #include "FWCore/Utilities/interface/InputTag.h"
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/MakerMacros.h"
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 #include "FWCore/Framework/interface/ESHandle.h"
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 #include "DataFormats/L1GlobalTrigger/interface/L1GtFdlWord.h"
0025 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0026 #include "DataFormats/Common/interface/TriggerResults.h"
0027 #include "FWCore/Common/interface/TriggerNames.h"
0028
0029 using namespace edm;
0030 using namespace std;
0031
0032 HLTInspect::HLTInspect(const edm::ParameterSet& iConfig) {
0033 hlTriggerResults_ = iConfig.getParameter<edm::InputTag>("HLTriggerResults");
0034 init_ = false;
0035 }
0036
0037 HLTInspect::~HLTInspect() {}
0038 void HLTInspect::analyze(const edm::Event& iEvent, const edm::EventSetup& c) {
0039 int ievt = iEvent.id().event();
0040 int irun = iEvent.id().run();
0041 int ils = iEvent.luminosityBlock();
0042 int bx = iEvent.bunchCrossing();
0043
0044
0045
0046 int trigger_type = -1;
0047 if (iEvent.isRealData())
0048 trigger_type = iEvent.experimentType();
0049
0050
0051 edm::Handle<TriggerResults> HLTR;
0052 iEvent.getByLabel(hlTriggerResults_, HLTR);
0053
0054 if (HLTR.isValid() == false) {
0055 std::cout << " HLTInspect Error - Could not access Results with name " << hlTriggerResults_ << std::endl;
0056 }
0057 if (HLTR.isValid()) {
0058 if (!init_) {
0059 init_ = true;
0060 const edm::TriggerNames& triggerNames = iEvent.triggerNames(*HLTR);
0061 hlNames_ = triggerNames.triggerNames();
0062 }
0063 std::cout << "HLTInspect: Run " << irun << " Ev " << ievt << " LB " << ils << " BX " << bx << " Type "
0064 << trigger_type << " Acc: ";
0065 const unsigned int n(hlNames_.size());
0066 for (unsigned int i = 0; i != n; ++i) {
0067 if (HLTR->accept(i)) {
0068 std::cout << hlNames_[i] << ",";
0069 }
0070 }
0071 std::cout << std::endl;
0072 }
0073 }
0074
0075 DEFINE_FWK_MODULE(HLTInspect);