Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::AvalancheMC Class Reference

#include <AvalancheMC.hh>

Public Member Functions

 AvalancheMC ()
 
 ~AvalancheMC ()
 
void SetSensor (Sensor *s)
 
void EnablePlotting (ViewDrift *view)
 
void DisablePlotting ()
 
void EnableSignalCalculation ()
 
void DisableSignalCalculation ()
 
void EnableInducedChargeCalculation ()
 
void DisableInducedChargeCalculation ()
 
void EnableProjectedPathIntegration ()
 
void DisableProjectedPathIntegration ()
 
void EnableDiffusion ()
 
void DisableDiffusion ()
 
void EnableAttachment ()
 
void DisableAttachment ()
 
void EnableMagneticField ()
 
void DisableMagneticField ()
 
void SetTimeSteps (const double d=0.02)
 
void SetDistanceSteps (const double d=0.001)
 
void SetCollisionSteps (const int n=100)
 
void SetTimeWindow (const double t0, const double t1)
 
void UnsetTimeWindow ()
 
void SetHoles ()
 
void SetIons ()
 
void SetElectronSignalScalingFactor (const double scale)
 
void SetHoleSignalScalingFactor (const double scale)
 
void SetIonSignalScalingFactor (const double scale)
 
void GetAvalancheSize (int &ne, int &ni) const
 
unsigned int GetNumberOfDriftLinePoints () const
 
void GetDriftLinePoint (const unsigned int i, double &x, double &y, double &z, double &t)
 
unsigned int GetNumberOfElectronEndpoints () const
 
unsigned int GetNumberOfHoleEndpoints () const
 
unsigned int GetNumberOfIonEndpoints () const
 
void GetElectronEndpoint (const unsigned int i, double &x0, double &y0, double &z0, double &t0, double &x1, double &y1, double &z1, double &t1, int &status) const
 
void GetHoleEndpoint (const unsigned int i, double &x0, double &y0, double &z0, double &t0, double &x1, double &y1, double &z1, double &t1, int &status) const
 
void GetIonEndpoint (const unsigned int i, double &x0, double &y0, double &z0, double &t0, double &x1, double &y1, double &z1, double &t1, int &status) const
 
bool DriftElectron (const double x0, const double y0, const double z0, const double t0)
 
bool DriftHole (const double x0, const double y0, const double z0, const double t0)
 
bool DriftIon (const double x0, const double y0, const double z0, const double t0)
 
bool AvalancheElectron (const double x0, const double y0, const double z0, const double t0, const bool hole=false)
 
bool AvalancheHole (const double x0, const double y0, const double z0, const double t0, const bool electron=false)
 
bool AvalancheElectronHole (const double x0, const double y0, const double z0, const double t0)
 
void EnableDebugging ()
 
void DisableDebugging ()
 

Detailed Description

Definition at line 12 of file AvalancheMC.hh.

Constructor & Destructor Documentation

◆ AvalancheMC()

Garfield::AvalancheMC::AvalancheMC ( )

Definition at line 15 of file AvalancheMC.cc.

16 : m_sensor(NULL),
17 m_nDrift(0),
18 m_stepModel(2),
19 m_tMc(0.02),
20 m_dMc(0.001),
21 m_nMc(100),
22 m_hasTimeWindow(false),
23 m_tMin(0.),
24 m_tMax(0.),
25 m_nElectrons(0),
26 m_nHoles(0),
27 m_nIons(0),
28 m_nEndpointsElectrons(0),
29 m_nEndpointsHoles(0),
30 m_nEndpointsIons(0),
31 m_usePlotting(false),
32 m_viewer(NULL),
33 m_useSignal(false),
34 m_useInducedCharge(false),
35 m_useEquilibration(true),
36 m_useDiffusion(true),
37 m_useAttachment(false),
38 m_useBfield(false),
39 m_useIons(true),
40 m_withElectrons(true),
41 m_withHoles(true),
42 m_scaleElectronSignal(1.),
43 m_scaleHoleSignal(1.),
44 m_scaleIonSignal(1.),
45 m_debug(false) {
46
47 m_className = "AvalancheMC";
48
49 m_drift.reserve(10000);
50}

