Garfield++ v2r0
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/*
8Copyright (c) 2000 Igor B. Smirnov
9
10The file can be used, copied, modified, and distributed
11according to the terms of GNU Lesser General Public License version 2.1
12as published by the Free Software Foundation,
13and provided that the above copyright notice, this permission notice,
14and notices about any modifications of the original text
15appear in all copies and in supporting documentation.
16The file is provided "as is" without express or implied warranty.
17 */
18
19namespace Heed {
20
21/// Massive particle. A force can be applied.
22
23class mparticle : public gparticle {
24 public:
25 /// Mass (not mass * speed_of_light^2)
26 double mass;
27
29 double orig_gamma_1; // gamma-1
31 double prev_gamma_1; // gamma-1
33 double curr_gamma_1; // gamma-1
34
35 /// Check consistency of kin_energy, gamma_1, speed, speed_of_light and mass.
36 void check_consistency() const;
37
38 virtual void step(std::vector<gparticle*>& secondaries);
39
40 /// Set curvature. Calls force().
41 /// If force is zero, returns fs_cf=0; frelcen=dv0;
42 /// If force is zero, and currpos.dir==dv0, makes, in addition, fmrange=0;
43 /// If currpos.dir==dv0, makes currpos.dir=unit_vec(f);
44 /// If force is parallel or anti-parallel to dir, makes fs_cf=0; frelcen=dv0;
45 /// If force is anti-parallel to dir, restricts range till exceeding
46 /// kinetic energy.
47 virtual void curvature(int& fs_cf, vec& frelcen, vfloat& fmrange,
48 vfloat prec);
49
50 /// The force is considered to be split in two components.
51 /// One component, namely f, can be in any direction and is
52 /// capable of doing work. The other one is always normal to dir
53 /// and cannot do work. The latter can represent the magnetic component of
54 /// the Lorentz force.
55 /// This splitting improve precision of calculation of kinetic energy.
56 /// But the latter component is not the true force. To derive the force
57 /// one should do vector multiplication of speed by f_perp,
58 /// f_perp2 = currpos.speed * (currpos.dir || f_perp_fl2);
59 /// Return 0 if there is no force, f is initialised to zero anyway.
60 /// mrange is the distance at which the force should not change much.
61 /// The dimension of f is [weight] * [lenght] / [time]^2
62 /// The dimension of f_perp is [weight] / [time];
63 virtual int force(const point& pt, vec& f, vec& f_perp, vfloat& mrange);
64
65 /// Set new speed, direction and time for currpos.
66 void new_speed();
67
68 /// Default constructor.
69 mparticle() : gparticle(), mass(0.0) {}
70 /// Constructor, \f$\gamma - 1\f$ calculated from the from velocity vector.
71 mparticle(manip_absvol* primvol, const point& pt, const vec& vel, vfloat time,
72 double fmass);
73
74 virtual void print(std::ostream& file, int l) const;
75 virtual mparticle* copy() const { return new mparticle(*this); }
76 /// Destructor.
77 virtual ~mparticle() {}
78};
79
80std::ostream& operator<<(std::ostream& file, const mparticle& f);
81}
82
83#endif
Abstract base classs for volume "manipulators".
Definition: volume.h:178
Massive particle. A force can be applied.
Definition: mparticle.h:23
double orig_kin_energy
Definition: mparticle.h:28
double prev_kin_energy
Definition: mparticle.h:30
void check_consistency() const
Check consistency of kin_energy, gamma_1, speed, speed_of_light and mass.
Definition: mparticle.cpp:36
mparticle()
Default constructor.
Definition: mparticle.h:69
virtual int force(const point &pt, vec &f, vec &f_perp, vfloat &mrange)
Definition: mparticle.cpp:138
virtual void step(std::vector< gparticle * > &secondaries)
Definition: mparticle.cpp:68
double curr_kin_energy
Definition: mparticle.h:32
double mass
Mass (not mass * speed_of_light^2)
Definition: mparticle.h:26
virtual ~mparticle()
Destructor.
Definition: mparticle.h:77
virtual void print(std::ostream &file, int l) const
Definition: mparticle.cpp:242
double curr_gamma_1
Definition: mparticle.h:33
double prev_gamma_1
Definition: mparticle.h:31
virtual mparticle * copy() const
Definition: mparticle.h:75
double orig_gamma_1
Definition: mparticle.h:29
virtual void curvature(int &fs_cf, vec &frelcen, vfloat &fmrange, vfloat prec)
Definition: mparticle.cpp:96
void new_speed()
Set new speed, direction and time for currpos.
Definition: mparticle.cpp:145
Point.
Definition: vec.h:374
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