G4DarkBreM
v2.1.0
Geant4 Dark Bremmstrahlung from MadGraph
|
Interpolation of cross sections by element. More...
#include <ElementXsecInterpolation.h>
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, SampleSet > | the_samples_ |
each element has its own set of sample points | |
std::shared_ptr< PrototypeModel > | model_ |
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... | |
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.
|
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.
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.
std::runtime_error | if no model is available for calculating cross sections |
[in] | energy | Energy of incident lepton [MeV] |
[in] | A | atomic mass of element [atomic mass units] |
[in] | Z | atomic number of element [num protons] |
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.
void g4db::ElementXsecInterpolation::stream | ( | std::ostream & | o | ) | const |
Stream the table of sample points into the output stream.
[in,out] | o | ostream to write to |
|
friend |
Overload the streaming operator for ease.
[in] | o | ostream to write to |
[in] | c | interpolation to write out |