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

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

Collaboration diagram for g4db::ElementXsecInterpolation::SampleSet:
[legend]

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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ SampleSet()

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.

Note
We assume that the input vectors are ordered properly i.e. init_x are ordered by their values and init_y are paired with their x.
Parameters
[in]init_xx values ordered by x
[in]init_ycorresponding y values

Member Function Documentation

◆ append()

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.

Parameters
[in]xnew highest x sample point
[in]ycorresponding y value

◆ dump()

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.

Parameters
[in]ooutput stream to write to
[in]zatomic z to write as first entry in CSV
[in]kinematic_minminimum energy to add to x value

◆ interpolate()

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.

Note
We assume that the input x is within the range of the sample set. In debug build mode, this assumption is enforced with assert.
Returns
interpolated value y for the input x

◆ max()

const double & g4db::ElementXsecInterpolation::SampleSet::max ( ) const

Get the maximum x currently in sample set.

Returns
maximum x in sample set

◆ min()

const double & g4db::ElementXsecInterpolation::SampleSet::min ( ) const

Get the minimum x currently in sample set.

Returns
minimum x in sample set

◆ prepend()

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.

Parameters
[in]xnew lowest x sample point
[in]ycorresponding y value

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