CommonTools
CandAlgos
interface
CloneProducer.h
Go to the documentation of this file.
1
#ifndef CandAlgos_CloneProducer_h
2
#define CandAlgos_CloneProducer_h
3
16
#include "
FWCore/Framework/interface/EDProducer.h
"
17
#include "
FWCore/Framework/interface/Event.h
"
18
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
19
#include "
FWCore/Utilities/interface/InputTag.h
"
20
#include "
DataFormats/Candidate/interface/Candidate.h
"
21
22
template
<
typename
C>
23
class
CloneProducer
:
public
edm::EDProducer
{
24
public
:
26
explicit
CloneProducer
(
const
edm::ParameterSet
& );
28
~CloneProducer
();
29
30
private
:
32
virtual
void
produce
(
edm::Event
&,
const
edm::EventSetup
& );
34
edm::EDGetTokenT<C>
srcToken_
;
35
};
36
37
template
<
typename
C>
38
CloneProducer<C>::CloneProducer
(
const
edm::ParameterSet
& par ) :
39
srcToken_( consumes<
C
>( par.
template
getParameter<
edm
::
InputTag
>(
"src"
) ) ) {
40
produces<reco::CandidateCollection>();
41
}
42
43
template
<
typename
C>
44
CloneProducer<C>::~CloneProducer
() {
45
}
46
47
template
<
typename
C>
48
void
CloneProducer<C>::produce
(
edm::Event
& evt,
const
edm::EventSetup
& ) {
49
std::unique_ptr<reco::CandidateCollection> coll(
new
reco::CandidateCollection
);
50
edm::Handle<C>
masterCollection;
51
evt.
getByToken
( srcToken_, masterCollection );
52
for
(
size_t
i
= 0;
i
< masterCollection->size(); ++
i
) {
53
reco::CandidateBaseRef
masterClone(
edm::Ref<C>
( masterCollection,
i
) );
54
coll->push_back( masterClone->clone() );
55
}
56
evt.
put
(
std::move
( coll ) );
57
}
58
59
#endif
mps_fire.i
i
Definition:
mps_fire.py:428
EDProducer.h
edm::EDGetTokenT< C >
edm
HLT enums.
Definition:
AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89281
CloneProducer
Definition:
CloneProducer.h:23
edm::Handle
Definition:
AssociativeIterator.h:50
edm::Ref
Definition:
AssociativeIterator.h:58
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:535
CloneProducer::produce
virtual void produce(edm::Event &, const edm::EventSetup &)
process an event
Definition:
CloneProducer.h:48
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
CloneProducer::~CloneProducer
~CloneProducer()
destructor
Definition:
CloneProducer.h:44
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:133
edm::EventSetup
Definition:
EventSetup.h:58
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition:
svgfig.py:521
CloneProducer::CloneProducer
CloneProducer(const edm::ParameterSet &)
constructor from parameter set
Definition:
CloneProducer.h:38
InputTag.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
gen::C
C
Definition:
PomwigHadronizer.cc:78
edm::EDProducer
Definition:
EDProducer.h:35
edm::RefToBase< Candidate >
Candidate.h
CloneProducer::srcToken_
edm::EDGetTokenT< C > srcToken_
labels of the collection to be converted
Definition:
CloneProducer.h:34
ParameterSet.h
edm::Event
Definition:
Event.h:73
edm::OwnVector
Definition:
OwnVector.h:24
Generated for CMSSW Reference Manual by
1.8.16