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