All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GenericCRT_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: GenericCRT
3 // Plugin Type: producer (art v3_05_01)
4 // File: GenericCRT_module.cc
5 //
6 // Generated at Wed Oct 28 07:07:35 2020 by Andrzej Szelc using cetskelgen
7 // from cetlib version v3_10_00.
8 ////////////////////////////////////////////////////////////////////////
9 
12 
13 #include "art/Framework/Core/EDProducer.h"
14 #include "art/Framework/Core/ModuleMacros.h"
15 #include "art/Framework/Principal/Event.h"
16 #include "art/Framework/Principal/Handle.h"
17 #include "art/Framework/Principal/Run.h"
18 #include "art/Framework/Principal/SubRun.h"
19 #include "canvas/Utilities/InputTag.h"
20 #include "fhiclcpp/ParameterSet.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
22 
23 #include "GenericCRT.h"
24 
25 #include <memory>
26 #include <string>
27 #include <utility>
28 #include <vector>
29 
30 namespace sim {
31  class GenericCRT;
32 }
33 
34 
35 class sim::GenericCRT : public art::EDProducer {
36 public:
37  explicit GenericCRT(fhicl::ParameterSet const& p);
38  // The compiler-generated destructor is fine for non-base
39  // classes without bare pointers or other resource use.
40 
41  // Plugins should not be copied or assigned.
42  GenericCRT(GenericCRT const&) = delete;
43  GenericCRT(GenericCRT&&) = delete;
44  GenericCRT& operator=(GenericCRT const&) = delete;
45  GenericCRT& operator=(GenericCRT&&) = delete;
46 
47  // Required functions.
48  void produce(art::Event& e) override;
49 
50 
51 private:
52 
53  std::string fEnergyUnitsScale;
55 
56  // Declare member data here.
57 
58 };
59 
60 
61 sim::GenericCRT::GenericCRT(fhicl::ParameterSet const& p)
62  : EDProducer{p} //
63  ,fEnergyUnitsScale (p.get<std::string>("EnergyUnitsScale","MeV"))
64  ,fCRTConvertUtil(fEnergyUnitsScale)
65  // More initializers here.
66  {
67 
68  produces< std::vector<sim::AuxDetSimChannel> >();
69  }
70 
71 void sim::GenericCRT::produce(art::Event& e)
72 {
73  // Implementation of required member function here.
74  //std::unique_ptr< std::vector< sim::AuxDetSimChannel > > adCol (new std::vector<sim::AuxDetSimChannel> );
75  auto adCol = std::make_unique<std::vector<sim::AuxDetSimChannel>>();
76 
77  auto const &auxdethitcollection = e.getMany< std::vector<sim::AuxDetHit>> ();
78 
79  for (size_t ii = 0; ii < auxdethitcollection.size(); ii++) {
80  for (auto ch : fCRTConvertUtil.GetAuxDetSimChannels(*(auxdethitcollection.at(ii))))
81  adCol->emplace_back(ch);
82  }
83 
84  e.put(std::move(adCol));
85 
86 }
87 
88 DEFINE_ART_MODULE(sim::GenericCRT)
pdgs p
Definition: selectors.fcl:22
sim::GenericCRTUtility fCRTConvertUtil
GenericCRT & operator=(GenericCRT const &)=delete
void produce(art::Event &e) override
object containing MC truth information necessary for making RawDigits and doing back tracking ...
GenericCRT(fhicl::ParameterSet const &p)
do i e
std::string fEnergyUnitsScale