Garfield++ v2r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
MediumGas.hh
Go to the documentation of this file.
1#ifndef G_MEDIUM_GAS_H
2#define G_MEDIUM_GAS_H
3
4#include <vector>
5#include <cmath>
6
7#include "Medium.hh"
8
9namespace Garfield {
10
11/// Base class for gas media.
12
13class MediumGas : public Medium {
14
15 public:
16 // Constructor
17 MediumGas();
18 // Destructor
19 virtual ~MediumGas() {}
20
21 bool IsGas() const { return true; }
22
23 // Set/get the gas mixture
24 bool SetComposition(const std::string& gas1, const double f1 = 1.,
25 const std::string& gas2 = "", const double f2 = 0.,
26 const std::string& gas3 = "", const double f3 = 0.,
27 const std::string& gas4 = "", const double f4 = 0.,
28 const std::string& gas5 = "", const double f5 = 0.,
29 const std::string& gas6 = "", const double f6 = 0.);
30
31 void GetComposition(std::string& gas1, double& f1, std::string& gas2,
32 double& f2, std::string& gas3, double& f3,
33 std::string& gas4, double& f4, std::string& gas5,
34 double& f5, std::string& gas6, double& f6);
35 void GetComponent(const unsigned int i, std::string& label, double& f);
36
37 void SetAtomicNumber(const double z);
38 double GetAtomicNumber() const;
39 void SetAtomicWeight(const double a);
40 double GetAtomicWeight() const;
41 void SetNumberDensity(const double n);
42 double GetNumberDensity() const;
43 void SetMassDensity(const double rho);
44 double GetMassDensity() const;
45
46 bool LoadGasFile(const std::string& filename);
47 bool WriteGasFile(const std::string& filename);
48
49 void PrintGas();
50
51 bool LoadIonMobility(const std::string& filename);
52
53 void SetExtrapolationMethodExcitationRates(const std::string& extrLow,
54 const std::string& extrHigh);
55 void SetExtrapolationMethodIonisationRates(const std::string& extrLow,
56 const std::string& extrHigh);
57 void SetInterpolationMethodExcitationRates(const int intrp);
58 void SetInterpolationMethodIonisationRates(const int intrp);
59
60 // Scaling laws.
61 double ScaleElectricField(const double e) const {
62 return e * m_pressureTable / m_pressure;
63 }
64 double UnScaleElectricField(const double e) const {
65 return e * m_pressure / m_pressureTable;
66 }
67 double ScaleDiffusion(const double d) const {
68 return d * sqrt(m_pressureTable / m_pressure);
69 }
70 double ScaleDiffusionTensor(const double d) const {
71 return d * m_pressureTable / m_pressure;
72 }
73 double ScaleTownsend(const double alpha) const {
74 return alpha * m_pressure / m_pressureTable;
75 }
76 double ScaleAttachment(const double eta) const {
77 return eta * m_pressure / m_pressureTable;
78 }
79 double ScaleLorentzAngle(const double lor) const {
80 return lor * m_pressure / m_pressureTable;
81 }
82
83 bool GetPhotoabsorptionCrossSection(const double& e, double& sigma,
84 const unsigned int& i);
85
86 protected:
87 static const unsigned int m_nMaxGases = 6;
88
89 // Gas mixture
90 std::string m_gas[m_nMaxGases];
94
95 // Penning transfer
96 // Flag enabling/disabling Penning transfer
98 // Penning transfer probability
101 // Mean distance of Penning ionisation
104
105 // Pressure at which the transport parameter table was calculated
107 // Temperature at which the transport parameter table was calculated
109
110 // Table of Townsend coefficients without Penning transfer
111 std::vector<std::vector<std::vector<double> > > m_tabTownsendNoPenning;
112
113 // Tables for excitation and ionisation rates
115 std::vector<std::vector<std::vector<std::vector<double> > > > m_tabExcRates;
116 std::vector<std::vector<std::vector<std::vector<double> > > > m_tabIonRates;
117
118 // Store excitation and ionization information
120 std::string label;
121 double energy;
122 double prob;
123 double rms;
124 double dt;
125 };
126 std::vector<excListElement> m_excitationList;
127
129 std::string label;
130 double energy;
131 };
132 std::vector<ionListElement> m_ionisationList;
133
134 // Extrapolation/interpolation for excitation and ionisation rates.
137 unsigned int m_intpExcRates;
138 unsigned int m_intpIonRates;
139
140 bool GetGasInfo(const std::string& gasname, double& a, double& z) const;
141 bool GetGasName(const int gasnumber, const int version, std::string& gasname);
142 bool GetGasName(std::string input, std::string& gasname) const;
143 bool GetGasNumberGasFile(const std::string& input, int& number) const;
144};
145}
146
147#endif
Base class for gas media.
Definition: MediumGas.hh:13
void GetComponent(const unsigned int i, std::string &label, double &f)
Definition: MediumGas.cc:177
double m_rPenningGlobal
Definition: MediumGas.hh:99
void GetComposition(std::string &gas1, double &f1, std::string &gas2, double &f2, std::string &gas3, double &f3, std::string &gas4, double &f4, std::string &gas5, double &f5, std::string &gas6, double &f6)
Definition: MediumGas.cc:158
std::vector< excListElement > m_excitationList
Definition: MediumGas.hh:126
void SetAtomicNumber(const double z)
Definition: MediumGas.cc:191
std::string m_gas[m_nMaxGases]
Definition: MediumGas.hh:90
bool GetGasInfo(const std::string &gasname, double &a, double &z) const
Definition: MediumGas.cc:1861
double ScaleDiffusionTensor(const double d) const
Definition: MediumGas.hh:70
double ScaleLorentzAngle(const double lor) const
Definition: MediumGas.hh:79
void SetExtrapolationMethodExcitationRates(const std::string &extrLow, const std::string &extrHigh)
Definition: MediumGas.cc:1811
double GetMassDensity() const
Definition: MediumGas.cc:236
double m_lambdaPenningGlobal
Definition: MediumGas.hh:102
bool GetGasNumberGasFile(const std::string &input, int &number) const
Definition: MediumGas.cc:2587
double ScaleAttachment(const double eta) const
Definition: MediumGas.hh:76
bool LoadIonMobility(const std::string &filename)
Definition: MediumGas.cc:1707
bool GetGasName(const int gasnumber, const int version, std::string &gasname)
Definition: MediumGas.cc:2031
double m_rPenningGas[m_nMaxGases]
Definition: MediumGas.hh:100
double ScaleTownsend(const double alpha) const
Definition: MediumGas.hh:73
double ScaleElectricField(const double e) const
Definition: MediumGas.hh:61
double m_atNum[m_nMaxGases]
Definition: MediumGas.hh:93
std::vector< std::vector< std::vector< double > > > m_tabTownsendNoPenning
Definition: MediumGas.hh:111
double m_temperatureTable
Definition: MediumGas.hh:108
double UnScaleElectricField(const double e) const
Definition: MediumGas.hh:64
unsigned int m_intpExcRates
Definition: MediumGas.hh:137
std::vector< std::vector< std::vector< std::vector< double > > > > m_tabIonRates
Definition: MediumGas.hh:116
unsigned int m_extrHighExcRates
Definition: MediumGas.hh:135
double m_atWeight[m_nMaxGases]
Definition: MediumGas.hh:92
static const unsigned int m_nMaxGases
Definition: MediumGas.hh:87
bool WriteGasFile(const std::string &filename)
Definition: MediumGas.cc:986
bool IsGas() const
Definition: MediumGas.hh:21
double GetAtomicNumber() const
Definition: MediumGas.cc:241
void SetNumberDensity(const double n)
Definition: MediumGas.cc:205
bool SetComposition(const std::string &gas1, const double f1=1., const std::string &gas2="", const double f2=0., const std::string &gas3="", const double f3=0., const std::string &gas4="", const double f4=0., const std::string &gas5="", const double f5=0., const std::string &gas6="", const double f6=0.)
Definition: MediumGas.cc:59
double ScaleDiffusion(const double d) const
Definition: MediumGas.hh:67
void SetAtomicWeight(const double a)
Definition: MediumGas.cc:198
void SetInterpolationMethodIonisationRates(const int intrp)
Definition: MediumGas.cc:1854
virtual ~MediumGas()
Definition: MediumGas.hh:19
bool GetPhotoabsorptionCrossSection(const double &e, double &sigma, const unsigned int &i)
Definition: MediumGas.cc:2876
double m_fraction[m_nMaxGases]
Definition: MediumGas.hh:91
double GetAtomicWeight() const
Definition: MediumGas.cc:219
bool LoadGasFile(const std::string &filename)
Definition: MediumGas.cc:251
unsigned int m_intpIonRates
Definition: MediumGas.hh:138
unsigned int m_extrHighIonRates
Definition: MediumGas.hh:136
void SetInterpolationMethodExcitationRates(const int intrp)
Definition: MediumGas.cc:1847
unsigned int m_extrLowIonRates
Definition: MediumGas.hh:136
double GetNumberDensity() const
Definition: MediumGas.cc:229
unsigned int m_extrLowExcRates
Definition: MediumGas.hh:135
std::vector< ionListElement > m_ionisationList
Definition: MediumGas.hh:132
std::vector< std::vector< std::vector< std::vector< double > > > > m_tabExcRates
Definition: MediumGas.hh:115
double m_lambdaPenningGas[m_nMaxGases]
Definition: MediumGas.hh:103
void SetExtrapolationMethodIonisationRates(const std::string &extrLow, const std::string &extrHigh)
Definition: MediumGas.cc:1829
void SetMassDensity(const double rho)
Definition: MediumGas.cc:212
Abstract base class for media.
Definition: Medium.hh:11
double m_pressure
Definition: Medium.hh:305