EventFilter
HGCalRawToDigi
plugins
HGCDigiConverter.cc
Go to the documentation of this file.
1
//STL includes
2
#include <memory>
3
4
//framework includes
5
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
6
#include "
FWCore/Framework/interface/EventSetup.h
"
7
#include "
FWCore/Framework/interface/ESHandle.h
"
8
#include "
FWCore/Framework/interface/global/EDProducer.h
"
9
#include "
FWCore/Framework/interface/Event.h
"
10
#include "
FWCore/Framework/interface/MakerMacros.h
"
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
13
//other includes
14
#include "
DataFormats/HGCDigi/interface/HGCDigiCollections.h
"
15
16
class
HGCDigiConverter
:
public
edm::global::EDProducer
<> {
17
public
:
18
explicit
HGCDigiConverter
(
const
edm::ParameterSet
&);
19
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
20
21
private
:
22
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
23
edm::EDGetTokenT<HGCEEDigiCollection>
tok_ee_
;
24
edm::EDGetTokenT<HGCHEDigiCollection>
tok_fh_
;
25
edm::EDGetTokenT<HGCBHDigiCollection>
tok_bh_
;
26
};
27
28
HGCDigiConverter::HGCDigiConverter
(
const
edm::ParameterSet
& iConfig)
29
: tok_ee_(consumes<
HGCEEDigiCollection
>(iConfig.getParameter<
edm
::
InputTag
>(
"eeDigis"
))),
30
tok_fh_(consumes<
HGCHEDigiCollection
>(iConfig.getParameter<
edm
::
InputTag
>(
"fhDigis"
))),
31
tok_bh_(consumes<
HGCBHDigiCollection
>(iConfig.getParameter<
edm
::
InputTag
>(
"bhDigis"
))) {
32
produces<HGCalDigiCollection>(
"EE"
);
33
produces<HGCalDigiCollection>(
"HEfront"
);
34
produces<HGCalDigiCollection>(
"HEback"
);
35
}
36
37
void
HGCDigiConverter::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const
{
38
edm::Handle<HGCEEDigiCollection>
h_ee;
39
edm::Handle<HGCHEDigiCollection>
h_fh;
40
edm::Handle<HGCBHDigiCollection>
h_bh;
41
42
iEvent
.getByToken(
tok_ee_
, h_ee);
43
iEvent
.getByToken(
tok_fh_
, h_fh);
44
iEvent
.getByToken(
tok_bh_
, h_bh);
45
46
auto
out_ee = std::make_unique<HGCalDigiCollection>();
47
if
(h_ee.
isValid
()) {
48
for
(
const
auto
& df_ee : *h_ee) {
49
HGCalDataFrame
tmp
(df_ee.id());
50
tmp
.setData(df_ee.data());
51
out_ee->push_back(
tmp
);
52
}
53
}
54
iEvent
.put(
std::move
(out_ee),
"EE"
);
55
56
auto
out_fh = std::make_unique<HGCalDigiCollection>();
57
if
(h_fh.
isValid
()) {
58
for
(
const
auto
& df_fh : *h_fh) {
59
HGCalDataFrame
tmp
(df_fh.id());
60
tmp
.setData(df_fh.data());
61
out_fh->emplace_back(
tmp
);
62
}
63
}
64
iEvent
.put(
std::move
(out_fh),
"HEfront"
);
65
66
auto
out_bh = std::make_unique<HGCalDigiCollection>();
67
if
(h_bh.
isValid
()) {
68
for
(
const
auto
& df_bh : *h_bh) {
69
HGCalDataFrame
tmp
(df_bh.id());
70
tmp
.setData(df_bh.data());
71
out_bh->emplace_back(
tmp
);
72
}
73
}
74
iEvent
.put(
std::move
(out_bh),
"HEback"
);
75
}
76
77
void
HGCDigiConverter::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
78
edm::ParameterSetDescription
desc;
79
desc.
add
<
edm::InputTag
>(
"eeDigis"
,
edm::InputTag
(
"mix:HGCDigisEE"
));
80
desc.
add
<
edm::InputTag
>(
"fhDigis"
,
edm::InputTag
(
"mix:HGCDigisHEfront"
));
81
desc.
add
<
edm::InputTag
>(
"bhDigis"
,
edm::InputTag
(
"mix:HGCDigisHEback"
));
82
83
descriptions.
add
(
"HGCDigiConverter"
, desc);
84
}
85
86
//define this as a plug-in
87
DEFINE_FWK_MODULE
(
HGCDigiConverter
);
edm::StreamID
Definition:
StreamID.h:30
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition:
ParameterSetDescription.h:95
ESHandle.h
HGCDigiConverter::HGCDigiConverter
HGCDigiConverter(const edm::ParameterSet &)
Definition:
HGCDigiConverter.cc:28
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
edm::SortedCollection
Definition:
SortedCollection.h:49
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
HGCDigiConverter::tok_ee_
edm::EDGetTokenT< HGCEEDigiCollection > tok_ee_
Definition:
HGCDigiConverter.cc:23
edm::Handle
Definition:
AssociativeIterator.h:50
MakerMacros.h
HGCDigiConverter::tok_bh_
edm::EDGetTokenT< HGCBHDigiCollection > tok_bh_
Definition:
HGCDigiConverter.cc:25
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
HGCDigiConverter::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
HGCDigiConverter.cc:77
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
HGCDigiConverter::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
HGCDigiConverter.cc:37
HLT_2018_cff.InputTag
InputTag
Definition:
HLT_2018_cff.py:79016
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
HGCDataFrame
Readout digi for HGC.
Definition:
HGCDataFrame.h:14
iEvent
int iEvent
Definition:
GenABIO.cc:224
HGCDigiCollections.h
edm::EventSetup
Definition:
EventSetup.h:57
eostools.move
def move(src, dest)
Definition:
eostools.py:511
HGCDigiConverter::tok_fh_
edm::EDGetTokenT< HGCHEDigiCollection > tok_fh_
Definition:
HGCDigiConverter.cc:24
Frameworkfwd.h
HGCDigiConverter
Definition:
HGCDigiConverter.cc:16
EventSetup.h
ParameterSet.h
EDProducer.h
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:70
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16