Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::TrackSrim Class Reference

Generate tracks based on SRIM energy loss, range and straggling tables. More...

#include <TrackSrim.hh>

Inheritance diagram for Garfield::TrackSrim:
Garfield::Track

Classes

struct  Cluster

Public Member Functions

 TrackSrim ()
 Default constructor.
 TrackSrim (Sensor *sensor)
 Constructor.
virtual ~TrackSrim ()
 Destructor.
bool ReadFile (const std::string &file)
 Load data from a SRIM file.
void Print ()
 Print the energy loss table.
void PlotEnergyLoss ()
 Plot the electromagnetic, hadronic, and total energy loss as function of the projectile energy.
void PlotRange ()
 Plot the projected range as function of the projectile energy.
void PlotStraggling ()
 Plot the transverse and longitudinal straggling as function of the projectile energy.
void SetModel (const int m)
 Set the fluctuation model (0 = none, 1 = Landau, 2 = Vavilov, 3 = Gaussian, 4 = Combined).
int GetModel () const
 Get the fluctuation model.
void SetTargetClusterSize (const int n)
 Specify how many electrons should be grouped to a cluster.
int GetTargetClusterSize () const
 Retrieve the target cluster size.
void SetClustersMaximum (const int n)
 Set the max. number of clusters on a track.
int GetClustersMaximum () const
 Retrieve the max. number of clusters on a track.
void SetWorkFunction (const double w)
 Set the W value [eV].
double GetWorkFunction () const
 Get the W value [eV].
void SetFanoFactor (const double f)
 Set the Fano factor.
void UnsetFanoFactor ()
 Use the default Fano factor.
double GetFanoFactor () const
 Get the Fano factor.
void SetDensity (const double density)
 Set the density [g/cm3] of the target medium.
double GetDensity () const
 Get the density [g/cm3] of the target medium.
void SetAtomicMassNumbers (const double a, const double z)
 Set A and Z of the target medium.
void GetAtomicMassMumbers (double &a, double &z) const
 Get A and Z of the target medium.
void EnableTransverseStraggling (const bool on=true)
 Simulate transverse straggling (default: on).
void EnableLongitudinalStraggling (const bool on=true)
 Simulate longitudinal straggling (default: off).
bool NewTrack (const double x0, const double y0, const double z0, const double t0, const double dx0, const double dy0, const double dz0) override
 Calculate a new track starting from (x0, y0, z0) at time t0 in direction (dx0, dy0, dz0).
const std::vector< Cluster > & GetClusters () const
bool GetCluster (double &xc, double &yc, double &zc, double &tc, int &nc, double &ec, double &extra)
Public Member Functions inherited from Garfield::Track
 Track ()=delete
 Default constructor.
 Track (const std::string &name)
 Constructor.
virtual ~Track ()
 Destructor.
virtual void SetParticle (const std::string &part)
 Set the type of charged particle.
void SetEnergy (const double e)
 Set the particle energy.
void SetBetaGamma (const double bg)
 Set the relative momentum of the particle.
void SetBeta (const double beta)
 Set the speed ( $\beta = v/c$) of the particle.
void SetGamma (const double gamma)
 Set the Lorentz factor of the particle.
void SetMomentum (const double p)
 Set the particle momentum.
void SetKineticEnergy (const double ekin)
 Set the kinetic energy of the particle.
double GetEnergy () const
 Return the particle energy.
double GetBetaGamma () const
 Return the $\beta\gamma$ of the projectile.
double GetBeta () const
 Return the speed ( $\beta = v/c$) of the projectile.
double GetGamma () const
 Return the Lorentz factor of the projectile.
double GetMomentum () const
 Return the particle momentum.
double GetKineticEnergy () const
 Return the kinetic energy of the projectile.
double GetCharge () const
 Get the charge of the projectile.
double GetMass () const
 Get the mass [eV / c2] of the projectile.
void SetSensor (Sensor *s)
 Set the sensor through which to transport the particle.
virtual double GetClusterDensity ()
 Get the cluster density (number of ionizing collisions per cm or inverse mean free path for ionization).
virtual double GetStoppingPower ()
 Get the stopping power (mean energy loss [eV] per cm).
