All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MARLEYHelper.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////
2 /// \file MARLEYHelper.h
3 /// \brief LArSoft interface to the MARLEY (Model of Argon Reaction Low Energy
4 /// Yields) supernova neutrino event generator
5 ///
6 /// \author Steven Gardiner <sjgardiner@ucdavis.edu>
7 //////////////////////////////////////////////////////////////////////////////
8 
9 #ifndef LARSIM_ALGORITHMS_MARLEYGENERATOR_H
10 #define LARSIM_ALGORITHMS_MARLEYGENERATOR_H
11 
12 // standard library includes
13 #include <memory>
14 #include <sstream>
15 #include <string>
16 #include <vector>
17 
18 // framework includes
19 namespace fhicl { class ParameterSet; }
20 
21 // art extensions
22 namespace rndm { class NuRandomService; }
23 
24 // LArSoft includes
25 #include "nusimdata/SimulationBase/MCTruth.h"
26 
27 // ROOT includes
28 #include "TLorentzVector.h"
29 
30 // MARLEY includes
31 #include "marley/Generator.hh"
32 
33 namespace marley {
34  class Event;
35  class JSON;
36  class Particle;
37 }
38 
39 namespace evgen {
40 
41  class MARLEYHelper {
42 
43  public:
44 
45  MARLEYHelper( const fhicl::ParameterSet& pset,
46  rndm::NuRandomService& rand_service,
47  const std::string& generator_name );
48 
49  void reconfigure( const fhicl::ParameterSet& pset );
50 
51  // If a non-null marley::Event* is supplied, the marley::Event
52  // object corresponding to the generated MCTruth object is loaded
53  // into the target of the pointer.
54  simb::MCTruth create_MCTruth( const TLorentzVector& vtx_pos,
55  marley::Event* marley_event = nullptr );
56 
59  { return *fMarleyGenerator; }
60 
61  std::string find_file( const std::string& fileName,
62  const std::string& fileType );
63 
64  protected:
65 
66  void add_marley_particles( simb::MCTruth& truth,
67  const std::vector<marley::Particle*>& particles,
68  const TLorentzVector& vtx_pos, bool track );
69 
70  void load_full_paths_into_json( marley::JSON& json,
71  const std::string& array_name, bool missing_ok = false );
72 
73  std::unique_ptr< marley::Generator > fMarleyGenerator;
74 
75  // name to use for this instance of MARLEYHelper
76  std::string fHelperName;
77 
78  // string stream used to capture logger output from MARLEY
79  // and redirect it to the LArSoft logger
80  std::stringstream fMarleyLogStream;
81 
82  // Loads ROOT dictionaries for the MARLEY Event and Particle classes.
83  // This allows a module to write the generated events to a TTree.
85 
86  }; // class evgen::MARLEYHelper
87 
88 } // namespace evgen
89 
90 #endif // LARSIM_ALGORITHMS_MARLEYGENERATOR_H
std::unique_ptr< marley::Generator > fMarleyGenerator
Definition: MARLEYHelper.h:73
void add_marley_particles(simb::MCTruth &truth, const std::vector< marley::Particle * > &particles, const TLorentzVector &vtx_pos, bool track)
MARLEYHelper(const fhicl::ParameterSet &pset, rndm::NuRandomService &rand_service, const std::string &generator_name)
simb::MCTruth create_MCTruth(const TLorentzVector &vtx_pos, marley::Event *marley_event=nullptr)
process_name use argoneut_mc_hitfinder track
std::stringstream fMarleyLogStream
Definition: MARLEYHelper.h:80
std::string fHelperName
Definition: MARLEYHelper.h:76
std::string find_file(const std::string &fileName, const std::string &fileType)
void reconfigure(const fhicl::ParameterSet &pset)
void load_full_paths_into_json(marley::JSON &json, const std::string &array_name, bool missing_ok=false)
const marley::Generator & get_generator() const
Definition: MARLEYHelper.h:58
marley::Generator & get_generator()
Definition: MARLEYHelper.h:57