CbmRoot
Loading...
Searching...
No Matches
CbmFieldMapData.cxx
Go to the documentation of this file.
1/* Copyright (C) 2006-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig, Denis Bertini [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmFieldMapData source file -----
7// ----- V. Friese 14/02/06 -----
8// -------------------------------------------------------------------------
9#include "CbmFieldMapData.h"
10
11#include "CbmFieldMap.h" // for CbmFieldMap
12
13#include <TArrayF.h> // for TArrayF
14#include <TNamed.h> // for TNamed
15
16// ------------- Default constructor ----------------------------------
18 : TNamed()
19 , fType(1)
20 , fXmin(0.)
21 , fXmax(0.)
22 , fYmin(0.)
23 , fYmax(0.)
24 , fZmin(0.)
25 , fZmax(0.)
26 , fNx(0)
27 , fNy(0)
28 , fNz(0)
29 , fBx(nullptr)
30 , fBy(nullptr)
31 , fBz(nullptr)
32{
33}
34// ------------------------------------------------------------------------
35
36
37// ------------- Standard constructor ---------------------------------
39 : TNamed(mapName, "CBM Field Map Data")
40 , fType(1)
41 , fXmin(0.)
42 , fXmax(0.)
43 , fYmin(0.)
44 , fYmax(0.)
45 , fZmin(0.)
46 , fZmax(0.)
47 , fNx(0)
48 , fNy(0)
49 , fNz(0)
50 , fBx(nullptr)
51 , fBy(nullptr)
52 , fBz(nullptr)
53{
54}
55// ------------------------------------------------------------------------
56
57
58// ----- Constructor from CbmFieldMap ------------------------------
59CbmFieldMapData::CbmFieldMapData(const char* name, const CbmFieldMap& map)
60 : TNamed(name, "CBM Field Map Data")
61 , fType(map.GetType())
62 , fXmin(map.GetXmin())
63 , fXmax(map.GetXmax())
64 , fYmin(map.GetYmin())
65 , fYmax(map.GetYmax())
66 , fZmin(map.GetZmin())
67 , fZmax(map.GetZmax())
68 , fNx(map.GetNx())
69 , fNy(map.GetNy())
70 , fNz(map.GetNz())
71 , fBx(new TArrayF(*(map.GetBx())))
72 , fBy(new TArrayF(*(map.GetBy())))
73 , fBz(new TArrayF(*(map.GetBz())))
74{
75 // Take out scaling factor and convert from kG to T
76 if (map.GetScale() == 0.) { Fatal("CbmFieldMap", "Zero scaling factor"); }
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// ------------ Destructor --------------------------------------------
95{
96 if (fBx) delete fBx;
97 if (fBy) delete fBy;
98 if (fBz) delete fBz;
99}
100// ------------------------------------------------------------------------
101
102
ClassImp(CbmConverterManager)
virtual ~CbmFieldMapData()