Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::trajestep Class Reference

#include <trajestep.h>

+ Inheritance diagram for Heed::trajestep:

Public Member Functions

 trajestep (const vfloat fmax_range, const vfloat frad_for_straight, const vfloat fmax_straight_arange, const vfloat fmax_circ_arange, const point &fcurrpos, const vec &fdir, const bool fcurved, const vec &frelcen, vfloat fmrange, vfloat prec)
 
 trajestep (const trajestep &fts, vfloat fmrange)
 
 trajestep ()=default
 Default constructor.
 
virtual ~trajestep ()
 Destructor.
 
void Gnextpoint (vfloat frange, point &fpos, vec &fdir) const
 Move to the next point.
 
- Public Member Functions inherited from Heed::absref
virtual ~absref ()
 Destructor.
 
virtual void down (const abssyscoor *fasc)
 Convert numbering representation of object to basical system of fasc.
 
virtual void up (const abssyscoor *fasc)
 Convert numbering representation of objects to new system.
 
virtual void turn (const vec &dir, vfloat angle)
 Turn around axis doing via center of coordinate system along dir.
 
virtual void shift (const vec &dir)
 

Public Attributes

vfloat max_range = 100. * CLHEP::cm
 Max. step length.
 
vfloat rad_for_straight = 1000. * CLHEP::cm
 Radius beyond which to prefer straight lines to reduce calculation time.
 
vfloat max_straight_arange = 0.1 * CLHEP::rad
 Angular step for curved lines when using straight-line approximation.
 
vfloat max_circ_arange = 0.2 * CLHEP::rad
 Angular step for curved lines.
 
point currpos
 Current position.
 
vec dir
 Unit vector.
 
bool curved = false
 Type of trajectory (curved or straight).
 
vec relcen
 
int s_range_cf = 0
 
int s_prec = 0
 
vfloat mrange = 0.
 Maximal possible range.
 
point mpoint
 

Protected Member Functions

virtual absref_transmit get_components () override
 

Static Protected Attributes

static absref absref::* aref [4]
 

Detailed Description

Trajectory step of any object (particle, photon, ...). Here we interested in geometrical parameters only. The time, speed, acceleration, mass, and forces are not interesting here. The object can move by straight line or by curved line. The real trajectory is approximated by little steps. Each step can be straight or with constant curvature (circumference). If the path is always straight (for example for light or neutral particles), the step length is limited by extra conditions, typically edge of a volume. If the path is curved, the step length is limited first by length at which the curvature is changed, then by precision of approximation of the real shape of curvature.

Definition at line 32 of file trajestep.h.

Constructor & Destructor Documentation

◆ trajestep() [1/3]

Heed::trajestep::trajestep ( const vfloat  fmax_range,
const vfloat  frad_for_straight,
const vfloat  fmax_straight_arange,
const vfloat  fmax_circ_arange,
const point fcurrpos,
const vec fdir,
const bool  fcurved,
const vec frelcen,
vfloat  fmrange,
vfloat  prec 
)

Constructor.

Parameters
fmax_rangemaximum step length
frad_for_straightradius beyond which to use straight-line steps.
fmax_straight_arangeangular step for straight-line approximation.
fmax_circ_arangeangular step for curved steps.
fcurrposinitial coordinates.
fdirinitial direction.
fcurvedflag whether the trajectory is curved or straight.
frelcencentre of rotation (only used for curved lines).
fmrangecan be used for reducing/limiting the step length.
prectolerance for checking if frelcen is perpendicular to dir.

Definition at line 25 of file trajestep.cpp.

30 : max_range(fmax_range),
31 rad_for_straight(frad_for_straight),
32 max_straight_arange(fmax_straight_arange),
33 max_circ_arange(fmax_circ_arange),
34 currpos(fcurrpos),
35 dir(),
36 curved(fcurved),
37 relcen(frelcen),
38 s_prec(1),
39 mrange(fmrange) {
40 pvecerror("trajestep::trajestep(...)");
41 if (fdir == dv0) {
42 dir = dv0;
43 mrange = 0;
44 } else {
45 dir = unit_vec(fdir);
46 if (curved) {
47 check_econd11a(check_perp(dir, relcen, prec), != 1,
48 "dir=" << dir << "relcen=" << relcen
49 << "fcurrpos=" << fcurrpos << "fdir=" << fdir,
50 mcerr);
51 }
52 if (mrange < 0 || mrange > max_range) mrange = max_range;
54 if (s_range_cf == 1) {
55 const vfloat r = relcen.length();
56 if (r >= rad_for_straight) {
57 s_range_cf = 0;
58 mrange = std::min(mrange, r * max_straight_arange);
59 } else {
60 mrange = std::min(mrange, r * max_circ_arange);
61 }
62 }
63 }
64}
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:172
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
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
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
vfloat length() const
Definition: vec.h:196
vec dv0(0, 0, 0)
Definition: vec.h:308
double vfloat
Definition: vfloat.h:16
#define mcerr
Definition: prstream.h:128
#define pvecerror(string)
Definition: vec.h:28

◆ trajestep() [2/3]

Heed::trajestep::trajestep ( const trajestep fts,
vfloat  fmrange 
)

Constructor to continue propagation from the end point of another step.

Parameters
ftsold step to continue
fmrangenew range to travel

Definition at line 66 of file trajestep.cpp.