◆ ~AvalancheMC()

Garfield::AvalancheMC::~AvalancheMC ( )
inline

Definition at line 18 of file AvalancheMC.hh.

18{}

Member Function Documentation

◆ AvalancheElectron()

bool Garfield::AvalancheMC::AvalancheElectron ( const double  x0,
const double  y0,
const double  z0,
const double  t0,
const bool  hole = false 
)

Definition at line 848 of file AvalancheMC.cc.

850 {
851
852 // Initialise the avalanche table
853 m_aval.clear();
854 avalPoint point;
855 point.x = x0;
856 point.y = y0;
857 point.z = z0;
858 point.t = t0;
859 point.ne = 1;
860 point.nh = 0;
861 point.ni = 0;
862 m_aval.push_back(point);
863
864 m_endpointsElectrons.clear();
865 m_endpointsHoles.clear();
866 m_endpointsIons.clear();
867 m_nEndpointsElectrons = 0;
868 m_nEndpointsHoles = 0;
869 m_nEndpointsIons = 0;
870
871 m_nElectrons = 1;
872 m_nHoles = 0;
873 m_nIons = 0;
874
875 m_withHoles = holes;
876 return Avalanche();
877}
Definition: vec.h:477

◆ AvalancheElectronHole()

bool Garfield::AvalancheMC::AvalancheElectronHole ( const double  x0,
const double  y0,
const double  z0,
const double  t0 
)

Definition at line 910 of file AvalancheMC.cc.

911 {
912
913 // Initialise the avalanche table
914 m_aval.clear();
915 avalPoint point;
916 point.x = x0;
917 point.y = y0;
918 point.z = z0;
919 point.t = t0;
920 point.ne = 1;
921 point.nh = 1;
922 point.ni = 0;
923 m_aval.push_back(point);
924
925 m_endpointsElectrons.clear();
926 m_endpointsHoles.clear();
927 m_endpointsIons.clear();
928 m_nEndpointsElectrons = 0;
929 m_nEndpointsHoles = 0;
930 m_nEndpointsIons = 0;
931
932 m_nElectrons = 1;
933 m_nHoles = 1;
934 m_nIons = 0;
935
936 m_withElectrons = m_withHoles = true;
937 return Avalanche();
938}

◆ AvalancheHole()

bool Garfield::AvalancheMC::AvalancheHole ( const double  x0,
const double  y0,
const double  z0,
const double  t0,
const bool  electron = false 
)

Definition at line 879 of file AvalancheMC.cc.

881 {
882
883 // Initialise the avalanche table
884 m_aval.clear();
885 avalPoint point;
886 point.x = x0;
887 point.y = y0;
888 point.z = z0;
889 point.t = t0;
890 point.ne = 0;
891 point.nh = 1;
892 point.ni = 0;
893 m_aval.push_back(point);
894
895 m_endpointsElectrons.clear();
896 m_endpointsHoles.clear();
897 m_endpointsIons.clear();
898 m_nEndpointsElectrons = 0;
899 m_nEndpointsHoles = 0;
900 m_nEndpointsIons = 0;
901
902 m_nElectrons = 0;
903 m_nHoles = 1;
904 m_nIons = 0;
905
906 m_withElectrons = electrons;
907 return Avalanche();
908}

◆ DisableAttachment()

void Garfield::AvalancheMC::DisableAttachment ( )
inline

Definition at line 47 of file AvalancheMC.hh.

47{ m_useAttachment = false; }

◆ DisableDebugging()

void Garfield::AvalancheMC::DisableDebugging ( )
inline

Definition at line 126 of file AvalancheMC.hh.

126{ m_debug = false; }

