9#include "CorrFitVerticalSlices.h"
22 void CorrFitVerticalSlices1D::FillNum(Int_t bin, FemtoPair* pair) { fNum[bin] += pair->GetWeight(); }
24 void CorrFitVerticalSlices1D::FillDen(Int_t bin, FemtoPair* pair) { fDen[bin] += pair->GetWeight(); }
26 void CorrFitVerticalSlices3D::FillNum(Int_t bin, FemtoPair* pair) {
30 void CorrFitVerticalSlices3D::FillDen(Int_t bin, FemtoPair* pair) {
34 void CorrFitVerticalSlicesSH::FillNum(Int_t bin, FemtoPair* pair) {
35 std::complex<double>* YlmBuffer = fLmMath.YlmUpToL(fLmVals.
GetMaxL(), pair->GetX(), pair->GetY(), pair->GetZ());
36 for (
int ilm = 0; ilm < fMaxJM; ilm++) {
37 Double_t wRe = real(YlmBuffer[ilm]) * pair->GetWeight();
38 Double_t wIm = imag(YlmBuffer[ilm]) * pair->GetWeight();
39 fShNumReal[bin][ilm] += wRe;
40 fShNumImag[bin][ilm] -= wIm;
41 fShNumRealE[bin][ilm] += wRe * wRe;
42 fShNumImagE[bin][ilm] += wIm * wIm;
43 fNum[bin] += pair->GetWeight();
47 void CorrFitVerticalSlicesSH::FillDen(Int_t bin, FemtoPair* pair) {
48 std::complex<double>* YlmBuffer = fLmMath.YlmUpToL(fLmVals.
GetMaxL(), pair->GetX(), pair->GetY(), pair->GetZ());
49 for (
int ilm = 0; ilm < fMaxJM; ilm++) {
50 Double_t wRe = real(YlmBuffer[ilm]) * pair->GetWeight();
51 Double_t wIm = imag(YlmBuffer[ilm]) * pair->GetWeight();
52 fShDenReal[bin][ilm] += wRe;
53 fShDenImag[bin][ilm] -= wIm;
54 fShDenRealE[bin][ilm] += wRe * wRe;
55 fShDenImagE[bin][ilm] += wIm * wIm;
56 fDen[bin] += pair->GetWeight();
60 void CorrFitVerticalSlicesSH::FillNumBuffer(std::complex<double>* shCoord, Double_t weight, Int_t paramBin) {
61 for (
int ilm = 0; ilm < fMaxJM; ilm++) {
62 Double_t wRe = real(shCoord[ilm]) * weight;
63 Double_t wIm = imag(shCoord[ilm]) * weight;
64 fShNumReal[paramBin][ilm] += wRe;
65 fShNumImag[paramBin][ilm] -= wIm;
66 fShNumRealE[paramBin][ilm] += wRe * wRe;
67 fShNumImagE[paramBin][ilm] += wIm * wIm;
68 fNum[paramBin] += weight;
70 Double_t weight2 = weight * weight;
71 for (
int ilmzero = 0; ilmzero < fMaxJM; ilmzero++) {
72 const int twoilmzero = ilmzero * 2;
73 for (
int ilmprim = 0; ilmprim < fMaxJM; ilmprim++) {
74 const int twoilmprim = ilmprim * 2;
75 fCovMatrix[paramBin][twoilmzero][twoilmprim] += real(shCoord[ilmzero]) * real(shCoord[ilmprim]) * weight2;
76 fCovMatrix[paramBin][twoilmzero][twoilmprim + 1] += real(shCoord[ilmzero]) * -imag(shCoord[ilmprim]) * weight2;
77 fCovMatrix[paramBin][twoilmzero + 1][twoilmprim] -= imag(shCoord[ilmzero]) * real(shCoord[ilmprim]) * weight2;
78 fCovMatrix[paramBin][twoilmzero + 1][twoilmprim + 1] -= imag(shCoord[ilmzero]) * -imag(shCoord[ilmprim]) * weight2;
82 void CorrFitVerticalSlicesSH::FillDenBuffer(std::complex<double>* shCoord, Double_t weight, Int_t paramBin) {
83 for (
int ilm = 0; ilm < fMaxJM; ilm++) {
84 Double_t wRe = real(shCoord[ilm]) * weight;
85 Double_t wIm = imag(shCoord[ilm]) * weight;
86 fShDenReal[paramBin][ilm] += wRe;
87 fShDenImag[paramBin][ilm] -= wIm;
88 fShDenRealE[paramBin][ilm] += wRe * wRe;
89 fShDenImagE[paramBin][ilm] += wIm * wIm;
90 fDen[paramBin] += weight;
94 void CorrFitVerticalSlicesSH::FillNumBuffer10(std::complex<double>* shCoord, std::vector<Double_t>& weight, Int_t paramBin) {
95 for (
int ilm = 0; ilm < fMaxJM; ilm++) {
96 for (
auto w : weight) {
97 Double_t wRe = real(shCoord[ilm]) * w;
98 Double_t wIm = imag(shCoord[ilm]) * w;
99 fShNumReal[paramBin][ilm] += wRe;
100 fShNumImag[paramBin][ilm] -= wIm;
101 fShNumRealE[paramBin][ilm] += wRe * wRe;
102 fShNumImagE[paramBin][ilm] += wIm * wIm;
106 for (
int ilmzero = 0; ilmzero < fMaxJM; ilmzero++) {
107 const int twoilmzero = ilmzero * 2;
108 for (
int ilmprim = 0; ilmprim < fMaxJM; ilmprim++) {
109 const int twoilmprim = ilmprim * 2;
110 for (
auto w : weight) {
112 fCovMatrix[paramBin][twoilmzero][twoilmprim] += real(shCoord[ilmzero]) * real(shCoord[ilmprim]) * w2;
113 fCovMatrix[paramBin][twoilmzero][twoilmprim + 1] += real(shCoord[ilmzero]) * -imag(shCoord[ilmprim]) * w2;
114 fCovMatrix[paramBin][twoilmzero + 1][twoilmprim] -= imag(shCoord[ilmzero]) * real(shCoord[ilmprim]) * w2;
115 fCovMatrix[paramBin][twoilmzero + 1][twoilmprim + 1] -= imag(shCoord[ilmzero]) * -imag(shCoord[ilmprim]) * w2;
121 void CorrFitVerticalSlicesSH::FillDenBuffer10(std::complex<double>* shCoord, std::vector<Double_t>& weight, Int_t paramBin) {
122 for (
int ilm = 0; ilm < fMaxJM; ilm++) {
123 for (
auto w : weight) {
124 Double_t wRe = real(shCoord[ilm]) * w;
125 Double_t wIm = imag(shCoord[ilm]) * w;
126 fShDenReal[paramBin][ilm] += wRe;
127 fShDenImag[paramBin][ilm] -= wIm;
128 fShDenRealE[paramBin][ilm] += wRe * wRe;
129 fShDenImagE[paramBin][ilm] += wIm * wIm;
135 std::complex<double>* CorrFitVerticalSlicesSH::GetBufferCalc(FemtoPair* pair) {
136 return fLmMath.YlmUpToL(fLmVals.
GetMaxL(), pair->GetX(), pair->GetY(), pair->GetZ());
139 CorrFitVerticalSlices1D::CorrFitVerticalSlices1D(
const Hal::Femto1DCF& h, Int_t nSamples) {
140 Hal::Std::ResizeVector1D(fNum, nSamples);
141 Hal::Std::ResizeVector1D(fDen, nSamples);
144 CorrFitVerticalSlices3D::CorrFitVerticalSlices3D(
const Hal::Femto3DCF& h, Int_t nSamples) {
145 fOutBins = h.
GetNum()->GetNbinsX();
146 fSideBins = h.
GetNum()->GetNbinsY();
147 fMin[0] = h.
GetNum()->GetXaxis()->GetBinLowEdge(1);
148 fMin[1] = h.
GetNum()->GetYaxis()->GetBinLowEdge(1);
149 fOverStep[0] = 1.0 / h.
GetNum()->GetXaxis()->GetBinWidth(1);
150 fOverStep[1] = 1.0 / h.
GetNum()->GetYaxis()->GetBinWidth(1);
151 Hal::Std::ResizeVector3D(fNum, nSamples, fOutBins, fSideBins);
152 Hal::Std::ResizeVector3D(fDen, nSamples, fOutBins, fSideBins);
155 CorrFitVerticalSlicesSH::CorrFitVerticalSlicesSH(
const Hal::FemtoSHCF& h, Int_t nSamples) :
156 fMaxJM((h.GetLMax() + 1) * (h.GetLMax() + 1)) {
158 Hal::Std::ResizeVector1D(fNum, nSamples);
159 Hal::Std::ResizeVector1D(fDen, nSamples);
160 Hal::Std::ResizeVector2D(fShNumReal, nSamples, fMaxJM);
161 Hal::Std::ResizeVector2D(fShDenReal, nSamples, fMaxJM);
162 Hal::Std::ResizeVector2D(fShNumImag, nSamples, fMaxJM);
163 Hal::Std::ResizeVector2D(fShDenImag, nSamples, fMaxJM);
164 Hal::Std::ResizeVector2D(fShNumRealE, nSamples, fMaxJM);
165 Hal::Std::ResizeVector2D(fShDenRealE, nSamples, fMaxJM);
166 Hal::Std::ResizeVector2D(fShNumImagE, nSamples, fMaxJM);
167 Hal::Std::ResizeVector2D(fShDenImagE, nSamples, fMaxJM);
168 Hal::Std::ResizeVector3D(fCovMatrix, nSamples, fMaxJM * 2, fMaxJM * 2);
171 std::pair<int, int> CorrFitVerticalSlices3D::FindBin(FemtoPair* pair) {
172 std::pair<int, int> res;
174 res.first = int((TMath::Abs(pair->GetX()) - fMin[0]) * fOverStep[0]);
175 res.second = int((TMath::Abs(pair->GetY()) - fMin[1]) * fOverStep[1]);
177 res.first = int((pair->GetX() - fMin[0]) * fOverStep[0]);
178 res.second = int((pair->GetY() - fMin[1]) * fOverStep[1]);
183 void CorrFitVerticalSlicesSH::Print(Option_t* option)
const {
184 TString opt = option;
185 auto vec = Hal::Std::ExplodeString(opt,
'+');
186 Int_t pos = vec[0].Atoi();
188 if (vec.size() == 2) secondOpt = vec[1];
189 if (secondOpt ==
"short") {
190 std::cout <<
"NUM " << fNum[pos] << std::endl;
191 std::cout <<
"DEN " << fDen[pos] << std::endl;
193 std::cout <<
"Pos " << pos << std::endl;
194 std::cout <<
"NUM " << fNum[pos] << std::endl;
195 std::cout <<
"DEN " << fDen[pos] << std::endl;
196 auto printing = [](
const std::vector<Double_t>& arr, TString label) {
197 std::cout << label << std::endl;
198 for (
auto val : arr) {
199 std::cout <<
" " << val << std::endl;
202 printing(fShNumReal[pos],
"NumRe");
203 printing(fShNumImag[pos],
"NumIm");
204 printing(fShDenReal[pos],
"DenRe");
205 printing(fShDenImag[pos],
"DenIm");