PhysicsTools
NanoAOD
plugins
UniqueStringProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/global/EDProducer.h
"
2
#include "
FWCore/Framework/interface/Run.h
"
3
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
4
#include "
DataFormats/NanoAOD/interface/UniqueString.h
"
5
6
#include <vector>
7
8
class
UniqueStringProducer
:
public
edm::global::EDProducer
<edm::BeginRunProducer> {
9
public
:
10
UniqueStringProducer
(
edm::ParameterSet
const
& iConfig) {
11
const
edm::ParameterSet
&
strings
= iConfig.
getParameter
<
edm::ParameterSet
>(
"strings"
);
12
for
(
const
std::string
& vname :
strings
.getParameterNamesForType<
std::string
>()) {
13
strings_
.emplace_back(vname,
strings
.getParameter<
std::string
>(vname));
14
produces<nanoaod::UniqueString, edm::InRun>(vname);
15
}
16
}
17
18
~UniqueStringProducer
()
override
{}
19
20
void
produce
(
edm::StreamID
,
edm::Event
&,
edm::EventSetup
const
&)
const override
{}
// do nothing
21
22
void
globalBeginRunProduce
(
edm::Run
& iRun,
edm::EventSetup
const
&)
const override
{
23
for
(
const
auto
& pair :
strings_
) {
24
iRun.
put
(std::make_unique<nanoaod::UniqueString>(pair.second), pair.first);
25
}
26
}
27
28
protected
:
29
std::vector<std::pair<std::string, std::string>>
strings_
;
30
};
31
32
#include "
FWCore/Framework/interface/MakerMacros.h
"
33
DEFINE_FWK_MODULE
(
UniqueStringProducer
);
UniqueStringProducer
Definition:
UniqueStringProducer.cc:8
edm::StreamID
Definition:
StreamID.h:30
UniqueStringProducer::produce
void produce(edm::StreamID, edm::Event &, edm::EventSetup const &) const override
Definition:
UniqueStringProducer.cc:20
edm::Run
Definition:
Run.h:45
nano_cff.strings
strings
Definition:
nano_cff.py:26
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::Run::put
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Run.h:109
Run.h
edm::global::EDProducer
Definition:
EDProducer.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition:
ParameterSet.h:47
UniqueString.h
edm::EventSetup
Definition:
EventSetup.h:58
UniqueStringProducer::strings_
std::vector< std::pair< std::string, std::string > > strings_
Definition:
UniqueStringProducer.cc:29
UniqueStringProducer::globalBeginRunProduce
void globalBeginRunProduce(edm::Run &iRun, edm::EventSetup const &) const override
Definition:
UniqueStringProducer.cc:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
UniqueStringProducer::UniqueStringProducer
UniqueStringProducer(edm::ParameterSet const &iConfig)
Definition:
UniqueStringProducer.cc:10
ParameterSet.h
EDProducer.h
edm::Event
Definition:
Event.h:73
UniqueStringProducer::~UniqueStringProducer
~UniqueStringProducer() override
Definition:
UniqueStringProducer.cc:18
Generated for CMSSW Reference Manual by
1.8.16