◆ DisableDiffusion()

void Garfield::AvalancheMC::DisableDiffusion ( )
inline

Definition at line 41 of file AvalancheMC.hh.

41{ m_useDiffusion = false; }

◆ DisableInducedChargeCalculation()

void Garfield::AvalancheMC::DisableInducedChargeCalculation ( )
inline

Definition at line 32 of file AvalancheMC.hh.

32{ m_useInducedCharge = false; }

◆ DisableMagneticField()

void Garfield::AvalancheMC::DisableMagneticField ( )
inline

Definition at line 51 of file AvalancheMC.hh.

51{ m_useBfield = false; }

◆ DisablePlotting()

void Garfield::AvalancheMC::DisablePlotting ( )

Definition at line 75 of file AvalancheMC.cc.

75 {
76
77 m_viewer = NULL;
78 m_usePlotting = false;
79}

◆ DisableProjectedPathIntegration()

void Garfield::AvalancheMC::DisableProjectedPathIntegration ( )
inline

Definition at line 37 of file AvalancheMC.hh.

37{ m_useEquilibration = false; }

◆ DisableSignalCalculation()

void Garfield::AvalancheMC::DisableSignalCalculation ( )
inline

Definition at line 28 of file AvalancheMC.hh.

28{ m_useSignal = false; }

◆ DriftElectron()

bool Garfield::AvalancheMC::DriftElectron ( const double  x0,
const double  y0,
const double  z0,
const double  t0 
)

Definition at line 229 of file AvalancheMC.cc.

230 {
231
232 if (!m_sensor) {
233 std::cerr << m_className << "::DriftElectron:\n";
234 std::cerr << " Sensor is not defined.\n";
235 return false;
236 }
237
238 m_endpointsElectrons.clear();
239 m_endpointsHoles.clear();
240 m_endpointsIons.clear();
241 m_nEndpointsElectrons = 0;
242 m_nEndpointsHoles = 0;
243 m_nEndpointsIons = 0;
244
245 m_nElectrons = 1;
246 m_nHoles = 0;
247 m_nIons = 0;
248
249 if (!DriftLine(x0, y0, z0, t0, -1)) return false;
250
251 return true;
252}

Referenced by GarfieldPhysics::DoIt().

◆ DriftHole()

bool Garfield::AvalancheMC::DriftHole ( const double  x0,
const double  y0,
const double  z0,
const double  t0 
)

Definition at line 254 of file AvalancheMC.cc.

255 {
256
257 if (!m_sensor) {
258 std::cerr << m_className << "::DriftHole:\n";
259 std::cerr << " Sensor is not defined.\n";
260 return false;
261 }
262
263 m_endpointsElectrons.clear();
264 m_endpointsHoles.clear();
265 m_endpointsIons.clear();
266 m_nEndpointsElectrons = 0;
267 m_nEndpointsHoles = 0;
268 m_nEndpointsIons = 0;
269
270 m_nElectrons = 0;
271 m_nHoles = 1;
272 m_nIons = 0;
273
274 if (!DriftLine(x0, y0, z0, t0, 1)) return false;
275
276 return true;
277}

◆ DriftIon()

bool Garfield::AvalancheMC::DriftIon ( const double  x0,
const double  y0,
const double  z0,
const double  t0 
)

Definition at line 279 of file AvalancheMC.cc.

280 {
281
282 if (!m_sensor) {
283 std::cerr << m_className << "::DriftIon:\n";
284 std::cerr << " Sensor is not defined.\n";
285 return false;
286 }
287
288 m_endpointsElectrons.clear();
289 m_endpointsHoles.clear();
290 m_endpointsIons.clear();
291 m_nEndpointsElectrons = 0;
292 m_nEndpointsHoles = 0;
293 m_nEndpointsIons = 0;
294
295 m_nElectrons = 0;
296 m_nHoles = 0;
297 m_nIons = 1;
298
299 if (!DriftLine(x0, y0, z0, t0, 2)) return false;
300
301 return true;
302}

