CMS 3D CMS Logo

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:
29  :src_(pset.template getParameter<edm::InputTag>("src")) {
30  produces<Collection>();
31  }
33  ~CopyProducer() override{};
35  void produce(edm::Event& evt, const edm::EventSetup& es) override {
36  // Output collection
37  auto coll = std::make_unique<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(std::move(coll));
47  }
48  private:
51 };
52 
53 }}
54 
55 #endif
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
void produce(edm::Event &evt, const edm::EventSetup &es) override
process an event
Definition: CopyProducer.h:35
static std::string const input
Definition: EdmProvDump.cc:44
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:520
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:464
edm::InputTag src_
labels of the collection to be converted
Definition: CopyProducer.h:50
~CopyProducer() override
destructor
Definition: CopyProducer.h:33
JetCorrectorParametersCollection coll
Definition: classes.h:10
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:510
CopyProducer(const edm::ParameterSet &pset)
constructor from parameter set
Definition: CopyProducer.h:28