CMS 3D CMS Logo

FwdPtrProducer.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_FwdPtrProducer_h
2 #define CommonTools_UtilAlgos_FwdPtrProducer_h
3 
19 #include <vector>
20 
21 namespace edm {
22 
23  template <class T, class H = FwdPtrFromProductFactory<T> >
25  public:
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 {
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:
51  };
52 } // namespace edm
53 
54 #endif
edm::FwdPtrProducer::srcToken_
edm::EDGetTokenT< edm::View< T > > srcToken_
Definition: FwdPtrProducer.h:50
FwdPtrConversionFactory.h
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 &params)
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:36
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
data-class-funcs.H
H
Definition: data-class-funcs.py:33
View.h
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15