PCHitAggregator_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: PCHitAggregator
3 // Plugin Type: producer (art v2_11_01)
4 // File: PCHitAggregator_module.cc
5 //
6 // Generated at Tue Sep 25 16:23:21 2018 by Kevin Mulder using cetskelgen
7 // from cetlib version v3_03_00.
8 ////////////////////////////////////////////////////////////////////////
9 
10 // C/C++ includes
11 #include <memory>
12 
13 //Framework includes
21 #include "fhiclcpp/ParameterSet.h"
23 
24 //NOvASoft includes
26 
27 //ROOT includes
28 
29 namespace calib {
30  class PCHitAggregator;
31 }
32 
34 public:
35  explicit PCHitAggregator(fhicl::ParameterSet const & p);
36 
37  // Plugins should not be copied or assigned.
38  PCHitAggregator(PCHitAggregator const &) = delete;
39  PCHitAggregator(PCHitAggregator &&) = delete;
40  PCHitAggregator & operator = (PCHitAggregator const &) = delete;
42 
43  // Required functions.
44  void produce(art::Event & e) override;
45 
46  // Selected optional functions.
47  void reconfigure(const fhicl::ParameterSet& pset);
48  void endRun(art::Run& run) override;
49 
50  std::unique_ptr< std::vector<caldp::PCHit> > fRunVector{new std::vector<caldp::PCHit>};
51 
52 private:
54 };
55 
57 {
58  fInputModuleLabel = pset.get<std::string>("InputModuleLabel");
59 }
60 
62 {
63  this->reconfigure(p);
64  produces< std::vector<caldp::PCHit>, art::InRun >();
65 }
66 
68 {
69  // Declarations
71  std::vector< art::Handle<std::vector<caldp::PCHit>>> PCHitsvector;
72  e.getManyByType(PCHitsvector);
73  if(PCHitsvector.size()>1){
74  std::cout<<"Warning multiple PCHits vectors found, aggregating the first one. Check inputfiles!"<<std::endl;
75  }
76  PCHits = PCHitsvector.front();
77  fRunVector->insert(fRunVector->end(), PCHits->begin(), PCHits->end());
78  return;
79 }
80 
82 {
83  run.put(std::move(fRunVector));
84  fRunVector.reset(new std::vector<caldp::PCHit>);
85 }
86 
87 
88 
const char * p
Definition: xmltok.h:285
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:149
DEFINE_ART_MODULE(TestTMapFile)
PCHitAggregator & operator=(PCHitAggregator const &)=delete
Definition: Run.h:31
CDPStorage service.
void endRun(art::Run &run) override
T get(std::string const &key) const
Definition: ParameterSet.h:231
void getManyByType(std::vector< Handle< PROD >> &results) const
Definition: DataViewImpl.h:446
Definition: run.py:1
OStream cout
Definition: OStream.cxx:6
void reconfigure(const fhicl::ParameterSet &pset)
PCHitAggregator(fhicl::ParameterSet const &p)
void produce(art::Event &e) override
std::unique_ptr< std::vector< caldp::PCHit > > fRunVector
Float_t e
Definition: plot.C:35
enum BeamMode string