CbmRoot
Loading...
Searching...
No Matches
CbmFieldMap.cxx
Go to the documentation of this file.
1/* Copyright (C) 2004-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Mohammad Al-Turany, Denis Bertini [committer], Florian Uhlig, Volker Friese */
4
5// -------------------------------------------------------------------------
6// ----- CbmFieldMap source file -----
7// ----- Created 12/01/04 by M. Al/Turany (CbmField.cxx) -----
8// ----- Redesign 13/02/06 by V. Friese -----
9// -------------------------------------------------------------------------
10#include "CbmFieldMap.h"
11
12#include "CbmFieldMapCreator.h" // for CbmFieldMapCreator
13#include "CbmFieldMapData.h" // for CbmFieldMapData
14#include "CbmFieldPar.h" // for CbmFieldPar
15
16#include <FairField.h> // for FairField
17#include <Logger.h> // for LOG, Logger
18
19#include <TArrayF.h> // for TArrayF
20#include <TFile.h> // for TFile, gFile
21#include <TMath.h> // for Nint
22
23#include <cassert> // for assert
24#include <cstdlib> // for div, div_t, getenv, exit
25#include <iomanip> // for operator<<, setw
26#include <iostream> // for operator<<, basic_ostream, endl, ost...
27
28using std::cerr;
29using std::cout;
30using std::endl;
31using std::flush;
32using std::right;
33using std::setw;
34using std::showpoint;
35
36
37// ------------- Default constructor ----------------------------------
39 : FairField()
40 , fFileName("")
41 , fScale(1.)
42 , fPosX(0.)
43 , fPosY(0.)
44 , fPosZ(0.)
45 , fXmin(0.)
46 , fXmax(0.)
47 , fXstep(0.)
48 , fYmin(0.)
49 , fYmax(0.)
50 , fYstep(0.)
51 , fZmin(0.)
52 , fZmax(0.)
53 , fZstep(0.)
54 , fNx(0)
55 , fNy(0)
56 , fNz(0)
57 , fBx(nullptr)
58 , fBy(nullptr)
59 , fBz(nullptr)
60 , fBxOrigin(0.)
61 , fByOrigin(0.)
62 , fBzOrigin(0.)
63{
64 // Assign values to data members of base classes
65 // There is no appropriate constructor of the base
66 // class.
67 fName = "";
68 fType = 1;
69}
70// ------------------------------------------------------------------------
71
72
73// ------------- Standard constructor ---------------------------------
74CbmFieldMap::CbmFieldMap(const char* mapName, const char* fileType)
75 : FairField()
76 , fFileName("")
77 , fScale(1.)
78 , fPosX(0.)
79 , fPosY(0.)
80 , fPosZ(0.)
81 , fXmin(0.)
82 , fXmax(0.)
83 , fXstep(0.)
84 , fYmin(0.)
85 , fYmax(0.)
86 , fYstep(0.)
87 , fZmin(0.)
88 , fZmax(0.)
89 , fZstep(0.)
90 , fNx(0)
91 , fNy(0)
92 , fNz(0)
93 , fBx(nullptr)
94 , fBy(nullptr)
95 , fBz(nullptr)
96 , fBxOrigin(0.)
97 , fByOrigin(0.)
98 , fBzOrigin(0.)
99{
100 // Assign values to data members of base classes
101 // There is no appropriate constructor of the base
102 // class.
103 fName = mapName;
104 fTitle = "CbmFieldMap";
105 TString dir = getenv("VMCWORKDIR");
106 fFileName = dir + "/input/" + mapName;
107 if (fileType[0] == 'R') {
108 fFileName += ".root";
109 }
110 else {
111 fFileName += ".dat";
112 }
113 fType = 1;
114 LOG(info) << "Filename is " << fFileName;
115}
116// ------------------------------------------------------------------------
117
118
119// ------------ Constructor from CbmFieldPar --------------------------
121 : FairField()
122 , fFileName("")
123 , fScale(1.)
124 , fPosX(0.)
125 , fPosY(0.)
126 , fPosZ(0.)
127 , fXmin(0.)
128 , fXmax(0.)
129 , fXstep(0.)
130 , fYmin(0.)
131 , fYmax(0.)
132 , fYstep(0.)
133 , fZmin(0.)
134 , fZmax(0.)
135 , fZstep(0.)
136 , fNx(0)
137 , fNy(0)
138 , fNz(0)
139 , fBx(nullptr)
140 , fBy(nullptr)
141 , fBz(nullptr)
142 , fBxOrigin(0.)
143 , fByOrigin(0.)
144 , fBzOrigin(0.)
145{
146 // Assign values to data members of base classes
147 // There is no appropriate constructor of the base
148 // class.
149 fName = "";
150 fType = 1;
151 if (!fieldPar) {
152 cerr << "-W- CbmFieldConst::CbmFieldMap: empty parameter container!" << endl;
153 }
154 else {
155 fieldPar->MapName(fName);
156 fPosX = fieldPar->GetPositionX();
157 fPosY = fieldPar->GetPositionY();
158 fPosZ = fieldPar->GetPositionZ();
159 fScale = fieldPar->GetScale();
160 TString dir = getenv("VMCWORKDIR");
161 fFileName = dir + "/input/" + fName + ".root";
162 fType = fieldPar->GetType();
163 }
164}
165// ------------------------------------------------------------------------
166
167
168// ------------ Constructor from CbmFieldMapCreator ---------------------
170 : FairField()
171 , fFileName("")
172 , fScale(1.)
173 , fPosX(0.)
174 , fPosY(0.)
175 , fPosZ(0.)
176 , fXmin(0.)
177 , fXmax(0.)
178 , fXstep(0.)
179 , fYmin(0.)
180 , fYmax(0.)
181 , fYstep(0.)
182 , fZmin(0.)
183 , fZmax(0.)
184 , fZstep(0.)
185 , fNx(0)
186 , fNy(0)
187 , fNz(0)
188 , fBx(nullptr)
189 , fBy(nullptr)
190 , fBz(nullptr)
191 , fBxOrigin(0.)
192 , fByOrigin(0.)
193 , fBzOrigin(0.)
194{
195 // Assign values to data members of base classes
196 // There is no appropriate constructor of the base
197 // class.
198 fName = "";
199 fType = 1;
200 if (!creator) {
201 cerr << "-W- CbmFieldMap: no creator given!" << endl;
202 }
203 else {
204 fType = 1;
205 fName = creator->GetMapName();
206 fXmin = creator->GetXmin();
207 fXmax = creator->GetXmax();
208 fYmin = creator->GetYmin();
209 fYmax = creator->GetYmax();
210 fZmin = creator->GetZmin();
211 fZmax = creator->GetZmax();
212 fNx = creator->GetNx();
213 fNy = creator->GetNy();
214 fNz = creator->GetNz();
215 fXstep = (fXmax - fXmin) / Double_t(fNx - 1);
216 fYstep = (fYmax - fYmin) / Double_t(fNy - 1);
217 fZstep = (fZmax - fZmin) / Double_t(fNz - 1);
218 fBx = creator->GetBx();
219 fBy = creator->GetBy();
220 fBz = creator->GetBz();
221 }
222}
223
224// ------------------------------------------------------------------------
225
226
227// ------------ Destructor --------------------------------------------
229{
230 if (fBx) delete fBx;
231 if (fBy) delete fBy;
232 if (fBz) delete fBz;
233}
234// ------------------------------------------------------------------------
235
236
237// ----------- Intialisation ------------------------------------------
239{
240 if (fFileName.EndsWith(".root"))
241 ReadRootFile(fFileName, fName);
242 else if (fFileName.EndsWith(".dat"))
244 else {
245 cerr << "-E- CbmFieldMap::Init: No proper file name defined! (" << fFileName << ")" << endl;
246 Fatal("Init", "No proper file name");
247 }
248 // Fill values needed in the Print() function. This is needed to allow
249 // a constant Print() function.
250 fBxOrigin = GetBx(0., 0., 0.);
251 fByOrigin = GetBy(0., 0., 0.);
252 fBzOrigin = GetBz(0., 0., 0.);
253
254 Print();
255}
256// ------------------------------------------------------------------------
257
258
259// ----- Initialisation from arrays -------------------------------------
260void CbmFieldMap::Init(Int_t nX, Double_t xMin, Double_t xMax, Int_t nY, Double_t yMin, Double_t yMax, Int_t nZ,
261 Double_t zMin, Double_t zMax, TArrayF* bx, TArrayF* by, TArrayF* bz)
262{
263
264 Reset();
265 fNx = nX;
266 fXmin = xMin;
267 fXmax = xMax;
268 fNy = nY;
269 fYmin = yMin;
270 fYmax = yMax;
271 fNz = nZ;
272 fZmin = zMin;
273 fZmax = zMax;
274 Int_t nPoints = nX * nY * nZ;
275 assert(bx->GetSize() == by->GetSize());
276 assert(bz->GetSize() == bx->GetSize());
277 if (bx->GetSize() != nPoints) {
278 LOG(error) << "CbmFieldMap: array size " << bx->GetSize() << " does not match number of grid points.";
279 return;
280 }
281 fBx = new TArrayF(nPoints);
282 fBy = new TArrayF(nPoints);
283 fBz = new TArrayF(nPoints);
284 Int_t index = 0;
285 for (Int_t ix = 0; ix < fNx; ix++) {
286 for (Int_t iy = 0; iy < fNy; iy++) {
287 for (Int_t iz = 0; iz < fNz; iz++) {
288 index = ix * fNy * fNz + iy * fNz + iz;
289 (*fBx)[index] = (*bx)[index];
290 (*fBy)[index] = (*by)[index];
291 (*fBz)[index] = (*bz)[index];
292 } //# iz
293 } //# iy
294 } //# ix
295
296 fXstep = (fXmax - fXmin) / Double_t(fNx - 1);
297 fYstep = (fYmax - fYmin) / Double_t(fNy - 1);
298 fZstep = (fZmax - fZmin) / Double_t(fNz - 1);
299 fBxOrigin = GetBx(0., 0., 0.);
300 fByOrigin = GetBy(0., 0., 0.);
301 fBzOrigin = GetBz(0., 0., 0.);
302
303 LOG(info) << "CbmFieldMap: Initialised from " << nPoints << " grid points";
304 Print();
305}
306// ------------------------------------------------------------------------
307
308
309// ----------- Get x component of the field ---------------------------
310Double_t CbmFieldMap::GetBx(Double_t x, Double_t y, Double_t z) { return Interpolate(fBx, Global2Grid(x, y, z)); }
311// ------------------------------------------------------------------------
312
313
314// ----------- Get y component of the field ---------------------------
315Double_t CbmFieldMap::GetBy(Double_t x, Double_t y, Double_t z) { return Interpolate(fBy, Global2Grid(x, y, z)); }
316// ------------------------------------------------------------------------
317
318
319// ----------- Get z component of the field ---------------------------
320Double_t CbmFieldMap::GetBz(Double_t x, Double_t y, Double_t z) { return Interpolate(fBz, Global2Grid(x, y, z)); }
321// ------------------------------------------------------------------------
322
323
324// ----------- Get the field value at a point ------------------------
325void CbmFieldMap::GetFieldValue(const Double_t point[3], Double_t* bField)
326{
327 auto cell = Global2Grid(point[0], point[1], point[2]);
328
329 bField[0] = Interpolate(fBx, cell);
330 bField[1] = Interpolate(fBy, cell);
331 bField[2] = Interpolate(fBz, cell);
332}
333// ------------------------------------------------------------------------
334
335
336// ---------- Write the map to an ASCII file --------------------------
337void CbmFieldMap::WriteAsciiFile(const char* fileName)
338{
339
340 // Open file
341 LOG(info) << "Writing field map to ASCII file " << fileName;
342 std::ofstream mapFile(fileName);
343 if (!mapFile.is_open()) {
344 LOG(error) << "Could not open file! ";
345 return;
346 }
347
348 // Write field map grid parameters
349 mapFile.precision(6);
350 mapFile << showpoint;
351 if (fType == 1) mapFile << "nosym" << endl;
352 if (fType == 2) mapFile << "sym2" << endl;
353 if (fType == 3) mapFile << "sym3" << endl;
354 mapFile << fXmin << " " << fXmax << " " << fNx << endl;
355 mapFile << fYmin << " " << fYmax << " " << fNy << endl;
356 mapFile << fZmin << " " << fZmax << " " << fNz << endl;
357
358 // Write field values
359 Double_t factor = 10. * fScale; // Takes out scaling and converts kG->T
360 cout << right;
361 Int_t nTot = fNx * fNy * fNz;
362 cout << "-I- CbmFieldMap: " << fNx * fNy * fNz << " entries to write... " << setw(3) << 0 << " % ";
363 Int_t index = 0;
364 div_t modul;
365 Int_t iDiv = TMath::Nint(nTot / 100.);
366 for (Int_t ix = 0; ix < fNx; ix++) {
367 for (Int_t iy = 0; iy < fNy; iy++) {
368 for (Int_t iz = 0; iz < fNz; iz++) {
369 index = ix * fNy * fNz + iy * fNz + iz;
370 modul = div(index, iDiv);
371 if (modul.rem == 0) {
372 Double_t perc = TMath::Nint(100. * index / nTot);
373 cout << "\b\b\b\b\b\b" << setw(3) << perc << " % " << flush;
374 }
375 mapFile << fBx->At(index) / factor << " " << fBy->At(index) / factor << " " << fBz->At(index) / factor << endl;
376 } // z-Loop
377 } // y-Loop
378 } // x-Loop
379 cout << " " << index + 1 << " written" << endl;
380 mapFile.close();
381}
382// ------------------------------------------------------------------------
383
384
385// ------- Write field map to a ROOT file -----------------------------
386void CbmFieldMap::WriteRootFile(const char* fileName, const char* mapName)
387{
388
389 CbmFieldMapData* data = new CbmFieldMapData(mapName, *this);
390
392 TFile* oldFile = gFile;
393 TDirectory* oldDir = gDirectory;
394
395 TFile* file = new TFile(fileName, "RECREATE");
396 data->Write();
397 file->Close();
398
400 gFile = oldFile;
401 gDirectory = oldDir;
402}
403// ------------------------------------------------------------------------
404
405
406// ----- Set the position of the field centre in global coordinates -----
407void CbmFieldMap::SetPosition(Double_t x, Double_t y, Double_t z)
408{
409 fPosX = x;
410 fPosY = y;
411 fPosZ = z;
412}
413// ------------------------------------------------------------------------
414
415
416// --------- Screen output --------------------------------------------
417void CbmFieldMap::Print(Option_t*) const
418{
419 TString type = "Map";
420 if (fType == 2) type = "Map sym2";
421 if (fType == 3) type = "Map sym3";
422 cout << "======================================================" << endl;
423 cout.precision(4);
424 cout << showpoint;
425 cout << "---- " << fTitle << " : " << fName << endl;
426 cout << "----" << endl;
427 cout << "---- Field type : " << type << endl;
428 cout << "----" << endl;
429 cout << "---- Field map grid : " << endl;
430 cout << "---- x = " << setw(4) << fXmin << " to " << setw(4) << fXmax << " cm, " << fNx
431 << " grid points, dx = " << fXstep << " cm" << endl;
432 cout << "---- y = " << setw(4) << fYmin << " to " << setw(4) << fYmax << " cm, " << fNy
433 << " grid points, dy = " << fYstep << " cm" << endl;
434 cout << "---- z = " << setw(4) << fZmin << " to " << setw(4) << fZmax << " cm, " << fNz
435 << " grid points, dz = " << fZstep << " cm" << endl;
436 cout << endl;
437 cout << "---- Field centre position: ( " << setw(6) << fPosX << ", " << setw(6) << fPosY << ", " << setw(6) << fPosZ
438 << ") cm" << endl;
439 cout << "---- Field scaling factor: " << fScale << endl;
440 cout << "----" << endl;
441 cout << "---- Field at origin is ( " << setw(6) << fBxOrigin << ", " << setw(6) << fByOrigin << ", " << setw(6)
442 << fBzOrigin << ") kG" << endl;
443
444 cout << "======================================================" << endl;
445}
446// ------------------------------------------------------------------------
447
448
449// --------- Reset parameters and data (private) ----------------------
451{
452 fPosX = fPosY = fPosZ = 0.;
453 fXmin = fYmin = fZmin = 0.;
454 fXmax = fYmax = fZmax = 0.;
455 fXstep = fYstep = fZstep = 0.;
456 fNx = fNy = fNz = 0;
457 fScale = 1.;
458 if (fBx) {
459 delete fBx;
460 fBx = nullptr;
461 }
462 if (fBy) {
463 delete fBy;
464 fBy = nullptr;
465 }
466 if (fBz) {
467 delete fBz;
468 fBz = nullptr;
469 }
470}
471// ------------------------------------------------------------------------
472
473
474// ----- Read field map from ASCII file (private) ---------------------
475void CbmFieldMap::ReadAsciiFile(const char* fileName)
476{
477
478 Double_t bx = 0., by = 0., bz = 0.;
479
480 // Open file
481 LOG(info) << "CbmFieldMap: Reading field map from ASCII file " << fileName;
482 std::ifstream mapFile(fileName);
483 if (!mapFile.is_open()) {
484 LOG(error) << "CbmFieldMap:ReadAsciiFile: Could not open file!";
485 LOG(fatal) << "CbmFieldMap:ReadAsciiFile: Could not open file!";
486 }
487
488 // Read map type
489 TString type;
490 mapFile >> type;
491 Int_t iType = 0;
492 if (type == "nosym") iType = 1;
493 if (type == "sym2") iType = 2;
494 if (type == "sym3") iType = 3;
495 if (fType != iType) {
496 cout << "-E- CbmFieldMap::ReadAsciiFile: Incompatible map types!" << endl;
497 cout << " Field map is of type " << fType << " but map on file is of type " << iType << endl;
498 Fatal("ReadAsciiFile", "Incompatible map types");
499 }
500
501 // Read grid parameters
502 mapFile >> fXmin >> fXmax >> fNx;
503 mapFile >> fYmin >> fYmax >> fNy;
504 mapFile >> fZmin >> fZmax >> fNz;
505 fXstep = (fXmax - fXmin) / Double_t(fNx - 1);
506 fYstep = (fYmax - fYmin) / Double_t(fNy - 1);
507 fZstep = (fZmax - fZmin) / Double_t(fNz - 1);
508
509 // Create field arrays
510 fBx = new TArrayF(fNx * fNy * fNz);
511 fBy = new TArrayF(fNx * fNy * fNz);
512 fBz = new TArrayF(fNx * fNy * fNz);
513
514 // Read the field values
515 Double_t factor = fScale * 10.; // Factor 10 for T -> kG
516 cout << right;
517 Int_t nTot = fNx * fNy * fNz;
518 cout << "-I- CbmFieldMap: " << nTot << " entries to read... " << setw(3) << 0 << " % ";
519 Int_t index = 0;
520 div_t modul;
521 Int_t iDiv = TMath::Nint(nTot / 100.);
522 for (Int_t ix = 0; ix < fNx; ix++) {
523 for (Int_t iy = 0; iy < fNy; iy++) {
524 for (Int_t iz = 0; iz < fNz; iz++) {
525 if (!mapFile.good())
526 cerr << "-E- CbmFieldMap::ReadAsciiFile: "
527 << "I/O Error at " << ix << " " << iy << " " << iz << endl;
528 index = ix * fNy * fNz + iy * fNz + iz;
529 modul = div(index, iDiv);
530 if (modul.rem == 0) {
531 Double_t perc = TMath::Nint(100. * index / nTot);
532 cout << "\b\b\b\b\b\b" << setw(3) << perc << " % " << flush;
533 }
534 mapFile >> bx >> by >> bz;
535 fBx->AddAt(factor * bx, index);
536 fBy->AddAt(factor * by, index);
537 fBz->AddAt(factor * bz, index);
538 if (mapFile.eof()) {
539 cerr << endl
540 << "-E- CbmFieldMap::ReadAsciiFile: EOF"
541 << " reached at " << ix << " " << iy << " " << iz << endl;
542 mapFile.close();
543 break;
544 }
545 } // z-Loop
546 } // y-Loop0)
547 } // x-Loop
548
549 cout << " " << index + 1 << " read" << endl;
550
551 mapFile.close();
552}
553// ------------------------------------------------------------------------
554
555
556// ------------- Read field map from ROOT file (private) ---------------
557void CbmFieldMap::ReadRootFile(const char* fileName, const char* mapName)
558{
560 TFile* oldFile = gFile;
561 TDirectory* oldDir = gDirectory;
562
563 // Open root file
564 LOG(info) << "CbmFieldMap: Reading field map from ROOT file " << fileName;
565 TFile* file = new TFile(fileName, "READ");
566 if (!(file->IsOpen())) {
567 LOG(error) << "CbmFieldMap:ReadRootFile: Could not open file!";
568 LOG(fatal) << "CbmFieldMap:ReadRootFile: Could not open file!";
569 }
570
571 // Get the field data object
572 CbmFieldMapData* data = nullptr;
573 file->GetObject(mapName, data);
574 if (!data) {
575 cout << "-E- CbmFieldMap::ReadRootFile: data object " << fileName << " not found in file! " << endl;
576 exit(-1);
577 }
578
579 // Get the field parameters
580 SetField(data);
581
582 // Close the root file and delete the data object
583 file->Close();
584 delete data;
585
587 gFile = oldFile;
588 gDirectory = oldDir;
589}
590// ------------------------------------------------------------------------
591
592
593// ------------ Set field parameters and data (private) ----------------
595{
596
597 // Check compatibility
598 if (data->GetType() != fType) {
599 if (!((data->GetType() == 3) && (fType == 5))) // E.Litvinenko
600 {
601 cout << "-E- CbmFieldMap::SetField: Incompatible map types!" << endl;
602 cout << " Field map is of type " << fType << " but map on file is of type " << data->GetType() << endl;
603 Fatal("SetField", "Incompatible map types");
604 }
605 else
606 cout << " CbmFieldMap::SetField: Warning: You are using PosDepScaled "
607 "map (original map type = 3)"
608 << endl;
609 }
610
611
612 fXmin = data->GetXmin();
613 fYmin = data->GetYmin();
614 fZmin = data->GetZmin();
615 fXmax = data->GetXmax();
616 fYmax = data->GetYmax();
617 fZmax = data->GetZmax();
618 fNx = data->GetNx();
619 fNy = data->GetNy();
620 fNz = data->GetNz();
621 fXstep = (fXmax - fXmin) / Double_t(fNx - 1);
622 fYstep = (fYmax - fYmin) / Double_t(fNy - 1);
623 fZstep = (fZmax - fZmin) / Double_t(fNz - 1);
624 if (fBx) delete fBx;
625 if (fBy) delete fBy;
626 if (fBz) delete fBz;
627 fBx = new TArrayF(*(data->GetBx()));
628 fBy = new TArrayF(*(data->GetBy()));
629 fBz = new TArrayF(*(data->GetBz()));
630
631 // Scale and convert from T to kG
632 Double_t factor = fScale * 10.;
633 Int_t index = 0;
634 for (Int_t ix = 0; ix < fNx; ix++) {
635 for (Int_t iy = 0; iy < fNy; iy++) {
636 for (Int_t iz = 0; iz < fNz; iz++) {
637 index = ix * fNy * fNz + iy * fNz + iz;
638 if (fBx) (*fBx)[index] = (*fBx)[index] * factor;
639 if (fBy) (*fBy)[index] = (*fBy)[index] * factor;
640 if (fBz) (*fBz)[index] = (*fBz)[index] * factor;
641 }
642 }
643 }
644}
645// ------------------------------------------------------------------------
int Int_t
Double_t GetYmax() const
Double_t GetZmax() const
TString GetMapName() const
Double_t GetXmin() const
Double_t GetXmax() const
TArrayF * GetBz() const
Double_t GetYmin() const
Double_t GetZmin() const
TArrayF * GetBy() const
TArrayF * GetBx() const
Double_t GetZmin() const
Double_t GetXmax() const
TArrayF * GetBz() const
Int_t GetNz() const
TArrayF * GetBy() const
Double_t GetYmax() const
Int_t GetNy() const
Int_t GetType() const
Int_t GetNx() const
Double_t GetYmin() const
Double_t GetZmax() const
Double_t GetXmin() const
TArrayF * GetBx() const
Double_t fPosZ
Double_t fBxOrigin
TArrayF * fBy
Double_t fPosY
TArrayF * GetBz() const
virtual void SetPosition(Double_t x, Double_t y, Double_t z)
virtual void GetFieldValue(const Double_t point[3], Double_t *bField) override
Double_t fYmax
Double_t fPosX
Double_t fZmin
Double_t fZmax
Double_t fYmin
void WriteRootFile(const char *fileName, const char *mapName)
virtual ~CbmFieldMap()
void ReadAsciiFile(const char *fileName)
TArrayF * GetBx() const
TArrayF * fBx
TArrayF * fBz
void SetField(const CbmFieldMapData *data)
Double_t fXmin
virtual void Print(Option_t *="") const override
TString fFileName
Double_t fYstep
Double_t fZstep
GridCoordinates Global2Grid(Double_t x, Double_t y, Double_t z) const
Get grid cell coordinates for a point in global coordinates.
void ReadRootFile(const char *fileName, const char *mapName)
void WriteAsciiFile(const char *fileName)
Double_t fXstep
Double_t fBzOrigin
y-component of the field at the origin
Double_t fScale
Double_t Interpolate(const TArrayF *B, const GridCoordinates &point) const
Get field values by interpolation of the grid.
virtual void Init() override
Double_t fByOrigin
x-component of the field at the origin
TArrayF * GetBy() const
Double_t fXmax
Double_t GetPositionZ() const
Definition CbmFieldPar.h:74
Int_t GetType() const
Definition CbmFieldPar.h:61
void MapName(TString &name)
Definition CbmFieldPar.h:71
Double_t GetPositionY() const
Definition CbmFieldPar.h:73
Double_t GetScale() const
Definition CbmFieldPar.h:75
Double_t GetPositionX() const
Definition CbmFieldPar.h:72