15 #include "../../../parallel/LitFieldGrid.h"
16 #include "../../../parallel/LitFieldSlice.h"
17 #include "../../../parallel/LitFieldValue.h"
19 #include "FairField.h"
20 #include "FairRunAna.h"
21 #include "FairRuntimeDb.h"
31 #include "TPaveText.h"
39 #include <boost/assign/list_of.hpp>
41 using boost::assign::list_of;
58 , fAcceptanceAngleX(25.)
59 , fAcceptanceAngleY(25.)
62 , fUseEllipseAcc(true)
63 , fOutputDir(
"./field/")
66 , fPolynomDegreeIndex(1)
101 fField = FairRunAna::Instance()->GetField();
138 string names[] = {
"Bx",
"By",
"Bz",
"Mod"};
140 "B_{x} [kGauss]",
"B_{y} [kGauss]",
"B_{z} [kGauss]",
"|B| [kGauss]"};
141 for (Int_t
v = 0;
v < 4;
v++) {
143 TGraph2D* graph =
new TGraph2D();
146 string title = name +
";X [cm];Y [cm];" + zTitle[
v];
147 graph->SetNameTitle(name.c_str(), title.c_str());
154 string names[] = {
"Bx",
"By",
"Bz",
"Mod"};
158 Int_t nofBinsErrB = 100;
159 Int_t nofBinsRelErrB = 100;
160 Int_t nofBinsErrX = 100;
161 Int_t nofBinsErrY = 100;
162 Double_t minErrB = 0., maxErrB = 0., minRelErrB = 0., maxRelErrB = 0.;
171 "B_{x} [kGauss]",
"B_{y} [kGauss]",
"B_{z} [kGauss]",
"|B| [kGauss]"};
172 string errTitle[] = {
"B_{x} error [kGauss]",
173 "B_{y} error [kGauss]",
174 "B_{z} error [kGauss]",
175 "|B| error [kGauss]"};
176 string relErrTitle[] = {
"B_{x} relative error [%]",
177 "B_{y} relative error [%]",
178 "B_{z} relative error [%]",
179 "|B| relative error [%]"};
182 for (Int_t
v = 0;
v < 4;
v++) {
185 TGraph2D* graph =
new TGraph2D();
186 string name =
"hfa_" + names[
v] +
"Apr_Graph2D" +
"_"
189 string title = name +
";X [cm];Y [cm];" + zTitle[
v];
190 graph->SetNameTitle(name.c_str(), title.c_str());
193 name =
"hfa_" + names[
v] +
"ErrApr_H1_"
196 title = name +
";" + errTitle[
v] +
";Counter";
199 new TH1D(name.c_str(), title.c_str(), nofBinsErrB, minErrB, maxErrB));
201 name =
"hfa_" + names[
v] +
"ErrApr_H2_"
204 title = name +
";X [cm];Y [cm];" + errTitle[
v];
206 new TH2D(name.c_str(),
215 name =
"hfa_" + names[
v] +
"RelErrApr_H1_"
218 title = name +
";" + relErrTitle[
v] +
";Counter";
220 new TH1D(name.c_str(),
226 name =
"hfa_" + names[
v] +
"RelErrApr_H2_"
229 title = name +
";X [cm];Y [cm];" + relErrTitle[
v];
231 new TH2D(name.c_str(),
242 cout <<
"-I- CbmLitFieldApproximationQa::CreateFitterErrHistos: Field fitter "
243 "error histograms created"
248 string names[] = {
"Bx",
"By",
"Bz",
"Mod"};
252 Int_t nofBinsErrB = 100;
253 Int_t nofBinsRelErrB = 100;
254 Int_t nofBinsErrX = 100;
255 Int_t nofBinsErrY = 100;
256 Double_t minErrB = 0., maxErrB = 0., minRelErrB = 0., maxRelErrB = 0.;
265 "B_{x} [kGauss]",
"B_{y} [kGauss]",
"B_{z} [kGauss]",
"|B| [kGauss]"};
266 string errTitle[] = {
"B_{x} error [kGauss]",
267 "B_{y} error [kGauss]",
268 "B_{z} error [kGauss]",
269 "|B| error [kGauss]"};
270 string relErrTitle[] = {
"B_{x} relative error [%]",
271 "B_{y} relative error [%]",
272 "B_{z} relative error [%]",
273 "|B| relative error [%]"};
276 for (Int_t
v = 0;
v < 4;
v++) {
278 TGraph2D* graph =
new TGraph2D();
279 string name =
"hfa_" + names[
v] +
"Grid_Graph2D_"
281 string title = name +
";X [cm]; Y [cm];" + zTitle[
v];
282 graph->SetNameTitle(name.c_str(), title.c_str());
287 title = name +
";" + errTitle[
v] +
";Counter";
290 new TH1D(name.c_str(), title.c_str(), nofBinsErrB, minErrB, maxErrB));
294 title = name +
";X [cm];Y [cm];" + errTitle[
v];
296 new TH2D(name.c_str(),
305 name =
"hfa_" + names[
v] +
"RelErrGrid_H1_"
307 title = name +
";" + relErrTitle[
v] +
";Counter";
311 name.c_str(), title.c_str(), nofBinsRelErrB, minRelErrB, maxRelErrB));
313 name =
"hfa_" + names[
v] +
"RelErrGrid_H2_"
315 title = name +
";X [cm];Y [cm];" + relErrTitle[
v];
317 new TH2D(name.c_str(),
327 cout <<
"-I- CbmLitFieldApproximationQa::CreateGridErrHistos(): Grid creator "
328 "error histograms created"
334 for (UInt_t iSlice = 0; iSlice <
fNofSlices; iSlice++) {
342 for (Int_t iX = 0; iX <
fNofBinsX; iX++) {
344 for (Int_t iY = 0; iY <
fNofBinsY; iY++) {
354 Double_t
pos[3] = {X, Y, Z};
358 Double_t Bmod =
sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
361 fHM->
G2(
string(
"hfa_Bx_Graph2D_") + s)->SetPoint(cnt, X, Y, B[0]);
362 fHM->
G2(
string(
"hfa_By_Graph2D_") + s)->SetPoint(cnt, X, Y, B[1]);
363 fHM->
G2(
string(
"hfa_Bz_Graph2D_") + s)->SetPoint(cnt, X, Y, B[2]);
364 fHM->
G2(
string(
"hfa_Mod_Graph2D_") + s)->SetPoint(cnt, X, Y, Bmod);
372 vector<vector<LitFieldSliceScal>> slices;
382 cout <<
"-I- CbmLitFieldApproximationQa::FillFieldApproximationHistos: "
389 for (UInt_t iSlice = 0; iSlice <
fNofSlices; iSlice++) {
397 for (Int_t iX = 0; iX <
fNofBinsX; iX++) {
399 for (Int_t iY = 0; iY <
fNofBinsY; iY++) {
410 slices[p][iSlice].GetFieldValue(X, Y,
v);
411 Double_t mod =
sqrt(
v.Bx *
v.Bx +
v.By *
v.By +
v.Bz *
v.Bz);
414 fHM->
G2(
string(
"hfa_BxApr_Graph2D_") + s)->SetPoint(cnt, X, Y,
v.Bx);
415 fHM->
G2(
string(
"hfa_ByApr_Graph2D_") + s)->SetPoint(cnt, X, Y,
v.By);
416 fHM->
G2(
string(
"hfa_BzApr_Graph2D_") + s)->SetPoint(cnt, X, Y,
v.Bz);
417 fHM->
G2(
string(
"hfa_ModApr_Graph2D_") + s)->SetPoint(cnt, X, Y, mod);
425 Int_t nofBinsX = 100;
426 Int_t nofBinsY = 100;
427 for (Int_t iSlice = 0; iSlice <
fNofSlices; iSlice++) {
433 for (Int_t iX = 0; iX < nofBinsX; iX++) {
435 for (Int_t iY = 0; iY < nofBinsY; iY++) {
445 Double_t
pos[3] = {X, Y, Z};
449 Double_t Bmod =
sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
453 slices[p][iSlice].GetFieldValue(X, Y,
v);
454 Double_t mod =
sqrt(
v.Bx *
v.Bx +
v.By *
v.By +
v.Bz *
v.Bz);
456 Double_t errBx = B[0] -
v.Bx;
457 Double_t errBy = B[1] -
v.By;
458 Double_t errBz = B[2] -
v.Bz;
459 Double_t errMod = Bmod - mod;
460 Double_t relErrBx = (B[0] != 0.) ? (errBx / B[0]) * 100. : 0.;
461 Double_t relErrBy = (B[1] != 0.) ? (errBy / B[1]) * 100. : 0.;
462 Double_t relErrBz = (B[2] != 0.) ? (errBz / B[2]) * 100. : 0.;
463 Double_t relErrMod = (Bmod != 0.) ? (errMod / Bmod) * 100. : 0;
467 fHM->
H1(
string(
"hfa_BxErrApr_H1_") + s)->Fill(errBx);
468 fHM->
H1(
string(
"hfa_BxRelErrApr_H1_") + s)->Fill(relErrBx);
469 fHM->
H2(
string(
"hfa_BxErrApr_H2_") + s)->Fill(X, Y, errBx);
470 fHM->
H2(
string(
"hfa_BxRelErrApr_H2_") + s)->Fill(X, Y, relErrBx);
471 fHM->
H1(
string(
"hfa_ByErrApr_H1_") + s)->Fill(errBy);
472 fHM->
H1(
string(
"hfa_ByRelErrApr_H1_") + s)->Fill(relErrBy);
473 fHM->
H2(
string(
"hfa_ByErrApr_H2_") + s)->Fill(X, Y, errBy);
474 fHM->
H2(
string(
"hfa_ByRelErrApr_H2_") + s)->Fill(X, Y, relErrBy);
475 fHM->
H1(
string(
"hfa_BzErrApr_H1_") + s)->Fill(errBz);
476 fHM->
H1(
string(
"hfa_BzRelErrApr_H1_") + s)->Fill(relErrBz);
477 fHM->
H2(
string(
"hfa_BzErrApr_H2_") + s)->Fill(X, Y, errBz);
478 fHM->
H2(
string(
"hfa_BzRelErrApr_H2_") + s)->Fill(X, Y, relErrBz);
479 fHM->
H1(
string(
"hfa_ModErrApr_H1_") + s)->Fill(errMod);
480 fHM->
H1(
string(
"hfa_ModRelErrApr_H1_") + s)->Fill(relErrMod);
481 fHM->
H2(
string(
"hfa_ModErrApr_H2_") + s)->Fill(X, Y, errMod);
482 fHM->
H2(
string(
"hfa_ModRelErrApr_H2_") + s)->Fill(X, Y, relErrMod);
490 vector<LitFieldGrid> grids;
492 for (Int_t iSlice = 0; iSlice <
fNofSlices; iSlice++) {
497 for (Int_t iSlice = 0; iSlice <
fNofSlices; iSlice++) {
504 for (Int_t iX = 0; iX <
fNofBinsX; iX++) {
506 for (Int_t iY = 0; iY <
fNofBinsY; iY++) {
509 grids[iSlice].GetFieldValue(X, Y,
v);
510 Double_t mod =
sqrt(
v.Bx *
v.Bx +
v.By *
v.By +
v.Bz *
v.Bz);
512 fHM->
G2(
string(
"hfa_BxGrid_Graph2D_") + s)->SetPoint(cnt, X, Y,
v.Bx);
513 fHM->
G2(
string(
"hfa_ByGrid_Graph2D_") + s)->SetPoint(cnt, X, Y,
v.By);
514 fHM->
G2(
string(
"hfa_BzGrid_Graph2D_") + s)->SetPoint(cnt, X, Y,
v.Bz);
515 fHM->
G2(
string(
"hfa_ModGrid_Graph2D_") + s)->SetPoint(cnt, X, Y, mod);
522 Int_t nofBinsX = 100;
523 Int_t nofBinsY = 100;
524 for (Int_t iSlice = 0; iSlice <
fNofSlices; iSlice++) {
530 for (Int_t iX = 0; iX < nofBinsX; iX++) {
532 for (Int_t iY = 0; iY < nofBinsY; iY++) {
536 Double_t
pos[3] = {X, Y, Z};
540 Double_t Bmod =
sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
543 grids[iSlice].GetFieldValue(X, Y,
v);
544 Double_t mod =
sqrt(
v.Bx *
v.Bx +
v.By *
v.By +
v.Bz *
v.Bz);
546 Double_t errBx = B[0] -
v.Bx;
547 Double_t errBy = B[1] -
v.By;
548 Double_t errBz = B[2] -
v.Bz;
549 Double_t errMod = Bmod - mod;
550 Double_t relErrBx = (B[0] != 0.) ? (errBx / B[0]) * 100. : 0.;
551 Double_t relErrBy = (B[1] != 0.) ? (errBy / B[1]) * 100. : 0.;
552 Double_t relErrBz = (B[2] != 0.) ? (errBz / B[2]) * 100. : 0.;
553 Double_t relErrMod = (Bmod != 0.) ? (errMod / Bmod) * 100. : 0;
556 fHM->
H1(
string(
"hfa_BxErrGrid_H1_") + s)->Fill(errBx);
557 fHM->
H1(
string(
"hfa_BxRelErrGrid_H1_") + s)->Fill(relErrBx);
558 fHM->
H2(
string(
"hfa_BxErrGrid_H2_") + s)->Fill(X, Y, errBx);
559 fHM->
H2(
string(
"hfa_BxRelErrGrid_H2_") + s)->Fill(X, Y, relErrBx);
560 fHM->
H1(
string(
"hfa_ByErrGrid_H1_") + s)->Fill(errBy);
561 fHM->
H1(
string(
"hfa_ByRelErrGrid_H1_") + s)->Fill(relErrBy);
562 fHM->
H2(
string(
"hfa_ByErrGrid_H2_") + s)->Fill(X, Y, errBy);
563 fHM->
H2(
string(
"hfa_ByRelErrGrid_H2_") + s)->Fill(X, Y, relErrBy);
564 fHM->
H1(
string(
"hfa_BzErrGrid_H1_") + s)->Fill(errBz);
565 fHM->
H1(
string(
"hfa_BzRelErrGrid_H1_") + s)->Fill(relErrBz);
566 fHM->
H2(
string(
"hfa_BzErrGrid_H2_") + s)->Fill(X, Y, errBz);
567 fHM->
H2(
string(
"hfa_BzRelErrGrid_H2_") + s)->Fill(X, Y, relErrBz);
568 fHM->
H1(
string(
"hfa_ModErrGrid_H1_") + s)->Fill(errMod);
569 fHM->
H1(
string(
"hfa_ModRelErrGrid_H1_") + s)->Fill(relErrMod);
570 fHM->
H2(
string(
"hfa_ModErrGrid_H2_") + s)->Fill(X, Y, errMod);
571 fHM->
H2(
string(
"hfa_ModRelErrGrid_H2_") + s)->Fill(X, Y, relErrMod);