Garfield++ v2r0
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
21 public:
22 /// Constructor.
23 trajestep_limit(vfloat fmax_range, vfloat frad_for_straight,
24 vfloat fmax_straight_arange, vfloat fmax_circumf_arange)
25 : max_range(fmax_range),
26 rad_for_straight(frad_for_straight),
27 max_straight_arange(fmax_straight_arange),
28 max_circumf_arange(fmax_circumf_arange) {}
29
30
32
33 // The three following parameters regulate the precision for s_cf == 1.
34 /// Radius beyond which to prefer straight lines to reduce calculation time.
36 /// Angle of range if it goes along straight line, but s_cf == 1.
37 // But the angle is calculated taking way as circle anyway.
39 /// Angle of range if it goes along circle.
41
42 // Chooses straight or circle line and calculates maximal range.
43 // vfloat& mrange gives first maximal range and filled by finishing
44 // maximal range which should be less by value.
45 // fs_cf0 : 0 - if the track must be straight.
46 // 1 - if the real track is curved. It can or can not be
47 // approximated by straight line.
48 // fs_cf1 : 0 - the track is simulated by straight line.
49 // 1 - the track is simulated by curved line.
50 void range(int fs_cf0, vfloat rad, int& fs_cf1, vfloat& mrange) const;
51};
52
53/// Trajectory step of any object (particle, photon, ...).
54/// Here we interested in geometrical parameters only.
55/// The time, speed, acceleration, mass, and forces are not interesting here.
56/// The object can move by straight line or by curved line.
57/// The real trajectory is approximated by little steps.
58/// Each step can be straight or with constant curvature (circumference).
59/// If the path is always straight (for example for light or neutral particles),
60/// the step length is limited by extra conditions, typically edge of a volume.
61/// If the path is curved, the step length is limited first by length at
62/// which the curvature is changed, then by precision of approximation
63/// of the real shape of curvature.
64
65class trajestep : public absref {
66 public:
69 /// Unit vector.
71 /// Type of trajectory.
72 /// 0 - the track is straight,
73 /// 1 - curved track (but the range may anyway be calculated
74 /// as straight line, depending on s_range_cf)
75 int s_cf;
76
77 // Position of the center of circumf. relatively currpos
78 // Used only if s_cf=1; otherwise ignored.
79 // If used, should be perpendicular to dir.
81
82 // 0 - range have been calculated via straight line
83 // 1 - via circle
85
86 // 1 - range is limited by precision
87 int s_prec;
88
89 /// Maximal possible range
91
92 // Finishing point
93 // It looks like that at s_prec=1 mpoint is not initiated
94 // At s_prec=0 the point is initiated
96
97 void Gnextpoint(vfloat frange, point& fpos, vec& fdir) const;
98 void Gnextpoint1(vfloat frange, point& fpos, vec& fdir, vec& frelcen) const;
99
100 /// Constructor.
101 /// Here prec is used to check if frelcen is perp. to dir.
102 /// If it is not perpendicular with this precision,
103 /// the function terminates the program.
104 /// To reduce range fmrange may be used.
105 trajestep(trajestep_limit* ftl, const point& fcurrpos, const vec& fdir,
106 int fs_cf, const vec& frelcen, vfloat fmrange, vfloat prec);
107 /** Constructor to continue propagation from the end point of another step.
108 * \param fts old step to continue
109 * \param fmrange new range to travel
110 */
111 trajestep(const trajestep& fts, vfloat fmrange);
112 /// Default constructor.
114 tl(),
115 currpos(),
116 dir(),
117 s_cf(0),
118 relcen(),
119 s_range_cf(0),
120 s_prec(0),
121 mrange(0),
122 mpoint() {}
123 /// Destructor
124 virtual ~trajestep() {}
125
126 protected:
127 virtual void get_components(ActivePtr<absref_transmit>& aref_tran);
128 static absref(absref::*aref[4]);
129};
130std::ostream& operator<<(std::ostream& file, const trajestep& f);
131}
132
133#endif
Active pointer or automatic container or controlling pointer.
Definition: AbsPtr.h:199
Point.
Definition: vec.h:374
vfloat max_straight_arange
Angle of range if it goes along straight line, but s_cf == 1.
Definition: trajestep.h:38
vfloat max_circumf_arange
Angle of range if it goes along circle.
Definition: trajestep.h:40
void range(int fs_cf0, vfloat rad, int &fs_cf1, vfloat &mrange) const
Definition: trajestep.cpp:16
vfloat rad_for_straight
Radius beyond which to prefer straight lines to reduce calculation time.
Definition: trajestep.h:35
trajestep_limit(vfloat fmax_range, vfloat frad_for_straight, vfloat fmax_straight_arange, vfloat fmax_circumf_arange)
Constructor.
Definition: trajestep.h:23
trajestep()
Default constructor.
Definition: trajestep.h:113
PassivePtr< trajestep_limit > tl
Definition: trajestep.h:67
vfloat mrange
Maximal possible range.
Definition: trajestep.h:90
void Gnextpoint1(vfloat frange, point &fpos, vec &fdir, vec &frelcen) const
Definition: trajestep.cpp:103
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
Definition: trajestep.cpp:34
static absrefabsref::*[4] aref
Definition: trajestep.h:128
void Gnextpoint(vfloat frange, point &fpos, vec &fdir) const
Definition: trajestep.cpp:76
virtual ~trajestep()
Destructor.
Definition: trajestep.h:124
vec dir
Unit vector.
Definition: trajestep.h:70
Definition: vec.h:186
Definition: BGMesh.cpp:5
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:36
double vfloat
Definition: vfloat.h:16