MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
JSONConfig.hh
1
4//
5// This file is part of MARLEY (Model of Argon Reaction Low Energy Yields)
6//
7// MARLEY is free software: you can redistribute it and/or modify it under the
8// terms of version 3 of the GNU General Public License as published by the
9// Free Software Foundation.
10//
11// For the full text of the license please see COPYING or
12// visit http://opensource.org/licenses/GPL-3.0
13//
14// Please respect the MCnet academic usage guidelines. See GUIDELINES
15// or visit https://www.montecarlonet.org/GUIDELINES for details.
16
17#pragma once
18
19// standard library includes
20#include <string>
21
22// MARLEY includes
23#include "marley/CoulombCorrector.hh"
24#include "marley/Generator.hh"
25#include "marley/InterpolationGrid.hh"
26#include "marley/JSON.hh"
27
28namespace marley {
29
30 class JSONConfig {
31
32 public:
33
34 using InterpMethod = marley::InterpolationGrid<double>
36
37 explicit JSONConfig( const marley::JSON& object );
38 explicit JSONConfig( const std::string& json_filename );
39
40 marley::Generator create_generator() const;
41
42 void prepare_direction( marley::Generator& gen ) const;
43 void prepare_neutrino_source( marley::Generator& gen ) const;
44 void prepare_reactions( marley::Generator& gen,
46 const marley::JSON& ff_config ) const;
47 void prepare_structure( marley::Generator& gen ) const;
48 void prepare_target( marley::Generator& gen ) const;
49 void prepare_weights( marley::Generator& gen ) const;
50
51 InterpMethod get_interpolation_method( const std::string& rule ) const;
52 int neutrino_pdg( const std::string& nu ) const;
53
58 bool process_extra_source_types( const std::string& type,
59 const marley::JSON& source_spec, int pdg_code,
60 std::unique_ptr< marley::NeutrinoSource >& source ) const;
61
66 const marley::JSON& ff_config );
67
68 inline const marley::JSON& get_json() const;
69 inline void set_json( const marley::JSON& json );
70
71 static void handle_json_error( const std::string& name,
72 const marley::JSON& json );
73
74 protected:
75
78 std::string source_get( const char* name,
79 const marley::JSON& source_spec, const char* description,
80 const char* default_str ) const;
81
84 };
85
86 inline const marley::JSON& marley::JSONConfig::get_json() const
87 { return json_; }
88
89 inline void marley::JSONConfig::set_json( const marley::JSON& json )
90 { json_ = json; }
91
92}
CoulombMode
Enumerated type used to set the method for handling Coulomb corrections for CC nuclear reactions.
The MARLEY Event generator.
Definition Generator.hh:54
One-dimensional function y(x) defined using a grid of ordered pairs (x,y) and an interpolation rule.
marley::JSON json_
JSON object describing this configuration.
Definition JSONConfig.hh:83
static bool check_for_allowed_approximation(const marley::JSON &ff_config)
std::string source_get(const char *name, const marley::JSON &source_spec, const char *description, const char *default_str) const
Helper function for loading strings from the JSON configuration.
bool process_extra_source_types(const std::string &type, const marley::JSON &source_spec, int pdg_code, std::unique_ptr< marley::NeutrinoSource > &source) const
Helper function used to define ROOT-based neutrino source types @detail This function is a no-op when...