void EnablePlotting (ViewDrift *viewer)
 Switch on plotting.
void DisablePlotting ()
 Switch off plotting.
void EnableDebugging ()
 Switch on debugging messages.
void DisableDebugging ()
 Switch off debugging messages.

Protected Member Functions

double Xi (const double x, const double beta2, const double edens) const
double DedxEM (const double e) const
double DedxHD (const double e) const
bool PreciseLoss (const double step, const double estart, double &deem, double &dehd) const
bool EstimateRange (const double ekin, const double step, double &stpmax) const
bool SmallestStep (const double ekin, const double edens, double de, double step, double &stpmin)
Medium * GetMedium (const std::array< double, 3 > &x) const
double Terminate (const std::array< double, 3 > &x0, const std::array< double, 3 > &v0, const double step0) const
double TerminateBfield (const std::array< double, 3 > &x0, const std::array< double, 3 > &v0, const double dt0, const double vmag) const
double RndmEnergyLoss (const double ekin, const double de, const double step, const double edens) const
Protected Member Functions inherited from Garfield::Track
void PlotNewTrack (const double x0, const double y0, const double z0)
void PlotCluster (const double x0, const double y0, const double z0)

Protected Attributes

bool m_useTransStraggle = true
 Include transverse straggling.
bool m_useLongStraggle = false
 Include longitudinal straggling.
bool m_chargeset = false
 Has the charge been defined?
double m_qion = 1.
 Charge of the projectile.
double m_mion = -1.
 Mass [MeV] of the projectile.
double m_rho = -1.
 Mass density [g/cm3] of the target.
double m_work = -1.
 Work function [eV] of the target.
bool m_fset = false
 Has the Fano factor been set?
double m_fano = -1.
 Fano factor [-] of the target.
double m_a = -1.
 Effective A of the target.
double m_z = -1.
 Effective Z of the target.
int m_maxclusters = -1
 Maximum number of clusters allowed (infinite if 0)
std::vector< double > m_ekin
 Energy in energy loss table [MeV].
std::vector< double > m_emloss
 EM energy loss [MeV cm2/g].
std::vector< double > m_hdloss
 Hadronic energy loss [MeV cm2/g].
std::vector< double > m_range
 Projected range [cm].
std::vector< double > m_transstraggle
 Transverse straggling [cm].
std::vector< double > m_longstraggle
 Longitudinal straggling [cm].
size_t m_currcluster = 0
 Index of the next cluster to be returned.
unsigned int m_model = 4
 Fluctuation model (0 = none, 1 = Landau, 2 = Vavilov, 3 = Gaussian, 4 = Combined)
int m_nsize = -1
 Targeted cluster size.
std::vector< Clusterm_clusters
Protected Attributes inherited from Garfield::Track
std::string m_className = "Track"
double m_q = -1.
int m_spin = 1
double m_mass
double m_energy = 0.
double m_beta2 = 1.
bool m_isElectron = false
std::string m_particleName = "mu-"
Sensor * m_sensor = nullptr
bool m_isChanged = true
ViewDriftm_viewer = nullptr
bool m_debug = false
size_t m_plotId = 0

Additional Inherited Members

Static Protected Member Functions inherited from Garfield::Track
static std::array< double, 3 > StepBfield (const double dt, const double qoverm, const double vmag, double bx, double by, double bz, std::array< double, 3 > &dir)

Detailed Description

Generate tracks based on SRIM energy loss, range and straggling tables.

Definition at line 14 of file TrackSrim.hh.

Constructor & Destructor Documentation

◆ TrackSrim() [1/2]

Garfield::TrackSrim::TrackSrim ( )
inline

Default constructor.

Definition at line 17 of file TrackSrim.hh.

17: TrackSrim(nullptr) {}
TrackSrim()
Default constructor.
Definition TrackSrim.hh:17

◆ TrackSrim() [2/2]

Garfield::TrackSrim::TrackSrim ( Sensor * sensor)

Constructor.

◆ ~TrackSrim()

virtual Garfield::TrackSrim::~TrackSrim ( )
inlinevirtual

Destructor.

