CMS 3D CMS Logo

ProductFromFwdPtrProducer.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_ProductFromFwdPtrProducer_h
2 #define CommonTools_UtilAlgos_ProductFromFwdPtrProducer_h
3 
19 #include <vector>
20 
21 namespace edm {
22 
23  template <class T, class H = ProductFromFwdPtrFactory<T> >
25  public:
27  : srcToken_(consumes<std::vector<edm::FwdPtr<T> > >(params.getParameter<edm::InputTag>("src"))) {
28  produces<std::vector<T> >();
29  }
30 
32 
33  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override {
35  iEvent.getByToken(srcToken_, hSrc);
36 
37  std::unique_ptr<std::vector<T> > pOutput(new std::vector<T>);
38 
39  for (typename std::vector<edm::FwdPtr<T> >::const_iterator ibegin = hSrc->begin(), iend = hSrc->end(), i = ibegin;
40  i != iend;
41  ++i) {
42  H factory;
43  T t = factory(*i);
44  pOutput->push_back(t);
45  }
46 
47  iEvent.put(std::move(pOutput));
48  }
49 
50  protected:
52  };
53 } // namespace edm
54 
55 #endif
FwdPtrConversionFactory.h
class-composition.H
H
Definition: class-composition.py:31
edm::StreamID
Definition: StreamID.h:30
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
edm::ProductFromFwdPtrProducer::srcToken_
const edm::EDGetTokenT< std::vector< edm::FwdPtr< T > > > srcToken_
Definition: ProductFromFwdPtrProducer.h:51
edm::Handle
Definition: AssociativeIterator.h:50
edm::ProductFromFwdPtrProducer
Produces a list of objects "by value" that correspond to the FwdPtr's from an input collection.
Definition: ProductFromFwdPtrProducer.h:24
edm::ProductFromFwdPtrProducer::~ProductFromFwdPtrProducer
~ProductFromFwdPtrProducer() override
Definition: ProductFromFwdPtrProducer.h:31
edm::FwdPtr
Definition: FwdPtr.h:40
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:58
InputTag.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
FwdPtr.h
T
long double T
Definition: Basic3DVectorLD.h:48
edm::ProductFromFwdPtrProducer::produce
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition: ProductFromFwdPtrProducer.h:33
View.h
edm::ProductFromFwdPtrProducer::ProductFromFwdPtrProducer
ProductFromFwdPtrProducer(edm::ParameterSet const &params)
Definition: ProductFromFwdPtrProducer.h:26
ParameterSet.h
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:155
EDProducer.h
edm::Event
Definition: Event.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::InputTag
Definition: InputTag.h:15