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
NeutrinoSource.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#include <functional>
19#include <set>
20
21#include "marley/marley_utils.hh"
22#include "marley/InterpolationGrid.hh"
23
24namespace marley {
25
26 class Generator;
27
39 public:
40
43 NeutrinoSource(int particle_id);
44
45 virtual ~NeutrinoSource() = default;
46
49 virtual double get_Emax() const = 0;
50
53 virtual double get_Emin() const = 0;
54
57 inline virtual int get_pid() const;
58
66 virtual double pdf(double E) const = 0;
67
71 static inline bool pdg_is_allowed(const int pdg);
72
83 virtual double sample_incident_neutrino(int& pdg,
84 marley::Generator& gen) const;
85
86 protected:
87
88 int pid_;
89
90 private:
95 static const std::set<int> pids_;
96 };
97
100 public:
103 inline MonoNeutrinoSource(int particle_id =
104 marley_utils::ELECTRON_NEUTRINO, double E = 10.);
105
106 inline virtual double get_Emax() const override;
107
108 inline virtual double get_Emin() const override;
109
110 inline virtual double pdf(double E) const override;
111
112 protected:
113 double energy_;
114 };
115
125 public:
126
133 FermiDiracNeutrinoSource(int particle_id
134 = marley_utils::ELECTRON_NEUTRINO, double Emin = 0.,
135 double Emax = 50., double temp = 3.5, double eta = 0.);
136
137 inline virtual double get_Emin() const override;
138
139 inline virtual double get_Emax() const override;
140
141 virtual double pdf(double E) const override;
142
143 protected:
144
145 double Emin_;
146 double Emax_;
148 double eta_;
149 double C_;
150 };
151
164 public:
171 AlphaFitNeutrinoSource(int particle_id
172 = marley_utils::ELECTRON_NEUTRINO, double Emin = 0.,
173 double Emax = 50., double Emean = 13., double alpha = 2.);
174
175 inline virtual double get_Emin() const override;
176 inline virtual double get_Emax() const override;
177
178 virtual double pdf(double E) const override;
179
180 protected:
181 double Emin_;
182 double Emax_;
187 double Emean_;
188 double alpha_;
189 double C_;
190 };
191
205 public:
212 BetaFitNeutrinoSource(int particle_id
213 = marley_utils::ELECTRON_NEUTRINO, double Emin = 0.,
214 double Emax = 50., double Emean = 13., double beta = 4.5);
215
216 inline virtual double get_Emin() const override;
217 inline virtual double get_Emax() const override;
218
219 virtual double pdf(double E) const override;
220
221 protected:
222 double Emin_;
223 double Emax_;
228 double Emean_;
229 double alpha_;
230 double C_;
231 };
232
236 public:
243 FunctionNeutrinoSource(int particle_id
244 = marley_utils::ELECTRON_NEUTRINO, double Emin = 0., double Emax = 50.,
245 std::function<double(double)> prob_dens_func
246 = [](double) -> double { return 1.; });
247
248 inline virtual double get_Emax() const override;
249
250 inline virtual double get_Emin() const override;
251
252 inline virtual double pdf(double E) const override;
253
254 private:
255 double Emin_;
256 double Emax_;
258 std::function<double(double)> probability_density_;
259 };
260
270 public:
273 DecayAtRestNeutrinoSource(int particle_id
274 = marley_utils::ELECTRON_NEUTRINO);
275
276 inline virtual double get_Emax() const override;
277
278 inline virtual double get_Emin() const override;
279
280 virtual double pdf(double E) const override;
281
282 private:
283 // Muon mass stuff (m_mu^(-4) pre-computed for speed)
284 static constexpr double m_mu_ = marley_utils::m_mu
285 * marley_utils::micro_amu; // MeV
286 static constexpr double m_mu_to_the_minus_four_
287 = 1. / (m_mu_ * m_mu_ * m_mu_ * m_mu_);
288 static constexpr double Emin_ = 0.; // MeV
289 static constexpr double Emax_ = m_mu_ / 2.; // MeV
290 };
291
294 public:
295 using Grid = InterpolationGrid<double>;
296 using Method = Grid::InterpolationMethod;
297
302 inline GridNeutrinoSource(const Grid& g, int particle_id
303 = marley_utils::ELECTRON_NEUTRINO);
304
311 inline GridNeutrinoSource(const std::vector<double>& Es,
312 const std::vector<double>& PDs, int particle_id
313 = marley_utils::ELECTRON_NEUTRINO, Method method
314 = Method::LinearLinear);
315
316 inline virtual double get_Emax() const override;
317
318 inline virtual double get_Emin() const override;
319
320 inline virtual double pdf(double E) const override;
321
322 protected:
323 Grid grid_;
324
325 private:
328 void check_for_errors();
329 };
330
331 // Inline function definitions
332 inline int NeutrinoSource::get_pid() const { return pid_; }
333 inline bool NeutrinoSource::pdg_is_allowed(const int pdg)
334 { return (pids_.count(pdg) > 0); }
335
336 inline MonoNeutrinoSource::MonoNeutrinoSource(int particle_id, double E)
337 : NeutrinoSource(particle_id), energy_(E) {}
338 inline double MonoNeutrinoSource::get_Emax() const { return energy_; }
339 inline double MonoNeutrinoSource::get_Emin() const { return energy_; }
340 inline double MonoNeutrinoSource::pdf(double E) const
341 { if (energy_ == E) return 1.; else return 0.; }
342
343 inline double FermiDiracNeutrinoSource::get_Emax() const { return Emax_; }
344 inline double FermiDiracNeutrinoSource::get_Emin() const { return Emin_; }
345
346 inline double AlphaFitNeutrinoSource::get_Emax() const { return Emax_; }
347 inline double AlphaFitNeutrinoSource::get_Emin() const { return Emin_; }
348
349 inline double BetaFitNeutrinoSource::get_Emax() const { return Emax_; }
350 inline double BetaFitNeutrinoSource::get_Emin() const { return Emin_; }
351
352 inline double FunctionNeutrinoSource::get_Emax() const { return Emax_; }
353 inline double FunctionNeutrinoSource::get_Emin() const { return Emin_; }
354 inline double FunctionNeutrinoSource::pdf(double E) const {
355 if (E < Emin_ || E > Emax_) return 0.;
356 else return probability_density_(E);
357 }
358
359 inline double DecayAtRestNeutrinoSource::get_Emax() const { return Emax_; }
360 inline double DecayAtRestNeutrinoSource::get_Emin() const { return Emin_; }
361
362 inline double GridNeutrinoSource::get_Emax() const
363 { return grid_.back().first; }
364 inline double GridNeutrinoSource::get_Emin() const
365 { return grid_.front().first; }
366 inline double GridNeutrinoSource::pdf(double E) const
367 { return grid_.interpolate(E); }
368
369 inline GridNeutrinoSource::GridNeutrinoSource(const Grid& g, int particle_id)
370 : NeutrinoSource(particle_id), grid_(g) { check_for_errors(); }
371
372 inline GridNeutrinoSource::GridNeutrinoSource(const std::vector<double>& Es,
373 const std::vector<double>& prob_densities, int particle_id, Method method)
374 : NeutrinoSource(particle_id), grid_(Es, prob_densities, method)
375 { check_for_errors(); }
376}
double C_
dimensionless normalization constant
AlphaFitNeutrinoSource(int particle_id=marley_utils::ELECTRON_NEUTRINO, double Emin=0., double Emax=50., double Emean=13., double alpha=2.)
double Emin_
minimum neutrino energy (MeV)
virtual double pdf(double E) const override
Probability density function describing the incident neutrino energy distribution.
virtual double get_Emax() const override
Get the maximum neutrino energy (MeV) that can be sampled by this source.
double Emean_
mean neutrino energy
virtual double get_Emin() const override
Get the minimum neutrino energy (MeV) that can be sampled by this source.
double alpha_
dimensionless pinching parameter
virtual double pdf(double E) const override
Probability density function describing the incident neutrino energy distribution.
double C_
dimensionless normalization constant
double alpha_
pinching parameter (stored as alpha = beta - 1)
virtual double get_Emax() const override
Get the maximum neutrino energy (MeV) that can be sampled by this source.
double Emean_
mean neutrino energy
virtual double get_Emin() const override
Get the minimum neutrino energy (MeV) that can be sampled by this source.
double Emin_
minimum neutrino energy (MeV)
BetaFitNeutrinoSource(int particle_id=marley_utils::ELECTRON_NEUTRINO, double Emin=0., double Emax=50., double Emean=13., double beta=4.5)
virtual double get_Emax() const override
Get the maximum neutrino energy (MeV) that can be sampled by this source.
DecayAtRestNeutrinoSource(int particle_id=marley_utils::ELECTRON_NEUTRINO)
virtual double pdf(double E) const override
Probability density function describing the incident neutrino energy distribution.
virtual double get_Emin() const override
Get the minimum neutrino energy (MeV) that can be sampled by this source.
FermiDiracNeutrinoSource(int particle_id=marley_utils::ELECTRON_NEUTRINO, double Emin=0., double Emax=50., double temp=3.5, double eta=0.)
double eta_
dimensionless pinching parameter
double Emin_
minimum neutrino energy (MeV)
virtual double get_Emax() const override
Get the maximum neutrino energy (MeV) that can be sampled by this source.
double C_
normalization constant (MeV2)
double Emax_
maximum neutrino energy (MeV)
virtual double pdf(double E) const override
Probability density function describing the incident neutrino energy distribution.
double temperature_
temperature (MeV)
virtual double get_Emin() const override
Get the minimum neutrino energy (MeV) that can be sampled by this source.
virtual double pdf(double E) const override
Probability density function describing the incident neutrino energy distribution.
virtual double get_Emax() const override
Get the maximum neutrino energy (MeV) that can be sampled by this source.
FunctionNeutrinoSource(int particle_id=marley_utils::ELECTRON_NEUTRINO, double Emin=0., double Emax=50., std::function< double(double)> prob_dens_func=[](double) -> double { return 1.;})
virtual double get_Emin() const override
Get the minimum neutrino energy (MeV) that can be sampled by this source.
The MARLEY Event generator.
Definition Generator.hh:54
virtual double pdf(double E) const override
Probability density function describing the incident neutrino energy distribution.
virtual double get_Emin() const override
Get the minimum neutrino energy (MeV) that can be sampled by this source.
virtual double get_Emax() const override
Get the maximum neutrino energy (MeV) that can be sampled by this source.
GridNeutrinoSource(const Grid &g, int particle_id=marley_utils::ELECTRON_NEUTRINO)
One-dimensional function y(x) defined using a grid of ordered pairs (x,y) and an interpolation rule.
double energy_
neutrino energy (MeV)
virtual double pdf(double E) const override
Probability density function describing the incident neutrino energy distribution.
virtual double get_Emax() const override
Get the maximum neutrino energy (MeV) that can be sampled by this source.
virtual double get_Emin() const override
Get the minimum neutrino energy (MeV) that can be sampled by this source.
MonoNeutrinoSource(int particle_id=marley_utils::ELECTRON_NEUTRINO, double E=10.)
virtual double get_Emax() const =0
Get the maximum neutrino energy (MeV) that can be sampled by this source.
NeutrinoSource(int particle_id)
int pid_
PDG particle ID for the neutrinos produced by this source.
virtual double get_Emin() const =0
Get the minimum neutrino energy (MeV) that can be sampled by this source.
virtual double pdf(double E) const =0
Probability density function describing the incident neutrino energy distribution.
virtual double sample_incident_neutrino(int &pdg, marley::Generator &gen) const
Samples an incident neutrino energy and loads pdg with the PDG code of the appropriate neutrino type.
virtual int get_pid() const
Get the PDG particle ID for the neutrino type produced by this source.
static bool pdg_is_allowed(const int pdg)