CbmRoot
CbmFieldMapData.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmFieldMapData source file -----
3 // ----- V. Friese 14/02/06 -----
4 // -------------------------------------------------------------------------
5 #include "CbmFieldMapData.h"
6 
7 #include "CbmFieldMap.h" // for CbmFieldMap
8 
9 #include <TArrayF.h> // for TArrayF
10 #include <TNamed.h> // for TNamed
11 
12 // ------------- Default constructor ----------------------------------
14  : TNamed()
15  , fType(1)
16  , fXmin(0.)
17  , fXmax(0.)
18  , fYmin(0.)
19  , fYmax(0.)
20  , fZmin(0.)
21  , fZmax(0.)
22  , fNx(0)
23  , fNy(0)
24  , fNz(0)
25  , fBx(nullptr)
26  , fBy(nullptr)
27  , fBz(nullptr) {}
28 // ------------------------------------------------------------------------
29 
30 
31 // ------------- Standard constructor ---------------------------------
33  : TNamed(mapName, "CBM Field Map Data")
34  , fType(1)
35  , fXmin(0.)
36  , fXmax(0.)
37  , fYmin(0.)
38  , fYmax(0.)
39  , fZmin(0.)
40  , fZmax(0.)
41  , fNx(0)
42  , fNy(0)
43  , fNz(0)
44  , fBx(nullptr)
45  , fBy(nullptr)
46  , fBz(nullptr) {}
47 // ------------------------------------------------------------------------
48 
49 
50 // ----- Constructor from CbmFieldMap ------------------------------
51 CbmFieldMapData::CbmFieldMapData(const char* name, const CbmFieldMap& map)
52  : TNamed(name, "CBM Field Map Data")
53  , fType(map.GetType())
54  , fXmin(map.GetXmin())
55  , fXmax(map.GetXmax())
56  , fYmin(map.GetYmin())
57  , fYmax(map.GetYmax())
58  , fZmin(map.GetZmin())
59  , fZmax(map.GetZmax())
60  , fNx(map.GetNx())
61  , fNy(map.GetNy())
62  , fNz(map.GetNz())
63  , fBx(new TArrayF(*(map.GetBx())))
64  , fBy(new TArrayF(*(map.GetBy())))
65  , fBz(new TArrayF(*(map.GetBz()))) {
66  // Take out scaling factor and convert from kG to T
67  if (map.GetScale() == 0.) { Fatal("CbmFieldMap", "Zero scaling factor"); }
68  Double_t factor = map.GetScale() * 10.;
69  Int_t index = 0;
70  for (Int_t ix = 0; ix < fNx; ix++) {
71  for (Int_t iy = 0; iy < fNy; iy++) {
72  for (Int_t iz = 0; iz < fNz; iz++) {
73  index = ix * fNy * fNz + iy * fNz + iz;
74  if (fBx) (*fBx)[index] = (*fBx)[index] / factor;
75  if (fBy) (*fBy)[index] = (*fBy)[index] / factor;
76  if (fBz) (*fBz)[index] = (*fBz)[index] / factor;
77  } // z loop
78  } // y loop
79  } // x loop
80 }
81 // ------------------------------------------------------------------------
82 
83 
84 // ------------ Destructor --------------------------------------------
86  if (fBx) delete fBx;
87  if (fBy) delete fBy;
88  if (fBz) delete fBz;
89 }
90 // ------------------------------------------------------------------------
91 
92 
CbmFieldMapData::~CbmFieldMapData
virtual ~CbmFieldMapData()
Definition: CbmFieldMapData.cxx:85
CbmFieldMapData::fBz
TArrayF * fBz
Definition: CbmFieldMapData.h:84
CbmFieldMapData.h
CbmFieldMapData::fNx
Int_t fNx
Definition: CbmFieldMapData.h:78
CbmFieldMap
Definition: CbmFieldMap.h:34
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmFieldMapData
Definition: CbmFieldMapData.h:29
CbmFieldMapData::fNy
Int_t fNy
Definition: CbmFieldMapData.h:78
CbmFieldMapData::CbmFieldMapData
CbmFieldMapData()
Definition: CbmFieldMapData.cxx:13
CbmFieldMap::GetScale
Double_t GetScale() const
Definition: CbmFieldMap.h:154
CbmFieldMap.h
CbmFieldMapData::fBy
TArrayF * fBy
Definition: CbmFieldMapData.h:83
CbmFieldMapData::fNz
Int_t fNz
Definition: CbmFieldMapData.h:78
CbmFieldMapData::fBx
TArrayF * fBx
Definition: CbmFieldMapData.h:82