CMS 3D CMS Logo

CollectionAdder.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_UtilAlgos_CollectionAdder_h
2 #define PhysicsTools_UtilAlgos_CollectionAdder_h
3 /* \class CollectionAdder<C>
4  *
5  * \author Luca Lista, INFN
6  *
7  * \version $Id: CollectionAdder.h,v 1.3 2010/02/20 20:55:17 wmtan Exp $
8  */
15 
16 template<typename C>
18 public:
19  typedef C collection;
21  srcTokens_(edm::vector_transform(cfg.template getParameter<std::vector<edm::InputTag> >("src"), [this](edm::InputTag const & tag){return consumes<collection>(tag);})) {
22  produces<collection>();
23  }
24 private:
25  std::vector<edm::EDGetTokenT<collection>> srcTokens_;
26  void produce(edm::Event & evt, const edm::EventSetup&) override {
27  std::unique_ptr<collection> coll(new collection);
28  typename collection::Filler filler(*coll);
29  for(size_t i = 0; i < srcTokens_.size(); ++i ) {
31  evt.getByToken(srcTokens_[i], src);
32  *coll += *src;
33  }
34  evt.put(std::move(coll));
35  }
36 };
37 
38 #endif
39 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void produce(edm::Event &evt, const edm::EventSetup &) override
std::vector< edm::EDGetTokenT< collection > > srcTokens_
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
JetCorrectorParametersCollection coll
Definition: classes.h:10
CollectionAdder(const edm::ParameterSet &cfg)
HLT enums.
def move(src, dest)
Definition: eostools.py:511