Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
FemtoSerializationInterfaceSH.cxx
1/*
2 * FemtoSerializationInterfaceSH.cxx
3 *
4 * Created on: 17 sty 2024
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "FemtoSerializationInterfaceSH.h"
10
11#include "Cout.h"
12#include "FemtoSHCF.h"
13#include <iostream>
14
15namespace Hal {
16 void FemtoSerializationInterfaceSH::PostInit() {
17 int maxL = 0;
18 if (fCF) {
19 maxL = fCF->GetLMax();
20 } else {
21 maxL = fSlice->GetMaxL();
22 }
23 fMaxJM = (maxL + 1) * (maxL + 1);
24 }
25
26 Bool_t FemtoSerializationInterfaceSH::GetBinsNo() {
27 fBinStop = fCF->GetNum()->GetNbinsX();
28 fBinStart = 1;
29 return kTRUE;
30 }
31
32 void FemtoSerializationInterfaceSH::ConvertCF(ECopyDir dir) {
33 unsigned int dim = 2 + fMaxJM * 8 + fMaxJM * fMaxJM * 4;
34 int qbins = fBinHi - fBinLow + 1;
35 ExpandArrayIfSerialize(dim * qbins, dir);
36 std::vector<TH1*> cfs, cfs2;
37 cfs.push_back(fCF->GetNum());
38 cfs.push_back(fCF->GetDen());
39 for (int i = 0; i < fMaxJM; i++) {
40 cfs.push_back(fCF->fNumReal[i]);
41 cfs.push_back(fCF->fDenReal[i]);
42 cfs.push_back(fCF->fNumImag[i]);
43 cfs.push_back(fCF->fDenImag[i]);
44 cfs2.push_back(fCF->fNumReal[i]);
45 cfs2.push_back(fCF->fDenReal[i]);
46 cfs2.push_back(fCF->fNumImag[i]);
47 cfs2.push_back(fCF->fDenImag[i]);
48 }
49 for (int iq = fBinLow; iq <= fBinHi; iq++) {
50 CopyData1D(cfs, iq, dir);
51 CopyData1D(cfs2, iq, dir, true);
52 for (int i = 0; i < fMaxJM * 2; i++) {
53 for (int j = 0; j < fMaxJM * 2; j++) {
54 CopyDataSingle(fCF->fCovNum[iq - 1][i][j], dir);
55 // CopyDataSingle(fCF->fCovNum[iq][i][j], dir);
56 }
57 }
58 }
59 }
60
61 void FemtoSerializationInterfaceSH::ConvertSlice(ECopyDir dir) {
62 int count = 0;
63 ExpandArrayIfSerialize(2 + fMaxJM * 8 + fMaxJM * fMaxJM * 4, dir);
64 CopyDataSingle(fSlice->fNum[fBinLow], dir);
65 CopyDataSingle(fSlice->fDen[fBinLow], dir);
66
67 for (int i = 0; i < fMaxJM; i++) {
68 CopyDataSingle(fSlice->fShNumReal[fBinLow][i], dir);
69 CopyDataSingle(fSlice->fShDenReal[fBinLow][i], dir);
70 CopyDataSingle(fSlice->fShNumImag[fBinLow][i], dir);
71 CopyDataSingle(fSlice->fShDenImag[fBinLow][i], dir);
72 }
73 auto sqrSeralize = [&](Double_t& val, ECopyDir dirx) {
74 Double_t copy;
75 if (dirx == ECopyDir::kSerialize) {
76 copy = TMath::Sqrt(val); // go to error to be compatible with TH1D
77 CopyDataSingle(copy, dirx);
78 } else {
79 CopyDataSingle(copy, dirx); // go to error^2 from TH1D to this
80 val = copy * copy;
81 }
82 };
83 float temp_err = 0;
84 for (int i = 0; i < fMaxJM; i++) { // set errors to zero to be compatible with CF's
85 sqrSeralize(fSlice->fShNumRealE[fBinLow][i], dir);
86 sqrSeralize(fSlice->fShDenRealE[fBinLow][i], dir);
87 sqrSeralize(fSlice->fShNumImagE[fBinLow][i], dir);
88 sqrSeralize(fSlice->fShDenImagE[fBinLow][i], dir);
89 }
90 for (int i = 0; i < fMaxJM * 2; i++) {
91 for (int j = 0; j < fMaxJM * 2; j++) {
92 if (i == j && i == 0) std::cout << "EXPORT COV " << fSlice->fCovMatrix[fBinLow][i][j] << std::endl;
93 CopyDataSingle(fSlice->fCovMatrix[fBinLow][i][j], dir);
94 }
95 }
96 }
97
98 void FemtoSerializationInterfaceSH::ConvertCFSimple(ECopyDir dir) {
99 unsigned int dim = 2 + fMaxJM * 2;
100 int qbins = fBinHi - fBinLow + 1;
101 ExpandArrayIfSerialize(dim * qbins, dir);
102 std::vector<TH1*> cfs;
103 cfs.push_back(fCF->GetNum());
104 cfs.push_back(fCF->GetDen());
105 for (int i = 0; i < fMaxJM; i++) {
106 cfs.push_back(fCF->fCFReal[i]);
107 cfs.push_back(fCF->fCFImag[i]);
108 }
109 for (int iq = fBinStart; iq <= fBinStop; iq++) {
110 CopyData1D(cfs, iq, dir);
111 }
112 }
113
114 void FemtoSerializationInterfaceSH::ConvertSliceSimple(ECopyDir dir) {
115 ConvertSlice(dir);
116 return;
117 int count = 0;
118 ExpandArrayIfSerialize(2 + fMaxJM * 4 + fMaxJM * fMaxJM * 4, dir);
119
120 CopyDataSingle(fSlice->fNum[fBinLow], dir);
121 CopyDataSingle(fSlice->fDen[fBinLow], dir);
122
123 for (int i = 0; i < fMaxJM; i++) {
124 CopyDataSingle(fSlice->fShNumReal[fBinLow][i], dir);
125 CopyDataSingle(fSlice->fShDenReal[fBinLow][i], dir);
126 CopyDataSingle(fSlice->fShNumImag[fBinLow][i], dir);
127 CopyDataSingle(fSlice->fShDenImag[fBinLow][i], dir);
128 }
129 for (int i = 0; i < fMaxJM * 2; i++) {
130 for (int j = 0; j < fMaxJM * 2; j++) {
131 CopyDataSingle(fSlice->fCovMatrix[fBinLow][i][j], dir);
132 }
133 }
134 }
135
136} /* namespace Hal */
Int_t GetLMax() const
Definition FemtoSHCF.h:306