Basic Interface

The core of this library is two abstract classes, Particle and Medium. Users who want to implement their own dark matter and medium models only need to inherit them and implement all virtual functions. We show all the abstract classes below.

class Medium

template<typename Vector3, typename Value>
class Medium

Base abstract Medium class.

Subclassed by darkprop::MediumBall< Vector3d< double >, double >, darkprop::MediumBall< Vector3, Value >

Public Functions

virtual Value propagate(Particle<Vector3, Value> &particle, RandomNumber<Value> &rn) = 0

Propagate a particle.

Sample a free path and propagate the particle and determine whether the particle is in the Medium or not. Set Particle::in_medium to false if the simulation should stop.

virtual Target sampleTarget(const Particle<Vector3, Value> &particle, RandomNumber<Value> &rn) const = 0

Sample a target before scattering.

template<typename Vector3 = Vector3d<double>, typename Value = double>
class MediumBall : public darkprop::Medium<Vector3d<double>, double>

Base class for spherical medium.

Subclassed by darkprop::Earth< Vector3d< double >, double >, darkprop::Earth< Vector3, Value >, darkprop::Sun< Vector3, Value >

template<typename Vector3 = Vector3d<double>, typename Value = double>
class Earth : public darkprop::MediumBall<Vector3d<double>, double>

Abstract Earth class.

Subclassed by darkprop::HomoEarth< Vector3, Value >, darkprop::HomoElectronEarth< Vector3, Value >, darkprop::PREMEarth< Vector3, Value >

class Particle

template<typename Vector3, typename Value>
class Particle

Base abstract Particle class.

Subclassed by darkprop::ParticleElastic< Vector3d< double >, double >, darkprop::GENIEBDM< Vector3, Value >, darkprop::ParticleElastic< Vector3, Value >, darkprop::SolarDM< Vector3, Value >

Public Functions

virtual Value totalCrossSection(const Target &t) const = 0

Total cross section scattering with Target t.

Use current this->T as initial kinetic energy. Return the statistical weight.

virtual Value scatter(const Target &t, RandomNumber<Value> &rn) = 0

Sample final state DM particle.

The changes are made directly. Return the statistical weight.

inline Event<Vector3, Value> toEvent(Value weight = 1.0, bool kmsec = true)

Generate a Event from the current state.

Parameters:
  • weight – The statistical weight.

  • kmsec – If true the quantities t and r will be in unit of second and kilometer, respectively, otherwise remain natural unit with GeV = 1.

Public Members

Value m

mass

Value sigma0

cross section

Value t

time

Value T

kinetic energy

Vector3 r

position

Vector3 v

velocity

Vector3 p3

3 momentum

Vector3 ep

velocity (momentum) direction

Vector3 er

position direction

bool in_medium

switch indicating whether to continue the simulation

Interface Functions: propagate and scatter

template<typename Vector3, typename Value>
Value darkprop::propagate(Particle<Vector3, Value> &p, Medium<Vector3, Value> &m, RandomNumber<Value> &rn)

Basic interface for Particle propagating in the Medium.

It simply wraps Medium::propagate. Return the statistical weight.

template<typename Vector3, typename Value>
Value darkprop::scatter(Particle<Vector3, Value> &p, Medium<Vector3, Value> &m, RandomNumber<Value> &rn)

Basic interface for Particle scattering in the Medium.

Update T, p3, v, ep of the particle p after a scattering. It simply wraps Medium::sampleTarget and Particle::scatter. Return the statistical weight.

Other Ingredients

struct Target

Target nucleus or electron.

Public Members

std::string name

name string

int Z

charge number

int A

mass number

double m

mass

template<typename Value = double>
class RandomNumber

Random number generator.

Public Functions

inline Value uniform_phi()

Sample uniform distribution on (0, pi).

inline Value uniform_costheta()

Sample uniform distribution on (-1, 1).

inline Value uniform_xi()

Sample uniform distribution on (0, 1).

inline Value uniform_ab(Value a, Value b)

Sample uniform distribution on (a, b).

inline Value normal(Value mu, Value sigma)

Sample normal distribution N(mu, sigma).

template<typename Vector3, typename Value>
struct Event

Store particle information for dump.

Public Members

Value t

time

Value T

kinetic energy

Vector3 r

position

Vector3 p3

3 momentum

Value weight

statistical weight for importance sampling