Definition at line 21 of file TrackSrim.hh.

21{}

Member Function Documentation

◆ DedxEM()

double Garfield::TrackSrim::DedxEM ( const double e) const
protected

◆ DedxHD()

double Garfield::TrackSrim::DedxHD ( const double e) const
protected

◆ EnableLongitudinalStraggling()

void Garfield::TrackSrim::EnableLongitudinalStraggling ( const bool on = true)
inline

Simulate longitudinal straggling (default: off).

Definition at line 86 of file TrackSrim.hh.

86 {
88 }
bool m_useLongStraggle
Include longitudinal straggling.
Definition TrackSrim.hh:108

◆ EnableTransverseStraggling()

void Garfield::TrackSrim::EnableTransverseStraggling ( const bool on = true)
inline

Simulate transverse straggling (default: on).

Definition at line 82 of file TrackSrim.hh.

82 {
84 }
bool m_useTransStraggle
Include transverse straggling.
Definition TrackSrim.hh:106

◆ EstimateRange()

bool Garfield::TrackSrim::EstimateRange ( const double ekin,
const double step,
double & stpmax ) const
protected

◆ GetAtomicMassMumbers()

void Garfield::TrackSrim::GetAtomicMassMumbers ( double & a,
double & z ) const
inline

Get A and Z of the target medium.

Definition at line 76 of file TrackSrim.hh.

76 {
77 a = m_a;
78 z = m_z;
79 }
double m_z
Effective Z of the target.
Definition TrackSrim.hh:127
double m_a
Effective A of the target.
Definition TrackSrim.hh:125

◆ GetCluster()

bool Garfield::TrackSrim::GetCluster ( double & xc,
double & yc,
double & zc,
double & tc,
int & nc,
double & ec,
double & extra )

◆ GetClusters()

const std::vector< Cluster > & Garfield::TrackSrim::GetClusters ( ) const
inline

Definition at line 100 of file TrackSrim.hh.

100{ return m_clusters; }
std::vector< Cluster > m_clusters
Definition TrackSrim.hh:151

◆ GetClustersMaximum()

int Garfield::TrackSrim::GetClustersMaximum ( ) const
inline

Retrieve the max. number of clusters on a track.

Definition at line 51 of file TrackSrim.hh.

51{ return m_maxclusters; }
int m_maxclusters
Maximum number of clusters allowed (infinite if 0)
Definition TrackSrim.hh:130

◆ GetDensity()

double Garfield::TrackSrim::GetDensity ( ) const
inline

Get the density [g/cm3] of the target medium.

Definition at line 69 of file TrackSrim.hh.

69{ return m_rho; }
double m_rho
Mass density [g/cm3] of the target.
Definition TrackSrim.hh:117

◆ GetFanoFactor()

double Garfield::TrackSrim::GetFanoFactor ( ) const
inline

Get the Fano factor.

Definition at line 65 of file TrackSrim.hh.

65{ return m_fano; }
double m_fano
Fano factor [-] of the target.
Definition TrackSrim.hh:123

◆ GetMedium()

Medium * Garfield::TrackSrim::GetMedium ( const std::array< double, 3 > & x) const
protected

◆ GetModel()

int Garfield::TrackSrim::GetModel ( ) const
inline

Get the fluctuation model.

Definition at line 41 of file TrackSrim.hh.

41{ return m_model; }
unsigned int m_model
Fluctuation model (0 = none, 1 = Landau, 2 = Vavilov, 3 = Gaussian, 4 = Combined)
Definition TrackSrim.hh:148

◆ GetTargetClusterSize()

int Garfield::TrackSrim::GetTargetClusterSize ( ) const
inline

Retrieve the target cluster size.

Definition at line 46 of file TrackSrim.hh.

46{ return m_nsize; }
int m_nsize
Targeted cluster size.
Definition TrackSrim.hh:150

◆ GetWorkFunction()

double Garfield::TrackSrim::GetWorkFunction ( ) const
inline

Get the W value [eV].

Definition at line 56 of file TrackSrim.hh.

56{ return m_work; }
double m_work
Work function [eV] of the target.
Definition TrackSrim.hh:119

