test
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  */
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::auto_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(coll);
35  }
36 };
37 
38 #endif
39 
int i
Definition: DBlmapReader.cc:9
tuple cfg
Definition: looper.py:293
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
void produce(edm::Event &evt, const edm::EventSetup &) override
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
std::vector< edm::EDGetTokenT< collection > > srcTokens_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
JetCorrectorParametersCollection coll
Definition: classes.h:10
string const
Definition: compareJSON.py:14
CollectionAdder(const edm::ParameterSet &cfg)
def template
Definition: svgfig.py:520