PhysicsTools
UtilAlgos
plugins
NTuplingDevice.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: NTuplingDevice
4
// Class: NTuplingDevice
5
//
13
//
14
// Original Author: Jean-Roch Vlimant
15
// Created: Sun May 11 21:12:46 CEST 2008
16
//
17
//
18
19
// system include files
20
#include <memory>
21
22
// user include files
23
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
24
#include "
FWCore/Framework/interface/EDProducer.h
"
25
26
#include "
FWCore/Framework/interface/Event.h
"
27
#include "
FWCore/Framework/interface/MakerMacros.h
"
28
29
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
30
31
#include "
PhysicsTools/UtilAlgos/interface/NTupler.h
"
32
33
//
34
// class decleration
35
//
36
37
class
NTuplingDevice
:
public
edm::EDProducer
{
38
public
:
39
explicit
NTuplingDevice
(
const
edm::ParameterSet
&);
40
~NTuplingDevice
()
override
;
41
42
private
:
43
void
beginJob
()
override
;
44
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
45
void
endJob
()
override
;
46
47
// ----------member data ---------------------------
48
std::unique_ptr<NTupler>
ntupler_
;
49
};
50
51
//
52
// constants, enums and typedefs
53
//
54
55
//
56
// static data member definitions
57
//
58
59
//
60
// constructors and destructor
61
//
62
NTuplingDevice::NTuplingDevice
(
const
edm::ParameterSet
& iConfig) {
63
//this Ntupler can work with the InputTagDistributor, but should not be configured as such.
64
edm::ParameterSet
ntPset = iConfig.
getParameter
<
edm::ParameterSet
>(
"Ntupler"
);
65
std::string
ntuplerName = ntPset.
getParameter
<
std::string
>(
"ComponentName"
);
66
ntupler_
=
NTuplerFactory::get
()->create(ntuplerName, ntPset);
67
68
//register the leaves from the ntupler
69
ntupler_
->registerleaves(
producesCollector
());
70
71
//put a dummy product if the ntupler does not output on edm
72
produces<double>(
"dummy"
);
73
}
74
75
NTuplingDevice::~NTuplingDevice
() {}
76
77
// ------------ method called to produce the data ------------
78
void
NTuplingDevice::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
79
ntupler_
->fill(
iEvent
);
80
iEvent
.put(std::make_unique<double>(0.),
"dummy"
);
81
}
82
83
// ------------ method called once each job just before starting event loop ------------
84
void
NTuplingDevice::beginJob
() {}
85
86
// ------------ method called once each job just after ending the event loop ------------
87
void
NTuplingDevice::endJob
() {}
88
89
//define this as a plug-in
90
DEFINE_FWK_MODULE
(
NTuplingDevice
);
EDProducer.h
NTuplingDevice::beginJob
void beginJob() override
Definition:
NTuplingDevice.cc:84
NTuplingDevice::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
NTuplingDevice.cc:78
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
NTuplingDevice::~NTuplingDevice
~NTuplingDevice() override
Definition:
NTuplingDevice.cc:75
NTuplingDevice::endJob
void endJob() override
Definition:
NTuplingDevice.cc:87
NTuplingDevice::NTuplingDevice
NTuplingDevice(const edm::ParameterSet &)
Definition:
NTuplingDevice.cc:62
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:36
NTuplingDevice::ntupler_
std::unique_ptr< NTupler > ntupler_
Definition:
NTuplingDevice.cc:48
Event.h
NTuplingDevice
Definition:
NTuplingDevice.cc:37
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
NTupler.h
Frameworkfwd.h
edm::EDProducer
Definition:
EDProducer.h:36
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::ProducerBase::producesCollector
ProducesCollector producesCollector()
Definition:
ProducerBase.cc:105
Generated for CMSSW Reference Manual by
1.8.16