DPGAnalysis
SiStripTools
plugins
EventWithHistoryProducer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: EventWithHistoryProducer
4
// Class: EventWithHistoryProducer
5
//
13
//
14
// Original Author: Andrea Venturi
15
// Created: Sun Nov 30 19:05:41 CET 2008
16
// $Id: EventWithHistoryProducer.cc,v 1.2 2010/01/12 09:13:04 venturia Exp $
17
//
18
//
19
20
// system include files
21
#include <memory>
22
23
// user include files
24
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
25
#include "
FWCore/Framework/interface/EDProducer.h
"
26
27
#include "
FWCore/Framework/interface/Event.h
"
28
#include "
FWCore/Framework/interface/MakerMacros.h
"
29
30
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
31
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
32
33
//#include "DPGAnalysis/SiStripTools/interface/TinyEvent.h"
34
#include "
DPGAnalysis/SiStripTools/interface/EventWithHistory.h
"
35
36
//
37
// class decleration
38
//
39
40
class
EventWithHistoryProducer
:
public
edm::EDProducer
{
41
public
:
42
explicit
EventWithHistoryProducer
(
const
edm::ParameterSet
&);
43
~EventWithHistoryProducer
()
override
;
44
45
private
:
46
void
beginJob
()
override
;
47
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
48
void
endJob
()
override
;
49
50
// ----------member data ---------------------------
51
52
const
unsigned
int
_depth
;
53
EventWithHistory
_prevHE
;
54
};
55
56
//
57
// constants, enums and typedefs
58
//
59
60
//
61
// static data member definitions
62
//
63
64
//
65
// constructors and destructor
66
//
67
EventWithHistoryProducer::EventWithHistoryProducer
(
const
edm::ParameterSet
& iConfig)
68
: _depth(iConfig.getUntrackedParameter<unsigned
int
>(
"historyDepth"
)), _prevHE() {
69
produces<EventWithHistory>();
70
71
//now do what ever other initialization is needed
72
}
73
74
EventWithHistoryProducer::~EventWithHistoryProducer
() {
75
// do anything here that needs to be done at desctruction time
76
// (e.g. close files, deallocate resources etc.)
77
}
78
79
//
80
// member functions
81
//
82
83
// ------------ method called to produce the data ------------
84
void
EventWithHistoryProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
85
using namespace
edm
;
86
87
std::unique_ptr<EventWithHistory> heOut(
88
new
EventWithHistory
(
iEvent
.id().event(),
iEvent
.orbitNumber(),
iEvent
.bunchCrossing()));
89
heOut->add(
_prevHE
,
_depth
);
90
91
if
(*heOut <
_prevHE
)
92
edm::LogInfo
(
"EventsNotInOrder"
) <<
" Events not in order "
<<
_prevHE
.
_event
;
93
94
_prevHE
= *heOut;
95
iEvent
.put(
std::move
(heOut));
96
}
97
98
// ------------ method called once each job just before starting event loop ------------
99
void
EventWithHistoryProducer::beginJob
() {}
100
101
// ------------ method called once each job just after ending the event loop ------------
102
void
EventWithHistoryProducer::endJob
() {}
103
104
//define this as a plug-in
105
DEFINE_FWK_MODULE
(
EventWithHistoryProducer
);
MessageLogger.h
EDProducer.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
TinyEvent::_event
edm::EventNumber_t _event
Definition:
TinyEvent.h:64
EventWithHistory.h
edm::LogInfo
Log< level::Info, false > LogInfo
Definition:
MessageLogger.h:125
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
EventWithHistoryProducer
Definition:
EventWithHistoryProducer.cc:40
EventWithHistoryProducer::~EventWithHistoryProducer
~EventWithHistoryProducer() override
Definition:
EventWithHistoryProducer.cc:74
EventWithHistoryProducer::endJob
void endJob() override
Definition:
EventWithHistoryProducer.cc:102
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
createfilelist.int
int
Definition:
createfilelist.py:10
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
EventWithHistory
Definition:
EventWithHistory.h:17
EventWithHistoryProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
EventWithHistoryProducer.cc:84
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Frameworkfwd.h
edm::EDProducer
Definition:
EDProducer.h:35
EventWithHistoryProducer::beginJob
void beginJob() override
Definition:
EventWithHistoryProducer.cc:99
EventWithHistoryProducer::EventWithHistoryProducer
EventWithHistoryProducer(const edm::ParameterSet &)
Definition:
EventWithHistoryProducer.cc:67
ParameterSet.h
edm::Event
Definition:
Event.h:73
EventWithHistoryProducer::_prevHE
EventWithHistory _prevHE
Definition:
EventWithHistoryProducer.cc:53
EventWithHistoryProducer::_depth
const unsigned int _depth
Definition:
EventWithHistoryProducer.cc:52
Generated for CMSSW Reference Manual by
1.8.16