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.) {
77 Fatal("CbmFieldMap", "Zero scaling factor");
78 }
79 Double_t factor = map.GetScale() * 10.;
80 Int_t index = 0;
81 for (Int_t ix = 0; ix < fNx; ix++) {
82 for (Int_t iy = 0; iy < fNy; iy++) {
83 for (Int_t iz = 0; iz < fNz; iz++) {
84 index = ix * fNy * fNz + iy * fNz + iz;
85 if (fBx) (*fBx)[index] = (*fBx)[index] / factor;
86 if (fBy) (*fBy)[index] = (*fBy)[index] / factor;
87 if (fBz) (*fBz)[index] = (*fBz)[index] / factor;
88 } // z loop
89 } // y loop
90 } // x loop
91}
92// ------------------------------------------------------------------------
93
94
95// ------------ Destructor --------------------------------------------
97{
98 if (fBx) delete fBx;
99 if (fBy) delete fBy;
100 if (fBz) delete fBz;
101}
102// ------------------------------------------------------------------------
103
104
ClassImp(CbmConverterManager)
int Int_t
Double_t GetZmin() const
Double_t GetXmax() const
TArrayF * GetBz() const
Int_t GetNz() const
TArrayF * GetBy() const
Double_t GetYmax() const
Int_t GetNy() const
Int_t GetType() const
Int_t GetNx() const
virtual ~CbmFieldMapData()
Double_t GetYmin() const
Double_t GetZmax() const
Double_t GetXmin() const
TArrayF * GetBx() const
Double_t GetScale() const