PhysicsTools
NanoAOD
plugins
NativeArrayTableProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
2
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
3
#include "
DataFormats/NanoAOD/interface/FlatTable.h
"
4
5
#include <vector>
6
7
template
<
typename
TIn,
typename
TCol>
8
class
NativeArrayTableProducer
:
public
edm::stream::EDProducer
<> {
9
public
:
10
NativeArrayTableProducer
(
edm::ParameterSet
const
&
params
)
11
:
name_
(
params
.getParameter<
std
::
string
>(
"name"
)),
12
doc_
(
params
.existsAs<
std
::
string
>(
"doc"
) ?
params
.getParameter<
std
::
string
>(
"doc"
) :
""
),
13
src_
(consumes<TIn>(
params
.getParameter<
edm
::
InputTag
>(
"src"
))) {
14
produces<nanoaod::FlatTable>();
15
}
16
17
~NativeArrayTableProducer
()
override
{}
18
19
void
produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
override
{
20
edm::Handle<TIn>
src
;
21
iEvent
.getByToken(
src_
,
src
);
22
23
const
auto
&
in
= *
src
;
24
auto
out
= std::make_unique<nanoaod::FlatTable>(
in
.size(),
name_
,
false
,
false
);
25
out
->setDoc(
doc_
);
26
(*out).template addColumn<TCol>(this->
name_
,
in
, this->
doc_
);
27
iEvent.
put
(
std::move
(
out
));
28
}
29
30
protected
:
31
const
std::string
name_
;
32
const
std::string
doc_
;
33
const
edm::EDGetTokenT<TIn>
src_
;
34
};
35
36
typedef
NativeArrayTableProducer<std::vector<float>
,
float
>
FloatArrayTableProducer
;
37
typedef
NativeArrayTableProducer<std::vector<double>
,
float
>
DoubleArrayTableProducer
;
38
typedef
NativeArrayTableProducer<std::vector<int>
,
int
>
IntArrayTableProducer
;
39
typedef
NativeArrayTableProducer<std::vector<bool>
,
bool
>
BoolArrayTableProducer
;
40
41
#include "
FWCore/Framework/interface/MakerMacros.h
"
42
DEFINE_FWK_MODULE
(
FloatArrayTableProducer
);
43
DEFINE_FWK_MODULE
(
DoubleArrayTableProducer
);
44
DEFINE_FWK_MODULE
(
IntArrayTableProducer
);
45
DEFINE_FWK_MODULE
(
BoolArrayTableProducer
);
NativeArrayTableProducer::src_
const edm::EDGetTokenT< TIn > src_
Definition:
NativeArrayTableProducer.cc:33
CalibrationSummaryClient_cfi.params
params
Definition:
CalibrationSummaryClient_cfi.py:14
edm::EDGetTokenT< TIn >
edm
HLT enums.
Definition:
AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89353
NativeArrayTableProducer::NativeArrayTableProducer
NativeArrayTableProducer(edm::ParameterSet const ¶ms)
Definition:
NativeArrayTableProducer.cc:10
EDProducer.h
DoubleArrayTableProducer
NativeArrayTableProducer< std::vector< double >, float > DoubleArrayTableProducer
Definition:
NativeArrayTableProducer.cc:37
edm::Handle
Definition:
AssociativeIterator.h:50
NativeArrayTableProducer
Definition:
NativeArrayTableProducer.cc:8
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
BoolArrayTableProducer
NativeArrayTableProducer< std::vector< bool >, bool > BoolArrayTableProducer
Definition:
NativeArrayTableProducer.cc:39
FloatArrayTableProducer
NativeArrayTableProducer< std::vector< float >, float > FloatArrayTableProducer
Definition:
NativeArrayTableProducer.cc:36
edm::ParameterSet
Definition:
ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition:
TrackRefitter_38T_cff.py:24
NativeArrayTableProducer::~NativeArrayTableProducer
~NativeArrayTableProducer() override
Definition:
NativeArrayTableProducer.cc:17
recoMuon::in
Definition:
RecoMuonEnumerators.h:6
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:133
edm::stream::EDProducer
Definition:
EDProducer.h:38
edm::EventSetup
Definition:
EventSetup.h:57
FlatTable.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
IntArrayTableProducer
NativeArrayTableProducer< std::vector< int >, int > IntArrayTableProducer
Definition:
NativeArrayTableProducer.cc:38
NativeArrayTableProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition:
NativeArrayTableProducer.cc:19
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
NativeArrayTableProducer::doc_
const std::string doc_
Definition:
NativeArrayTableProducer.cc:32
ParameterSet.h
edm::Event
Definition:
Event.h:73
NativeArrayTableProducer::name_
const std::string name_
Definition:
NativeArrayTableProducer.cc:31
Generated for CMSSW Reference Manual by
1.8.16