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
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:224
ProductFromFwdPtrProducer(edm::ParameterSet const &params)
const edm::EDGetTokenT< std::vector< edm::FwdPtr< T > > > srcToken_
HLT enums.
Produces a list of objects "by value" that correspond to the FwdPtr&#39;s from an input collection...
long double T
def move(src, dest)
Definition: eostools.py:511