BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnFieldMap.cxx
Go to the documentation of this file.
1// ---------------------------------------------------------------------------------
2// ----- BmnFieldMap header file -------------
3// ----- Created 03/02/2015 by P. Batyuk -------------
4// ---------------------------------------------------------------------------------
5
6#include "BmnFieldMap.h"
7
8#include "BmnFieldPoint.h"
9#include "TFile.h"
10#include "TMath.h"
11#include "TSystem.h"
12#include "TTree.h"
13
14#include <iomanip>
15#include <iostream>
16using namespace std;
17
19 : FairField()
20 , fScale(1.)
21 , fPosX(0.)
22 , fPosY(0.)
23 , fPosZ(0.)
24 , fXmin(0.)
25 , fXmax(0.)
26 , fXstep(0.)
27 , fYmin(0.)
28 , fYmax(0.)
29 , fYstep(0.)
30 , fZmin(0.)
31 , fZmax(0.)
32 , fZstep(0.)
33 , fNx(0)
34 , fNy(0)
35 , fNz(0)
36 , fBx(nullptr)
37 , fBy(nullptr)
38 , fBz(nullptr)
40 , fIsOff(kFALSE)
41{
42 // Initilization of arrays is to my knowledge not
43 // possible in member initalization lists
44 for (Int_t i = 0; i < 2; i++) {
45 fHc[i] = 0;
46 for (Int_t j = 0; j < 2; j++) {
47 fHb[i][j] = 0;
48 for (Int_t k = 0; k < 2; k++) {
49 fHa[i][j][k] = 0;
50 }
51 }
52 }
53
54 // fName stores file name or path (using $VMCWORKDIR var) with magnetic field map
55 fName = "";
56 // fType: 1- nosym magnetic field, 2 - sym2, 3 - sym3
57 fType = 1;
58}
59
60BmnFieldMap::BmnFieldMap(const char* mapFileName)
61 : BmnFieldMap()
62{
63 fName = mapFileName;
64 fType = 1;
65}
66
68 : BmnFieldMap()
69{
70 if (!fieldPar)
71 LOG(error) << "BmnFieldMap::BmnFieldMap: empty parameter container";
72 else {
73 fPosX = fieldPar->GetPositionX();
74 fPosY = fieldPar->GetPositionY();
75 fPosZ = fieldPar->GetPositionZ();
76 fScale = fieldPar->GetScale();
77 fIsOff = fieldPar->IsFieldOff();
78 fieldPar->MapName(fName);
79 fType = fieldPar->GetType();
80 }
81}
82
84{
85 if (fBx)
86 delete fBx;
87 if (fBy)
88 delete fBy;
89 if (fBz)
90 delete fBz;
91}
92
93// get the expanded path to the field map file: a file name without a folder is searched in the storage of
94// the Local Geometry Database ($DBL_FILE_PATH), then in $GEOMPATH, otherwise in $VMCWORKDIR/input
96{
97 if (!mapName.Contains("/")) {
98 TString localDbPath = gSystem->Getenv("DBL_FILE_PATH");
99 if (localDbPath != "") {
100 gSystem->ExpandPathName(localDbPath);
101 // DBL_FILE_PATH can point to the database file itself, e.g. after the database was installed
102 // to a writable directory, so the storage is located next to the file in this case
103 FileStat_t file_stat;
104 if ((gSystem->GetPathInfo(localDbPath.Data(), file_stat) == 0) && (!R_ISDIR(file_stat.fMode)))
105 localDbPath = gSystem->GetDirName(localDbPath.Data());
106 mapName = localDbPath + "/storage/" + mapName;
107 } else {
108 localDbPath = gSystem->Getenv("GEOMPATH");
109 if (localDbPath == "")
110 mapName = "$VMCWORKDIR/input/" + mapName;
111 else
112 mapName = "$GEOMPATH/" + mapName;
113 }
114 }
115 gSystem->ExpandPathName(mapName);
116
117 return mapName;
118}
119
121{
122 // fName is not changed here: it is written to the output files (DST run header, field parameters),
123 // so it must not contain the path specific to the installation, where the files were produced
124 TString mapFilePath = GetMapFilePath(fName);
125
126 if (mapFilePath.Contains("extrap")) {
127 LOG(info) << "Extrapolated magnetic field map is used";
128 ReadRootFileNewFormatExtrap(mapFilePath);
129 } else {
130 LOG(info) << "Basic magnetic field map is used";
131 ReadRootFileNewFormat(mapFilePath);
132 }
136}
137
138void BmnFieldMap::WriteAsciiFile(const char* asciiFileName)
139{
140 TString strFileName(asciiFileName);
141 gSystem->ExpandPathName(strFileName);
142 // Open file
143 LOG(info) << "BmnFieldMap: Writing field map to ASCII file " << strFileName.Data() << endl;
144 ofstream mapFile(strFileName.Data());
145 if (!mapFile.is_open()) {
146 LOG(error) << "BmnFieldMap:ReadAsciiFile: Could not open file" << endl;
147 return;
148 }
149
150 // Write field map grid parameters
151 mapFile.precision(6);
152 mapFile << showpoint;
153 if (fType == 1)
154 mapFile << "nosym" << endl;
155 if (fType == 2)
156 mapFile << "sym2" << endl;
157 if (fType == 3)
158 mapFile << "sym3" << endl;
159 mapFile << fXmin << " " << fXmax << " " << fNx << endl;
160 mapFile << fYmin << " " << fYmax << " " << fNy << endl;
161 mapFile << fZmin << " " << fZmax << " " << fNz << endl;
162
163 // Write field values
164 Double_t factor = 10. * fScale; // Takes out scaling and converts kG->T
165 cout << right;
166 Int_t nTot = fNx * fNy * fNz;
167 LOG(info) << "BmnFieldMap: " << fNx * fNy * fNz << " entries to write... " << setw(3) << 0 << " % ";
168 Int_t index = 0;
169 div_t modul;
170 Int_t iDiv = TMath::Nint(nTot / 100.);
171 for (Int_t ix = 0; ix < fNx; ix++) {
172 for (Int_t iy = 0; iy < fNy; iy++) {
173 for (Int_t iz = 0; iz < fNz; iz++) {
174 index = ix * fNy * fNz + iy * fNz + iz;
175 modul = div(index, iDiv);
176 if (modul.rem == 0) {
177 Double_t perc = TMath::Nint(100. * index / nTot);
178 cout << "\b\b\b\b\b\b" << setw(3) << perc << " % " << flush;
179 }
180 mapFile << fBx->At(index) / factor << " " << fBy->At(index) / factor << " " << fBz->At(index) / factor
181 << endl;
182 } // z-Loop
183 } // y-Loop
184 } // x-Loop
185 cout << " " << index + 1 << " written" << endl;
186 mapFile.close();
187}
188
189void BmnFieldMap::WriteRootFile(const char* rootFileName, const char* mapFileName)
190{
191 BmnFieldMapData* data = new BmnFieldMapData(mapFileName, *this);
192 TFile* oldFile = gFile;
193 TString strFileName(rootFileName);
194 gSystem->ExpandPathName(strFileName);
195 TFile* file = TFile::Open(strFileName, "RECREATE");
196 data->Write();
197 delete file;
198 if (oldFile)
199 oldFile->cd();
200}
201
203{
204 fPosX = x;
205 fPosY = y;
206 fPosZ = z;
210}
211
213{
214 TString type = "Map";
215 if (fType == 2)
216 type = "Map sym2";
217 if (fType == 3)
218 type = "Map sym3";
219 cout << "======================================================" << endl;
220 cout.precision(4);
221 cout << showpoint;
222 cout << "---- " << fTitle << " : " << fName << endl;
223 cout << "----" << endl;
224 cout << "---- Field type : " << type << endl;
225 cout << "----" << endl;
226 cout << "---- Field map grid : " << endl;
227 cout << "---- x = " << setw(4) << fXmin << " to " << setw(4) << fXmax << " cm, " << fNx
228 << " grid points, dx = " << fXstep << " cm" << endl;
229 cout << "---- y = " << setw(4) << fYmin << " to " << setw(4) << fYmax << " cm, " << fNy
230 << " grid points, dy = " << fYstep << " cm" << endl;
231 cout << "---- z = " << setw(4) << fZmin << " to " << setw(4) << fZmax << " cm, " << fNz
232 << " grid points, dz = " << fZstep << " cm" << endl;
233 cout << endl;
234 cout << "---- Target position: ( " << setw(6) << fPosX << ", " << setw(6) << fPosY << ", " << setw(6) << fPosZ
235 << ") cm" << endl;
236 cout << "---- Field scaling factor: " << fScale << endl;
237 if (fIsOff)
238 cout << "---- Field is off ----" << endl;
239 cout << "----" << endl;
240 cout << "---- Field at Target Position ( " << setw(6) << fPosBx << ", " << setw(6) << fPosBy << ", " << setw(6)
241 << fPosBz << ") kG" << endl;
242 cout << "======================================================" << endl;
243}
244
246{
247 fPosX = fPosY = fPosZ = 0.;
248 fPosBx = fPosBy = fPosBz = 0.;
249 fXmin = fYmin = fZmin = 0.;
250 fXmax = fYmax = fZmax = 0.;
251 fXstep = fYstep = fZstep = 0.;
252 fNx = fNy = fNz = 0;
253 fScale = 1.;
254 fIsOff = kFALSE;
255 if (fBx) {
256 delete fBx;
257 fBx = NULL;
258 }
259 if (fBy) {
260 delete fBy;
261 fBy = NULL;
262 }
263 if (fBz) {
264 delete fBz;
265 fBz = NULL;
266 }
267}
268
269void BmnFieldMap::ReadAsciiFile(const char* asciiFileName)
270{
271 Double_t bx = 0., by = 0., bz = 0.;
272
273 TString strFileName(asciiFileName);
274 gSystem->ExpandPathName(strFileName);
275 // Open file
276 LOG(info) << "BmnFieldMap: Reading field map from ASCII file " << strFileName.Data();
277 ifstream mapFile(strFileName.Data());
278 if (!mapFile.is_open()) {
279 LOG(error) << "BmnFieldMap:ReadAsciiFile: Could not open file!";
280 LOG(fatal) << "BmnFieldMap:ReadAsciiFile: Could not open file!";
281 }
282
283 // Read map type
284 TString type;
285 mapFile >> type;
286 Int_t iType = 0;
287 if (type == "nosym")
288 iType = 1;
289 if (type == "sym2")
290 iType = 2;
291 if (type == "sym3")
292 iType = 3;
293 if (fType != iType) {
294 cout << "-E- BmnFieldMap::ReadAsciiFile: Incompatible map types!" << endl;
295 cout << " Field map is of type " << fType << " but map on file is of type " << iType << endl;
296 Fatal("ReadAsciiFile", "Incompatible map types");
297 }
298
299 // Read grid parameters
300 mapFile >> fXmin >> fXmax >> fNx;
301 mapFile >> fYmin >> fYmax >> fNy;
302 mapFile >> fZmin >> fZmax >> fNz;
303 fXstep = (fXmax - fXmin) / Double_t(fNx - 1);
304 fYstep = (fYmax - fYmin) / Double_t(fNy - 1);
305 fZstep = (fZmax - fZmin) / Double_t(fNz - 1);
306
307 // Create field arrays
308 fBx = new TArrayF(fNx * fNy * fNz);
309 fBy = new TArrayF(fNx * fNy * fNz);
310 fBz = new TArrayF(fNx * fNy * fNz);
311
312 // Read the field values
313 Double_t factor = fScale * 10.; // Factor 10 for T -> kG
314 cout << right;
315 Int_t nTot = fNx * fNy * fNz;
316 // cout << "-I- BmnFieldMap: " << nTot << " entries to read... " << setw(3) << 0 << " % ";
317 Int_t index = 0;
318 div_t modul;
319 Int_t iDiv = TMath::Nint(nTot / 100.);
320 for (Int_t ix = 0; ix < fNx; ix++) {
321 for (Int_t iy = 0; iy < fNy; iy++) {
322 for (Int_t iz = 0; iz < fNz; iz++) {
323 if (!mapFile.good())
324 cerr << "-E- BmnFieldMap::ReadAsciiFile: "
325 << "I/O Error at " << ix << " " << iy << " " << iz << endl;
326 index = ix * fNy * fNz + iy * fNz + iz;
327 modul = div(index, iDiv);
328 // if (modul.rem == 0) {
329 // Double_t perc = TMath::Nint(100. * index / nTot);
330 // cout << "\b\b\b\b\b\b" << setw(3) << perc << " % " << flush;
331 //}
332 mapFile >> bx >> by >> bz;
333 fBx->AddAt(factor * bx, index);
334 fBy->AddAt(factor * by, index);
335 fBz->AddAt(factor * bz, index);
336 if (mapFile.eof()) {
337 cerr << endl
338 << "-E- BmnFieldMap::ReadAsciiFile: EOF"
339 << " reached at " << ix << " " << iy << " " << iz << endl;
340 mapFile.close();
341 break;
342 }
343 } // z-Loop
344 } // y-Loop0)
345 } // x-Loop
346
347 cout << " " << index + 1 << " read" << endl;
348
349 fXmin += fPosX;
350 fXmax += fPosX;
351
352 fYmin += fPosY;
353 fYmax += fPosY;
354
355 fZmin += fPosZ;
356 fZmax += fPosZ;
357
358 mapFile.close();
359}
360
361void BmnFieldMap::ReadRootFileNewFormat(const char* rootFileName)
362{
363 TString strFileName(rootFileName);
364 gSystem->ExpandPathName(strFileName);
365 // Open root file
366 LOG(info) << "BmnFieldMap: Reading field map from ROOT file " << strFileName.Data();
367 TFile* file = TFile::Open(strFileName, "READ");
368 if ((file == nullptr) || (!file->IsOpen()))
369 LOG(fatal) << "BmnFieldMap:ReadRootFileNewFormat: Could not open the file with a field map";
370
371 BmnFieldPoint point;
372 TTree* tree = (TTree*)file->Get("Field_map");
373 tree->SetBranchAddress("field_points", &point);
374
375 fNx = 126;
376 fXmin = -155.78;
377 fXmax = 144.82;
378 fXstep = (fXmax - fXmin) / (fNx - 1);
379
380 fNy = 47;
381 fYmin = -37.67;
382 fYmax = 54.33;
383 fYstep = (fYmax - fYmin) / (fNy - 1);
384
385 fNz = 241;
386 fZmin = -162.16;
387 fZmax = 439.04;
388 fZstep = (fZmax - fZmin) / (fNz - 1);
389
390 Int_t nTot = fNx * fNy * fNz;
391 fBx = new TArrayF(nTot);
392 fBy = new TArrayF(nTot);
393 fBz = new TArrayF(nTot);
394
395 Int_t index = 0;
396
397 for (Int_t i = 0; i < tree->GetEntries(); i++) {
398 tree->GetEntry(i);
399 // В дереве, сформированном из CSV файлов, данные записаны в одном порядке, а BmnFieldMap они хранятся в другом.
400 // Поэтому сначала из общего сквозного индекса получаем отдельные индексы по каждому измерению.
401 // При этом индекс по x инвертируем, так как направление оси в Bmn и в рамке с замерами поля противоположные.
402 Int_t iz = i % fNz;
403 Int_t ix = fNx - ((i / fNz) % fNx) - 1;
404 Int_t iy = ((i / fNz) / fNx) % fNy;
405 // После этого формируем итоговый сквозной индекс для карты поля в формате BmnFieldMap
406 index = ix * fNy * fNz + iy * fNz + iz;
407 // И пишем по этому индексу компоненты, предварительно скалируя их.
408 fBx->AddAt(fScale * point.GetBx(), index);
409 fBy->AddAt(fScale * point.GetBy(), index);
410 fBz->AddAt(fScale * point.GetBz(), index);
411 }
412
413 delete file;
414}
415
416void BmnFieldMap::ReadRootFileNewFormatExtrap(const char* rootFileName)
417{
418 TString strFileName(rootFileName);
419 gSystem->ExpandPathName(strFileName);
420 // Open root file
421 LOG(info) << "BmnFieldMap: Reading field map from ROOT file " << strFileName.Data();
422 TFile* file = TFile::Open(strFileName, "READ");
423 if ((file == nullptr) || (!file->IsOpen()))
424 LOG(fatal) << "BmnFieldMap:ReadRootFileNewFormatExtrap: Could not open the file with a field map";
425
426 BmnFieldPoint point;
427 TTree* tree = (TTree*)file->Get("Field_map");
428 tree->SetBranchAddress("field_points", &point);
429
430 fNx = 206;
431 fXmin = -251.972;
432 fXmax = 241.012;
433 fXstep = (fXmax - fXmin) / (fNx - 1);
434
435 fNy = 87;
436 fYmin = -77.67;
437 fYmax = 94.33;
438 fYstep = (fYmax - fYmin) / (fNy - 1);
439
440 fNz = 341;
441 fZmin = -287.41;
442 fZmax = 564.29;
443 fZstep = (fZmax - fZmin) / (fNz - 1);
444
445 Int_t nTot = fNx * fNy * fNz;
446 fBx = new TArrayF(nTot);
447 fBy = new TArrayF(nTot);
448 fBz = new TArrayF(nTot);
449
450 Int_t index = 0;
451
452 for (Int_t i = 0; i < tree->GetEntries(); i++) {
453 tree->GetEntry(i);
454 // В дереве, сформированном из CSV файлов, данные записаны в одном порядке, а BmnFieldMap они хранятся в другом.
455 // Поэтому сначала из общего сквозного индекса получаем отдельные индексы по каждому измерению.
456 // При этом индекс по x инвертируем, так как направление оси в Bmn и в рамке с замерами поля противоположные.
457 Int_t iz = i % fNz;
458 Int_t ix = fNx - ((i / fNz) % fNx) - 1;
459 Int_t iy = ((i / fNz) / fNx) % fNy;
460 // После этого формируем итоговый сквозной индекс для карты поля в формате BmnFieldMap
461 index = ix * fNy * fNz + iy * fNz + iz;
462 // И пишем по этому индексу компоненты, предварительно скалируя их.
463 fBx->AddAt(fScale * point.GetBx(), index);
464 fBy->AddAt(fScale * point.GetBy(), index);
465 fBz->AddAt(fScale * point.GetBz(), index);
466 }
467
468 delete file;
469}
470
471void BmnFieldMap::ReadRootFile(const char* rootFileName)
472{
473 TString* type = 0;
474 coordinate_info_t X, Y, Z;
475 vector<Double_t>* read_Field = NULL;
476
477 TString strFileName(rootFileName);
478 gSystem->ExpandPathName(strFileName);
479 // Open root file
480 LOG(info) << "BmnFieldMap: Reading field map from ROOT file " << strFileName.Data();
481 TFile* file = TFile::Open(strFileName, "READ");
482 if ((file == nullptr) || (!file->IsOpen()))
483 LOG(fatal) << "BmnFieldMap:ReadRootFile: Could not open the file with a field map";
484
485 TTree* tree = (TTree*)file->Get("Main_info");
486 TTree* t = (TTree*)file->Get("Field_map");
487 tree->SetBranchAddress("Field_type", &type);
488 tree->SetBranchAddress("Main_info_X", &X);
489 tree->SetBranchAddress("Main_info_Y", &Y);
490 tree->SetBranchAddress("Main_info_Z", &Z);
491 t->SetBranchAddress("field_map", &read_Field);
492
493 tree->GetEntry(0);
494 Int_t iType = 0;
495
496 if (*type == "nosym")
497 iType = 1;
498 if (*type == "sym2")
499 iType = 2;
500 if (*type == "sym3")
501 iType = 3;
502 if (fType != iType) {
503 LOG(error) << "BmnFieldMap::ReadRootFile: Incompatible map types!";
504 LOG(info) << " Field map is of type " << fType << " but map on file is of type " << iType;
505 LOG(fatal) << "ReadRootFile: Incompatible map types";
506 }
507
508 fNx = X.N;
509 fXmin = X.min + fPosX;
510 fXmax = X.max + fPosX;
511 fXstep = X.step;
512
513 fNy = Y.N;
514 fYmin = Y.min + fPosY;
515 fYmax = Y.max + fPosY;
516 fYstep = Y.step;
517
518 fNz = Z.N;
519 fZmin = Z.min + fPosZ;
520 fZmax = Z.max + fPosZ;
521 fZstep = Z.step;
522
523 fBx = new TArrayF(fNx * fNy * fNz);
524 fBy = new TArrayF(fNx * fNy * fNz);
525 fBz = new TArrayF(fNx * fNy * fNz);
526
527 Double_t factor = fScale;
528 Int_t nTot = fNx * fNy * fNz;
529 Int_t index = 0;
530 div_t modul;
531 Int_t iDiv = TMath::Nint(nTot / 100.);
532
533 for (Int_t ix = 0; ix < fNx; ix++) {
534 for (Int_t iy = 0; iy < fNy; iy++) {
535 for (Int_t iz = 0; iz < fNz; iz++) {
536 modul = div(index, iDiv);
537 // if (modul.rem == 0) {
538 // Double_t perc = TMath::Nint(100. * index / nTot);
539 // }
540 index = ix * fNy * fNz + iy * fNz + iz;
541 t->GetEntry(index);
542 vector<Double_t> v = (*read_Field);
543 fBx->AddAt(factor * v[0], index);
544 fBy->AddAt(factor * v[1], index);
545 fBz->AddAt(factor * v[2], index);
546 } // z-Loop
547 } // y-Loop
548 } // x-Loop
549
550 t->Delete();
551 tree->Delete();
552 delete type;
553 delete read_Field;
554 delete file;
555}
556
558{
559 // Check compatibility
560 if (data->GetType() != fType) {
561 if (!((data->GetType() == 3) && (fType == 5))) // E.Litvinenko
562 {
563 LOG(error) << "BmnFieldMap::SetField: Incompatible map types!";
564 LOG(info) << " Field map is of type " << fType << " but map on file is of type " << data->GetType();
565 LOG(fatal) << "SetField: Incompatible map types";
566 } else
567 LOG(info) << " BmnFieldMap::SetField: Warning: You are using PosDepScaled map (original map type = 3)";
568 }
569
570 fXmin = data->GetXmin();
571 fYmin = data->GetYmin();
572 fZmin = data->GetZmin();
573 fXmax = data->GetXmax();
574 fYmax = data->GetYmax();
575 fZmax = data->GetZmax();
576 fNx = data->GetNx();
577 fNy = data->GetNy();
578 fNz = data->GetNz();
579 fXstep = (fXmax - fXmin) / Double_t(fNx - 1);
580 fYstep = (fYmax - fYmin) / Double_t(fNy - 1);
581 fZstep = (fZmax - fZmin) / Double_t(fNz - 1);
582 if (fBx)
583 delete fBx;
584 if (fBy)
585 delete fBy;
586 if (fBz)
587 delete fBz;
588 fBx = new TArrayF(*(data->GetBx()));
589 fBy = new TArrayF(*(data->GetBy()));
590 fBz = new TArrayF(*(data->GetBz()));
591
592 // Scale and convert from T to kG
593 Double_t factor = fScale * 10.;
594 Int_t index = 0;
595 for (Int_t ix = 0; ix < fNx; ix++) {
596 for (Int_t iy = 0; iy < fNy; iy++) {
597 for (Int_t iz = 0; iz < fNz; iz++) {
598 index = ix * fNy * fNz + iy * fNz + iz;
599 if (fBx)
600 (*fBx)[index] = (*fBx)[index] * factor;
601 if (fBy)
602 (*fBy)[index] = (*fBy)[index] * factor;
603 if (fBz)
604 (*fBz)[index] = (*fBz)[index] * factor;
605 }
606 }
607 }
608}
609
611{
612 // Interpolate in x coordinate
613 fHb[0][0] = fHa[0][0][0] + (fHa[1][0][0] - fHa[0][0][0]) * dx;
614 fHb[1][0] = fHa[0][1][0] + (fHa[1][1][0] - fHa[0][1][0]) * dx;
615 fHb[0][1] = fHa[0][0][1] + (fHa[1][0][1] - fHa[0][0][1]) * dx;
616 fHb[1][1] = fHa[0][1][1] + (fHa[1][1][1] - fHa[0][1][1]) * dx;
617
618 // Interpolate in y coordinate
619 fHc[0] = fHb[0][0] + (fHb[1][0] - fHb[0][0]) * dy;
620 fHc[1] = fHb[0][1] + (fHb[1][1] - fHb[0][1]) * dy;
621
622 // Interpolate in z coordinate
623 return fHc[0] + (fHc[1] - fHc[0]) * dz;
624}
__m128 v
Definition P4_F32vec4.h:1
int i
Definition P4_F32vec4.h:22
int Int_t
constexpr Bool_t kFALSE
double Double_t
const char Option_t
void Fatal(const char *location, const char *msgfmt,...)
#define gFile
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
TArrayF * GetBy() const
Double_t GetYmax() const
Double_t GetZmin() const
Double_t GetXmin() const
TArrayF * GetBz() const
Int_t GetNz() const
Int_t GetType() const
Accessors to field parameters in local coordinate system.
Double_t GetXmax() const
Int_t GetNy() const
TArrayF * GetBx() const
Accessors to the field value arrays.
Int_t GetNx() const
Double_t GetYmin() const
Double_t GetZmax() const
void ReadRootFileNewFormat(const char *rootFileName)
Double_t fHa[2][2][2]
Variables for temporary storage Used in the very frequently called method GetFieldValue.
TArrayF * fBy
void SetField(const BmnFieldMapData *data)
Set field parameters and data.
Bool_t fIsOff
Whether magnetic field is off.
Double_t fPosZ
Double_t fPosBx
TArrayF * GetBx() const
Accessors to the field value arrays.
Definition BmnFieldMap.h:96
Int_t fNx
Number of grid points.
void ReadRootFileNewFormatExtrap(const char *rootFileName)
void ReadRootFile(const char *rootFileName)
Read field map from a ROOT file.
Double_t fPosY
static TString GetMapFilePath(TString mapName)
Get the expanded path to the field map file in the current installation.
TArrayF * GetBy() const
Definition BmnFieldMap.h:97
TArrayF * fBz
Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz)
Get field values by interpolation of the grid.
Double_t fScale
Global scaling factor (w.r.t.
Double_t fPosX
Field centre position in global coordinates.
Double_t fHc[2]
Interpolated field (2-dim).
void Reset()
Reset the field parameters and data.
virtual ~BmnFieldMap()
void SetPosition(Double_t x, Double_t y, Double_t z)
Set the position of the field centre.
Double_t fZmin
TArrayF * GetBz() const
Definition BmnFieldMap.h:98
Double_t fYmax
Double_t fHb[2][2]
Field at corners of a grid cell.
void WriteRootFile(const char *rootFileName, const char *mapFileName)
Write field map data to a ROOT file.
virtual void Init()
Bool_t fDebugInfo
Interpolated field (1-dim).
Double_t fPosBy
Double_t fXstep
Double_t fZstep
Double_t fPosBz
Double_t fXmin
Field limits in local coordinate system.
TArrayF * fBx
Arrays with the field values.
void ReadAsciiFile(const char *asciiFileName)
Reset the field parameters and data.
Double_t fZmax
Double_t fYmin
Double_t fYstep
void WriteAsciiFile(const char *asciiFileName)
Write the field map to an ASCII file.
Double_t fXmax
virtual void Print(Option_t *) const
Screen output.
Double_t GetPositionZ() const
Definition BmnFieldPar.h:61
Bool_t IsFieldOff() const
Definition BmnFieldPar.h:63
Int_t GetType() const
Accessors.
Definition BmnFieldPar.h:48
Double_t GetScale() const
Definition BmnFieldPar.h:62
Double_t GetPositionY() const
Definition BmnFieldPar.h:60
Double_t GetPositionX() const
Definition BmnFieldPar.h:59
void MapName(TString &name)
Definition BmnFieldPar.h:58
Double_t GetBy()
Double_t GetBz()
Double_t GetBx()
Bool_t cd() override
T * Get(const char *namecycle)
virtual Bool_t IsOpen() const
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
void Delete(Option_t *option="") override
virtual Long64_t GetEntries() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
Int_t Nint(T x)
Definition json.hpp:4446