Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
CorrFitFunc3D.cxx
1/*
2 * CorrFitFunc3D.cpp
3 *
4 * Created on: 12 kwi 2024
5 * Author: daniel
6 */
7
8#include "CorrFitFunc3D.h"
9#include "Cout.h"
10#include "ErrorCalc.h"
11
12namespace Hal {
13
14 CorrFitFunc3D::CorrFitFunc3D(e3DMode mode, Int_t par, Int_t dim) : CorrFitFunc(par, dim), fMode(mode) {
15 switch (mode) {
16 case e3DMode::kNormal3R: {
17 fLambdaParIndex = 4;
18 fNormParIndex = 3;
19 fRoutParIndex = 0;
20 fRsideParIndex = 1;
21 fRlongParIndex = 2;
22 fRoutsideParIndex = -1;
23 fRoutlongParIndex = -1;
24 fRsidelongParIndex = -1;
25 SetParameterName(fRsideParIndex, "R_{side}");
26 SetParameterName(fRlongParIndex, "R_{long}");
27 } break;
28 case e3DMode::kPlus3R: {
29 fLambdaParIndex = 4;
30 fNormParIndex = 3;
31 fRoutParIndex = 0;
32 fRsideParIndex = 1;
33 fRlongParIndex = 2;
34 fRoutsideParIndex = -1;
35 fRoutlongParIndex = -1;
36 fRsidelongParIndex = -1;
37 SetParameterName(fRsideParIndex, "R_{#Delta side}");
38 SetParameterName(fRlongParIndex, "R_{#Delta long}");
39 } break;
40 case e3DMode::kRatio3R: {
41 fLambdaParIndex = 4;
42 fNormParIndex = 3;
43 fRoutParIndex = 0;
44 fRsideParIndex = 1;
45 fRlongParIndex = 2;
46 fRoutsideParIndex = -1;
47 fRoutlongParIndex = -1;
48 fRsidelongParIndex = -1;
49 SetParameterName(fRsideParIndex, "R_{#times side}");
50 SetParameterName(fRlongParIndex, "R_{#times long}");
51 } break;
52 case e3DMode::kNormal6R: {
53 fLambdaParIndex = 7;
54 fNormParIndex = 6;
55 fRoutParIndex = 0;
56 fRsideParIndex = 1;
57 fRlongParIndex = 2;
58 fRoutsideParIndex = 3;
59 fRoutlongParIndex = 4;
60 fRsidelongParIndex = 5;
61 SetParameterName(fRsideParIndex, "R_{side}");
62 SetParameterName(fRlongParIndex, "R_{long}");
63 SetParameterName(fRoutsideParIndex, "R_{out-side}");
64 SetParameterName(fRoutlongParIndex, "R_{out-long}");
65 SetParameterName(fRsidelongParIndex, "R_{side-long}");
66 } break;
67
68 case e3DMode::kRatio6R: {
69 fLambdaParIndex = 7;
70 fNormParIndex = 6;
71 fRoutParIndex = 0;
72 fRsideParIndex = 1;
73 fRlongParIndex = 2;
74 fRoutsideParIndex = 3;
75 fRoutlongParIndex = 4;
76 fRsidelongParIndex = 5;
77
78 SetParameterName(fRsideParIndex, "R_{#times side}");
79 SetParameterName(fRlongParIndex, "R_{#times long}");
80 SetParameterName(fRoutsideParIndex, "R_{out-side}");
81 SetParameterName(fRoutlongParIndex, "R_{out-long}");
82 SetParameterName(fRsidelongParIndex, "R_{side-long}");
83 } break;
84
85 case e3DMode::kPlus6R: {
86 fLambdaParIndex = 7;
87 fNormParIndex = 6;
88 fRoutParIndex = 0;
89 fRsideParIndex = 1;
90 fRlongParIndex = 2;
91 fRoutsideParIndex = 3;
92 fRoutlongParIndex = 4;
93 fRsidelongParIndex = 5;
94 SetParameterName(fRsideParIndex, "R_{#Delta side}");
95 SetParameterName(fRlongParIndex, "R_{#Delta long+}");
96 SetParameterName(fRoutsideParIndex, "R_{out-side}");
97 SetParameterName(fRoutlongParIndex, "R_{out-long}");
98 SetParameterName(fRsidelongParIndex, "R_{side-long}");
99 } break;
100 default: {
101 } break;
102 }
103 SetParameterName(fLambdaParIndex, "#lambda");
104 SetParameterName(fNormParIndex, "N");
105 SetParameterName(fRoutParIndex, "R_{out}");
106 }
107
108 Double_t CorrFitFunc3D::GetRout() const { return GetParameter(fRoutParIndex); }
109
110 Double_t CorrFitFunc3D::GetRoutError() const { return GetParError(fRoutParIndex); }
111
112 Double_t CorrFitFunc3D::GetRside() const {
113 int idx = fRsideParIndex;
114 switch (fMode) {
115 case e3DMode::kNormal3R: {
116 return GetParameter(idx);
117 } break;
118 case e3DMode::kNormal6R: {
119 return GetParameter(idx);
120 } break;
121 case e3DMode::kRatio3R: {
122 return GetParameter(fRoutParIndex) * GetParameter(idx);
123 } break;
124 case e3DMode::kRatio6R: {
125 return GetParameter(fRoutParIndex) * GetParameter(idx);
126 } break;
127 case e3DMode::kPlus3R: {
128 return GetParameter(fRoutParIndex) + GetParameter(idx);
129 } break;
130 case e3DMode::kPlus6R: {
131 return GetParameter(fRoutParIndex) + GetParameter(idx);
132 } break;
133 default: {
134 } break;
135 }
136 return -1;
137 }
138
139 Double_t CorrFitFunc3D::GetRsideError() const {
140 int idx = fRsideParIndex;
141 switch (fMode) {
142 case e3DMode::kNormal3R: {
143 return GetParError(idx);
144 } break;
145 case e3DMode::kNormal6R: {
146 return GetParError(idx);
147 } break;
148 case e3DMode::kRatio3R: {
149 return ErrorCalc::SumError(
150 {GetParError(fRoutParIndex) * GetParameter(idx), GetParameter(fRoutParIndex) * GetParError(idx)});
151
152 } break;
153 case e3DMode::kRatio6R: {
154 return ErrorCalc::SumError(
155 {GetParError(fRoutParIndex) * GetParameter(idx), GetParameter(fRoutParIndex) * GetParError(idx)});
156 } break;
157 case e3DMode::kPlus3R: {
158 return ErrorCalc::SumError({GetParameter(fRoutParIndex), GetParError(idx)});
159 } break;
160 case e3DMode::kPlus6R: {
161 return ErrorCalc::SumError({GetParameter(fRoutParIndex), GetParError(idx)});
162 } break;
163 default: {
164 } break;
165 }
166 return -1;
167 }
168
169 Double_t CorrFitFunc3D::GetRlong() const {
170 int idx = fRlongParIndex;
171 switch (fMode) {
172 case e3DMode::kNormal3R: {
173 return GetParameter(idx);
174 } break;
175 case e3DMode::kNormal6R: {
176 return GetParameter(idx);
177 } break;
178 case e3DMode::kRatio3R: {
179 return GetParameter(fRoutParIndex) * GetParameter(idx);
180 } break;
181 case e3DMode::kRatio6R: {
182 return GetParameter(fRoutParIndex) * GetParameter(idx);
183 } break;
184 case e3DMode::kPlus3R: {
185 return GetParameter(fRoutParIndex) + GetParameter(idx);
186 } break;
187 case e3DMode::kPlus6R: {
188 return GetParameter(fRoutParIndex) + GetParameter(idx);
189 } break;
190 default: {
191 } break;
192 }
193 return -1;
194 }
195
196 Double_t CorrFitFunc3D::GetRlongError() const {
197 int idx = fRlongParIndex;
198 switch (fMode) {
199 case e3DMode::kNormal3R: {
200 return GetParError(idx);
201 } break;
202 case e3DMode::kNormal6R: {
203 return GetParError(idx);
204 } break;
205 case e3DMode::kRatio3R: {
206 return ErrorCalc::SumError(
207 {GetParError(fRoutParIndex) * GetParameter(idx), GetParameter(fRoutParIndex) * GetParError(idx)});
208
209 } break;
210 case e3DMode::kRatio6R: {
211 return ErrorCalc::SumError(
212 {GetParError(fRoutParIndex) * GetParameter(idx), GetParameter(fRoutParIndex) * GetParError(idx)});
213 } break;
214 case e3DMode::kPlus3R: {
215 return ErrorCalc::SumError({GetParameter(fRoutParIndex), GetParError(idx)});
216 } break;
217 case e3DMode::kPlus6R: {
218 return ErrorCalc::SumError({GetParameter(fRoutParIndex), GetParError(idx)});
219 } break;
220 default: {
221 } break;
222 }
223 return -1;
224 }
225
226 void CorrFitFunc3D::SetRsideLimits(Double_t min, Double_t max) {
227 if (fMode == e3DMode::kNormal3R || fMode == e3DMode::kNormal6R) {
228 SetParLimits(RsideID(), min, max);
229 } else {
230 Hal::Cout::PrintInfo("Cannot set rside limits wrong 3dmode", EInfo::kWarning);
231 }
232 }
233
234 void CorrFitFunc3D::SetRlongLimits(Double_t min, Double_t max) {
235 if (fMode == e3DMode::kNormal3R || fMode == e3DMode::kNormal6R) {
236 SetParLimits(RlongID(), min, max);
237 } else {
238 Hal::Cout::PrintInfo("Cannot set rlong limits wrong 3dmode", EInfo::kWarning);
239 }
240 }
241
242} /* namespace Hal */
static void PrintInfo(TString text, Hal::EInfo status)
Definition Cout.cxx:370