Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
21
// system include files
22
#include <memory>
23
24
// user include files
25
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
26
#include "
FWCore/Framework/interface/EDProducer.h
"
27
28
#include "
FWCore/Framework/interface/Event.h
"
29
#include "
FWCore/Framework/interface/MakerMacros.h
"
30
31
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
32
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
33
34
//#include "DPGAnalysis/SiStripTools/interface/TinyEvent.h"
35
#include "
DPGAnalysis/SiStripTools/interface/EventWithHistory.h
"
36
37
//
38
// class decleration
39
//
40
41
class
EventWithHistoryProducer
:
public
edm::EDProducer
{
42
public
:
43
explicit
EventWithHistoryProducer
(
const
edm::ParameterSet
&);
44
~EventWithHistoryProducer
();
45
46
private
:
47
virtual
void
beginJob
()
override
;
48
virtual
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
49
virtual
void
endJob
()
override
;
50
51
// ----------member data ---------------------------
52
53
const
unsigned
int
_depth
;
54
EventWithHistory
_prevHE
;
55
};
56
57
//
58
// constants, enums and typedefs
59
//
60
61
62
//
63
// static data member definitions
64
//
65
66
//
67
// constructors and destructor
68
//
69
EventWithHistoryProducer::EventWithHistoryProducer
(
const
edm::ParameterSet
& iConfig):
70
_depth(iConfig.getUntrackedParameter<unsigned int>(
"historyDepth"
)),
71
_prevHE()
72
{
73
74
produces<EventWithHistory>();
75
76
//now do what ever other initialization is needed
77
78
}
79
80
81
EventWithHistoryProducer::~EventWithHistoryProducer
()
82
{
83
84
// do anything here that needs to be done at desctruction time
85
// (e.g. close files, deallocate resources etc.)
86
87
}
88
89
90
//
91
// member functions
92
//
93
94
// ------------ method called to produce the data ------------
95
void
96
EventWithHistoryProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
97
{
98
99
using namespace
edm;
100
101
std::auto_ptr<EventWithHistory> heOut(
new
EventWithHistory
(iEvent.
id
().
event
(),iEvent.
orbitNumber
(),iEvent.
bunchCrossing
()));
102
heOut->add(
_prevHE
,
_depth
);
103
104
if
(*heOut <
_prevHE
)
edm::LogInfo
(
"EventsNotInOrder"
) <<
" Events not in order "
<<
_prevHE
.
_event
;
105
106
_prevHE
= *heOut;
107
iEvent.
put
(heOut);
108
109
}
110
111
// ------------ method called once each job just before starting event loop ------------
112
void
113
EventWithHistoryProducer::beginJob
()
114
{
115
}
116
117
// ------------ method called once each job just after ending the event loop ------------
118
void
119
EventWithHistoryProducer::endJob
() {
120
}
121
122
//define this as a plug-in
123
DEFINE_FWK_MODULE
(
EventWithHistoryProducer
);
edm::EventID::event
EventNumber_t event() const
Definition:
EventID.h:41
EventWithHistoryProducer
Definition:
EventWithHistoryProducer.cc:41
EventWithHistoryProducer::beginJob
virtual void beginJob() override
Definition:
EventWithHistoryProducer.cc:113
MessageLogger.h
EventWithHistoryProducer::EventWithHistoryProducer
EventWithHistoryProducer(const edm::ParameterSet &)
Definition:
EventWithHistoryProducer.cc:69
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
Event.h
EventWithHistory
Definition:
EventWithHistory.h:16
MakerMacros.h
EventWithHistoryProducer::_depth
const unsigned int _depth
Definition:
EventWithHistoryProducer.cc:53
edm::EventBase::bunchCrossing
int bunchCrossing() const
Definition:
EventBase.h:65
EventWithHistoryProducer::produce
virtual void produce(edm::Event &, const edm::EventSetup &) override
Definition:
EventWithHistoryProducer.cc:96
Frameworkfwd.h
edm::EDProducer
Definition:
EDProducer.h:35
ParameterSet.h
iEvent
int iEvent
Definition:
GenABIO.cc:230
edm::Event::put
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition:
Event.h:121
EventWithHistoryProducer::_prevHE
EventWithHistory _prevHE
Definition:
EventWithHistoryProducer.cc:54
edm::EventSetup
Definition:
EventSetup.h:45
edm::EventBase::orbitNumber
int orbitNumber() const
Definition:
EventBase.h:66
edm::LogInfo
Definition:
MessageLogger.h:214
EDProducer.h
EventWithHistoryProducer::~EventWithHistoryProducer
~EventWithHistoryProducer()
Definition:
EventWithHistoryProducer.cc:81
EventWithHistoryProducer::endJob
virtual void endJob() override
Definition:
EventWithHistoryProducer.cc:119
EventWithHistory.h
edm::EventBase::id
edm::EventID id() const
Definition:
EventBase.h:59
TinyEvent::_event
edm::EventNumber_t _event
Definition:
TinyEvent.h:87
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::Event
Definition:
Event.h:65
Generated for CMSSW Reference Manual by
1.8.5