Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
mparticle.h
Go to the documentation of this file.
1#ifndef MPARTICLE_H
2#define MPARTICLE_H
3#include <iostream>
6
7/* massive particle. A force can be applied.
8
9Copyright (c) 2000 Igor B. Smirnov
10
11The file can be used, copied, modified, and distributed
12according to the terms of GNU Lesser General Public License version 2.1
13as published by the Free Software Foundation,
14and provided that the above copyright notice, this permission notice,
15and notices about any modifications of the original text
16appear in all copies and in supporting documentation.
17The file is provided "as is" without express or implied warranty.
18 */
19
20namespace Heed {
21
22class mparticle : public gparticle {
23 public:
24 /// Mass (not mass * speed_of_light^2)
25 double mass;
26
28 double orig_gamma_1; // gamma-1
30 double prev_gamma_1; // gamma-1
32 double curr_gamma_1; // gamma-1
33
34 void check_consistency(void) const; // checks that kin_energy,
35 // gamma_1, speed, speed_of_light and mass correspond to each other
36
37 virtual void step(void);
38
39 virtual void curvature(int& fs_cf, vec& frelcen, vfloat& fmrange,
40 vfloat prec);
41 // Allows to set curvature.
42 // Calls force().
43 // If force is zero, returns fs_cf=0; frelcen=dv0;
44 // If force is zero, and currpos.dir==dv0, makes, in addition, fmrange=0;
45 // If currpos.dir==dv0, makes currpos.dir=unit_vec(f);
46 // If force is parallel or anti-parallel to dir, makes fs_cf=0; frelcen=dv0;
47 // If force is anti-parallel to dir, restrics range till exceeding
48 // of kinetic energy.
49
50 virtual void physics_after_new_speed(void) { ; }
51 // Allows to apply any other processes, to turn the trajectory, kill
52 // the particle and so on.
53
54 virtual void physics(void) { ; }
55 // Allows to apply any other processes, to turn the trajectory, kill
56 // the particle and so on.
57
58 virtual int force(const point& pt, vec& f, vec& f_perp, vfloat& mrange);
59 // Force is considered to be split to two components.
60 // One component, namely f,
61 // is directed to any direction and capable to do the work.
62 // The other one is always normal to dir and it cannot do the work.
63 // The latter can represent magnetic component of Lorentz force.
64 // This splitting improve precision of calculation of kinetic energy.
65 // But the latter component is not the true force.
66 // To derive the force one should
67 // do vector multiplication of speed by f_perp.:
68 // f_perp2=currpos.speed * (currpos.dir||f_perp_fl2);
69 //
70 // if returns 0 then no force, but it should fill zero to f anyway
71 // mrange - distance at which the force should not change much
72 //
73 // The dimension of f is [weight] * [lenght] / [time]^2
74 // The dimsnsion of f_perp is [weight] / [time];
75
76 void new_speed(void);
77 // Set new speed, direction and time for currpos.
78
79 mparticle(void) : gparticle(), mass(0.0) { ; }
80 mparticle(gparticle const& gp, double fmass); // dengerous,
81 // only not for very fast particles, since gamma-1 is computed from speed.
82 mparticle(gparticle const& gp, double fmass, double gamma_1);
83 // safe, but only current gamma_1 is given.
84 // It should be equal to origin one.
85 // The previous and the next speed should be zero.
86 // So this constructor is good when gparticle is in origin point.
87 // But gamma_1 should correspond to velocity given in gp.
88 // It is automatically checked.
89 // In the following constructor the length of velocity has no affect.
90 mparticle(manip_absvol* primvol, const point& pt, const vec& vel, vfloat time,
91 double fmass, double gamma_1);
92
93 virtual void print(std::ostream& file, int l) const;
95 virtual ~mparticle() { ; }
96};
97
98std::ostream& operator<<(std::ostream& file, const mparticle& f);
99
100}
101
102#endif
virtual void physics_after_new_speed(void)
Definition: mparticle.h:50
double orig_kin_energy
Definition: mparticle.h:27
macro_copy_total(gparticle)
void check_consistency(void) const
Definition: mparticle.cpp:81
double prev_kin_energy
Definition: mparticle.h:29
virtual int force(const point &pt, vec &f, vec &f_perp, vfloat &mrange)
Definition: mparticle.cpp:186
virtual void physics(void)
Definition: mparticle.h:54
double curr_kin_energy
Definition: mparticle.h:31
double mass
Mass (not mass * speed_of_light^2)
Definition: mparticle.h:25
virtual ~mparticle()
Definition: mparticle.h:95
virtual void print(std::ostream &file, int l) const
Definition: mparticle.cpp:308
double curr_gamma_1
Definition: mparticle.h:32
double prev_gamma_1
Definition: mparticle.h:30
virtual void step(void)
Definition: mparticle.cpp:115
double orig_gamma_1
Definition: mparticle.h:28
void new_speed(void)
Definition: mparticle.cpp:193
virtual void curvature(int &fs_cf, vec &frelcen, vfloat &fmrange, vfloat prec)
Definition: mparticle.cpp:143
mparticle(void)
Definition: mparticle.h:79
Definition: vec.h:477
Definition: vec.h:248
Definition: BGMesh.cpp:3
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:22
double vfloat
Definition: vfloat.h:15