CommonTools
UtilAlgos
interface
CollectionAdder.h
Go to the documentation of this file.
1
#ifndef PhysicsTools_UtilAlgos_CollectionAdder_h
2
#define PhysicsTools_UtilAlgos_CollectionAdder_h
3
/* \class CollectionAdder<C>
4
*
5
* \author Luca Lista, INFN
6
*
7
* \version $Id: CollectionAdder.h,v 1.3 2010/02/20 20:55:17 wmtan Exp $
8
*/
9
#include "
FWCore/Framework/interface/EDProducer.h
"
10
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
11
#include "
FWCore/Utilities/interface/transform.h
"
12
#include "
FWCore/Utilities/interface/InputTag.h
"
13
#include "
FWCore/Framework/interface/Event.h
"
14
#include "
DataFormats/Common/interface/Handle.h
"
15
16
template
<
typename
C>
17
class
CollectionAdder
:
public
edm::EDProducer
{
18
public
:
19
typedef
C
collection
;
20
CollectionAdder
(
const
edm::ParameterSet
&
cfg
)
21
:
srcTokens_
(
edm
::
vector_transform
(
cfg
.
template
getParameter<
std
::
vector
<
edm
::
InputTag
>>(
"src"
),
22
[this](
edm
::
InputTag
const
&
tag
) {
return
consumes<collection>(
tag
); })) {
23
produces<collection>();
24
}
25
26
private
:
27
std::vector<edm::EDGetTokenT<collection>>
srcTokens_
;
28
void
produce
(
edm::Event
& evt,
const
edm::EventSetup
&)
override
{
29
std::unique_ptr<collection> coll(
new
collection
);
30
typename
collection::Filler
filler
(*coll);
31
for
(
size_t
i
= 0;
i
<
srcTokens_
.size(); ++
i
) {
32
edm::Handle<collection>
src
;
33
evt.
getByToken
(
srcTokens_
[
i
],
src
);
34
*coll += *
src
;
35
}
36
evt.
put
(
std::move
(coll));
37
}
38
};
39
40
#endif
Handle.h
mps_fire.i
i
Definition:
mps_fire.py:428
EDProducer.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
CollectionAdder::srcTokens_
std::vector< edm::EDGetTokenT< collection > > srcTokens_
Definition:
CollectionAdder.h:27
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89353
watchdog.const
const
Definition:
watchdog.py:83
edm::Handle
Definition:
AssociativeIterator.h:50
CollectionAdder::CollectionAdder
CollectionAdder(const edm::ParameterSet &cfg)
Definition:
CollectionAdder.h:20
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition:
GlobalPosition_Frontier_DevDB_cff.py:11
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:531
CollectionAdder::collection
C collection
Definition:
CollectionAdder.h:19
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition:
transform.h:11
edm::ParameterSet
Definition:
ParameterSet.h:47
TrackRefitter_38T_cff.src
src
Definition:
TrackRefitter_38T_cff.py:24
Event.h
trigObjTnPSource_cfi.filler
filler
Definition:
trigObjTnPSource_cfi.py:21
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:133
trackerHitRTTI::vector
Definition:
trackerHitRTTI.h:21
edm::EventSetup
Definition:
EventSetup.h:57
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition:
svgfig.py:521
InputTag.h
looper.cfg
cfg
Definition:
looper.py:297
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
gen::C
C
Definition:
PomwigHadronizer.cc:78
CollectionAdder::produce
void produce(edm::Event &evt, const edm::EventSetup &) override
Definition:
CollectionAdder.h:28
transform.h
edm::EDProducer
Definition:
EDProducer.h:35
ParameterSet.h
edm::Event
Definition:
Event.h:73
CollectionAdder
Definition:
CollectionAdder.h:17
Generated for CMSSW Reference Manual by
1.8.16