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 
31 public:
32  explicit EventCountProducer(const edm::ParameterSet&);
34 
35 private:
36  virtual void produce(edm::Event &, const edm::EventSetup &);
39 
40  // ----------member data ---------------------------
41 
42  unsigned int eventsProcessedInLumi_;
43 
44 };
45 
46 
47 
48 using namespace edm;
49 using namespace std;
50 
51 
52 
54  produces<edm::MergeableCounter, edm::InLumi>();
55 }
56 
57 
59 
60 
61 void
63  eventsProcessedInLumi_++;
64  return;
65 }
66 
67 
68 void
69 EventCountProducer::beginLuminosityBlock(LuminosityBlock & theLuminosityBlock, const EventSetup & theSetup) {
70  eventsProcessedInLumi_ = 0;
71  return;
72 }
73 
74 
75 void
76 EventCountProducer::endLuminosityBlock(LuminosityBlock & theLuminosityBlock, const EventSetup & theSetup) {
77  LogTrace("EventCounting") << "endLumi: adding " << eventsProcessedInLumi_ << " events" << endl;
78 
79  auto_ptr<edm::MergeableCounter> numEventsPtr(new edm::MergeableCounter);
80  numEventsPtr->value = eventsProcessedInLumi_;
81  theLuminosityBlock.put(numEventsPtr);
82 
83  return;
84 }
85 
86 
87 
88 //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 &)
virtual void endLuminosityBlock(edm::LuminosityBlock &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:243
EventCountProducer(const edm::ParameterSet &)
virtual void beginLuminosityBlock(edm::LuminosityBlock &, const edm::EventSetup &)
#define LogTrace(id)
void put(std::auto_ptr< PROD > product)
Put a new product.