CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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&);
35 
36 private:
37  virtual void produce(edm::Event &, const edm::EventSetup&) override;
38  virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup&) override;
39  virtual void endLuminosityBlock(edm::LuminosityBlock const&, const edm::EventSetup&) override;
40  virtual void endLuminosityBlockProduce(edm::LuminosityBlock &, 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::InLumi>();
57 }
58 
59 
61 
62 
63 void
65  eventsProcessedInLumi_++;
66  return;
67 }
68 
69 
70 void
71 EventCountProducer::beginLuminosityBlock(const LuminosityBlock & theLuminosityBlock, const EventSetup & theSetup) {
72  eventsProcessedInLumi_ = 0;
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
virtual 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.
def move
Definition: eostools.py:510
#define LogTrace(id)
virtual void endLuminosityBlockProduce(edm::LuminosityBlock &, const edm::EventSetup &) override
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
virtual void endLuminosityBlock(edm::LuminosityBlock const &, const edm::EventSetup &) override