source: PSPA/Interface_Web/trunk/pspaWT/sources/controler/src/bareParticle.cc @ 442

Last change on this file since 442 was 442, checked in by lemeur, 10 years ago

ajout traitement utilisateur

File size: 2.8 KB
Line 
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
39const TRIDVECTOR&  bareParticle::getReferenceToPosition() const
40  {
41    return position_;
42  }
43
44TRIDVECTOR  bareParticle::getPosition() const
45  {
46    return position_;
47  }
48
49 TRIDVECTOR&  bareParticle::getReferenceToPosition() 
50  {
51    return position_;
52  }
53
54double  bareParticle::getZ() const
55  {
56    return position_.getComponent(2);
57  }
58
59
60void  bareParticle::setZ(double z) 
61  {
62    position_.setComponent(2, z);
63  }
64
65void  bareParticle::incrementZ( double dz) 
66  {
67    position_.incrementComponent(2, dz);
68  }
69
70void  bareParticle::setX(double x) 
71  {
72    position_.setComponent(0, x);
73  }
74
75
76double  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
85TRIDVECTOR  bareParticle::getBetaGamma() const
86  {
87    return betagamma_;
88  }
89
90
91TRIDVECTOR&  bareParticle::getReferenceToBetaGamma() 
92  {
93    return betagamma_;
94  }
95 
96void  bareParticle::setBetaGamma(const TRIDVECTOR& btg) 
97  {
98    betagamma_ = btg;
99     gamma_ = sqrt( 1.0 + betagamma_.norm2() );
100  }
101
102double  bareParticle::getBetaz() const
103  {
104    return betagamma_.getComponent(2)/gamma_;
105  }
106
107
108double  bareParticle::getGamma() const 
109  {
110    return gamma_;
111  }
112
113string bareParticle::FileOutputFlow() const
114  {
115    ostringstream sortie;
116    sortie << position_.output_flow()  << betagamma_.output_flow() << " " <<  gamma_;
117    return sortie.str();
118  }
119
120
121bool bareParticle::FileInput( ifstream& ifs)
122 {
123    bool test = false;
124    if ( position_.input_flow(ifs) && betagamma_.input_flow(ifs) )
125      { 
126        if (  ifs >> gamma_ ) 
127          {
128            test = true;
129          }
130      } 
131    return test;
132 }
133
134
135
136  void bareParticle::imprimer() const 
137  {
138    cout << " ---- impression particule nue ----- " << endl;
139    cout << " position : " << endl;
140    position_.print();
141    cout << " betas : " << endl;
142    TRIDVECTOR betas;
143    double fac = 1.0/gamma_;
144    betas = betagamma_ * fac;
145    betas.print();
146    cout << " gamma = " << gamma_  << endl;
147  }
Note: See TracBrowser for help on using the repository browser.