CMS 3D CMS Logo

HLTPrescaleExample.cc
Go to the documentation of this file.
1 #include <string>
2 
9 
10 class HLTPrescaleExample : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
11 public:
13 
14  void beginJob() override {}
15  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
16  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
17  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
18  void endJob() override {}
19 
20 private:
24 };
25 
27  : hltPSProvider_(iPSet.getParameter<edm::ParameterSet>("hltPSProvCfg"), consumesCollector(), *this),
28  hltProcess_(iPSet.getParameter<std::string>("hltProcess")),
29  hltPath_(iPSet.getParameter<std::string>("hltPath")) {}
30 
31 void HLTPrescaleExample::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
32  bool changed = false;
33  hltPSProvider_.init(iRun, iSetup, hltProcess_, changed);
34 }
35 
37  auto const hltPSDouble = hltPSProvider_.prescaleValue<double>(iEvent, iSetup, hltPath_);
38  auto const hltPSFrac = hltPSProvider_.prescaleValue<FractionalPrescale>(iEvent, iSetup, hltPath_);
39 
40  auto const l1HLTPSDouble = hltPSProvider_.prescaleValues<double>(iEvent, iSetup, hltPath_);
41  auto const l1HLTPSFrac = hltPSProvider_.prescaleValues<FractionalPrescale>(iEvent, iSetup, hltPath_);
42  auto const l1HLTPSDoubleFrac = hltPSProvider_.prescaleValues<double, FractionalPrescale>(iEvent, iSetup, hltPath_);
43 
44  auto const l1HLTDetailPSDouble = hltPSProvider_.prescaleValuesInDetail<double>(iEvent, iSetup, hltPath_);
45  auto const l1HLTDetailPSFrac = hltPSProvider_.prescaleValuesInDetail<FractionalPrescale>(iEvent, iSetup, hltPath_);
46 
47  edm::LogPrint log("");
48 
49  log << "---------Begin Event--------\n";
50  log << "hltDouble " << hltPSDouble << " hltFrac " << hltPSFrac << "\n";
51  log << " l1HLTDouble " << l1HLTPSDouble.first << " " << l1HLTPSDouble.second << " l1HLTFrac " << l1HLTPSFrac.first
52  << " " << l1HLTPSFrac.second << " l1HLTDoubleFrac " << l1HLTPSDoubleFrac.first << " " << l1HLTPSDoubleFrac.second
53  << "\n";
54  auto printL1HLTDetail = [&log](const std::string& text, const auto& val) {
55  log << text;
56  for (const auto& entry : val.first) {
57  log << entry.first << ":" << entry.second << " ";
58  }
59  log << " HLT : " << val.second << "\n";
60  };
61 
62  printL1HLTDetail("l1HLTDetailDouble ", l1HLTDetailPSDouble);
63  printL1HLTDetail("l1HLTDetailFrac ", l1HLTDetailPSFrac);
64  log << "---------End Event--------\n\n";
65 }
66 
void endJob() override
T prescaleValue(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
combining the two methods above
std::pair< std::vector< std::pair< std::string, TL1 > >, THLT > prescaleValuesInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
HLTPrescaleExample(edm::ParameterSet const &iPSet)
std::string const hltProcess_
boost::rational< int > FractionalPrescale
HLTPrescaleProvider hltPSProvider_
int iEvent
Definition: GenABIO.cc:224
std::pair< TL1, THLT > prescaleValues(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::string const hltPath_
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
HLT enums.
void beginJob() override
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
Definition: Run.h:45