66 {
67 mfunname("trajestep::trajestep(const trajestep& fts, vfloat fmrange)");
68 // Continue propagation from the end point of the old step.
69 point fpos;
70 vec fdir;
71 vec frelcen;
72 fts.Gnextpoint1(fts.mrange, fpos, fdir, frelcen);
73 vfloat prec = 0.1; // not important here
74 *this =
75 trajestep(fts.max_range, fts.rad_for_straight,
76 fts.max_straight_arange, fts.max_circ_arange,
77 fpos, fdir, fts.curved, frelcen, fmrange, prec);
78}
#define mfunname(string)
Definition: FunNameStack.h:45
trajestep()=default
Default constructor.

◆ trajestep() [3/3]

Heed::trajestep::trajestep ( )
default

Default constructor.

Referenced by trajestep().

◆ ~trajestep()

virtual Heed::trajestep::~trajestep ( )
inlinevirtual

Destructor.

Definition at line 58 of file trajestep.h.

58{}

Member Function Documentation

◆ get_components()

absref_transmit Heed::trajestep::get_components ( )
overrideprotectedvirtual

Reimplemented from Heed::absref.

Definition at line 21 of file trajestep.cpp.

21 {
22 return absref_transmit(4, aref);
23}
static absref absref::* aref[4]
Definition: trajestep.h:102

◆ Gnextpoint()

void Heed::trajestep::Gnextpoint ( vfloat  frange,
point fpos,
vec fdir 
) const

Move to the next point.

Definition at line 80 of file trajestep.cpp.

80 {
81 pvecerror("int trajestep::Gnextpoint(vfloat frange, point& fpos, vec& fdir)");
82 check_econd12(frange, >, mrange, mcerr);
83 if (s_range_cf == 0) {
84 // interpolation by straight line
85 fpos = currpos + frange * dir;
86 if (!curved) {
87 // no curvature
88 fdir = dir;
89 } else {
90 vfloat ang = frange / relcen.length();
91 fdir = dir;
92 fdir.turn(dir || relcen, ang);
93 }
94 } else {
95 vfloat ang = frange / relcen.length(); // angle to turn
96 fdir = dir;
97 fdir.turn(dir || relcen, ang); // direction at the end
98 vec frelcen = relcen;
99 frelcen.turn(dir || relcen, ang);
100 fpos = currpos + relcen - frelcen;
101 }
102}
#define check_econd12(a, sign, b, stream)
Definition: FunNameStack.h:163
void turn(const vec &dir, vfloat angle) override
Turn this vector.
Definition: vec.cpp:216

Referenced by Heed::stvpoint::stvpoint().

Member Data Documentation

◆ aref

absref absref::* Heed::trajestep::aref
staticprotected
Initial value:
= {(absref absref::*)&trajestep::currpos,
(absref absref::*)&trajestep::dir,
(absref absref::*)&trajestep::relcen,
(absref absref::*)&trajestep::mpoint}

Definition at line 102 of file trajestep.h.

Referenced by get_components().

◆ currpos

point Heed::trajestep::currpos

Current position.

Definition at line 74 of file trajestep.h.

Referenced by Gnextpoint(), Heed::operator<<(), Heed::splane::range(), Heed::box::range_ext(), and Heed::ulsvolume::range_ext().

◆ curved

bool Heed::trajestep::curved = false

Type of trajectory (curved or straight).

Definition at line 78 of file trajestep.h.

Referenced by Gnextpoint(), Heed::operator<<(), and trajestep().

◆ dir

vec Heed::trajestep::dir

Unit vector.

Definition at line 76 of file trajestep.h.

Referenced by Gnextpoint(), Heed::operator<<(), Heed::splane::range(), Heed::ulsvolume::range_ext(), and trajestep().

◆ max_circ_arange

vfloat Heed::trajestep::max_circ_arange = 0.2 * CLHEP::rad

Angular step for curved lines.

Definition at line 71 of file trajestep.h.

Referenced by trajestep().

◆ max_range

vfloat Heed::trajestep::max_range = 100. * CLHEP::cm

Max. step length.

Definition at line 64 of file trajestep.h.

Referenced by trajestep().

◆ max_straight_arange

vfloat Heed::trajestep::max_straight_arange = 0.1 * CLHEP::rad

Angular step for curved lines when using straight-line approximation.

Definition at line 69 of file trajestep.h.

Referenced by trajestep().

◆ mpoint

point Heed::trajestep::mpoint

◆ mrange

◆ rad_for_straight

vfloat Heed::trajestep::rad_for_straight = 1000. * CLHEP::cm

Radius beyond which to prefer straight lines to reduce calculation time.

Definition at line 67 of file trajestep.h.

Referenced by trajestep().

◆ relcen

vec Heed::trajestep::relcen

Centre of rotation relative to currpos. Used only for curved trajectories. If used, should be perpendicular to dir.

Definition at line 83 of file trajestep.h.

Referenced by Gnextpoint(), Heed::operator<<(), Heed::splane::range(), and trajestep().

◆ s_prec

int Heed::trajestep::s_prec = 0

◆ s_range_cf

int Heed::trajestep::s_range_cf = 0

Definition at line 87 of file trajestep.h.

Referenced by Gnextpoint(), Heed::operator<<(), Heed::splane::range(), and trajestep().


The documentation for this class was generated from the following files: