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.3 2010/02/20 20:55:17 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&) {
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
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag > src_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
void produce(edm::Event &evt, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
JetCorrectorParametersCollection coll
Definition: classes.h:14
CollectionAdder(const edm::ParameterSet &cfg)
def template
Definition: svgfig.py:520