◆ EnableAttachment()

void Garfield::AvalancheMC::EnableAttachment ( )
inline

Definition at line 46 of file AvalancheMC.hh.

46{ m_useAttachment = true; }

◆ EnableDebugging()

void Garfield::AvalancheMC::EnableDebugging ( )
inline

Definition at line 125 of file AvalancheMC.hh.

125{ m_debug = true; }

◆ EnableDiffusion()

void Garfield::AvalancheMC::EnableDiffusion ( )
inline

Definition at line 40 of file AvalancheMC.hh.

40{ m_useDiffusion = true; }

◆ EnableInducedChargeCalculation()

void Garfield::AvalancheMC::EnableInducedChargeCalculation ( )
inline

Definition at line 31 of file AvalancheMC.hh.

31{ m_useInducedCharge = true; }

◆ EnableMagneticField()

void Garfield::AvalancheMC::EnableMagneticField ( )
inline

Definition at line 50 of file AvalancheMC.hh.

50{ m_useBfield = true; }

◆ EnablePlotting()

void Garfield::AvalancheMC::EnablePlotting ( ViewDrift view)

Definition at line 63 of file AvalancheMC.cc.

63 {
64
65 if (!view) {
66 std::cerr << m_className << "::EnablePlotting:\n";
67 std::cerr << " Viewer pointer is null.\n";
68 return;
69 }
70
71 m_usePlotting = true;
72 m_viewer = view;
73}

◆ EnableProjectedPathIntegration()

void Garfield::AvalancheMC::EnableProjectedPathIntegration ( )
inline

Definition at line 36 of file AvalancheMC.hh.

36{ m_useEquilibration = true; }

◆ EnableSignalCalculation()

void Garfield::AvalancheMC::EnableSignalCalculation ( )
inline

Definition at line 27 of file AvalancheMC.hh.

27{ m_useSignal = true; }

◆ GetAvalancheSize()

void Garfield::AvalancheMC::GetAvalancheSize ( int &  ne,
int &  ni 
) const
inline

Definition at line 79 of file AvalancheMC.hh.

79 {
80 ne = m_nElectrons;
81 ni = m_nIons;
82 }

◆ GetDriftLinePoint()

void Garfield::AvalancheMC::GetDriftLinePoint ( const unsigned int  i,
double &  x,
double &  y,
double &  z,
double &  t 
)

Definition at line 148 of file AvalancheMC.cc.

149 {
150
151 if (i >= m_nDrift) {
152 std::cerr << m_className << "::GetDriftLinePoint:\n";
153 std::cerr << " Index is outside the range.\n";
154 return;
155 }
156
157 x = m_drift[i].x;
158 y = m_drift[i].y;
159 z = m_drift[i].z;
160 t = m_drift[i].t;
161}

◆ GetElectronEndpoint()

void Garfield::AvalancheMC::GetElectronEndpoint ( const unsigned int  i,
double &  x0,
double &  y0,
double &  z0,
double &  t0,
double &  x1,
double &  y1,
double &  z1,
double &  t1,
int &  status 
) const

Definition at line 206 of file AvalancheMC.cc.

210 {
211
212 if (i >= m_nEndpointsElectrons) {
213 std::cerr << m_className << "::GetElectronEndpoint:\n";
214 std::cerr << " Endpoint " << i << " does not exist.\n";
215 return;
216 }
217
218 x0 = m_endpointsElectrons[i].x0;
219 x1 = m_endpointsElectrons[i].x1;
220 y0 = m_endpointsElectrons[i].y0;
221 y1 = m_endpointsElectrons[i].y1;
222 z0 = m_endpointsElectrons[i].z0;
223 z1 = m_endpointsElectrons[i].z1;
224 t0 = m_endpointsElectrons[i].t0;
225 t1 = m_endpointsElectrons[i].t1;
226 status = m_endpointsElectrons[i].status;
227}

