CMS 3D CMS Logo

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 
HLTPrescaleExample::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: HLTPrescaleExample.cc:30
EDAnalyzer.h
edm::Run
Definition: Run.h:45
HLTPrescaleExample::hltProcess_
std::string hltProcess_
Definition: HLTPrescaleExample.cc:21
edm
HLT enums.
Definition: AlignableModifier.h:19
mps_splice.entry
entry
Definition: mps_splice.py:68
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HLTPrescaleProvider::prescaleValues
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.
Definition: HLTPrescaleProvider.h:72
HLTPrescaleExample::HLTPrescaleExample
HLTPrescaleExample(edm::ParameterSet const &iPSet)
Definition: HLTPrescaleExample.cc:25
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLTPrescaleExample::hltPSProvider_
HLTPrescaleProvider hltPSProvider_
Definition: HLTPrescaleExample.cc:20
HLTPrescaleExample::endJob
void endJob() override
Definition: HLTPrescaleExample.cc:17
HLTPrescaleExample::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: HLTPrescaleExample.cc:16
HLTPrescaleProvider::prescaleValuesInDetail
std::pair< std::vector< std::pair< std::string, TL1 > >, THLT > prescaleValuesInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
Definition: HLTPrescaleProvider.h:82
HLTPrescaleExample::hltPath_
std::string hltPath_
Definition: HLTPrescaleExample.cc:22
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
ParameterSet
Definition: Functions.h:16
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTPrescaleExample::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition: HLTPrescaleExample.cc:35
HLTPrescaleProvider
Definition: HLTPrescaleProvider.h:38
edm::EventSetup
Definition: EventSetup.h:58
FractionalPrescale
boost::rational< int > FractionalPrescale
Definition: FractionalPrescale.h:5
HLTPrescaleProvider::init
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
Definition: HLTPrescaleProvider.cc:21
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HLTPrescaleProvider::prescaleValue
T prescaleValue(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
combining the two methods above
Definition: HLTPrescaleProvider.h:63
HLTPrescaleExample::beginJob
void beginJob() override
Definition: HLTPrescaleExample.cc:13
heppy_batch.val
val
Definition: heppy_batch.py:351
std
Definition: JetResolutionObject.h:76
HLTPrescaleProvider.h
HLTPrescaleExample
Definition: HLTPrescaleExample.cc:9
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ParameterSet.h
runonSM.text
text
Definition: runonSM.py:43
edm::Event
Definition: Event.h:73