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
~FwdPtrProducer() override
int iEvent
Definition: GenABIO.cc:224
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
FwdPtrProducer(edm::ParameterSet const &params)
Produces a list of FwdPtr&#39;s to an input collection.
HLT enums.
edm::EDGetTokenT< edm::View< T > > srcToken_
long double T
def move(src, dest)
Definition: eostools.py:511