All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PtrMakerProducer2_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: PtrMakerProducer2
3 // Plugin Type: producer (art v2_05_00)
4 // File: PtrMakerProducer2_module.cc
5 //
6 // Generated at Wed Nov 23 22:59:41 2016 by Saba Sehrish using cetskelgen
7 // from cetlib version v1_21_00.
8 ////////////////////////////////////////////////////////////////////////
9 
10 #include "art/Framework/Core/EDProducer.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "fhiclcpp/ParameterSet.h"
14 #include "art/Persistency/Common/PtrMaker.h"
15 #include <memory>
16 
17 class PtrMakerProducer2;
18 
19 
20 class PtrMakerProducer2 : public art::EDProducer {
21 public:
22  typedef std::vector<int> intvector_t;
23  typedef art::PtrVector<int> intPtrvector_t;
24  explicit PtrMakerProducer2(fhicl::ParameterSet const & p);
25  // The compiler-generated destructor is fine for non-base
26  // classes without bare pointers or other resource use.
27 
28  // Plugins should not be copied or assigned.
29  PtrMakerProducer2(PtrMakerProducer2 const &) = delete;
33 
34  // Required functions.
35  void produce(art::Event & e) override;
36 
37 private:
38 
39  int nvalues;
40 };
41 
42 
43 PtrMakerProducer2::PtrMakerProducer2(fhicl::ParameterSet const & p)
44  : EDProducer{p}, nvalues( p.get<int>("nvalues") )
45  {
46  produces<intvector_t>();
47  produces<intPtrvector_t>();
48  }
49 
50 void PtrMakerProducer2::produce(art::Event & e)
51 {
52  std::cerr << "PtrMakerProducer 2 is running!\n";
53  int value_ = e.id().event();
54  std::unique_ptr<intvector_t> intvector(new intvector_t);
55  auto intptrs = std::make_unique<intPtrvector_t>();
56  art::PtrMaker<int> make_intptr(e);
57 
58  for( int i = 0; i != nvalues; ++i ) {
59  intvector->push_back(value_ * i);
60  auto p = make_intptr(i);
61  intptrs->push_back(p);
62  }
63  e.put(std::move(intvector));
64  e.put(std::move(intptrs));
65 }
66 
67 DEFINE_ART_MODULE(PtrMakerProducer2)
PtrMakerProducer2(fhicl::ParameterSet const &p)
void produce(art::Event &e) override
art::PtrVector< int > intPtrvector_t
BEGIN_PROLOG could also be cerr
pdgs p
Definition: selectors.fcl:22
std::vector< int > intvector_t
PtrMakerProducer2 & operator=(PtrMakerProducer2 const &)=delete
do i e