Garfield++
3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Solid.cc
Go to the documentation of this file.
1
#include <cmath>
2
#include <iostream>
3
4
#include "
Garfield/FundamentalConstants.hh
"
5
#include "
Garfield/GarfieldConstants.hh
"
6
#include "
Garfield/Solid.hh
"
7
8
namespace
Garfield
{
9
10
unsigned
int
Solid::s_id = 0;
11
12
void
Solid::SetDirection
(
const
double
dx,
const
double
dy,
const
double
dz) {
13
const
double
d = sqrt(dx * dx + dy * dy + dz * dz);
14
if
(d < Small) {
15
std::cerr <<
m_className
<<
": Direction vector has zero norm.\n"
;
16
return
;
17
}
18
m_dX
= dx / d;
19
m_dY
= dy / d;
20
m_dZ
= dz / d;
21
double
phi, theta;
22
const
double
dt = sqrt(
m_dX
*
m_dX
+
m_dY
*
m_dY
);
23
if
(dt < Small) {
24
phi = 0.;
25
if
(
m_dZ
> 0.) {
26
theta = 0.;
27
}
else
{
28
theta = Pi;
29
}
30
}
else
{
31
phi = atan2(
m_dY
,
m_dX
);
32
theta = atan2(dt,
m_dZ
);
33
}
34
m_cTheta
= cos(theta);
35
m_sTheta
= sin(theta);
36
m_cPhi
= cos(phi);
37
m_sPhi
= sin(phi);
38
}
39
40
double
Solid::NotImplemented(
const
std::string& fcn)
const
{
41
std::cerr <<
m_className
<<
"::"
<< fcn <<
": function not implemented.\n"
;
42
return
0.;
43
}
44
}
FundamentalConstants.hh
GarfieldConstants.hh
Solid.hh
Garfield::Solid::m_dZ
double m_dZ
Definition:
Solid.hh:167
Garfield::Solid::m_cTheta
double m_cTheta
Polar angle.
Definition:
Solid.hh:171
Garfield::Solid::m_dX
double m_dX
Direction vector.
Definition:
Solid.hh:167
Garfield::Solid::SetDirection
void SetDirection(const double dx, const double dy, const double dz)
Definition:
Solid.cc:12
Garfield::Solid::m_sPhi
double m_sPhi
Definition:
Solid.hh:169
Garfield::Solid::m_sTheta
double m_sTheta
Definition:
Solid.hh:171
Garfield::Solid::m_dY
double m_dY
Definition:
Solid.hh:167
Garfield::Solid::m_cPhi
double m_cPhi
Azimuthal angle.
Definition:
Solid.hh:169
Garfield::Solid::m_className
std::string m_className
Class name.
Definition:
Solid.hh:174
Garfield
Definition:
HeedChamber.hh:11
garfieldpp-3.0
Source
Solid.cc
Generated by
1.9.6