Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
trajestep.h
Go to the documentation of this file.
1#ifndef TRAJESTEP_H
2#define TRAJESTEP_H
5
6/*
7Copyright (c) 2000 Igor B. Smirnov
8
9The file can be used, copied, modified, and distributed
10according to the terms of GNU Lesser General Public License version 2.1
11as published by the Free Software Foundation,
12and provided that the above copyright notice, this permission notice,
13and notices about any modifications of the original text
14appear in all copies and in supporting documentation.
15The file is provided "as is" without express or implied warranty.
16*/
17
18namespace Heed {
19
20/// Trajectory step of any object (particle, photon, ...).
21/// Here we interested in geometrical parameters only.
22/// The time, speed, acceleration, mass, and forces are not interesting here.
23/// The object can move by straight line or by curved line.
24/// The real trajectory is approximated by little steps.
25/// Each step can be straight or with constant curvature (circumference).
26/// If the path is always straight (for example for light or neutral particles),
27/// the step length is limited by extra conditions, typically edge of a volume.
28/// If the path is curved, the step length is limited first by length at
29/// which the curvature is changed, then by precision of approximation
30/// of the real shape of curvature.
31
32class trajestep : public absref {
33 public:
34 /** Constructor.
35 * \param fmax_range maximum step length
36 * \param frad_for_straight radius beyond which to use straight-line steps.
37 * \param fmax_straight_arange angular step for straight-line approximation.
38 * \param fmax_circ_arange angular step for curved steps.
39 * \param fcurrpos initial coordinates.
40 * \param fdir initial direction.
41 * \param fcurved flag whether the trajectory is curved or straight.
42 * \param frelcen centre of rotation (only used for curved lines).
43 * \param fmrange can be used for reducing/limiting the step length.
44 * \param prec tolerance for checking if frelcen is perpendicular to dir.
45 */
46 trajestep(const vfloat fmax_range, const vfloat frad_for_straight,
47 const vfloat fmax_straight_arange, const vfloat fmax_circ_arange,
48 const point& fcurrpos, const vec& fdir, const bool fcurved,
49 const vec& frelcen, vfloat fmrange, vfloat prec);
50 /** Constructor to continue propagation from the end point of another step.
51 * \param fts old step to continue
52 * \param fmrange new range to travel
53 */
54 trajestep(const trajestep& fts, vfloat fmrange);
55 /// Default constructor.
56 trajestep() = default;
57 /// Destructor
58 virtual ~trajestep() {}
59
60 /// Move to the next point.
61 void Gnextpoint(vfloat frange, point& fpos, vec& fdir) const;
62
63 /// Max. step length.
64 vfloat max_range = 100. * CLHEP::cm;
65 // The three following parameters regulate the precision for curved lines.
66 /// Radius beyond which to prefer straight lines to reduce calculation time.
67 vfloat rad_for_straight = 1000. * CLHEP::cm;
68 /// Angular step for curved lines when using straight-line approximation.
69 vfloat max_straight_arange = 0.1 * CLHEP::rad;
70 /// Angular step for curved lines.
71 vfloat max_circ_arange = 0.2 * CLHEP::rad;
72
73 /// Current position.
75 /// Unit vector.
77 /// Type of trajectory (curved or straight).
78 bool curved = false;
79
80 /// Centre of rotation relative to currpos.
81 /// Used only for curved trajectories.
82 /// If used, should be perpendicular to dir.
84
85 // 0 - range have been calculated via straight line
86 // 1 - via circle
87 int s_range_cf = 0;
88
89 // 1 - range is limited by precision
90 int s_prec = 0;
91
92 /// Maximal possible range
94
95 // Finishing point
96 // It looks like that at s_prec=1 mpoint is not initiated
97 // At s_prec=0 the point is initiated
99
100 protected:
101 virtual absref_transmit get_components() override;
102 static absref(absref::*aref[4]);
103
104 private:
105 void Gnextpoint1(vfloat frange, point& fpos, vec& fdir, vec& frelcen) const;
106};
107std::ostream& operator<<(std::ostream& file, const trajestep& f);
108}
109
110#endif
Point.
Definition: vec.h:366
point currpos
Current position.
Definition: trajestep.h:74
vfloat rad_for_straight
Radius beyond which to prefer straight lines to reduce calculation time.
Definition: trajestep.h:67
vfloat mrange
Maximal possible range.
Definition: trajestep.h:93
trajestep()=default
Default constructor.
vfloat max_straight_arange
Angular step for curved lines when using straight-line approximation.
Definition: trajestep.h:69
bool curved
Type of trajectory (curved or straight).
Definition: trajestep.h:78
static absrefabsref::*[4] aref
Definition: trajestep.h:102
void Gnextpoint(vfloat frange, point &fpos, vec &fdir) const
Move to the next point.
Definition: trajestep.cpp:80
virtual ~trajestep()
Destructor.
Definition: trajestep.h:58
virtual absref_transmit get_components() override
Definition: trajestep.cpp:21
vfloat max_circ_arange
Angular step for curved lines.
Definition: trajestep.h:71
vfloat max_range
Max. step length.
Definition: trajestep.h:64
vec dir
Unit vector.
Definition: trajestep.h:76
Definition: vec.h:177
Definition: BGMesh.cpp:6
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:37
double vfloat
Definition: vfloat.h:16