CMS 3D CMS Logo

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