Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
FemtoSourceModelGauss.cxx
1/*
2 * FemtoSourceModelGaus.cxx
3 *
4 * Created on: 1 mar 2019
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "FemtoSourceModelGauss.h"
11
12#include "Const.h"
13#include "Cout.h"
14
15#include <TDecompChol.h>
16#include <TMath.h>
17#include <TMatrix.h>
18#include <TRandom.h>
19
20namespace Hal {
21 FemtoSourceModelGauss1D::FemtoSourceModelGauss1D() : FemtoSourceModel1D() {
22 fModelName = "gaus1d";
23 fDensity = new FemtoSourceDensityGaus1d();
24 }
25
26 FemtoSourceModelGauss1D::FemtoSourceModelGauss1D(const FemtoSourceModelGauss1D& model) : FemtoSourceModel1D(model) {}
27
29
31 fRout = fRandom->Gaus(0, GetParameter(0) * TMath::Sqrt2());
32 fRside = fRandom->Gaus(0, GetParameter(0) * TMath::Sqrt2());
33 fRlong = fRandom->Gaus(0, GetParameter(0) * TMath::Sqrt2());
34 }
35
36 FemtoSourceModelGauss1D::~FemtoSourceModelGauss1D() {}
37
38 //=========================== 3D ====================
39
44
46 fRout = fRandom->Gaus(0, GetParameter(0) * TMath::Sqrt2());
47 fRside = fRandom->Gaus(0, GetParameter(1) * TMath::Sqrt2());
48 fRlong = fRandom->Gaus(0, GetParameter(2) * TMath::Sqrt2());
49#ifdef _kinetic_debug
50 std::cout << "radii " << fRout << " " << fRside << " " << fRlong << std::endl;
51#endif
52 }
53
55
57
58 FemtoSourceModelGauss3D::~FemtoSourceModelGauss3D() {}
59
60 //=================================================
61
62 FemtoSourceDensityGaus1d::FemtoSourceDensityGaus1d() : FemtoSourceDensity(1, kTRUE, kTRUE) {}
63
64 Double_t FemtoSourceDensityGaus1d::GetProbDensity1d(const Double_t r, const Double_t* params) const {
65 if (r < 0) return 0;
66 Double_t u = params[0];
67 const Double_t Norm = 2. * Const::SqrtPi() * u * u * u; // TMath::Power(u * u, 1.5);
68 return TMath::Exp(-r * r / (4.0 * u * u)) / Norm * r * r;
69 }
70
71 Double_t FemtoSourceDensityGaus1d::GetProbDensity3d(const TVector3& vec, const Double_t* params) const {
72 const Double_t sxsysz = params[0] * params[0] * params[0];
73 const Double_t Gx = TMath::Gaus(vec.X(), 0, params[0] * TMath::Sqrt2());
74 const Double_t Gy = TMath::Gaus(vec.Y(), 0, params[0] * TMath::Sqrt2());
75 const Double_t Gz = TMath::Gaus(vec.Z(), 0, params[0] * TMath::Sqrt2());
76 return 0.02244839026564582 / sxsysz * Gx * Gy * Gz;
77 }
78
79 //=================================================
80 FemtoSourceDensityGaus3d::FemtoSourceDensityGaus3d() : FemtoSourceDensity(3, kTRUE, kTRUE) {}
81
82 Double_t FemtoSourceDensityGaus3d::GetProbDensity1d(const Double_t r, const Double_t* params) const {
83 if (r < 0) return 0;
84 Double_t u = TMath::Power(params[0] * params[1] * params[2], 1.0 / 3.0);
85 const Double_t Norm = 2. * Const::SqrtPi() * u * u * u; // TMath::Power(u * u, 1.5);
86 return TMath::Exp(-r * r / (4.0 * u * u)) / Norm * r * r;
87 }
88
89 Double_t FemtoSourceDensityGaus3d::GetProbDensity3d(const TVector3& vec, const Double_t* params) const {
90 const Double_t sxsysz = params[0] * params[1] * params[2]; // sqt?
91 const Double_t Gx = TMath::Gaus(vec.X(), 0, params[0] * TMath::Sqrt2());
92 const Double_t Gy = TMath::Gaus(vec.Y(), 0, params[1] * TMath::Sqrt2());
93 const Double_t Gz = TMath::Gaus(vec.Z(), 0, params[2] * TMath::Sqrt2());
94 return 0.02244839026564582 / sxsysz * Gx * Gy * Gz;
95 }
96
97 //=================================================
99 SetParameter(3, 1);
100 SetParameter(4, 0);
101 SetParameter(5, 0);
102 SetParName(3, "R_{out-side}");
103 SetParName(4, "R_{out-long}");
104 SetParName(5, "R_{side-long}");
105 }
106
108 FemtoSourceModel3D(model), fAMatrix(3, 3), fCovMatrix(3, 3) {
109 fAMatrix = model.fAMatrix;
110 fCovMatrix = model.fCovMatrix;
111 for (int i = 0; i < 3; i++) {
112 fRowX[i] = model.fRowX[i];
113 fRowY[i] = model.fRowY[i];
114 fRowZ[i] = model.fRowZ[i];
115 }
116 }
117
119
121 // fRout = fRandom->Gaus(0, GetParameter(0) * TMath::Sqrt2());
122 // fRside = fRandom->Gaus(0, GetParameter(1) * TMath::Sqrt2());
123 // fRlong = fRandom->Gaus(0, GetParameter(2) * TMath::Sqrt2());
124 Double_t Z1 = fRandom->Gaus(0, TMath::Sqrt2());
125 Double_t Z2 = fRandom->Gaus(0, TMath::Sqrt2());
126 Double_t Z3 = fRandom->Gaus(0, TMath::Sqrt2());
127 // Double_t Z1 = fRandom->Gaus(0, 1);
128 // Double_t Z2 = fRandom->Gaus(0, 1);
129 // Double_t Z3 = fRandom->Gaus(0, 1);
130 // option 1
131 fRout = Z1 * fRowX[0] + Z2 * fRowX[1] + Z3 * fRowX[2];
132 fRside = Z1 * fRowY[0] + Z2 * fRowY[1] + Z3 * fRowY[2];
133 fRlong = Z1 * fRowZ[0] + Z2 * fRowZ[1] + Z3 * fRowZ[2];
134 // option 2
135 }
136
138 TMatrixD sigma(3, 3);
139 sigma[0][0] = GetParameter(0); // out out
140 sigma[0][1] = GetOutSide(); // out side
141 sigma[0][2] = GetOutLong();
142 sigma[1][0] = GetOutSide();
143 sigma[1][1] = GetParameter(1);
144 sigma[1][2] = GetSideLong();
145 sigma[2][0] = GetOutLong();
146 sigma[2][1] = GetSideLong();
147 sigma[2][2] = GetParameter(2);
148 for (int i = 0; i < 3; i++) {
149 for (int j = 0; j < 3; j++) {
150 sigma[i][j] = sigma[i][j] * sigma[i][j];
151 }
152 }
157 TDecompChol chol(sigma);
158 Bool_t decomposed = chol.Decompose();
159 if (!decomposed) {
160 Hal::Cout::PrintInfo("Cannot decompose matrix in FemtoSourceModelGauss3DCross", Hal::EInfo::kError);
161 return kFALSE;
162 }
163 auto m = chol.GetU();
164 m.Transpose(m);
165 m.Print();
166
167 for (int i = 0; i < 3; i++) {
168 fRowX[i] = m[0][i];
169 fRowY[i] = m[1][i];
170 fRowZ[i] = m[2][i];
171 }
172 return kFALSE;
173 }
174
175} // namespace Hal
static void PrintInfo(TString text, Hal::EInfo status)
Definition Cout.cxx:370
Double_t GetProbDensity1d(const Double_t r, const Double_t *params) const
Double_t GetProbDensity3d(const TVector3 &vec, const Double_t *params) const
Double_t GetProbDensity3d(const TVector3 &vec, const Double_t *params) const
Double_t GetProbDensity1d(const Double_t r, const Double_t *params) const
FemtoSourceModel * MakeCopy() const
void GenerateCoordinates(FemtoPair *Pair)
FemtoSourceModel * MakeCopy() const
void GenerateCoordinates(FemtoPair *Pair)
void SetParameter(Int_t par_no, Double_t par_val)
Double_t GetParameter(Int_t n) const
FemtoSourceDensity * fDensity