BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnFieldMapData.cxx
Go to the documentation of this file.
1// -------------------------------------------------------------------------
2// ----- BmnFieldMapData source file -----
3// ----- V. Friese 14/02/06 -----
4// -------------------------------------------------------------------------
5#include "BmnFieldMapData.h"
6
7#include "BmnFieldMap.h"
8#include "TArrayF.h"
9
10// ------------- Default constructor ----------------------------------
12 : TNamed()
13 , fType(1)
14 , fXmin(0.)
15 , fXmax(0.)
16 , fYmin(0.)
17 , fYmax(0.)
18 , fZmin(0.)
19 , fZmax(0.)
20 , fNx(0)
21 , fNy(0)
22 , fNz(0)
23 , fBx(NULL)
24 , fBy(NULL)
25 , fBz(NULL)
26{}
27// ------------------------------------------------------------------------
28
29// ------------- Standard constructor ---------------------------------
31 : TNamed(mapName, "CBM Field Map Data")
32 , fType(1)
33 , fXmin(0.)
34 , fXmax(0.)
35 , fYmin(0.)
36 , fYmax(0.)
37 , fZmin(0.)
38 , fZmax(0.)
39 , fNx(0)
40 , fNy(0)
41 , fNz(0)
42 , fBx(NULL)
43 , fBy(NULL)
44 , fBz(NULL)
45{}
46// ------------------------------------------------------------------------
47
48// ----- Constructor from BmnFieldMap ------------------------------
49BmnFieldMapData::BmnFieldMapData(const char* name, const BmnFieldMap& map)
50 : TNamed(name, "CBM Field Map Data")
51 , fType(map.GetType())
52 , fXmin(map.GetXmin())
53 , fXmax(map.GetXmax())
54 , fYmin(map.GetYmin())
55 , fYmax(map.GetYmax())
56 , fZmin(map.GetZmin())
57 , fZmax(map.GetZmax())
58 , fNx(map.GetNx())
59 , fNy(map.GetNy())
60 , fNz(map.GetNz())
61 , fBx(new TArrayF(*(map.GetBx())))
62 , fBy(new TArrayF(*(map.GetBy())))
63 , fBz(new TArrayF(*(map.GetBz())))
64{
65 // Take out scaling factor and convert from kG to T
66 if (map.GetScale() == 0.) {
67 Fatal("BmnFieldMap", "Zero scaling factor");
68 }
69 Double_t factor = map.GetScale() * 10.;
70 Int_t index = 0;
71 for (Int_t ix = 0; ix < fNx; ix++) {
72 for (Int_t iy = 0; iy < fNy; iy++) {
73 for (Int_t iz = 0; iz < fNz; iz++) {
74 index = ix * fNy * fNz + iy * fNz + iz;
75 if (fBx)
76 (*fBx)[index] = (*fBx)[index] / factor;
77 if (fBy)
78 (*fBy)[index] = (*fBy)[index] / factor;
79 if (fBz)
80 (*fBz)[index] = (*fBz)[index] / factor;
81 } // z loop
82 } // y loop
83 } // x loop
84}
85// ------------------------------------------------------------------------
86
87// ------------ Destructor --------------------------------------------
89{
90 if (fBx)
91 delete fBx;
92 if (fBy)
93 delete fBy;
94 if (fBz)
95 delete fBz;
96}
97// ------------------------------------------------------------------------
int Int_t
double Double_t
TArrayF * GetBy() const
Double_t GetYmax() const
TArrayF * fBx
Arrays with the field values in T.
Double_t GetZmin() const
Double_t GetXmin() const
TArrayF * GetBz() const
virtual ~BmnFieldMapData()
Destructor.
Int_t GetNz() const
Int_t GetType() const
Accessors to field parameters in local coordinate system.
BmnFieldMapData()
Default constructor.
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 fXmin
Field limits in local coordinate system.
Int_t fType
Type of map.
Int_t fNx
Number of grid points.
Double_t GetZmax() const
Double_t GetScale() const
Accessor to global scaling factor.
Definition BmnFieldMap.h:90