CommonTools
UtilAlgos
interface
FwdPtrProducer.h
Go to the documentation of this file.
1
#ifndef CommonTools_UtilAlgos_FwdPtrProducer_h
2
#define CommonTools_UtilAlgos_FwdPtrProducer_h
3
12
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
13
#include "
FWCore/Framework/interface/Event.h
"
14
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
15
#include "
FWCore/Utilities/interface/InputTag.h
"
16
#include "
DataFormats/Common/interface/View.h
"
17
#include "
DataFormats/Common/interface/FwdPtr.h
"
18
#include "
CommonTools/UtilAlgos/interface/FwdPtrConversionFactory.h
"
19
#include <vector>
20
21
namespace
edm
{
22
23
template
<
class
T,
class
H = FwdPtrFromProductFactory<T> >
24
class
FwdPtrProducer
:
public
edm::stream::EDProducer
<> {
25
public
:
26
explicit
FwdPtrProducer
(
edm::ParameterSet
const
&
params
)
27
:
srcToken_
(consumes<
edm
::
View
<
T
> >(
params
.getParameter<
edm
::
InputTag
>(
"src"
))) {
28
produces<std::vector<edm::FwdPtr<T> > >();
29
}
30
31
~FwdPtrProducer
()
override
{}
32
33
void
produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
override
{
34
edm::Handle<edm::View<T>
> hSrc;
35
iEvent
.getByToken(
srcToken_
, hSrc);
36
37
std::unique_ptr<std::vector<edm::FwdPtr<T> > > pOutputFwdPtr(
new
std::vector
<
edm::FwdPtr<T>
>);
38
39
for
(
typename
edm::View<T>::const_iterator
ibegin = hSrc->begin(), iend = hSrc->end(),
i
= ibegin;
i
!= iend;
40
++
i
) {
41
H
factory;
42
FwdPtr<T>
ptr = factory(*hSrc,
i
- ibegin);
43
pOutputFwdPtr->push_back(ptr);
44
}
45
46
iEvent
.put(
std::move
(pOutputFwdPtr));
47
}
48
49
protected
:
50
edm::EDGetTokenT<edm::View<T>
>
srcToken_
;
51
};
52
}
// namespace edm
53
54
#endif
edm::FwdPtrProducer::srcToken_
edm::EDGetTokenT< edm::View< T > > srcToken_
Definition:
FwdPtrProducer.h:50
FwdPtrConversionFactory.h
class-composition.H
H
Definition:
class-composition.py:31
mps_fire.i
i
Definition:
mps_fire.py:428
CalibrationSummaryClient_cfi.params
params
Definition:
CalibrationSummaryClient_cfi.py:14
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
EDProducer.h
edm::FwdPtrProducer::FwdPtrProducer
FwdPtrProducer(edm::ParameterSet const ¶ms)
Definition:
FwdPtrProducer.h:26
edm::Handle
Definition:
AssociativeIterator.h:50
edm::FwdPtrProducer::~FwdPtrProducer
~FwdPtrProducer() override
Definition:
FwdPtrProducer.h:31
edm::FwdPtrProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition:
FwdPtrProducer.h:33
edm::FwdPtr
Definition:
FwdPtr.h:40
edm::View
Definition:
CaloClusterFwd.h:14
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
trackerHitRTTI::vector
Definition:
trackerHitRTTI.h:21
edm::stream::EDProducer
Definition:
EDProducer.h:38
edm::EventSetup
Definition:
EventSetup.h:58
InputTag.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
FwdPtr.h
edm::FwdPtrProducer
Produces a list of FwdPtr's to an input collection.
Definition:
FwdPtrProducer.h:24
T
long double T
Definition:
Basic3DVectorLD.h:48
View.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
Generated for CMSSW Reference Manual by
1.8.16