CMS 3D CMS Logo

EventCountProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EventCountProducer
4 // Class: EventCountProducer
5 //
13 // system include files
14 #include <memory>
15 #include <vector>
16 #include <algorithm>
17 #include <iostream>
18 
19 // user include files
26 
28 
29 
30 class EventCountProducer : public edm::one::EDProducer<edm::one::WatchLuminosityBlocks,
31  edm::EndLuminosityBlockProducer> {
32 public:
33  explicit EventCountProducer(const edm::ParameterSet&);
34  ~EventCountProducer() override;
35 
36 private:
37  void produce(edm::Event &, const edm::EventSetup&) override;
38  void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup&) override;
39  void endLuminosityBlock(edm::LuminosityBlock const&, const edm::EventSetup&) override;
41 
42  // ----------member data ---------------------------
43 
44  unsigned int eventsProcessedInLumi_;
45 
46 };
47 
48 
49 
50 using namespace edm;
51 using namespace std;
52 
53 
54 
56  produces<edm::MergeableCounter, edm::Transition::EndLuminosityBlock>();
57 }
58 
59 
61 
62 
63 void
66  return;
67 }
68 
69 
70 void
71 EventCountProducer::beginLuminosityBlock(const LuminosityBlock & theLuminosityBlock, const EventSetup & theSetup) {
73  return;
74 }
75 
76 void
77 EventCountProducer::endLuminosityBlock(LuminosityBlock const& theLuminosityBlock, const EventSetup & theSetup) {
78 }
79 
80 void
82  LogTrace("EventCounting") << "endLumi: adding " << eventsProcessedInLumi_ << " events" << endl;
83 
84  unique_ptr<edm::MergeableCounter> numEventsPtr(new edm::MergeableCounter);
85  numEventsPtr->value = eventsProcessedInLumi_;
86  theLuminosityBlock.put(std::move(numEventsPtr));
87 
88  return;
89 }
90 
91 
92 
93 //define this as a plug-in
unsigned int eventsProcessedInLumi_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void produce(edm::Event &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:230
EventCountProducer(const edm::ParameterSet &)
void put(std::unique_ptr< PROD > product)
Put a new product.
#define LogTrace(id)
void endLuminosityBlockProduce(edm::LuminosityBlock &, const edm::EventSetup &) override
HLT enums.
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
void endLuminosityBlock(edm::LuminosityBlock const &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:510
~EventCountProducer() override