Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ViewMedium.cc
Go to the documentation of this file.
1#include <cmath>
2#include <iostream>
3#include <string>
4
5#include <TAxis.h>
6#include <TLatex.h>
7
9#include "Garfield/Medium.hh"
10#include "Garfield/Plotting.hh"
12
13namespace {
14
15int FindIndex(const std::vector<double>& fields, const double field,
16 const double eps) {
17
18 if (fields.empty()) return -1;
19 const int n = fields.size();
20 for (int i = 0; i < n; ++i) {
21 const double sum = fabs(fields[i]) + fabs(field);
22 const double tol = std::max(eps * sum, Garfield::Small);
23 if (fabs(fields[i] - field) < tol) return i;
24 }
25 return -1;
26}
27
28}
29
30namespace Garfield {
31
32ViewMedium::ViewMedium() : ViewBase("ViewMedium") {}
33
35 if (!m) {
36 std::cerr << m_className << "::SetMedium: Null pointer.\n";
37 return;
38 }
39
40 m_medium = m;
41}
42
43void ViewMedium::SetRangeE(const double emin, const double emax,
44 const bool logscale) {
45 if (emin >= emax || emin < 0.) {
46 std::cerr << m_className << "::SetRangeE: Incorrect range.\n";
47 return;
48 }
49
50 m_eMin = emin;
51 m_eMax = emax;
52 m_logE = logscale;
53}
54
55void ViewMedium::SetRangeB(const double bmin, const double bmax, const bool logscale) {
56 if (bmin >= bmax || bmin < 0.) {
57 std::cerr << m_className << "::SetRangeB: Incorrect range.\n";
58 return;
59 }
60
61 m_bMin = bmin;
62 m_bMax = bmax;
63 m_logB = logscale;
64}
65
66void ViewMedium::SetRangeA(const double amin, const double amax, const bool logscale) {
67 if (amin >= amax || amin < 0.) {
68 std::cerr << m_className << "::SetRangeA: Incorrect range.\n";
69 return;
70 }
71
72 m_aMin = amin;
73 m_aMax = amax;
74 m_logA = logscale;
75}
76
77void ViewMedium::SetRangeY(const double ymin, const double ymax,
78 const bool logscale) {
79 if (ymin >= ymax || ymin < 0.) {
80 std::cerr << m_className << "::SetRangeY: Incorrect range.\n";
81 return;
82 }
83
84 m_yMin = ymin;
85 m_yMax = ymax;
86 m_logY = logscale;
87}
88
89void ViewMedium::PlotElectronVelocity(const char xaxis, const bool same) {
90 SetupCanvas();
91 AddFunction(same, ElectronVelocityE, xaxis);
92 AddFunction(true, ElectronVelocityB, xaxis);
93 AddFunction(true, ElectronVelocityExB, xaxis);
94}
95
96void ViewMedium::PlotHoleVelocity(const char xaxis, const bool same) {
97 SetupCanvas();
98 AddFunction(same, HoleVelocityE, xaxis);
99 AddFunction(true, HoleVelocityB, xaxis);
100 AddFunction(true, HoleVelocityExB, xaxis);
101}
102
103void ViewMedium::PlotIonVelocity(const char xaxis, const bool same) {
104 SetupCanvas();
105 AddFunction(same, IonVelocity, xaxis);
106}
107
108void ViewMedium::PlotElectronDiffusion(const char xaxis, const bool same) {
109 SetupCanvas();
110 AddFunction(same, ElectronTransverseDiffusion, xaxis);
111 AddFunction(true, ElectronLongitudinalDiffusion, xaxis);
112}
113
114void ViewMedium::PlotHoleDiffusion(const char xaxis, const bool same) {
115 SetupCanvas();
116 AddFunction(same, HoleTransverseDiffusion, xaxis);
117 AddFunction(true, HoleLongitudinalDiffusion, xaxis);
118}
119
120void ViewMedium::PlotIonDiffusion(const char xaxis, const bool same) {
121 SetupCanvas();
122 AddFunction(same, IonTransverseDiffusion, xaxis);
123 AddFunction(true, IonLongitudinalDiffusion, xaxis);
124}
125
126void ViewMedium::PlotElectronTownsend(const char xaxis, const bool same) {
127 SetupCanvas();
128 AddFunction(same, ElectronTownsend, xaxis);
129}
130
131void ViewMedium::PlotHoleTownsend(const char xaxis, const bool same) {
132 SetupCanvas();
133 AddFunction(same, HoleTownsend, xaxis);
134}
135
136void ViewMedium::PlotElectronAttachment(const char xaxis, const bool same) {
137 SetupCanvas();
138 AddFunction(same, ElectronAttachment, xaxis);
139}
140
141void ViewMedium::PlotHoleAttachment(const char xaxis, const bool same) {
142 SetupCanvas();
143 AddFunction(same, HoleAttachment, xaxis);
144}
145
146void ViewMedium::PlotElectronLorentzAngle(const char xaxis, const bool same) {
147 SetupCanvas();
148 AddFunction(same, ElectronLorentzAngle, xaxis);
149}
150
152 std::cerr << m_className << "::PlotElectronCrossSections: Not implemented.\n";
153}
154
155void ViewMedium::SetupCanvas() {
156 if (!m_canvas) {
157 m_canvas = new TCanvas();
158 m_canvas->SetTitle("Medium View");
160 }
161 m_canvas->cd();
162 gPad->SetLeftMargin(0.15);
163}
164
165void ViewMedium::AddFunction(const bool keep, const Property type,
166 const char xaxis) {
167 // Make sure the medium is set.
168 if (!m_medium) {
169 std::cerr << m_className << "::AddFunction: Medium is not defined.\n";
170 return;
171 }
172
173 // Look for an unused function name.
174 std::string fname = FindUnusedFunctionName("fMediumView");
175 if (m_debug) {
176 std::cout << m_className << "::AddFunction: Adding " << fname << "\n";
177 }
178 if (!keep) {
179 m_functions.clear();
180 for (auto graph : m_graphs) delete graph;
181 m_graphs.clear();
182 m_labels.clear();
183 }
184
185 // Get the field grid.
186 std::vector<double> efields;
187 std::vector<double> bfields;
188 std::vector<double> bangles;
189 m_medium->GetFieldGrid(efields, bfields, bangles);
190 double xmin = 0., xmax = 0.;
191 bool logx = false;
192 GetAxisRangeX(efields, bfields, bangles, xaxis, xmin, xmax, logx);
193
194 // Create a TF1 and add it to the list of functions.
195 TF1 fcn(fname.c_str(), this, &ViewMedium::EvaluateFunction,
196 xmin, xmax, 5, "ViewMedium", "EvaluateFunction");
197 fcn.SetNpx(1000);
198 const std::string xlabel = GetLabelX(xaxis);
199 const std::string ylabel = GetLabelY(type);
200 const std::string title = ";" + xlabel + ";" + ylabel;
201 fcn.SetRange(xmin, xmax);
202 if (!m_autoRangeY && (fabs(m_yMax - m_yMin) > 0.)) {
203 fcn.SetMinimum(m_yMin);
204 fcn.SetMaximum(m_yMax);
205 }
206 fcn.GetXaxis()->SetTitle(xlabel.c_str());
207 fcn.GetYaxis()->SetTitle(ylabel.c_str());
208 fcn.SetTitle(title.c_str());
209 fcn.SetParameter(0, type);
210 fcn.SetParameter(1, xaxis);
211 fcn.SetParameter(2, m_efield);
212 fcn.SetParameter(3, m_bfield);
213 fcn.SetParameter(4, m_angle);
214 const auto color = GetColor(type);
215 fcn.SetLineColor(color);
216 m_functions.push_back(std::move(fcn));
217 m_labels.emplace_back(std::make_pair(GetLegend(type), color));
218 const unsigned int nE = efields.size();
219 const unsigned int nB = bfields.size();
220 const unsigned int nA = bangles.size();
221
222 if (!efields.empty() && !bfields.empty() && !bangles.empty()) {
223 // Add a graph with the values at the grid points.
224 int nPoints = xaxis == 'e' ? nE : xaxis == 'b' ? nB : nA;
225 TGraph* graph = new TGraph(nPoints);
226 graph->SetMarkerStyle(20);
227 graph->SetMarkerColor(color);
228 bool ok = true;
229
230 constexpr double eps = 1.e-3;
231 int ie = FindIndex(efields, m_efield, eps);
232 int ib = FindIndex(bfields, m_bfield, eps);
233 int ia = FindIndex(bangles, m_angle, eps);
234 if ((xaxis == 'e' && (ib < 0 || ia < 0)) ||
235 (xaxis == 'b' && (ie < 0 || ia < 0)) ||
236 (xaxis == 'a' && (ie < 0 || ib < 0))) {
237 ok = false;
238 }
239 bool nonzero = false;
240 for (int j = 0; j < nPoints; ++j) {
241 double value = 0.;
242 if (!ok) break;
243 if (xaxis == 'e') {
244 ie = j;
245 } else if (xaxis == 'b') {
246 ib = j;
247 } else if (xaxis == 'a') {
248 ia = j;
249 } else {
250 std::cerr << m_className << "::AddFunction: Unexpected axis.\n";
251 break;
252 }
253 switch (type) {
255 ok = m_medium->GetElectronVelocityE(ie, ib, ia, value);
256 value = m_medium->ScaleVelocity(value);
257 break;
259 ok = m_medium->GetElectronTransverseDiffusion(ie, ib, ia, value);
260 value = m_medium->ScaleDiffusion(value);
261 break;
263 ok = m_medium->GetElectronLongitudinalDiffusion(ie, ib, ia, value);
264 value = m_medium->ScaleDiffusion(value);
265 break;
266 case ElectronTownsend:
267 ok = m_medium->GetElectronTownsend(ie, ib, ia, value);
268 value = m_medium->ScaleTownsend(exp(value));
269 break;
271 ok = m_medium->GetElectronAttachment(ie, ib, ia, value);
272 value = m_medium->ScaleAttachment(exp(value));
273 break;
275 ok = m_medium->GetElectronLorentzAngle(ie, ib, ia, value);
276 value = m_medium->ScaleLorentzAngle(value);
277 break;
278 case HoleVelocityE:
279 ok = m_medium->GetHoleVelocityE(ie, ib, ia, value);
280 value = m_medium->ScaleVelocity(value);
281 break;
283 ok = m_medium->GetHoleTransverseDiffusion(ie, ib, ia, value);
284 value = m_medium->ScaleDiffusion(value);
285 break;
287 ok = m_medium->GetHoleLongitudinalDiffusion(ie, ib, ia, value);
288 value = m_medium->ScaleDiffusion(value);
289 break;
290 case HoleTownsend:
291 ok = m_medium->GetHoleTownsend(ie, ib, ia, value);
292 value = m_medium->ScaleTownsend(exp(value));
293 break;
294 case HoleAttachment:
295 ok = m_medium->GetHoleAttachment(ie, ib, ia, value);
296 value = m_medium->ScaleAttachment(exp(value));
297 break;
298 case IonVelocity:
299 ok = m_medium->GetIonMobility(ie, ib, ia, value);
300 value *= m_medium->UnScaleElectricField(efields[ie]);
301 break;
303 ok = m_medium->GetIonTransverseDiffusion(ie, ib, ia, value);
304 value = m_medium->ScaleDiffusion(value);
305 break;
307 ok = m_medium->GetIonLongitudinalDiffusion(ie, ib, ia, value);
308 value = m_medium->ScaleDiffusion(value);
309 break;
311 ok = m_medium->GetElectronVelocityB(ie, ib, ia, value);
312 value = fabs(m_medium->ScaleVelocity(value));
313 break;
315 ok = m_medium->GetElectronVelocityExB(ie, ib, ia, value);
316 value = fabs(m_medium->ScaleVelocity(value));
317 break;
318 case HoleVelocityB:
319 ok = m_medium->GetHoleVelocityB(ie, ib, ia, value);
320 value = fabs(m_medium->ScaleVelocity(value));
321 break;
322 case HoleVelocityExB:
323 ok = m_medium->GetHoleVelocityExB(ie, ib, ia, value);
324 value = fabs(m_medium->ScaleVelocity(value));
325 break;
326 }
327 if (xaxis == 'e')
328 graph->SetPoint(j, m_medium->UnScaleElectricField(efields[j]), value);
329 else if (xaxis == 'b')
330 graph->SetPoint(j, bfields[j], value);
331 else if (xaxis == 'a')
332 graph->SetPoint(j, bangles[j], value);
333 if (fabs(value) > 1.e-10) nonzero = true;
334 }
335 if (ok && nonzero) {
336 m_graphs.push_back(graph);
337 } else {
338 if (m_debug) {
339 std::cerr << m_className << "::AddFunction:\n Could not retrieve "
340 << "table for " << GetLegend(type) << ".\n";
341 }
342 delete graph;
343 }
344 }
345 if (m_functions.empty()) return;
346 TLatex label;
347 const unsigned int nFunctions = m_functions.size();
348 if (keep && nFunctions > 1) {
349 // Determine the y range.
350 double ymin = m_functions[0].GetMinimum();
351 double ymax = m_functions[0].GetMaximum();
352 for (unsigned int i = 1; i < nFunctions; ++i) {
353 const double fmin = m_functions[i].GetMinimum();
354 const double fmax = m_functions[i].GetMaximum();
355 constexpr double tol = 1.e-10;
356 if (fabs(fmin) < tol && fabs(fmax) < tol) continue;
357 ymin = std::min(ymin, fmin);
358 ymax = std::max(ymax, fmax);
359 }
360 if (m_autoRangeY) {
361 const double dy = ymax - ymin;
362 for (unsigned int i = 0; i < nFunctions; ++i) {
363 m_functions[i].SetMinimum(std::max(0., ymin - 0.1 * dy));
364 m_functions[i].SetMaximum(ymax + 0.1 * dy);
365 }
366 }
367 m_functions[0].Draw();
368 m_canvas->Clear();
369 m_functions[0].DrawCopy()->GetYaxis()->SetTitleOffset(0);
370 double xLabel = 1.3 * xmin;
371 double yLabel = 0.9 * ymax;
372 label.SetText(xLabel, yLabel, m_labels[0].first.c_str());
373 xLabel += label.GetXsize();
374 label.SetTextColor(m_labels[0].second);
375 label.DrawLatex(xLabel, yLabel, m_labels[0].first.c_str());
376 for (unsigned int i = 1; i < nFunctions; ++i) {
377 // See if the function has non-zero values.
378 const double fmin = m_functions[i].GetMinimum();
379 const double fmax = m_functions[i].GetMaximum();
380 constexpr double tol = 1.e-10;
381 if (fabs(fmin) < tol && fabs(fmax) < tol) continue;
382 m_functions[i].DrawCopy("lsame");
383 yLabel -= 1.5 * label.GetYsize();
384 label.SetTextColor(m_labels[i].second);
385 label.DrawLatex(xLabel, yLabel, m_labels[i].first.c_str());
386 }
387 } else {
388 m_functions.back().DrawCopy()->GetYaxis()->SetTitleOffset(0);
389 }
390 for (auto& graph : m_graphs) {
391 graph->DrawGraph(graph->GetN(), graph->GetX(), graph->GetY(), "p");
392 }
393 if (logx) {
394 m_canvas->SetLogx(1);
395 } else {
396 m_canvas->SetLogx(0);
397 }
398 if (m_logY && !m_autoRangeY) {
399 m_canvas->SetLogy(1);
400 } else {
401 m_canvas->SetLogy(0);
402 }
403 m_canvas->Update();
404}
405
406double ViewMedium::EvaluateFunction(double* pos, double* par) {
407 // to be modified to include B and angle
408
409 if (!m_medium) return 0.;
410 int type = int(par[0]);
411 char xaxis = char(par[1]);
412 const double x = pos[0];
413
414 const double ctheta = xaxis == 'a' ? cos(x) : cos(par[4]);
415 const double stheta = xaxis == 'a' ? sin(x) : sin(par[4]);
416 double ex = xaxis == 'e' ? x : par[2];
417 double ey = 0.;
418 double bx = xaxis == 'b' ? x : par[3];
419 double by = 0.;
420 if (type == ElectronVelocityExB || type == HoleVelocityExB ||
421 type == ElectronVelocityB || type == HoleVelocityB) {
422 ex *= ctheta;
423 ey = xaxis == 'e' ? x * stheta : par[2] * stheta;
424 } else {
425 bx *= ctheta;
426 by = xaxis == 'b' ? x * stheta : par[3] * stheta;
427 }
428 // Return value.
429 double y = 0.;
430 // Auxiliary (dummy) variables.
431 double s = 0., t = 0.;
432 switch (type) {
434 if (!m_medium->ElectronVelocity(ex, 0, 0, bx, by, 0, y, s, t)) return 0.;
435 y = fabs(y);
436 break;
438 if (!m_medium->ElectronDiffusion(ex, 0, 0, bx, by, 0, s, y)) return 0.;
439 break;
441 if (!m_medium->ElectronDiffusion(ex, 0, 0, bx, by, 0, y, s)) return 0.;
442 break;
443 case ElectronTownsend:
444 if (!m_medium->ElectronTownsend(ex, 0, 0, bx, by, 0, y)) return 0.;
445 break;
447 if (!m_medium->ElectronAttachment(ex, 0, 0, bx, by, 0, y)) return 0.;
448 break;
450 if (!m_medium->ElectronLorentzAngle(ex, 0, 0, bx, by, 0, y)) return 0.;
451 break;
452 case HoleVelocityE:
453 if (!m_medium->HoleVelocity(ex, 0, 0, bx, by, 0, y, s, t)) return 0.;
454 break;
456 if (!m_medium->HoleDiffusion(ex, 0, 0, bx, by, 0, s, y)) return 0.;
457 break;
459 if (!m_medium->HoleDiffusion(ex, 0, 0, bx, by, 0, y, s)) return 0.;
460 break;
461 case HoleTownsend:
462 if (!m_medium->HoleTownsend(ex, 0, 0, bx, by, 0, y)) return 0.;
463 break;
464 case HoleAttachment:
465 if (!m_medium->HoleAttachment(ex, 0, 0, bx, by, 0, y)) return 0.;
466 break;
467 case IonVelocity:
468 if (!m_medium->IonVelocity(ex, 0, 0, bx, by, 0, y, s, t)) return 0.;
469 break;
471 if (!m_medium->IonDiffusion(ex, 0, 0, bx, by, 0, s, y)) return 0.;
472 break;
474 if (!m_medium->IonDiffusion(ex, 0, 0, bx, by, 0, y, s)) return 0.;
475 break;
477 if (!m_medium->ElectronVelocity(ex, ey, 0, bx, 0, 0, y, s, t)) return 0.;
478 y = fabs(y);
479 break;
481 if (!m_medium->ElectronVelocity(ex, ey, 0, bx, 0, 0, s, t, y)) return 0.;
482 y = fabs(y);
483 break;
484 case HoleVelocityB:
485 if (!m_medium->HoleVelocity(ex, ey, 0, bx, 0, 0, y, s, t)) return 0.;
486 y = fabs(y);
487 break;
488 case HoleVelocityExB:
489 if (!m_medium->HoleVelocity(ex, ey, 0, bx, 0, 0, s, t, y)) return 0.;
490 y = fabs(y);
491 break;
492 default:
493 std::cerr << m_className << "::EvaluateFunction:\n "
494 << "Unknown type of transport coefficient requested. Bug!\n";
495 return 0.;
496 }
497
498 return y;
499}
500
501void ViewMedium::GetAxisRangeX(const std::vector<double>& efields,
502 const std::vector<double>& bfields, const std::vector<double>& angles,
503 const char xaxis, double& xmin, double& xmax, bool& logx) const {
504
505 if (m_autoRangeX) {
506 bool ok = false;
507 if (xaxis == 'e' && !efields.empty()) {
508 xmin = efields.front();
509 xmax = efields.back();
510 const double dx = xmax - xmin;
511 if (dx > Small && xmax > Small) {
512 xmax += 0.1 * dx;
513 if (xmin > Small) {
514 xmin *= 0.8;
515 logx = true;
516 } else {
517 logx = false;
518 }
519 ok = true;
520 }
521 } else if (xaxis == 'b' && !bfields.empty()) {
522 logx = false;
523 xmin = bfields.front();
524 xmax = bfields.back();
525 const double dx = xmax - xmin;
526 if (dx > Small && xmax > Small) {
527 if (xmin > Small) xmin *= 0.8;
528 xmax += 0.1 * dx;
529 ok = true;
530 }
531 } else if (xaxis == 'a' && !angles.empty()) {
532 logx = false;
533 xmin = angles.front();
534 xmax = angles.back();
535 const double dx = xmax - xmin;
536 if (dx > Small && xmax > Small) {
537 ok = true;
538 }
539 }
540 if (ok) return;
541 }
542 if (xaxis == 'e') {
543 xmin = m_eMin;
544 xmax = m_eMax;
545 logx = m_logE;
546 } else if (xaxis == 'b') {
547 xmin = m_bMin;
548 xmax = m_bMax;
549 logx = m_logB;
550 } else if (xaxis == 'a') {
551 xmin = m_aMin;
552 xmax = m_aMax;
553 logx = m_logA;
554 }
555}
556
557int ViewMedium::GetColor(const Property prop) const {
558 if (prop == ElectronLongitudinalDiffusion || prop == ElectronAttachment ||
559 prop == ElectronLorentzAngle) {
561 } else if (prop == HoleLongitudinalDiffusion || prop == HoleAttachment ||
562 prop == IonLongitudinalDiffusion) {
564 } else if (prop < HoleVelocityE) {
566 } else if (prop == ElectronVelocityB || prop == HoleVelocityB) {
567 return kGreen + 2;
568 } else if (prop == ElectronVelocityExB || prop == HoleVelocityExB) {
569 return kRed + 1;
570 } else if (prop < IonVelocity) {
572 }
574}
575
576std::string ViewMedium::GetLabelX(const char xaxis) const {
577
578 if (xaxis == 'e') {
579 return "electric field [V/cm]";
580 } else if (xaxis == 'b') {
581 return "magnetic field [T]";
582 } else if (xaxis == 'a') {
583 return "angle between #bf{E} and #bf{B} [rad]";
584 }
585 return "";
586}
587
588std::string ViewMedium::GetLabelY(const Property prop) const {
589
590 switch (prop) {
594 case HoleVelocityE:
595 case HoleVelocityB:
596 case HoleVelocityExB:
597 case IonVelocity:
598 return "drift velocity [cm/ns]";
599 break;
606 return "diffusion coefficient [#kern[-0.1]{#sqrt{cm}}#kern[0.1]{]}";
607 break;
608 case ElectronTownsend:
609 case HoleTownsend:
610 return "#it{#alpha} [1/cm]";
611 break;
613 case HoleAttachment:
614 return "#it{#eta} [1/cm]";
615 break;
617 return "Angle between #bf{v} and #bf{E} [rad]";
618 break;
619 default:
620 return "unknown";
621 }
622 return "";
623}
624
625std::string ViewMedium::GetLegend(const Property prop) const {
626
627 std::string label = "";
628 switch (prop) {
630 case HoleVelocityE:
631 label += "velocity #parallel #bf{E}";
632 break;
634 case HoleVelocityB:
635 label += "velocity #parallel #bf{B}_{t}";
636 break;
638 case HoleVelocityExB:
639 label += "velocity #parallel #bf{E}#times #bf{B}";
640 break;
641 case IonVelocity:
642 label += "ion velocity";
643 break;
647 label += "longitudinal diffusion";
648 break;
652 label += "transverse diffusion";
653 break;
654 case ElectronTownsend:
655 case HoleTownsend:
656 label += "Townsend";
657 break;
659 case HoleAttachment:
660 label += "Attachment";
661 break;
663 label += "Lorenz angle";
664 break;
665 }
666 return label;
667}
668
669}
Abstract base class for media.
Definition: Medium.hh:13
virtual double UnScaleElectricField(const double e) const
Definition: Medium.hh:477
virtual double ScaleVelocity(const double v) const
Definition: Medium.hh:478
bool GetElectronVelocityB(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &v)
Get an entry in the table of drift speeds along Btrans.
Definition: Medium.hh:228
bool GetElectronVelocityE(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &v)
Get an entry in the table of drift speeds along E.
Definition: Medium.hh:208
virtual bool HoleTownsend(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &alpha)
Ionisation coefficient [cm-1].
Definition: Medium.cc:534
virtual double ScaleAttachment(const double eta) const
Definition: Medium.hh:482
virtual double ScaleDiffusion(const double d) const
Definition: Medium.hh:479
virtual bool HoleVelocity(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &vx, double &vy, double &vz)
Drift velocity [cm / ns].
Definition: Medium.cc:513
virtual double ScaleLorentzAngle(const double lor) const
Definition: Medium.hh:483
virtual bool ElectronLorentzAngle(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &lor)
Lorentz angle.
Definition: Medium.cc:429
bool GetIonLongitudinalDiffusion(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &dl)
Get an entry in the table of longitudinal diffusion coefficients.
Definition: Medium.hh:390
bool GetHoleAttachment(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &eta)
Get an entry in the table of attachment coefficients.
Definition: Medium.hh:364
bool GetHoleVelocityExB(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &v)
Get an entry in the table of drift speeds along ExB.
Definition: Medium.hh:310
bool GetElectronAttachment(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &eta)
Get an entry in the table of attachment coefficients.
Definition: Medium.hh:278
virtual bool ElectronVelocity(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &vx, double &vy, double &vz)
Drift velocity [cm / ns].
Definition: Medium.cc:379
virtual bool IonVelocity(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &vx, double &vy, double &vz)
Drift velocity [cm / ns].
Definition: Medium.cc:565
bool GetIonMobility(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &mu)
Get an entry in the table of ion mobilities.
Definition: Medium.hh:379
bool GetElectronTownsend(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &alpha)
Get an entry in the table of Townsend coefficients.
Definition: Medium.hh:268
bool GetElectronLorentzAngle(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &lor)
Get an entry in the table of Lorentz angles.
Definition: Medium.hh:289
virtual double ScaleTownsend(const double alpha) const
Definition: Medium.hh:481
bool GetHoleTownsend(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &alpha)
Get an entry in the table of Townsend coefficients.
Definition: Medium.hh:354
virtual bool ElectronDiffusion(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &dl, double &dt)
Longitudinal and transverse diffusion coefficients [cm1/2].
Definition: Medium.cc:387
void GetFieldGrid(std::vector< double > &efields, std::vector< double > &bfields, std::vector< double > &angles)
Get the fields and E-B angles used in the transport tables.
Definition: Medium.cc:864
virtual bool ElectronTownsend(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &alpha)
Ionisation coefficient [cm-1].
Definition: Medium.cc:403
bool GetElectronVelocityExB(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &v)
Get an entry in the table of drift speeds along ExB.
Definition: Medium.hh:218
bool GetElectronTransverseDiffusion(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &dt)
Get an entry in the table of transverse diffusion coefficients.
Definition: Medium.hh:256
virtual bool ElectronAttachment(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &eta)
Attachment coefficient [cm-1].
Definition: Medium.cc:416
bool GetHoleVelocityE(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &v)
Get an entry in the table of drift speeds along E.
Definition: Medium.hh:300
bool GetHoleVelocityB(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &v)
Get an entry in the table of drift speeds along Btrans.
Definition: Medium.hh:320
bool GetHoleTransverseDiffusion(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &dt)
Get an entry in the table of transverse diffusion coefficients.
Definition: Medium.hh:344
bool GetElectronLongitudinalDiffusion(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &dl)
Get an entry in the table of longitudinal diffusion coefficients.
Definition: Medium.hh:241
virtual bool HoleDiffusion(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &dl, double &dt)
Longitudinal and transverse diffusion coefficients [cm1/2].
Definition: Medium.cc:521
bool GetHoleLongitudinalDiffusion(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &dl)
Get an entry in the table of longitudinal diffusion coefficients.
Definition: Medium.hh:332
virtual bool HoleAttachment(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &eta)
Attachment coefficient [cm-1].
Definition: Medium.cc:547
virtual bool IonDiffusion(const double ex, const double ey, const double ez, const double bx, const double by, const double bz, double &dl, double &dt)
Longitudinal and transverse diffusion coefficients [cm1/2].
Definition: Medium.cc:600
bool GetIonTransverseDiffusion(const unsigned int ie, const unsigned int ib, const unsigned int ia, double &dt)
Get an entry in the table of transverse diffusion coefficients.
Definition: Medium.hh:400
Base class for visualization classes.
Definition: ViewBase.hh:10
std::string m_className
Definition: ViewBase.hh:28
std::string FindUnusedFunctionName(const std::string &s) const
Definition: ViewBase.cc:30
bool m_hasExternalCanvas
Definition: ViewBase.hh:35
TCanvas * m_canvas
Definition: ViewBase.hh:34
double EvaluateFunction(double *pos, double *par)
Definition: ViewMedium.cc:406
void SetRangeY(const double ymin, const double ymax, const bool logscale=false)
Set the range of the function (velocity etc.) to be plotted.
Definition: ViewMedium.cc:77
void SetRangeB(const double bmin, const double bmax, const bool logscale)
Set the limits of the magnetic field.
Definition: ViewMedium.cc:55
void PlotIonVelocity(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:103
void PlotElectronTownsend(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:126
void SetMedium(Medium *m)
Set the medium from which to retrieve the transport coefficients.
Definition: ViewMedium.cc:34
void PlotHoleVelocity(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:96
void PlotHoleDiffusion(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:114
void PlotElectronAttachment(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:136
void PlotIonDiffusion(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:120
void PlotElectronCrossSections()
Definition: ViewMedium.cc:151
void PlotElectronLorentzAngle(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:146
void PlotElectronVelocity(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:89
void SetRangeE(const double emin, const double emax, const bool logscale)
Set the limits of the electric field.
Definition: ViewMedium.cc:43
void PlotHoleAttachment(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:141
void SetRangeA(const double amin, const double amax, const bool logscale)
Set the limits of the angle between electric and magnetic field.
Definition: ViewMedium.cc:66
ViewMedium()
Constructor.
Definition: ViewMedium.cc:32
void PlotElectronDiffusion(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:108
void PlotHoleTownsend(const char xaxis, const bool same=false)
Definition: ViewMedium.cc:131
PlottingEngineRoot plottingEngine
DoubleAc exp(const DoubleAc &f)
Definition: DoubleAc.cpp:377
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:615