CommonTools
UtilAlgos
plugins
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
19
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
20
#include "
FWCore/Framework/interface/one/EDProducer.h
"
21
#include "
FWCore/Framework/interface/Event.h
"
22
#include "
FWCore/Framework/interface/LuminosityBlock.h
"
23
#include "
FWCore/Framework/interface/MakerMacros.h
"
24
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
25
26
#include "
DataFormats/Common/interface/MergeableCounter.h
"
27
28
class
EventCountProducer
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
;
38
void
endLuminosityBlockProduce
(
edm::LuminosityBlock
&,
const
edm::EventSetup
&)
override
;
39
40
// ----------member data ---------------------------
41
42
unsigned
int
eventsProcessedInLumi_
;
43
};
44
45
using namespace
edm
;
46
using namespace
std
;
47
48
EventCountProducer::EventCountProducer
(
const
edm::ParameterSet
& iConfig) {
49
produces<edm::MergeableCounter, edm::Transition::EndLuminosityBlock>();
50
}
51
52
EventCountProducer::~EventCountProducer
() {}
53
54
void
EventCountProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
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
77
DEFINE_FWK_MODULE
(
EventCountProducer
);
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:36
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:115
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:671
ParameterSet.h
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16