◆ NewTrack()

bool Garfield::TrackSrim::NewTrack ( const double x0,
const double y0,
const double z0,
const double t0,
const double dx0,
const double dy0,
const double dz0 )
overridevirtual

Calculate a new track starting from (x0, y0, z0) at time t0 in direction (dx0, dy0, dz0).

Implements Garfield::Track.

◆ PlotEnergyLoss()

void Garfield::TrackSrim::PlotEnergyLoss ( )

Plot the electromagnetic, hadronic, and total energy loss as function of the projectile energy.

◆ PlotRange()

void Garfield::TrackSrim::PlotRange ( )

Plot the projected range as function of the projectile energy.

◆ PlotStraggling()

void Garfield::TrackSrim::PlotStraggling ( )

Plot the transverse and longitudinal straggling as function of the projectile energy.

◆ PreciseLoss()

bool Garfield::TrackSrim::PreciseLoss ( const double step,
const double estart,
double & deem,
double & dehd ) const
protected

◆ Print()

void Garfield::TrackSrim::Print ( )

Print the energy loss table.

◆ ReadFile()

bool Garfield::TrackSrim::ReadFile ( const std::string & file)

Load data from a SRIM file.

◆ RndmEnergyLoss()

double Garfield::TrackSrim::RndmEnergyLoss ( const double ekin,
const double de,
const double step,
const double edens ) const
protected

◆ SetAtomicMassNumbers()

void Garfield::TrackSrim::SetAtomicMassNumbers ( const double a,
const double z )
inline

Set A and Z of the target medium.

Definition at line 71 of file TrackSrim.hh.

71 {
72 m_a = a;
73 m_z = z;
74 }

◆ SetClustersMaximum()

void Garfield::TrackSrim::SetClustersMaximum ( const int n)
inline

Set the max. number of clusters on a track.

Definition at line 49 of file TrackSrim.hh.

49{ m_maxclusters = n; }

◆ SetDensity()

void Garfield::TrackSrim::SetDensity ( const double density)
inline

Set the density [g/cm3] of the target medium.

Definition at line 67 of file TrackSrim.hh.

67{ m_rho = density; }

◆ SetFanoFactor()

void Garfield::TrackSrim::SetFanoFactor ( const double f)
inline

Set the Fano factor.

Definition at line 58 of file TrackSrim.hh.

58 {
59 m_fano = f;
60 m_fset = true;
61 }
bool m_fset
Has the Fano factor been set?
Definition TrackSrim.hh:121

◆ SetModel()

void Garfield::TrackSrim::SetModel ( const int m)
inline

Set the fluctuation model (0 = none, 1 = Landau, 2 = Vavilov, 3 = Gaussian, 4 = Combined).

By default, the combined model (4) is used.

Definition at line 39 of file TrackSrim.hh.

39{ m_model = m; }

◆ SetTargetClusterSize()

void Garfield::TrackSrim::SetTargetClusterSize ( const int n)
inline

Specify how many electrons should be grouped to a cluster.

Definition at line 44 of file TrackSrim.hh.

44{ m_nsize = n; }

◆ SetWorkFunction()

void Garfield::TrackSrim::SetWorkFunction ( const double w)
inline

Set the W value [eV].

Definition at line 54 of file TrackSrim.hh.

54{ m_work = w; }

◆ SmallestStep()

bool Garfield::TrackSrim::SmallestStep ( const double ekin,
const double edens,
double de,
double step,
double & stpmin )
protected

◆ Terminate()

double Garfield::TrackSrim::Terminate ( const std::array< double, 3 > & x0,
const std::array< double, 3 > & v0,
const double step0 ) const
protected

◆ TerminateBfield()

double Garfield::TrackSrim::TerminateBfield ( const std::array< double, 3 > & x0,
const std::array< double, 3 > & v0,
const double dt0,
const double vmag ) const
protected

◆ UnsetFanoFactor()

void Garfield::TrackSrim::UnsetFanoFactor ( )
inline

Use the default Fano factor.

Definition at line 63 of file TrackSrim.hh.

63{ m_fset = false; }

◆ Xi()

