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 
13 #include "fhiclcpp/ParameterSet.h"
15 #include <memory>
16 
17 class PtrMakerProducer2;
18 
19 
21 public:
22  typedef std::vector<int> intvector_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 
44  : EDProducer{p}, nvalues( p.get<int>("nvalues") )
45  {
46  produces<intvector_t>();
47  produces<intPtrvector_t>();
48  }
49 
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 
PtrMakerProducer2(fhicl::ParameterSet const &p)
void produce(art::Event &e) override
art::PtrVector< int > intPtrvector_t
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
def move(depos, offset)
Definition: depos.py:107
p
Definition: test.py:223
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
std::vector< int > intvector_t
PtrMakerProducer2 & operator=(PtrMakerProducer2 const &)=delete
EventNumber_t event() const
Definition: EventID.h:116
EventID id() const
Definition: Event.cc:34