13 #include <FairField.h>
30 , fParentField(nullptr)
32 , fDistortionFilename(
"")
33 , fBxDistortionFormulaMult(nullptr)
34 , fBxDistortionFormulaAdd(nullptr)
35 , fByDistortionFormulaMult(nullptr)
36 , fByDistortionFormulaAdd(nullptr)
37 , fBzDistortionFormulaMult(nullptr)
38 , fBzDistortionFormulaAdd(nullptr) {
46 const char* pfDistortionFilename,
47 const char* parentName,
48 const char* fileTypeParent,
51 , fParentField(nullptr)
52 , fTypeOfParent(pfTypeOfParent)
53 , fDistortionFilename(pfDistortionFilename)
54 , fBxDistortionFormulaMult(nullptr)
55 , fBxDistortionFormulaAdd(nullptr)
56 , fByDistortionFormulaMult(nullptr)
57 , fByDistortionFormulaAdd(nullptr)
58 , fBzDistortionFormulaMult(nullptr)
59 , fBzDistortionFormulaAdd(nullptr) {
63 switch (pfTypeOfParent) {
89 const char* pfDistortionFilename,
90 const char* parentname)
103 , fDistortionFilename(pfDistortionFilename)
104 , fBxDistortionFormulaMult(nullptr)
105 , fBxDistortionFormulaAdd(nullptr)
106 , fByDistortionFormulaMult(nullptr)
107 , fByDistortionFormulaAdd(nullptr)
108 , fBzDistortionFormulaMult(nullptr)
109 , fBzDistortionFormulaAdd(nullptr) {
118 , fParentField(nullptr)
120 , fDistortionFilename(
"")
121 , fBxDistortionFormulaMult(nullptr)
122 , fBxDistortionFormulaAdd(nullptr)
123 , fByDistortionFormulaMult(nullptr)
124 , fByDistortionFormulaAdd(nullptr)
125 , fBzDistortionFormulaMult(nullptr)
126 , fBzDistortionFormulaAdd(nullptr) {
204 Double_t po[3], b[3];
208 GetFieldValue(po, b);
268 TFile* filesave = gFile;
276 cerr <<
"CbmFieldMapDistorted::ReadDistortionInformation Warning: file "
282 (TFormula*)
f->Get(
"BxDistortionFormulaMult");
284 (TFormula*)
f->Get(
"BxDistortionFormulaAdd");
286 (TFormula*)
f->Get(
"ByDistortionFormulaMult");
288 (TFormula*)
f->Get(
"ByDistortionFormulaAdd");
290 (TFormula*)
f->Get(
"BzDistortionFormulaMult");
292 (TFormula*)
f->Get(
"BzDistortionFormulaAdd");
295 cerr <<
"CbmFieldMapDistorted::ReadDistortionInformation ERROR: file "
307 TFile* filesave = gFile;
345 const char* action_option) {
348 TString co = component_option;
349 TString ao = action_option;
365 const char* component_option,
366 const char* action_option) {
367 TString co = component_option;
368 TString ao = action_option;
371 if (co.Contains(
"y") && ao.Contains(
"m")) {
375 if (co.Contains(
"y") && ao.Contains(
"a")) {
380 if (co.Contains(
"x") && ao.Contains(
"m")) {
384 if (co.Contains(
"x") && ao.Contains(
"a")) {
389 if (co.Contains(
"z") && ao.Contains(
"m")) {
393 if (co.Contains(
"z") && ao.Contains(
"a")) {
402 const char* component_option,
403 const char* action_option) {
404 TString co = component_option;
405 TString ao = action_option;
408 if (co.Contains(
"y") && ao.Contains(
"m")) {
410 new TFormula(
"ByDistortionFormulaMult", parDistortionFormulaText);
413 if (co.Contains(
"y") && ao.Contains(
"a")) {
415 new TFormula(
"ByDistortionFormulaAdd", parDistortionFormulaText);
419 if (co.Contains(
"x") && ao.Contains(
"m")) {
421 new TFormula(
"BxDistortionFormulaMult", parDistortionFormulaText);
424 if (co.Contains(
"x") && ao.Contains(
"a")) {
426 new TFormula(
"BxDistortionFormulaAdd", parDistortionFormulaText);
430 if (co.Contains(
"z") && ao.Contains(
"m")) {
432 new TFormula(
"BzDistortionFormulaMult", parDistortionFormulaText);
435 if (co.Contains(
"z") && ao.Contains(
"a")) {
437 new TFormula(
"BzDistortionFormulaAdd", parDistortionFormulaText);
482 cout <<
"============================================================="
484 cout <<
"---- " << fTitle <<
" : " << fName << endl;
486 cout <<
"== Parent Field: ==" << endl;
488 cout <<
"==============================" << endl;
490 cout <<
"== Distortion Information File : ==" << endl;
492 cout <<
"==============================" << endl;
494 cout <<
"== Bx Distortion Formula Mult : ==" << endl;
497 cout <<
"== Bx Distortion Formula Add : ==" << endl;
500 cout <<
"==============================" << endl;
502 cout <<
"== By Distortion Formula Mult : ==" << endl;
505 cout <<
"== By Distortion Formula Add : ==" << endl;
508 cout <<
"==============================" << endl;
510 cout <<
"== Bz Distortion Formula Mult : ==" << endl;
513 cout <<
"== Bz Distortion Formula Add : ==" << endl;
516 cout <<
"==============================" << endl;
519 cout <<
"---- Distorted field at origin is ( " <<
fBxOrigin <<
", "
522 cout <<
"============================================================="
549 Double_t dz = (zmax - zmin) / n0;
551 h =
new TH1D(
"hField", fName, n, zmin, zmax);
552 for (Int_t
i = 0;
i < n0;
i++)
553 h->SetBinContent(
i + 1,
GetBy(0., 0., zmin +
i * dz));
558 hp =
new TH1D(
"hFieldParent",
fParentField->GetName(), n, zmin, zmax);
559 for (Int_t
i = 0;
i < n0;
i++)
560 hp->SetBinContent(
i + 1,
fParentField->GetBy(0., 0., zmin +
i * dz));