KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVCoulombPropagator.cpp
1//Created by KVClassFactory on Mon May 30 12:55:36 2016
2//Author: John Frankland,,,
3
4#include "KVCoulombPropagator.h"
5
6#include <KVSimNucleus.h>
7
9
10
11
12
13void KVCoulombPropagator::updateEvent()
14{
15 for (int i = 1; i <= fMult; ++i) {
16 static_cast<KVSimNucleus*>(theEvent->GetParticle(i))->SetPosition(
17 y[particle_position_offset(i)],
18 y[particle_position_offset(i) + 1],
19 y[particle_position_offset(i) + 2]
20 );
21 static_cast<KVSimNucleus*>(theEvent->GetParticle(i))->SetVelocity(
22 TVector3(KVNucleus::C()*y[particle_velocity_offset(i)],
23 KVNucleus::C()*y[particle_velocity_offset(i) + 1],
24 KVNucleus::C()*y[particle_velocity_offset(i) + 2])
25 );
26 }
27}
28
29
30
35
37 : KVRungeKutta(e->GetMult() * 6, precision), theEvent(e), fMult(e->GetMult())
38{
39 // Initialise Coulomb propagation of event
40
41 // y[0],y[1],y[2]: position of first particle (x,y,z)
42 // y[3*fMult], y[3*fMult+1], y[3*fMult+2]: velocity of first particle (vx,vy,vz)
43
44 for (int i = 1; i <= fMult; ++i) {
45 for (int j = 0; j < 3; ++j) {
46 y[particle_position_offset(i) + j] = static_cast<KVSimNucleus*>(e->GetParticle(i))->GetPosition()[j];
47 y[particle_velocity_offset(i) + j] = static_cast<KVSimNucleus*>(e->GetParticle(i))->GetVelocity()[j] / KVNucleus::C();
48 }
49 }
50}
51
52
53
54
57
62
63
64
66
68{
69
70 for (int i = 1; i <= fMult; ++i) {
71 for (int j = 0; j < 3; ++j) {
73 DYDX[particle_velocity_offset(i) + j] = 0;
74 }
75 }
76 for (int i = 1; i < fMult; ++i) {
77 KVSimNucleus* Ni = static_cast<KVSimNucleus*>(theEvent->GetParticle(i));
78
79 for (int j = i + 1; j <= fMult; ++j) {
80 KVSimNucleus* Nj = static_cast<KVSimNucleus*>(theEvent->GetParticle(j));
84 TVector3 rij = Rij.Unit();
85 Double_t F = Ni->GetZ() * Nj->GetZ() * KVNucleus::e2 / Rij.Mag2();
86 TVector3 Fij = F * rij;
87 Double_t mi = Ni->GetMass();
88 Double_t mj = Nj->GetMass();
89
90 for (int k = 0; k < 3; ++k) {
91 DYDX[particle_velocity_offset(i) + k] += Fij[k] / mi;
92 DYDX[particle_velocity_offset(j) + k] -= Fij[k] / mj;
93 }
94 }
95 }
96}
97
98
99
101
103{
104 Double_t etot = 0;
105 for (int i = 1; i < fMult; ++i) {
106 KVSimNucleus* Ni = static_cast<KVSimNucleus*>(theEvent->GetParticle(i));
107
108 for (int j = i + 1; j <= fMult; ++j) {
109 KVSimNucleus* Nj = static_cast<KVSimNucleus*>(theEvent->GetParticle(j));
110 TVector3 Rij = Ni->GetPosition() - Nj->GetPosition();
111 Double_t U = Ni->GetZ() * Nj->GetZ() * KVNucleus::e2 / Rij.Mag();
112
113 etot += U;
114 }
115 }
116 return etot;
117}
118
119
120
122
124{
125 Integrate(y, 0, maxTime, 1.);
126 updateEvent();
127}
128
129
130//____________________________________________________________________________//
131
132
#define e(i)
double Double_t
Perform Coulomb propagation of events.
virtual ~KVCoulombPropagator()
Destructor.
void Propagate(int maxTime)
Int_t particle_position_offset(Int_t i)
KVCoulombPropagator(KVSimEvent *, Double_t precision=1.e-9)
Double_t TotalPotentialEnergy() const
Int_t particle_velocity_offset(Int_t i)
void CalcDerivs(Double_t, Double_t *Y, Double_t *DYDX)
static Double_t e2
e^2/(4.pi.epsilon_0) in MeV.fm
Definition KVNucleus.h:174
Int_t GetZ() const
Return the number of proton / atomic number.
static Double_t C()
Double_t GetMass() const
Definition KVParticle.h:574
Adaptive step-size 4th order Runge-Kutta ODE integrator from Numerical Recipes.
virtual void Integrate(Double_t *ystart, Double_t x1, Double_t x2, Double_t h1)
Double_t * y
Container class for simulated nuclei, KVSimNucleus.
Definition KVSimEvent.h:22
Nucleus in a simulated event.
const TVector3 * GetPosition() const
Particle * GetParticle(Int_t npart) const
Double_t Mag2() const
TVector3 Unit() const
Double_t Mag() const
Double_t y[n]
#define F(x, y, z)
ClassImp(TPyArg)