00001
00002
00003
00004
00005
00006
00007
00009 #include "Swimmer/SwimParticle.h"
00010 #include "TMath.h"
00011
00012
00013
00014 SwimParticle::SwimParticle(const TVector3 position,
00015 const TVector3 momentum,
00016 double mass,
00017 double charge) :
00018 fInitPosition(position),
00019 fPosition(position),
00020 fMomentum(momentum),
00021 fMass(mass),
00022 fCharge(charge),
00023 fS(0),
00024 fRange(0),
00025 fVxB(0)
00026 {}
00027
00028
00029
00030 const TVector3 SwimParticle::GetInitPosition() const
00031 {
00032 return fInitPosition;
00033 }
00034
00035
00036
00037 const TVector3 SwimParticle::GetPosition() const
00038 {
00039 return fPosition;
00040 }
00041
00042
00043
00044 const TVector3 SwimParticle::GetMomentum() const
00045 {
00046 return fMomentum;
00047 }
00048
00049
00050
00051 TVector3 SwimParticle::GetDirection() const
00052 {
00053 double modulus = SwimParticle::GetMomentumModulus();
00054 if (modulus!=0.0)
00055 return TVector3(fMomentum.X()/modulus,
00056 fMomentum.Y()/modulus,
00057 fMomentum.Z()/modulus);
00058 else return TVector3(0.0,0.0,0.0);
00059 }
00060
00061
00062
00063 double SwimParticle::GetMomentumModulus() const
00064 {
00065 return TMath::Sqrt(fMomentum.X()*fMomentum.X()
00066 + fMomentum.Y()*fMomentum.Y()
00067 + fMomentum.Z()*fMomentum.Z());
00068 }
00069
00070
00071
00072 double SwimParticle::GetEnergy() const
00073 {
00074 double momentumSqr = fMomentum.X()*fMomentum.X()
00075 + fMomentum.Y()*fMomentum.Y()
00076 + fMomentum.Z()*fMomentum.Z();
00077 return TMath::Sqrt(fMass*fMass+momentumSqr);
00078 }
00079
00080
00081
00082 double SwimParticle::GetMass() const
00083 {
00084 return fMass;
00085 }
00086
00087
00088
00089 double SwimParticle::GetCharge() const
00090 {
00091 return fCharge;
00092 }
00093
00094
00095
00096 double SwimParticle::GetS() const
00097 {
00098 return fS;
00099 }
00100
00101
00102
00103 double SwimParticle::GetRange() const
00104 {
00105 return fRange;
00106 }
00107
00108
00109
00110 double SwimParticle::GetVxB() const
00111 {
00112 return fVxB;
00113 }
00114
00115
00116
00117 void SwimParticle::SetPosition(const TVector3 position)
00118 {
00119 fPosition = position;
00120 }
00121
00122
00123
00124 void SwimParticle::SetMomentum(const TVector3 momentum)
00125 {
00126 fMomentum = momentum;
00127 }
00128
00129
00130
00131 void SwimParticle::SetMass(double mass)
00132 {
00133 fMass = mass;
00134 }
00135
00136
00137
00138 void SwimParticle::SetCharge(double charge)
00139 {
00140 fCharge = charge;
00141 }
00142
00143
00144
00145 void SwimParticle::AddS(double s)
00146 {
00147 fS += s;
00148 }
00149
00150
00151
00152 void SwimParticle::AddRange(double range)
00153 {
00154 fRange += range;
00155 }
00156
00157 void SwimParticle::AddVxB(double VxB)
00158 {
00159 fVxB += VxB;
00160 }
00161