CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HLTPrescaleExample.cc
Go to the documentation of this file.
1 
7 #include <iostream>
8 
9 class HLTPrescaleExample : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
10 public:
12 
13  void beginJob() override {}
14  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
15  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override;
16  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
17  void endJob() override {}
18 
19 private:
23 };
24 
26  : hltPSProvider_(iPSet.getParameter<edm::ParameterSet>("hltPSProvCfg"), consumesCollector(), *this),
27  hltProcess_(iPSet.getParameter<std::string>("hltProcess")),
28  hltPath_(iPSet.getParameter<std::string>("hltPath")) {}
29 
30 void HLTPrescaleExample::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
31  bool changed = false;
32  hltPSProvider_.init(iRun, iSetup, hltProcess_, changed);
33 }
34 
36  auto hltPSDouble = hltPSProvider_.prescaleValue<double>(iEvent, iSetup, hltPath_);
37  auto hltPSInt = hltPSProvider_.prescaleValue<int>(iEvent, iSetup, hltPath_);
38  auto hltPSUInt = hltPSProvider_.prescaleValue<unsigned int>(iEvent, iSetup, hltPath_);
40 
41  auto l1HLTPSDouble = hltPSProvider_.prescaleValues<double>(iEvent, iSetup, hltPath_);
42  auto l1HLTPSInt = hltPSProvider_.prescaleValues<int>(iEvent, iSetup, hltPath_);
43  auto l1HLTPSFrac = hltPSProvider_.prescaleValues<FractionalPrescale>(iEvent, iSetup, hltPath_);
44  auto l1HLTPSDoubleFrac = hltPSProvider_.prescaleValues<double, FractionalPrescale>(iEvent, iSetup, hltPath_);
45 
46  auto l1HLTDetailPSDouble = hltPSProvider_.prescaleValuesInDetail<double>(iEvent, iSetup, hltPath_);
47  auto l1HLTDetailPSInt = hltPSProvider_.prescaleValuesInDetail<int>(iEvent, iSetup, hltPath_);
48  auto l1HLTDetailPSFrac = hltPSProvider_.prescaleValuesInDetail<FractionalPrescale>(iEvent, iSetup, hltPath_);
49 
50  std::cout << "---------Begin Event--------" << std::endl;
51  std::cout << "hltDouble " << hltPSDouble << " hltInt " << hltPSInt << " hltPSUInt " << hltPSUInt << " hltFrac "
52  << hltPSFrac << std::endl;
53 
54  std::cout << " l1HLTDouble " << l1HLTPSDouble.first << " " << l1HLTPSDouble.second << " l1HLTInt " << l1HLTPSInt.first
55  << " " << l1HLTPSInt.second << " l1HLTFrac " << l1HLTPSFrac.first << " " << l1HLTPSFrac.second
56  << " l1HLTDoubleFrac " << l1HLTPSDoubleFrac.first << " " << l1HLTPSDoubleFrac.second << std::endl;
57  auto printL1HLTDetail = [](const std::string& text, const auto& val, std::ostream& out) {
58  out << text;
59  for (const auto& entry : val.first) {
60  out << entry.first << ":" << entry.second << " ";
61  }
62  out << " HLT : " << val.second << std::endl;
63  };
64 
65  printL1HLTDetail("l1HLTDetailDouble ", l1HLTDetailPSDouble, std::cout);
66  printL1HLTDetail("l1HLTDetailInt ", l1HLTDetailPSInt, std::cout);
67  printL1HLTDetail("l1HLTDetailFrac ", l1HLTDetailPSFrac, std::cout);
68  std::cout << "---------End Event--------" << std::endl << std::endl;
69 }
70 
void endJob() override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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)
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.
tuple text
Definition: runonSM.py:43
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
list entry
Definition: mps_splice.py:68
tuple cout
Definition: gather_cfg.py:144
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