Referenced by GarfieldPhysics::DoIt().

◆ GetHoleEndpoint()

void Garfield::AvalancheMC::GetHoleEndpoint ( const unsigned int  i,
double &  x0,
double &  y0,
double &  z0,
double &  t0,
double &  x1,
double &  y1,
double &  z1,
double &  t1,
int &  status 
) const

Definition at line 163 of file AvalancheMC.cc.

166 {
167
168 if (i >= m_nEndpointsHoles) {
169 std::cerr << m_className << "::GetHoleEndpoint:\n";
170 std::cerr << " Endpoint " << i << " does not exist.\n";
171 return;
172 }
173
174 x0 = m_endpointsHoles[i].x0;
175 x1 = m_endpointsHoles[i].x1;
176 y0 = m_endpointsHoles[i].y0;
177 y1 = m_endpointsHoles[i].y1;
178 z0 = m_endpointsHoles[i].z0;
179 z1 = m_endpointsHoles[i].z1;
180 t0 = m_endpointsHoles[i].t0;
181 t1 = m_endpointsHoles[i].t1;
182 status = m_endpointsHoles[i].status;
183}

◆ GetIonEndpoint()

void Garfield::AvalancheMC::GetIonEndpoint ( const unsigned int  i,
double &  x0,
double &  y0,
double &  z0,
double &  t0,
double &  x1,
double &  y1,
double &  z1,
double &  t1,
int &  status 
) const

Definition at line 185 of file AvalancheMC.cc.

187 {
188
189 if (i >= m_nEndpointsIons) {
190 std::cerr << m_className << "::GetIonEndpoint:\n";
191 std::cerr << " Endpoint " << i << " does not exist.\n";
192 return;
193 }
194
195 x0 = m_endpointsIons[i].x0;
196 x1 = m_endpointsIons[i].x1;
197 y0 = m_endpointsIons[i].y0;
198 y1 = m_endpointsIons[i].y1;
199 z0 = m_endpointsIons[i].z0;
200 z1 = m_endpointsIons[i].z1;
201 t0 = m_endpointsIons[i].t0;
202 t1 = m_endpointsIons[i].t1;
203 status = m_endpointsIons[i].status;
204}

◆ GetNumberOfDriftLinePoints()

unsigned int Garfield::AvalancheMC::GetNumberOfDriftLinePoints ( ) const
inline

Definition at line 84 of file AvalancheMC.hh.

84{ return m_nDrift; }

◆ GetNumberOfElectronEndpoints()

unsigned int Garfield::AvalancheMC::GetNumberOfElectronEndpoints ( ) const
inline

Definition at line 88 of file AvalancheMC.hh.

88 {
89 return m_nEndpointsElectrons;
90 }

◆ GetNumberOfHoleEndpoints()

unsigned int Garfield::AvalancheMC::GetNumberOfHoleEndpoints ( ) const
inline

Definition at line 91 of file AvalancheMC.hh.

91 {
92 return m_nEndpointsHoles;
93 }

◆ GetNumberOfIonEndpoints()

unsigned int Garfield::AvalancheMC::GetNumberOfIonEndpoints ( ) const
inline

Definition at line 94 of file AvalancheMC.hh.

94 {
95 return m_nEndpointsIons;
96 }

◆ SetCollisionSteps()

void Garfield::AvalancheMC::SetCollisionSteps ( const int  n = 100)

Definition at line 115 of file AvalancheMC.cc.

115 {
116
117 m_stepModel = 2;
118 if (n < 1) {
119 std::cerr << m_className << "::SetCollisionSteps:\n";
120 std::cerr << " Number of collisions to be skipped set to "
121 << " default value (100).\n";
122 m_nMc = 100;
123 } else {
124 if (m_debug) {
125 std::cout << m_className << "::SetCollisionSteps:\n";
126 std::cout << " Number of collisions to be skipped set to " << n
127 << ".\n";
128 }
129 m_nMc = n;
130 }
131}

