CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CopyProducer.h
Go to the documentation of this file.
1 #ifndef RecoTauTag_TauTagTools_CopyProducer_h
2 #define RecoTauTag_TauTagTools_CopyProducer_h
3 
4 /*
5  * Generic template class to take a View of C::value_type and produce an
6  * output collection (type C) of clones.
7  *
8  * Author: Evan K. Friis (UC Davis)
9  *
10  */
11 
19 
20 #include <algorithm>
21 
22 namespace reco { namespace tautools {
23 
24 template<typename Collection>
25 class CopyProducer : public edm::EDProducer {
26  public:
28  explicit CopyProducer( const edm::ParameterSet& pset)
29  :src_(pset.template getParameter<edm::InputTag>("src")) {
30  produces<Collection>();
31  }
35  virtual void produce(edm::Event& evt, const edm::EventSetup& es) {
36  // Output collection
37  std::auto_ptr<Collection> coll(new Collection());
39  // Get input
41  evt.getByLabel(src_, input);
42  // Reserve space
43  coll->reserve(input->size());
44  // Copy the input to the output
45  std::copy(input->begin(), input->end(), std::back_inserter(*coll));
46  evt.put( coll );
47  }
48  private:
51 };
52 
53 }}
54 
55 #endif
static std::string const input
Definition: EdmProvDump.cc:43
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
virtual void produce(edm::Event &evt, const edm::EventSetup &es)
process an event
Definition: CopyProducer.h:35
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
edm::InputTag src_
labels of the collection to be converted
Definition: CopyProducer.h:50
JetCorrectorParametersCollection coll
Definition: classes.h:10
def template
Definition: svgfig.py:520
CopyProducer(const edm::ParameterSet &pset)
constructor from parameter set
Definition: CopyProducer.h:28