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::FunctionNeutrinoSource Class Reference

Neutrino source with an arbitrary energy spectrum described by a std::function<double(double)> object. More...

#include <NeutrinoSource.hh>

Inheritance diagram for marley::FunctionNeutrinoSource:
marley::NeutrinoSource

Public Member Functions

 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_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.
 
virtual double pdf (double E) const override
 Probability density function describing the incident neutrino energy distribution.
 
- Public Member Functions inherited from marley::NeutrinoSource
 NeutrinoSource (int particle_id)
 
virtual int get_pid () const
 Get the PDG particle ID for the neutrino type produced by this source.
 
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.
 

Additional Inherited Members

- Static Public Member Functions inherited from marley::NeutrinoSource
static bool pdg_is_allowed (const int pdg)
 
- Protected Attributes inherited from marley::NeutrinoSource
int pid_
 PDG particle ID for the neutrinos produced by this source.
 

Detailed Description

Neutrino source with an arbitrary energy spectrum described by a std::function<double(double)> object.

Definition at line 235 of file NeutrinoSource.hh.

Constructor & Destructor Documentation

◆ FunctionNeutrinoSource()

marley::FunctionNeutrinoSource::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.; } )
Parameters
particle_idPDG particle ID for the neutrinos produced by this source
Eminminimum allowed neutrino energy (MeV)
Emaxmaximum allowed neutrino energy (MeV)
prob_dens_funca std::function<double(double)> object to be used as a probability density function

Definition at line 150 of file NeutrinoSource.cc.

152 : NeutrinoSource(particle_id), Emin_(Emin), Emax_(Emax)
153{
154 // Normalize the supplied spectrum (not strictly necessary, but having the
155 // spectrum approximately normalized makes the default rejection sampling
156 // tolerance of 1e-8 reliable for finding the maximum of the spectrum)
157 double integral = marley_utils::num_integrate(prob_dens_func, Emin, Emax);
158 probability_density_ = [prob_dens_func, integral](double E)
159 -> double { return prob_dens_func(E) / integral; };
160}
NeutrinoSource(int particle_id)

References marley::NeutrinoSource::NeutrinoSource().

Member Function Documentation

◆ get_Emax()

double marley::FunctionNeutrinoSource::get_Emax ( ) const
inlineoverridevirtual

Get the maximum neutrino energy (MeV) that can be sampled by this source.

Implements marley::NeutrinoSource.

Definition at line 352 of file NeutrinoSource.hh.

352{ return Emax_; }

◆ get_Emin()

double marley::FunctionNeutrinoSource::get_Emin ( ) const
inlineoverridevirtual

Get the minimum neutrino energy (MeV) that can be sampled by this source.

Implements marley::NeutrinoSource.

Definition at line 353 of file NeutrinoSource.hh.

353{ return Emin_; }

◆ pdf()

double marley::FunctionNeutrinoSource::pdf ( double E) const
inlineoverridevirtual

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)

Implements marley::NeutrinoSource.

Definition at line 354 of file NeutrinoSource.hh.

354 {
355 if (E < Emin_ || E > Emax_) return 0.;
356 else return probability_density_(E);
357 }

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