10#include "FemtoImaging3D.h"
19#include "FemtoConst.h"
23 FemtoImaging3D::FemtoImaging3D() :
24 fQMax {1.0, 1.0, 1.0},
29 fKinematics(Femto::EKinematics::kLCMS),
36 void FemtoImaging3D::Init() {
37 TH3* CF = (TH3*) fCF->GetHist(kTRUE);
38 Double_t min_x = CF->GetXaxis()->GetBinLowEdge(1);
39 Double_t max_x = CF->GetXaxis()->GetBinUpEdge(CF->GetNbinsX());
40 Double_t bins_x = CF->GetNbinsX();
41 Double_t min_y = CF->GetYaxis()->GetBinLowEdge(1);
42 Double_t max_y = CF->GetYaxis()->GetBinUpEdge(CF->GetNbinsY());
43 Double_t bins_y = CF->GetNbinsY();
44 Double_t min_z = CF->GetZaxis()->GetBinLowEdge(1);
45 Double_t max_z = CF->GetZaxis()->GetBinUpEdge(CF->GetNbinsZ());
46 Double_t bins_z = CF->GetNbinsZ();
47 fR =
new TH3D(
"R",
"R", bins_x, min_x, max_x, bins_y, min_y, max_y, bins_z, min_z, max_z);
48 for (
int i = 1; i <= bins_x; i++) {
49 for (
int j = 1; j <= bins_y; j++) {
50 for (
int k = 1; k <= bins_z; k++) {
51 fR->SetBinContent(i, j, k, CF->GetBinContent(i, j, k) - 1.0);
52 if (CF->GetBinContent(i, j, k) != 0) {
53 fR->SetBinError(i, j, k, CF->GetBinError(i, j, k) * fR->GetBinContent(i, j, k) / CF->GetBinContent(i, j, k));
60 new TH3D(
"Source",
"Source", fBins[0], fRMin[0], fRMax[0], fBins[1], fRMin[1], fRMax[1], fBins[2], fRMin[2], fRMax[2]);
61 if (fCF->GetFrame() == Femto::EKinematics::kPRF) {
62 fSource->GetXaxis()->SetTitle(
"r*_{out}");
63 fSource->GetYaxis()->SetTitle(
"r*_{side}");
64 fSource->GetZaxis()->SetTitle(
"r*_{long}");
65 fKinematics = Femto::EKinematics::kPRF;
66 }
else if (fCF->GetFrame() == Femto::EKinematics::kLCMS) {
67 Cout::PrintInfo(
"Imaging doesn't work for LCMS ", EInfo::kWarning);
69 fSource->GetXaxis()->SetTitle(
"r_{out}");
70 fSource->GetYaxis()->SetTitle(
"r_{side}");
71 fSource->GetZaxis()->SetTitle(
"r_{long}");
72 fKinematics = Femto::EKinematics::kLCMS;
76 void FemtoImaging3D::InverseTransofrm(Option_t* opt) {
79 if (option.EqualTo(
"fast")) fast = kTRUE;
80 Int_t zeroX = fSource->GetXaxis()->FindBin(0.0);
81 Int_t zeroY = fSource->GetYaxis()->FindBin(0.0);
82 Int_t zeroZ = fSource->GetZaxis()->FindBin(0.0);
83 Int_t isZeroX, isZeroY, isZeroZ;
85 for (
int i = 1; i <= fSource->GetNbinsX(); i++) {
86 Double_t rx = fSource->GetXaxis()->GetBinCenter(i) * Femto::FmToGeV();
92 for (
int j = 1; j <= fSource->GetNbinsY(); j++) {
93 Double_t ry = fSource->GetYaxis()->GetBinCenter(j) * Femto::FmToGeV();
99 for (
int k = 1; k <= fSource->GetNbinsZ(); k++) {
106 if ((isZeroX + isZeroY + isZeroZ) < 2) {
continue; }
109 Double_t rz = fSource->GetZaxis()->GetBinCenter(k) * Femto::FmToGeV();
112 Double_t errors = 0.0;
114 for (
int a = fR->GetXaxis()->FindBin(fQMin[0]); a <= fR->GetXaxis()->FindBin(fQMax[0]); a++) {
115 Double_t qx = fR->GetXaxis()->GetBinCenter(a);
116 Double_t QX = qx * rx;
117 for (
int b = fR->GetYaxis()->FindBin(fQMin[1]); b <= fR->GetYaxis()->FindBin(fQMax[1]); b++) {
118 Double_t qy = fR->GetYaxis()->GetBinCenter(b);
119 Double_t QY = qy * ry;
120 for (
int c = fR->GetZaxis()->FindBin(fQMin[2]); c <= fR->GetZaxis()->FindBin(fQMax[2]); c++) {
121 Double_t qz = fR->GetZaxis()->GetBinCenter(c);
122 Double_t QZ = qz * rz;
123 Double_t R = fR->GetBinContent(a, b, c);
124 if (R == 0)
continue;
125 Double_t dR = fR->GetBinError(a, b, c);
126 Double_t integral = TMath::Cos(2.0 * (QX + QY + QZ));
128 errors = dR * integral;
133 Double_t ex = rx * fR->GetXaxis()->GetBinWidth(1);
134 Double_t ey = ry * fR->GetYaxis()->GetBinWidth(1);
135 Double_t ez = rz * fR->GetZaxis()->GetBinWidth(1);
136 if (sum < 0) { sum = 0; }
137 Double_t dFourierX = (0.05 + ex * 0.22 + ex * ex + 0.084) * sum;
138 Double_t dFourierY = (0.05 + ey * 0.22 + ey * ey + 0.084) * sum;
139 Double_t dFourierZ = (0.05 + ez * 0.22 + ez * ez + 0.084) * sum;
141 errors = TMath::Sqrt(errors * errors + dFourierX * dFourierX + dFourierY * dFourierY + dFourierZ * dFourierZ);
142 fSource->SetBinContent(i, j, k, sum);
143 fSource->SetBinError(i, j, k, errors);
146 Cout::ProgressBar(i, fSource->GetNbinsX());
151 TH3D* FemtoImaging3D::Inverse(
Femto3DCF* cf, Option_t* opt) {
154 InverseTransofrm(opt);
155 Double_t norm = fSource->Integral(1, fSource->GetNbinsX(), 1, fSource->GetNbinsY(), 1, fSource->GetNbinsZ(),
"width");
156 fSource->Scale(1.0 / norm);
157 TH3D* histo = (TH3D*) fSource->Clone();
161 void FemtoImaging3D::SetRAxis(Int_t bins, Double_t min, Double_t max, Option_t* opt) {
165 }
else if (opt[0] ==
'y') {
167 }
else if (opt[0] ==
'z') {
172 fBins[option] = bins;
177 void FemtoImaging3D::SetQMax(Double_t qmax, Option_t* opt) {
181 }
else if (opt[0] ==
'y') {
183 }
else if (opt[0] ==
'z') {
188 fQMax[option] = qmax;
191 void FemtoImaging3D::SetQMin(Double_t qmin, Option_t* opt) {
195 }
else if (opt[0] ==
'y') {
197 }
else if (opt[0] ==
'z') {
202 fQMin[option] = qmin;
205 FemtoImaging3D::~FemtoImaging3D() {