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
6#include "Garfield/Solid.hh"
7
8namespace Garfield {
9
10unsigned int Solid::s_id = 0;
11
12void 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
40double Solid::NotImplemented(const std::string& fcn) const {
41 std::cerr << m_className << "::" << fcn << ": function not implemented.\n";
42 return 0.;
43}
44}
double m_dZ
Definition: Solid.hh:167
double m_cTheta
Polar angle.
Definition: Solid.hh:171
double m_dX
Direction vector.
Definition: Solid.hh:167
void SetDirection(const double dx, const double dy, const double dz)
Definition: Solid.cc:12
double m_sPhi
Definition: Solid.hh:169
double m_sTheta
Definition: Solid.hh:171
double m_dY
Definition: Solid.hh:167
double m_cPhi
Azimuthal angle.
Definition: Solid.hh:169
std::string m_className
Class name.
Definition: Solid.hh:174