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
StrengthVariationWeightCalculator.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 <memory>
21#include <random>
22#include <string>
23#include <vector>
24
25// MARLEY includes
26#include "marley/Reaction.hh"
27#include "marley/WeightCalculator.hh"
28
29namespace HepMC3 {
30 class GenEvent;
31}
32
33namespace marley {
34
36 class Generator;
37 class JSON;
38
45 class StrengthVariationWeightCalculator : public WeightCalculator {
46
47 public:
48
50 enum class VariationMode { multisim, shift, unisim };
51
59 static std::vector< std::shared_ptr<
61 create_instances( const marley::JSON& config,
62 marley::Generator& gen );
63
64 virtual ~StrengthVariationWeightCalculator() = default;
65
66 virtual double weight( HepMC3::GenEvent& event,
67 marley::Generator& gen ) const override;
68
69 private:
70
72 StrengthVariationWeightCalculator( const std::string& name,
73 std::shared_ptr< std::mt19937_64 > rng,
74 const std::string& resolved_reaction_file );
75
77 StrengthVariationWeightCalculator( const std::string& name,
78 double sigma_factor,
79 const std::string& resolved_reaction_file );
80
82 StrengthVariationWeightCalculator( const std::string& name,
83 double sigma_factor,
84 size_t matrix_element_index,
85 const std::string& resolved_reaction_file );
86
87 protected:
88
90 void ensure_initialized( marley::Generator& gen ) const;
91
93 std::shared_ptr< std::mt19937_64 > rng_;
94
97
100
103 double sigma_factor_ = 0.;
104
106 size_t me_idx_ = 0;
107
109 mutable bool initialized_ = false;
110
112 mutable const DiscreteNuclearReaction* dnr_ = nullptr;
113
117
119 mutable int target_pdg_ = 0;
120
123 mutable std::vector< double > varied_;
124 };
125
126}
Stores event-related information.
Definition GenEvent.h:47
A neutrino-nucleus reaction whose cross section is calculated according to the allowed approximation.
The MARLEY Event generator.
Definition Generator.hh:54
ProcessType
Enumerated type describing the kind of scattering process represented by a Reaction.
Definition Reaction.hh:58
@ Unknown
Dummy value used for error handling.
Definition Reaction.hh:59
WeightCalculator that varies nuclear matrix element strengths according to their experimental uncerta...
Reaction::ProcessType process_type_
Process type of the matched Reaction.
void ensure_initialized(marley::Generator &gen) const
Lazy initialization of per-instance varied strengths.
std::string resolved_reaction_file_
Resolved path of the reaction input file of interest.
const DiscreteNuclearReaction * dnr_
Pointer to the matched DiscreteNuclearReaction.
size_t me_idx_
Index of the single matrix element to vary (unisim mode)
double sigma_factor_
Signed sigma factor for systematic shifts (shift and unisim modes)
static std::vector< std::shared_ptr< StrengthVariationWeightCalculator > > create_instances(const marley::JSON &config, marley::Generator &gen)
Static factory: validates JSON configuration and creates all variation instances. Called by the Weigh...
bool initialized_
Whether lazy initialization has been completed.
std::vector< double > varied_
Pre-generated varied strengths (one per matrix element in the matched Reaction)
int target_pdg_
Target nucleus PDG code for the matched Reaction.
VariationMode mode_
Variation mode for this instance.
virtual double weight(HepMC3::GenEvent &event, marley::Generator &gen) const override
Compute the weight for the given event.
std::shared_ptr< std::mt19937_64 > rng_
Shared RNG (seeded once, shared across N instances)