BmnRoot
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
9#include "TArrayF.h"
10
11// ------------- Default constructor ----------------------------------
13 : TNamed(),
14 fType(1),
15 fXmin(0.),
16 fXmax(0.),
17 fYmin(0.),
18 fYmax(0.),
19 fZmin(0.),
20 fZmax(0.),
21 fNx(0),
22 fNy(0),
23 fNz(0),
24 fBx(NULL),
25 fBy(NULL),
26 fBz(NULL)
27{
28}
29// ------------------------------------------------------------------------
30
31
32
33// ------------- Standard constructor ---------------------------------
35 : TNamed(mapName, "CBM Field Map Data"),
36 fType(1),
37 fXmin(0.),
38 fXmax(0.),
39 fYmin(0.),
40 fYmax(0.),
41 fZmin(0.),
42 fZmax(0.),
43 fNx(0),
44 fNy(0),
45 fNz(0),
46 fBx(NULL),
47 fBy(NULL),
48 fBz(NULL)
49{
50}
51// ------------------------------------------------------------------------
52
53
54
55// ----- Constructor from BmnFieldMap ------------------------------
57 const BmnFieldMap& map)
58 : TNamed(name, "CBM Field Map Data"),
59 fType(map.GetType()),
60 fXmin(map.GetXmin()),
61 fXmax(map.GetXmax()),
62 fYmin(map.GetYmin()),
63 fYmax(map.GetYmax()),
64 fZmin(map.GetZmin()),
65 fZmax(map.GetZmax()),
66 fNx(map.GetNx()),
67 fNy(map.GetNy()),
68 fNz(map.GetNz()),
69 fBx(new TArrayF(*(map.GetBx()))),
70 fBy(new TArrayF(*(map.GetBy()))),
71 fBz(new TArrayF(*(map.GetBz())))
72{
73 // Take out scaling factor and convert from kG to T
74 if ( map.GetScale() == 0. ) {
75 Fatal("BmnFieldMap", "Zero scaling factor");
76 }
77 Double_t factor = map.GetScale() * 10.;
78 Int_t index = 0;
79 for (Int_t ix=0; ix<fNx; ix++) {
80 for (Int_t iy=0; iy<fNy; iy++) {
81 for (Int_t iz=0; iz<fNz; iz++) {
82 index = ix*fNy*fNz + iy*fNz + iz;
83 if ( fBx ) (*fBx)[index] = (*fBx)[index] / factor;
84 if ( fBy ) (*fBy)[index] = (*fBy)[index] / factor;
85 if ( fBz ) (*fBz)[index] = (*fBz)[index] / factor;
86 } // z loop
87 } // y loop
88 } // x loop
89
90}
91// ------------------------------------------------------------------------
92
93
94// ------------ Destructor --------------------------------------------
96 if ( fBx ) delete fBx;
97 if ( fBy ) delete fBy;
98 if ( fBz ) delete fBz;
99}
100// ------------------------------------------------------------------------
virtual ~BmnFieldMapData()
Double_t GetScale() const
Definition BmnFieldMap.h:90