G4DarkBreM
v2.1.0
Geant4 Dark Bremmstrahlung from MadGraph
|
A sample set is two parallel vectors limited to operate for our interpolation goal. More...
Public Member Functions | |
SampleSet (const std::vector< double > &init_x, const std::vector< double > &init_y) | |
Initialize the sample set with the two input vectors. More... | |
const double & | min () const |
Get the minimum x currently in sample set. More... | |
const double & | max () const |
Get the maximum x currently in sample set. More... | |
void | prepend (double x, double y) |
prepend the sample set with the input point More... | |
void | append (double x, double y) |
append the sample set with the input point More... | |
double | interpolate (double x) const |
Calculate an interpolation for the point x. More... | |
void | dump (std::ostream &o, int z, double kinematic_min) const |
Dump our sample points to the input stream. More... | |
Private Attributes | |
std::vector< double > | x_ |
x points | |
std::vector< double > | y_ |
y points | |
A sample set is two parallel vectors limited to operate for our interpolation goal.
g4db::ElementXsecInterpolation::SampleSet::SampleSet | ( | const std::vector< double > & | init_x, |
const std::vector< double > & | init_y | ||
) |
Initialize the sample set with the two input vectors.
[in] | init_x | x values ordered by x |
[in] | init_y | corresponding y values |
void g4db::ElementXsecInterpolation::SampleSet::append | ( | double | x, |
double | y | ||
) |
append the sample set with the input point
We assume that the input x is greater than the current maximum x. In debug build mode, this assumption is enforced by assert.
[in] | x | new highest x sample point |
[in] | y | corresponding y value |
void g4db::ElementXsecInterpolation::SampleSet::dump | ( | std::ostream & | o, |
int | z, | ||
double | kinematic_min | ||
) | const |
Dump our sample points to the input stream.
We also want to label each row with the Z of the nucleus the sample is for, so that is a parameter, moreover, we want to add the kinematic_min to the x value we used to recover the actual energy of the particle we have the sampled cross section for.
[in] | o | output stream to write to |
[in] | z | atomic z to write as first entry in CSV |
[in] | kinematic_min | minimum energy to add to x value |
double g4db::ElementXsecInterpolation::SampleSet::interpolate | ( | double | x | ) | const |
Calculate an interpolation for the point x.
The interpolation is a quadratic interpolation over three points whose range encloses the requested sample x. The first such three points that satisfies this criteria is used, so this usually selects the three points where two points are below x and one above.
const double & g4db::ElementXsecInterpolation::SampleSet::max | ( | ) | const |
Get the maximum x currently in sample set.
const double & g4db::ElementXsecInterpolation::SampleSet::min | ( | ) | const |
Get the minimum x currently in sample set.
void g4db::ElementXsecInterpolation::SampleSet::prepend | ( | double | x, |
double | y | ||
) |
prepend the sample set with the input point
We assume that the input x is less than the current minimum x. In debug build mode, this assumption is enforced by assert.
[in] | x | new lowest x sample point |
[in] | y | corresponding y value |