G4DarkBreM  v2.1.0
Geant4 Dark Bremmstrahlung from MadGraph
g4db::ElementXsecInterpolation Class Reference

Interpolation of cross sections by element. More...

#include <ElementXsecInterpolation.h>

Collaboration diagram for g4db::ElementXsecInterpolation:
[legend]

Classes

class  SampleSet
 A sample set is two parallel vectors limited to operate for our interpolation goal. More...
 

Public Member Functions

 ElementXsecInterpolation ()=default
 Default constructor. More...
 
 ElementXsecInterpolation (std::shared_ptr< PrototypeModel > model)
 Constructor with a model to calculate the cross section.
 
G4double get (G4double energy, G4double A, G4double Z)
 Get the value of the cross section for the input variables. More...
 
void stream (std::ostream &o) const
 Stream the table of sample points into the output stream. More...
 

Private Attributes

std::map< int, SampleSetthe_samples_
 each element has its own set of sample points
 
std::shared_ptr< PrototypeModelmodel_
 shared pointer to the model for calculating cross sections
 

Friends

std::ostream & operator<< (std::ostream &o, const ElementXsecInterpolation c)
 Overload the streaming operator for ease. More...
 

Detailed Description

Interpolation of cross sections by element.

The interpolation method is a modified quadratic interpolation where the main modification is - since we have a way to calculate new sample points - we expand the set of sample points if a cross section is requested for a energy and/or element outside of our current sample range.

Constructor & Destructor Documentation

◆ ElementXsecInterpolation()

g4db::ElementXsecInterpolation::ElementXsecInterpolation ( )
default

Default constructor.

Does nothing interesting, but no model for calculating cross section has been set. If interpolation is attempted with a default-constructed interpolator, an exception will be thrown.

Member Function Documentation

◆ get()

G4double g4db::ElementXsecInterpolation::get ( G4double  energy,
G4double  A,
G4double  Z 
)

Get the value of the cross section for the input variables.

For the interpolation to be successful, we impose the kinematic limit immediately - i.e. if energy is less than twice the A' mass, the cross section is zero.

Exceptions
std::runtime_errorif no model is available for calculating cross sections
Parameters
[in]energyEnergy of incident lepton [MeV]
[in]Aatomic mass of element [atomic mass units]
[in]Zatomic number of element [num protons]
Returns
cross section corresponding to the input parameters (including units Geant4 style)
Note
Implicit conversion to integer from the double form of Z. This may not function properly if users have a custom element that is an averaged Z, but since elements close in Z behave similarly, this may not matter either.

When there is no entry for an element yet, we initialize the samples by calculating the cross section in 10% energy steps from the kinematic minimum up to the requested energy.

When the requested energy is below the lowest sample point, we determine two more samples. One at the requested energy and one below it.

When the requested energy is above the highest sample point, we determine two more samples. One at the requested energy and one above it.

When the requested energy is within the range set by our samples, we do a quadratic interpolation using the three points that enclose the requested energy.

We do the interpolation with the first set of three points that encloses the requested energy, so this prefers the point set that has two samples below and one above.

◆ stream()

void g4db::ElementXsecInterpolation::stream ( std::ostream &  o) const

Stream the table of sample points into the output stream.

Parameters
[in,out]oostream to write to

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  o,
const ElementXsecInterpolation  c 
)
friend

Overload the streaming operator for ease.

Parameters
[in]oostream to write to
[in]cinterpolation to write out
Returns
modified ostream

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