CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.4 2013/02/28 00:34:12 wmtan Exp $
8  */
14 
15 template<typename C>
17 public:
18  typedef C collection;
20  src_(cfg.template getParameter<std::vector<edm::InputTag> >("src")) {
21  produces<collection>();
22  }
23 private:
24  std::vector<edm::InputTag> src_;
25  void produce(edm::Event & evt, const edm::EventSetup&) override {
26  std::auto_ptr<collection> coll(new collection);
27  typename collection::Filler filler(*coll);
28  for(size_t i = 0; i < src_.size(); ++i ) {
30  evt.getByLabel(src_[i], src);
31  *coll += *src;
32  }
33  evt.put(coll);
34  }
35 };
36 
37 #endif
38 
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag > src_
void produce(edm::Event &evt, const edm::EventSetup &) override
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
JetCorrectorParametersCollection coll
Definition: classes.h:16
CollectionAdder(const edm::ParameterSet &cfg)
def template
Definition: svgfig.py:520