◆ SetDistanceSteps()

void Garfield::AvalancheMC::SetDistanceSteps ( const double  d = 0.001)

Definition at line 98 of file AvalancheMC.cc.

98 {
99
100 m_stepModel = 1;
101 if (d < Small) {
102 std::cerr << m_className << "::SetDistanceSteps:\n";
103 std::cerr << " Specified step size is too small.\n";
104 std::cerr << " Using default (10 um) instead.\n";
105 m_dMc = 0.001;
106 } else {
107 if (m_debug) {
108 std::cout << m_className << "::SetDistanceSteps:\n";
109 std::cout << " Step size set to " << d << " cm.\n";
110 }
111 m_dMc = d;
112 }
113}

◆ SetElectronSignalScalingFactor()

void Garfield::AvalancheMC::SetElectronSignalScalingFactor ( const double  scale)
inline

Definition at line 69 of file AvalancheMC.hh.

69 {
70 m_scaleElectronSignal = scale;
71 }

◆ SetHoles()

void Garfield::AvalancheMC::SetHoles ( )
inline

Definition at line 66 of file AvalancheMC.hh.

66{ m_useIons = false; }

◆ SetHoleSignalScalingFactor()

void Garfield::AvalancheMC::SetHoleSignalScalingFactor ( const double  scale)
inline

Definition at line 72 of file AvalancheMC.hh.

72 {
73 m_scaleHoleSignal = scale;
74 }

◆ SetIons()

void Garfield::AvalancheMC::SetIons ( )
inline

Definition at line 67 of file AvalancheMC.hh.

67{ m_useIons = true; }

◆ SetIonSignalScalingFactor()

void Garfield::AvalancheMC::SetIonSignalScalingFactor ( const double  scale)
inline

Definition at line 75 of file AvalancheMC.hh.

75 {
76 m_scaleIonSignal = scale;
77 }

◆ SetSensor()

void Garfield::AvalancheMC::SetSensor ( Sensor s)

Definition at line 52 of file AvalancheMC.cc.

52 {
53
54 if (!s) {
55 std::cerr << m_className << "::SetSensor:\n";
56 std::cerr << " Sensor pointer is null.\n";
57 return;
58 }
59
60 m_sensor = s;
61}

Referenced by GarfieldPhysics::InitializePhysics().

◆ SetTimeSteps()

void Garfield::AvalancheMC::SetTimeSteps ( const double  d = 0.02)

Definition at line 81 of file AvalancheMC.cc.

81 {
82
83 m_stepModel = 0;
84 if (d < Small) {
85 std::cerr << m_className << "::SetTimeSteps:\n";
86 std::cerr << " Specified step size is too small.\n";
87 std::cerr << " Using default (20 ps) instead.\n";
88 m_tMc = 0.02;
89 } else {
90 if (m_debug) {
91 std::cout << m_className << "::SetTimeSteps:\n";
92 std::cout << " Step size set to " << d << " ns.\n";
93 }
94 m_tMc = d;
95 }
96}

◆ SetTimeWindow()

void Garfield::AvalancheMC::SetTimeWindow ( const double  t0,
const double  t1 
)

Definition at line 133 of file AvalancheMC.cc.

133 {
134
135 if (fabs(t1 - t0) < Small) {
136 std::cerr << m_className << "::SetTimeWindow:\n";
137 std::cerr << " Time interval must be greater than zero.\n";
138 return;
139 }
140
141 m_tMin = std::min(t0, t1);
142 m_tMax = std::max(t0, t1);
143 m_hasTimeWindow = true;
144}
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:616

◆ UnsetTimeWindow()

void Garfield::AvalancheMC::UnsetTimeWindow ( )

Definition at line 146 of file AvalancheMC.cc.

146{ m_hasTimeWindow = false; }

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