Garfield++ v1r0
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
4#include "wcpplib/geometry/circumf.h" // not in this file but usually in depending
6/*
7Step of trajectory of any object.
8It is particle, light or material thing.
9Here we interest in geometrical parameters only.
10The time, speed, acceleration, mass, and forces are not interested here.
11The object can move by straight line or by curved line.
12The real trajectory is approximated by little steps.
13Each step can be straight or with constant curvature (circumference).
14If real way is straight always
15(for example for light or for neutral particles),
16the length of step is limited by extra conditions, typically edge of a volume.
17If real way is curved, the length of step is limited first by length at
18which the curvature is changed, then by precision of approximation
19of the real shape of curvature.
20
21Copyright (c) 2000 Igor B. Smirnov
22
23The file can be used, copied, modified, and distributed
24according to the terms of GNU Lesser General Public License version 2.1
25as published by the Free Software Foundation,
26and provided that the above copyright notice, this permission notice,
27and notices about any modifications of the original text
28appear in all copies and in supporting documentation.
29The file is provided "as is" without express or implied warranty.
30*/
31
32class trajestep_limit : public RegPassivePtr {
33 public:
34 vfloat max_range; // useful if curvature is varyable.
35 // Then it shows how often it is changed.
36 //vfloat max_prange;
37 // When charged particle is curved by electric field,
38 // the field are changed faster, the stronger is field.
39 // This parameter limits the step by inverting field force:
40 // max_prange/field_force.
41
42 // 3 following parameters affect if s_cf==1.
43 // They regulate precision.
44 // radius beyond which straight lines are preferred to reduce calculation time
46 // angle of range if it goes along straight line, but s_cf==1.
47 // But the angle is calculated taking way as circle anyway.
49 // angle of range if it goes along circle
51
52 // Chooses straight or circle line and calculates maximal range.
53 // vfloat& mrange gives first maximal range and filled by finishing
54 // maximal range which should be less by value.
55 // fs_cf0 : 0 - if the track must be straight.
56 // 1 - if the real track is curved. It can or can not be
57 // approximated by straight line.
58 // fs_cf1 : 0 - the track is simulated by straight line.
59 // 1 - the track is simulated by curved line.
60 void range(int fs_cf0, vfloat rad, int& fs_cf1, vfloat& mrange);
61 trajestep_limit(vfloat fmax_range, vfloat frad_for_straight,
62 vfloat fmax_straight_arange, vfloat fmax_circumf_arange)
63 : max_range(fmax_range),
64 rad_for_straight(frad_for_straight),
65 max_straight_arange(fmax_straight_arange),
66 max_circumf_arange(fmax_circumf_arange) {
67 ;
68 }
69};
70
71class trajestep : public absref {
72 public:
75 vec dir; // unit_vec
76 int s_cf; // 0 - the track is straight,
77 // 1 - there is curvature, circumference
78 // (but the range may anyway be calculated as straight line,
79 // depending on s_range_cf, see below)
80 vec relcen; // position of the center of circumf. relatively currpos
81 // Used only if s_cf=1; otherwise ignored.
82 // If used, should be perpendicular to dir.
83 // internal data
84 //straight sl; // inited always
85 //circumf cf; // should be inited only if s_cf==1
86
87 // output data:
88 int s_range_cf; // 0 - range have been calculated via straight line
89 // 1 - via circle
90 int s_prec; // 1 - range is limited by precision
91 vfloat mrange; // maximal possible range
92 point mpoint; // finishing point
93 // It looks like that at s_prec=1 mpoint is not initiated
94 // At s_prec=0 the point is initiated
95
96 void Gnextpoint(vfloat frange, point& fpos, vec& fdir) const;
97 void Gnextpoint1(vfloat frange, point& fpos, vec& fdir, vec& frelcen) const;
98
99 // constructors
100 trajestep(trajestep_limit* ftl, const point& fcurrpos, const vec& fdir,
101 int fs_cf, const vec& frelcen, vfloat fmrange, vfloat prec);
102 // Here prec is used to check if frelcen is perp. to dir.
103 // If it is not perpendicular with this precision,
104 // the function terminates the program.
105 // To reduce range fmrange may be used.
106
107 // the new object will continue propagation from the end point of the old one
108 trajestep(const trajestep& fts, vfloat mrange); // new range to travel
110 : // temporary
111 tl(),
112 currpos(),
113 dir(),
114 s_cf(0),
115 relcen(),
116 s_range_cf(0),
117 s_prec(0),
118 mrange(0),
119 mpoint() {
120 ;
121 }
122 // destructor
123 virtual ~trajestep() {}
124
125 protected:
126 virtual void get_components(ActivePtr<absref_transmit>& aref_tran);
127 //virtual void Garef(int& fqaref , absref absref::**&faref, //fixed memory
128 // int& fqareff, absref **&fareff) // free memory
129 // {fqaref=4; fqareff=0; faref=&aref[0]; fareff=NULL;}
130 static absref(absref::* aref[4]);
131
132};
133std::ostream& operator<<(std::ostream& file, const trajestep& f);
134
135#endif
Definition: vec.h:134
Definition: vec.h:477
vfloat max_straight_arange
Definition: trajestep.h:48
void range(int fs_cf0, vfloat rad, int &fs_cf1, vfloat &mrange)
Definition: trajestep.cpp:14
vfloat max_circumf_arange
Definition: trajestep.h:50
trajestep_limit(vfloat fmax_range, vfloat frad_for_straight, vfloat fmax_straight_arange, vfloat fmax_circumf_arange)
Definition: trajestep.h:61
vfloat rad_for_straight
Definition: trajestep.h:45
vfloat max_range
Definition: trajestep.h:34
void Gnextpoint(vfloat frange, point &fpos, vec &fdir) const
Definition: trajestep.cpp:78
int s_range_cf
Definition: trajestep.h:88
vec dir
Definition: trajestep.h:75
point currpos
Definition: trajestep.h:74
static absrefabsref::*[4] aref
Definition: trajestep.h:130
PassivePtr< trajestep_limit > tl
Definition: trajestep.h:73
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
Definition: trajestep.cpp:34
vfloat mrange
Definition: trajestep.h:91
trajestep(void)
Definition: trajestep.h:109
int s_cf
Definition: trajestep.h:76
void Gnextpoint1(vfloat frange, point &fpos, vec &fdir, vec &frelcen) const
Definition: trajestep.cpp:105
vec relcen
Definition: trajestep.h:80
virtual ~trajestep()
Definition: trajestep.h:123
point mpoint
Definition: trajestep.h:92
int s_prec
Definition: trajestep.h:90
Definition: vec.h:248
std::ostream & operator<<(std::ostream &file, const trajestep &f)
Definition: trajestep.cpp:137
double vfloat
Definition: vfloat.h:15