SNNueAr40CCGen_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 /// \file SNNueAr40CCGen_module.cc
3 /// \brief Supernova Nue-Ar CC interaction generator
4 ///
5 /// Module that produces MC particles from supernova electron neutrinos
6 /// interacting via charge current with Ar40
7 ///
8 /// \author gleb.sinev@duke.edu
9 ////////////////////////////////////////////////////////////////////////////////
10 
11 // Framework includes
17 #include "fhiclcpp/ParameterSet.h"
18 
19 // nurandom includes
20 #include "nurandom/RandomUtils/NuRandomService.h"
21 
22 // nusimdata includes
24 
25 // LArSoft includes
29 
30 // C++ includes
31 
32 namespace evgen {
33 
34  /// Module producing electrons and gammas from supernova neutrino
35  /// interactions with liquid argon (based on SingleGen)
37  public:
38  explicit SNNueAr40CCGen(fhicl::ParameterSet const& pset);
39 
40  private:
41  void beginRun(art::Run& run) override;
42  void produce(art::Event& event) override;
43 
44  CLHEP::HepRandomEngine& fEngine;
46  };
47 
48  //____________________________________________________________________________
50  : EDProducer{pset}
51  // Create a default random engine: obtain the random seed
52  // freom NuRandomService, unless overriden in configuration with key "Seed"
53  , fEngine(art::ServiceHandle<rndm::NuRandomService>{}->createEngine(*this, pset, "Seed"))
54  , fGenerator{pset.get< fhicl::ParameterSet >("GeneratorAlg")}
55  {
56  produces< std::vector< simb::MCTruth > >();
57  produces< sumdata::RunData, art::InRun >();
58  }
59 
60  //____________________________________________________________________________
62  {
63  // Store information about the geometry we are using in run information
65  run.put(std::make_unique<sumdata::RunData>(geo->DetectorName()));
66  }
67 
68  //____________________________________________________________________________
70  {
71  event.put(std::make_unique<std::vector<simb::MCTruth>>(fGenerator.Generate(fEngine)));
72  }
73 
74 }
75 
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
art framework interface to geometry description
Definition: Run.h:17
void beginRun(art::Run &run) override
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
evgen::NueAr40CCGenerator fGenerator
SNNueAr40CCGen(fhicl::ParameterSet const &pset)
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
void produce(art::Event &event) override
std::vector< simb::MCTruth > Generate(CLHEP::HepRandomEngine &engine)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
Event Generation using GENIE, cosmics or single particles.
CLHEP::HepRandomEngine & fEngine
Event finding and building.