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
marley::NeutrinoSource Class Referenceabstract

Abstract base class for all objects that describe the incident neutrino energy distribution. More...

#include <NeutrinoSource.hh>

Inheritance diagram for marley::NeutrinoSource:
marley::AlphaFitNeutrinoSource marley::BetaFitNeutrinoSource marley::DecayAtRestNeutrinoSource marley::FermiDiracNeutrinoSource marley::FunctionNeutrinoSource marley::GridNeutrinoSource marley::MonoNeutrinoSource

Public Member Functions

 NeutrinoSource (int particle_id)
 
virtual double get_Emax () const =0
 Get the maximum neutrino energy (MeV) that can be sampled by this source.
 
virtual double get_Emin () const =0
 Get the minimum neutrino energy (MeV) that can be sampled by this source.
 
virtual int get_pid () const
 Get the PDG particle ID for the neutrino type produced 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.
 

Static Public Member Functions

static bool pdg_is_allowed (const int pdg)
 

Protected Attributes

int pid_
 PDG particle ID for the neutrinos produced by this source.
 

Detailed Description

Abstract base class for all objects that describe the incident neutrino energy distribution.

Classes derived from NeutrinoSource implement a probability density function used to sample neutrino energies for each event. Because MARLEY will weight this probability density by the reaction cross section(s) during event generation, all NeutrinoSource objects should use unweighted energy spectra. While normalizing the probability densities to unity is not strictly required (the cross section weighted spectra are normalized automatically before sampling), it is encouraged, and all classes derived from NeutrinoSource currently do so.

Definition at line 38 of file NeutrinoSource.hh.

Constructor & Destructor Documentation

◆ NeutrinoSource()

marley::NeutrinoSource::NeutrinoSource ( int particle_id)
Parameters
particle_idPDG particle ID for the neutrinos produced by this source

Definition at line 38 of file NeutrinoSource.cc.

38 {
39 if (!pdg_is_allowed(particle_id)) throw marley::Error(
40 "Creating a neutrino source object that produces"
41 " particles with PDG ID number " + std::to_string(particle_id)
42 + " is not allowed.");
43 else pid_ = particle_id;
44}
int pid_
PDG particle ID for the neutrinos produced by this source.
static bool pdg_is_allowed(const int pdg)

References pdg_is_allowed(), and pid_.

Referenced by marley::AlphaFitNeutrinoSource::AlphaFitNeutrinoSource(), marley::BetaFitNeutrinoSource::BetaFitNeutrinoSource(), marley::DecayAtRestNeutrinoSource::DecayAtRestNeutrinoSource(), marley::FermiDiracNeutrinoSource::FermiDiracNeutrinoSource(), marley::FunctionNeutrinoSource::FunctionNeutrinoSource(), marley::GridNeutrinoSource::GridNeutrinoSource(), marley::GridNeutrinoSource::GridNeutrinoSource(), and marley::MonoNeutrinoSource::MonoNeutrinoSource().

Member Function Documentation

◆ get_Emax()

virtual double marley::NeutrinoSource::get_Emax ( ) const
pure virtual

◆ get_Emin()

virtual double marley::NeutrinoSource::get_Emin ( ) const
pure virtual

◆ get_pid()

int marley::NeutrinoSource::get_pid ( ) const
inlinevirtual

Get the PDG particle ID for the neutrino type produced by this source.

Definition at line 332 of file NeutrinoSource.hh.

332{ return pid_; }

References pid_.

◆ pdf()

virtual double marley::NeutrinoSource::pdf ( double E) const
pure virtual

Probability density function describing the incident neutrino energy distribution.

The neutrino spectrum produced by this source will be folded with the relevant cross sections by a Generator object during event creation

Parameters
Eneutrino energy (MeV)
Returns
Probability density (MeV -1)

Implemented in marley::AlphaFitNeutrinoSource, marley::BetaFitNeutrinoSource, marley::DecayAtRestNeutrinoSource, marley::FermiDiracNeutrinoSource, marley::FunctionNeutrinoSource, marley::GridNeutrinoSource, and marley::MonoNeutrinoSource.

Referenced by sample_incident_neutrino().

◆ pdg_is_allowed()

bool marley::NeutrinoSource::pdg_is_allowed ( const int pdg)
inlinestatic

Returns true if the Particle Data Group code passed to the function is allowed to be used by a neutrino source object, and returns false otherwise.

Definition at line 333 of file NeutrinoSource.hh.

334 { return (pids_.count(pdg) > 0); }

Referenced by NeutrinoSource().

◆ sample_incident_neutrino()

double marley::NeutrinoSource::sample_incident_neutrino ( int & pdg,
marley::Generator & gen ) const
virtual

Samples an incident neutrino energy and loads pdg with the PDG code of the appropriate neutrino type.

This function uses a probability density function that represents the incident neutrino spectrum, i.e., it is not weighted by the reaction cross section(s). To sample a neutrino from the reacting (i.e., cross section weighted) spectrum, use Generator::sample_reaction().

Parameters
[out]pdgPDG code of the sampled neutrino
[in]genGenerator to use for random sampling
Returns
The energy of the sampled neutrino (MeV)

Definition at line 57 of file NeutrinoSource.cc.

59{
60 static double max = marley_utils::UNKNOWN_MAX;
61 pdg = pid_;
62 return gen.rejection_sample([this](double E)
63 -> double { return this->pdf(E); }, get_Emin(), get_Emax(), max);
64}
double rejection_sample(const std::function< double(double)> &f, double xmin, double xmax, double &fmax, double safety_factor=1.01, double max_search_tolerance=DEFAULT_REJECTION_SAMPLING_TOLERANCE_)
Sample from a given 1D probability density function f(x) on the interval [xmin, xmax] using a simple ...
Definition Generator.cc:281
virtual double get_Emax() const =0
Get the maximum neutrino energy (MeV) that can be sampled 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.

References get_Emax(), get_Emin(), pdf(), pid_, and marley::Generator::rejection_sample().

Member Data Documentation

◆ pid_

int marley::NeutrinoSource::pid_
protected

PDG particle ID for the neutrinos produced by this source.

Definition at line 88 of file NeutrinoSource.hh.

Referenced by NeutrinoSource(), get_pid(), marley::DecayAtRestNeutrinoSource::pdf(), and sample_incident_neutrino().


The documentation for this class was generated from the following files: