1 | #ifndef BAREPARTICLE_SEEN |
---|
2 | #define BAREPARTICLE_SEEN |
---|
3 | |
---|
4 | #include <iostream> |
---|
5 | #include <sstream> |
---|
6 | |
---|
7 | #include <cmath> |
---|
8 | |
---|
9 | |
---|
10 | #include "mathematicalTools.h" |
---|
11 | |
---|
12 | using namespace std; |
---|
13 | |
---|
14 | class bareParticle |
---|
15 | { |
---|
16 | |
---|
17 | protected: |
---|
18 | |
---|
19 | TRIDVECTOR position_; |
---|
20 | TRIDVECTOR betagamma_; |
---|
21 | double gamma_; |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | protected: |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | public : |
---|
31 | |
---|
32 | bareParticle() {;} |
---|
33 | |
---|
34 | ~bareParticle() {;} |
---|
35 | |
---|
36 | inline bareParticle& operator = (const bareParticle& bp) |
---|
37 | { |
---|
38 | position_ = bp.position_; |
---|
39 | betagamma_ = bp.betagamma_; |
---|
40 | gamma_ = bp.gamma_; |
---|
41 | return *this; |
---|
42 | } |
---|
43 | |
---|
44 | bareParticle(const TRIDVECTOR& pos , const TRIDVECTOR& bg) |
---|
45 | { |
---|
46 | position_ = pos; |
---|
47 | betagamma_ = bg; |
---|
48 | gamma_ = sqrt( 1.0 + betagamma_.norm2() ); |
---|
49 | } |
---|
50 | |
---|
51 | inline void resetDynamics(const bareParticle& bp) |
---|
52 | { |
---|
53 | position_ = bp.position_; |
---|
54 | betagamma_ = bp.betagamma_; |
---|
55 | gamma_ = bp.gamma_; |
---|
56 | |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | inline const TRIDVECTOR& getReferenceToPosition() const |
---|
62 | { |
---|
63 | return position_; |
---|
64 | } |
---|
65 | |
---|
66 | inline TRIDVECTOR getPosition() const |
---|
67 | { |
---|
68 | return position_; |
---|
69 | } |
---|
70 | |
---|
71 | inline TRIDVECTOR& getReferenceToPosition() |
---|
72 | { |
---|
73 | return position_; |
---|
74 | } |
---|
75 | |
---|
76 | inline double getZ() const |
---|
77 | { |
---|
78 | return position_.getComponent(2); |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | inline void setZ(double z) |
---|
83 | { |
---|
84 | position_.setComponent(2, z); |
---|
85 | } |
---|
86 | |
---|
87 | inline void incrementZ( double dz) |
---|
88 | { |
---|
89 | position_.incrementComponent(2, dz); |
---|
90 | } |
---|
91 | |
---|
92 | inline void setX(double x) |
---|
93 | { |
---|
94 | position_.setComponent(0, x); |
---|
95 | } |
---|
96 | |
---|
97 | |
---|
98 | inline double getRadius() const |
---|
99 | { |
---|
100 | double auxx = position_.getComponent(0); |
---|
101 | double auxy = position_.getComponent(1); |
---|
102 | |
---|
103 | return sqrt(auxx * auxx + auxy * auxy); |
---|
104 | } |
---|
105 | |
---|
106 | |
---|
107 | inline TRIDVECTOR getBetaGamma() const |
---|
108 | { |
---|
109 | return betagamma_; |
---|
110 | } |
---|
111 | |
---|
112 | |
---|
113 | inline TRIDVECTOR& getReferenceToBetaGamma() |
---|
114 | { |
---|
115 | return betagamma_; |
---|
116 | } |
---|
117 | |
---|
118 | inline void setBetaGamma(const TRIDVECTOR& btg) |
---|
119 | { |
---|
120 | betagamma_ = btg; |
---|
121 | gamma_ = sqrt( 1.0 + betagamma_.norm2() ); |
---|
122 | } |
---|
123 | |
---|
124 | inline double getBetaz() const |
---|
125 | { |
---|
126 | return betagamma_.getComponent(2)/gamma_; |
---|
127 | } |
---|
128 | |
---|
129 | |
---|
130 | inline double getGamma() const |
---|
131 | { |
---|
132 | return gamma_; |
---|
133 | } |
---|
134 | |
---|
135 | |
---|
136 | void imprimer() const; |
---|
137 | |
---|
138 | |
---|
139 | inline string FileOutputFlow() const |
---|
140 | { |
---|
141 | ostringstream sortie; |
---|
142 | sortie << position_.output_flow() << betagamma_.output_flow() << " " << gamma_; |
---|
143 | return sortie.str(); |
---|
144 | } |
---|
145 | |
---|
146 | virtual inline bool FileInput( ifstream& ifs) |
---|
147 | { |
---|
148 | bool test = false; |
---|
149 | if ( position_.input_flow(ifs) && betagamma_.input_flow(ifs) ) |
---|
150 | { |
---|
151 | if ( ifs >> gamma_ ) |
---|
152 | { |
---|
153 | test = true; |
---|
154 | } |
---|
155 | } |
---|
156 | return test; |
---|
157 | } |
---|
158 | |
---|
159 | |
---|
160 | }; |
---|
161 | |
---|
162 | |
---|
163 | |
---|
164 | |
---|
165 | #endif |
---|