Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ComponentBase.cc
Go to the documentation of this file.
1#include <iostream>
2#include "ComponentBase.hh"
3
4namespace Garfield {
5
7 : m_className("ComponentBase"),
8 theGeometry(0),
9 ready(false),
10 xPeriodic(false),
11 yPeriodic(false),
12 zPeriodic(false),
13 xMirrorPeriodic(false),
14 yMirrorPeriodic(false),
15 zMirrorPeriodic(false),
16 xAxiallyPeriodic(false),
17 yAxiallyPeriodic(false),
18 zAxiallyPeriodic(false),
19 xRotationSymmetry(false),
20 yRotationSymmetry(false),
21 zRotationSymmetry(false),
22 bx0(0.),
23 by0(0.),
24 bz0(0.),
25 debug(false) {}
26
28
29 // Make sure the geometry is defined
30 if (geo == 0) {
31 std::cerr << "ComponentBase::SetGeometry:\n";
32 std::cerr << " Geometry pointer is null.\n";
33 return;
34 }
35
36 theGeometry = geo;
37}
38
39Medium* ComponentBase::GetMedium(const double& x, const double& y,
40 const double& z) {
41
42 if (theGeometry == NULL) return NULL;
43 return theGeometry->GetMedium(x, y, z);
44}
45
47
48 theGeometry = 0;
49 Reset();
50}
51
52void ComponentBase::WeightingField(const double x, const double y,
53 const double z, double& wx, double& wy,
54 double& wz, const std::string label) {
55 if (debug) {
56 std::cerr << m_className << "::WeightingField:\n";
57 std::cerr << " This function is not implemented.\n";
58 std::cerr << " Weighting field at (" << x << ", " << y << ", " << z
59 << ") for electrode " << label << " cannot be calculated.\n";
60 }
61 wx = wy = wz = 0.;
62}
63
64double ComponentBase::WeightingPotential(const double x, const double y,
65 const double z,
66 const std::string label) {
67
68 if (debug) {
69 std::cerr << m_className << "::WeightingPotential:\n";
70 std::cerr << " This function is not implemented.\n";
71 std::cerr << " Weighting potential at (" << x << ", " << y << ", " << z
72 << ") for electrode " << label << " cannot be calculated.\n";
73 }
74 return 0.;
75}
76
77void ComponentBase::MagneticField(const double x, const double y,
78 const double z, double& bx, double& by,
79 double& bz, int& status) {
80 bx = bx0;
81 by = by0;
82 bz = bz0;
83 if (debug) {
84 std::cout << m_className << "::MagneticField:\n";
85 std::cout << " Magnetic field at (" << x << ", " << y << ", " << z
86 << ") is (" << bx << ", " << by << ", " << bz << ")\n";
87 }
88 status = 0;
89}
90
91void ComponentBase::SetMagneticField(const double bx, const double by,
92 const double bz) {
93
94 bx0 = bx;
95 by0 = by;
96 bz0 = bz;
97}
98
99bool ComponentBase::GetBoundingBox(double& xmin, double& ymin, double& zmin,
100 double& xmax, double& ymax, double& zmax) {
101
102 if (theGeometry == 0) return false;
103 return (theGeometry->GetBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax));
104}
105
106bool ComponentBase::IsWireCrossed(const double x0, const double y0,
107 const double z0,
108 const double /*x1*/, const double /*y1*/,
109 const double /*z1*/, double& xc,
110 double& yc, double& zc) {
111
112 xc = x0;
113 yc = y0;
114 zc = z0;
115 return false;
116
117}
118
119bool ComponentBase::IsInTrapRadius(double x0, double y0, double z0, double& xw,
120 double& yw, double& rw) {
121
122 xw = x0;
123 yw = y0;
124 rw = 0.;
125 return false;
126
127 if (debug) {
128 std::cout << m_className << "::IsInTrapRadius:\n";
129 std::cout << " (" << x0 << ", " << y0 << ", " << z0 << ") \n";
130 std::cout << " not trapped by a wire.\n";
131 }
132}
133}
GeometryBase * theGeometry
virtual bool IsInTrapRadius(double x0, double y0, double z0, double &xw, double &yw, double &rw)
void SetMagneticField(const double bx, const double by, const double bz)
virtual void Reset()=0
virtual void MagneticField(const double x, const double y, const double z, double &bx, double &by, double &bz, int &status)
virtual bool IsWireCrossed(const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, double &xc, double &yc, double &zc)
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
virtual Medium * GetMedium(const double &x, const double &y, const double &z)
virtual void WeightingField(const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string label)
virtual double WeightingPotential(const double x, const double y, const double z, const std::string label)
virtual void SetGeometry(GeometryBase *geo)
virtual Medium * GetMedium(const double x, const double y, const double z) const =0
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)=0