Garfield++ v1r0
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
11class MediumGas : public Medium {
12
13 public:
14 // Constructor
15 MediumGas();
16 // Destructor
18
19 bool IsGas() const { return true; }
20
21 // Set/get the gas mixture
22 bool SetComposition(const std::string gas1, const double f1 = 1.,
23 const std::string gas2 = "", const double f2 = 0.,
24 const std::string gas3 = "", const double f3 = 0.,
25 const std::string gas4 = "", const double f4 = 0.,
26 const std::string gas5 = "", const double f5 = 0.,
27 const std::string gas6 = "", const double f6 = 0.);
28
29 void GetComposition(std::string& gas1, double& f1, std::string& gas2,
30 double& f2, std::string& gas3, double& f3,
31 std::string& gas4, double& f4, std::string& gas5,
32 double& f5, std::string& gas6, double& f6);
33 void GetComponent(const unsigned int& i, std::string& label, double& f);
34
35 void SetAtomicNumber(const double& z);
36 double GetAtomicNumber() const;
37 void SetAtomicWeight(const double& a);
38 double GetAtomicWeight() const;
39 void SetNumberDensity(const double& n);
40 double GetNumberDensity() const;
41 void SetMassDensity(const double& rho);
42 double GetMassDensity() const;
43
44 bool LoadGasFile(const std::string& filename);
45 bool WriteGasFile(const std::string& filename);
46
47 void PrintGas();
48
49 bool LoadIonMobility(const std::string& filename);
50
51 void SetExtrapolationMethodExcitationRates(const std::string extrLow,
52 const std::string extrHigh);
53 void SetExtrapolationMethodIonisationRates(const std::string extrLow,
54 const std::string extrHigh);
55 void SetInterpolationMethodExcitationRates(const int intrp);
56 void SetInterpolationMethodIonisationRates(const int intrp);
57
58 // Scaling laws.
59 double ScaleElectricField(const double& e) const {
60 return e * pressureTable / m_pressure;
61 }
62 double UnScaleElectricField(const double& e) const {
63 return e * m_pressure / pressureTable;
64 }
65 double ScaleDiffusion(const double& d) const {
66 return d * sqrt(pressureTable / m_pressure);
67 }
68 double ScaleDiffusionTensor(const double& d) const {
69 return d * pressureTable / m_pressure;
70 }
71 double ScaleTownsend(const double& alpha) const {
72 return alpha * m_pressure / pressureTable;
73 }
74 double ScaleAttachment(const double& eta) const {
75 return eta * m_pressure / pressureTable;
76 }
77
78 bool GetPhotoabsorptionCrossSection(const double& e, double& sigma,
79 const unsigned int& i);
80
81 protected:
82 static const unsigned int m_nMaxGases = 6;
83
84 // Gas mixture
85 std::string gas[m_nMaxGases];
89
90 // Penning transfer
91 // Flag enabling/disabling Penning transfer
93 // Penning transfer probability
96 // Mean distance of Penning ionisation
99
100 // Pressure and temperature at which the transport parameter
101 // table was calculated
103
104 // Table of Townsend coefficients without Penning transfer
105 std::vector<std::vector<std::vector<double> > > tabTownsendNoPenning;
106
107 // Tables for excitation and ionisation rates
109 std::vector<std::vector<std::vector<std::vector<double> > > > tabExcRates;
110 std::vector<std::vector<std::vector<std::vector<double> > > > tabIonRates;
111
112 // Store excitation and ionization information
115 std::string label;
116 double energy;
117 double prob;
118 double rms;
119 double dt;
120 };
121 std::vector<excListElement> excitationList;
122
125 std::string label;
126 double energy;
127 };
128 std::vector<ionListElement> ionisationList;
129
130 // Extrapolation/interpolation for excitation and ionisation rates.
133 unsigned int m_intpExcRates;
134 unsigned int m_intpIonRates;
135
136 bool GetGasInfo(const std::string gasname, double& a, double& z) const;
137 bool GetGasName(const int gasnumber, const int version, std::string& gasname);
138 bool GetGasName(std::string input, std::string& gasname) const;
139 bool GetGasNumberGasFile(const std::string input, int& number) const;
140};
141}
142
143#endif
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
double ScaleDiffusionTensor(const double &d) const
Definition: MediumGas.hh:68
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:186
double ScaleDiffusion(const double &d) const
Definition: MediumGas.hh:65
double ScaleElectricField(const double &e) const
Definition: MediumGas.hh:59
std::vector< ionListElement > ionisationList
Definition: MediumGas.hh:128
void SetAtomicNumber(const double &z)
Definition: MediumGas.cc:220
std::vector< std::vector< std::vector< std::vector< double > > > > tabIonRates
Definition: MediumGas.hh:110
double GetMassDensity() const
Definition: MediumGas.cc:268
bool GetGasInfo(const std::string gasname, double &a, double &z) const
Definition: MediumGas.cc:1875
bool LoadIonMobility(const std::string &filename)
Definition: MediumGas.cc:1717
bool GetGasName(const int gasnumber, const int version, std::string &gasname)
Definition: MediumGas.cc:2045
void SetMassDensity(const double &rho)
Definition: MediumGas.cc:243
std::vector< std::vector< std::vector< double > > > tabTownsendNoPenning
Definition: MediumGas.hh:105
void SetNumberDensity(const double &n)
Definition: MediumGas.cc:236
void SetExtrapolationMethodExcitationRates(const std::string extrLow, const std::string extrHigh)
Definition: MediumGas.cc:1825
double lambdaPenningGas[m_nMaxGases]
Definition: MediumGas.hh:98
double lambdaPenningGlobal
Definition: MediumGas.hh:97
double fraction[m_nMaxGases]
Definition: MediumGas.hh:86
double ScaleAttachment(const double &eta) const
Definition: MediumGas.hh:74
std::vector< std::vector< std::vector< std::vector< double > > > > tabExcRates
Definition: MediumGas.hh:109
unsigned int m_intpExcRates
Definition: MediumGas.hh:133
unsigned int m_extrHighExcRates
Definition: MediumGas.hh:131
std::string gas[m_nMaxGases]
Definition: MediumGas.hh:85
static const unsigned int m_nMaxGases
Definition: MediumGas.hh:82
bool WriteGasFile(const std::string &filename)
Definition: MediumGas.cc:1021
void GetComponent(const unsigned int &i, std::string &label, double &f)
Definition: MediumGas.cc:205
bool GetGasNumberGasFile(const std::string input, int &number) const
Definition: MediumGas.cc:2601
bool IsGas() const
Definition: MediumGas.hh:19
void SetExtrapolationMethodIonisationRates(const std::string extrLow, const std::string extrHigh)
Definition: MediumGas.cc:1843
void SetAtomicWeight(const double &a)
Definition: MediumGas.cc:228
double GetAtomicNumber() const
Definition: MediumGas.cc:273
double ScaleTownsend(const double &alpha) const
Definition: MediumGas.hh:71
double rPenningGas[m_nMaxGases]
Definition: MediumGas.hh:95
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:64
double atNum[m_nMaxGases]
Definition: MediumGas.hh:88
double UnScaleElectricField(const double &e) const
Definition: MediumGas.hh:62
void SetInterpolationMethodIonisationRates(const int intrp)
Definition: MediumGas.cc:1868
bool GetPhotoabsorptionCrossSection(const double &e, double &sigma, const unsigned int &i)
Definition: MediumGas.cc:2890
std::vector< excListElement > excitationList
Definition: MediumGas.hh:121
double GetAtomicWeight() const
Definition: MediumGas.cc:251
bool LoadGasFile(const std::string &filename)
Definition: MediumGas.cc:283
unsigned int m_intpIonRates
Definition: MediumGas.hh:134
unsigned int m_extrHighIonRates
Definition: MediumGas.hh:132
void SetInterpolationMethodExcitationRates(const int intrp)
Definition: MediumGas.cc:1861
unsigned int m_extrLowIonRates
Definition: MediumGas.hh:132
double GetNumberDensity() const
Definition: MediumGas.cc:261
unsigned int m_extrLowExcRates
Definition: MediumGas.hh:131
double atWeight[m_nMaxGases]
Definition: MediumGas.hh:87
double m_pressure
Definition: Medium.hh:295