double Garfield::TrackSrim::Xi ( const double x,
const double beta2,
const double edens ) const
protected

Member Data Documentation

◆ m_a

double Garfield::TrackSrim::m_a = -1.
protected

Effective A of the target.

Definition at line 125 of file TrackSrim.hh.

◆ m_chargeset

bool Garfield::TrackSrim::m_chargeset = false
protected

Has the charge been defined?

Definition at line 111 of file TrackSrim.hh.

◆ m_clusters

std::vector<Cluster> Garfield::TrackSrim::m_clusters
protected

Definition at line 151 of file TrackSrim.hh.

◆ m_currcluster

size_t Garfield::TrackSrim::m_currcluster = 0
protected

Index of the next cluster to be returned.

Definition at line 145 of file TrackSrim.hh.

◆ m_ekin

std::vector<double> Garfield::TrackSrim::m_ekin
protected

Energy in energy loss table [MeV].

Definition at line 132 of file TrackSrim.hh.

◆ m_emloss

std::vector<double> Garfield::TrackSrim::m_emloss
protected

EM energy loss [MeV cm2/g].

Definition at line 134 of file TrackSrim.hh.

◆ m_fano

double Garfield::TrackSrim::m_fano = -1.
protected

Fano factor [-] of the target.

Definition at line 123 of file TrackSrim.hh.

◆ m_fset

bool Garfield::TrackSrim::m_fset = false
protected

Has the Fano factor been set?

Definition at line 121 of file TrackSrim.hh.

◆ m_hdloss

std::vector<double> Garfield::TrackSrim::m_hdloss
protected

Hadronic energy loss [MeV cm2/g].

Definition at line 136 of file TrackSrim.hh.

◆ m_longstraggle

std::vector<double> Garfield::TrackSrim::m_longstraggle
protected

Longitudinal straggling [cm].

Definition at line 142 of file TrackSrim.hh.

◆ m_maxclusters

int Garfield::TrackSrim::m_maxclusters = -1
protected

Maximum number of clusters allowed (infinite if 0)

Definition at line 130 of file TrackSrim.hh.

◆ m_mion

double Garfield::TrackSrim::m_mion = -1.
protected

Mass [MeV] of the projectile.

Definition at line 115 of file TrackSrim.hh.

◆ m_model

unsigned int Garfield::TrackSrim::m_model = 4
protected

Fluctuation model (0 = none, 1 = Landau, 2 = Vavilov, 3 = Gaussian, 4 = Combined)

Definition at line 148 of file TrackSrim.hh.

◆ m_nsize

int Garfield::TrackSrim::m_nsize = -1
protected

Targeted cluster size.

Definition at line 150 of file TrackSrim.hh.

◆ m_qion

double Garfield::TrackSrim::m_qion = 1.
protected

Charge of the projectile.

Definition at line 113 of file TrackSrim.hh.

◆ m_range

std::vector<double> Garfield::TrackSrim::m_range
protected

Projected range [cm].

Definition at line 138 of file TrackSrim.hh.

◆ m_rho

double Garfield::TrackSrim::m_rho = -1.
protected

Mass density [g/cm3] of the target.

Definition at line 117 of file TrackSrim.hh.

◆ m_transstraggle

std::vector<double> Garfield::TrackSrim::m_transstraggle
protected

Transverse straggling [cm].

Definition at line 140 of file TrackSrim.hh.

◆ m_useLongStraggle

bool Garfield::TrackSrim::m_useLongStraggle = false
protected

Include longitudinal straggling.

Definition at line 108 of file TrackSrim.hh.

◆ m_useTransStraggle

bool Garfield::TrackSrim::m_useTransStraggle = true
protected

Include transverse straggling.

Definition at line 106 of file TrackSrim.hh.

◆ m_work

double Garfield::TrackSrim::m_work = -1.
protected

Work function [eV] of the target.

Definition at line 119 of file TrackSrim.hh.

◆ m_z

double Garfield::TrackSrim::m_z = -1.
protected

Effective Z of the target.

Definition at line 127 of file TrackSrim.hh.


The documentation for this class was generated from the following file:
  • /builds/garfield/docs/source/Include/Garfield/TrackSrim.hh