CbmRoot
Loading...
Searching...
No Matches
CbmFieldMap.h
Go to the documentation of this file.
1/* Copyright (C) 2004-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Mohammad Al-Turany, Denis Bertini [committer], Volker Friese */
4
5// -------------------------------------------------------------------------
6// ----- CbmFieldMap header file -----
7// ----- Created 12/01/04 by M. Al/Turany (CbmField.h) -----
8// ----- Redesign 13/02/06 by V. Friese -----
9// -------------------------------------------------------------------------
10
11
23#ifndef CBMFIELDMAP_H
24#define CBMFIELDMAP_H 1
25
26
27#include <FairField.h> // for FairField
28
29#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
30#include <RtypesCore.h> // for Double_t, Int_t, Bool_t, Option_t
31#include <TString.h> // for TString
32
34class CbmFieldMapData;
35class CbmFieldPar;
36class TArrayF;
37
38class CbmFieldMap : public FairField {
39
40
41public:
44
45
50 CbmFieldMap(const char* mapName, const char* fileType = "R");
51
52
54 CbmFieldMap(CbmFieldPar* fieldPar);
55
56
59
60
62 virtual ~CbmFieldMap();
63
64
66 virtual void Init();
67
68
80 virtual void Init(Int_t nX, Double_t xMin, Double_t xMax, Int_t nY, Double_t yMin, Double_t yMax, Int_t nZ,
81 Double_t zMin, Double_t zMax, TArrayF* bx, TArrayF* by, TArrayF* bz);
82
83
88 virtual Double_t GetBx(Double_t x, Double_t y, Double_t z);
89 virtual Double_t GetBy(Double_t x, Double_t y, Double_t z);
90 virtual Double_t GetBz(Double_t x, Double_t y, Double_t z);
91
92
99 virtual Bool_t IsInside(Double_t x, Double_t y, Double_t z, Int_t& ix, Int_t& iy, Int_t& iz, Double_t& dx,
100 Double_t& dy, Double_t& dz);
101
102
104 void WriteAsciiFile(const char* fileName);
105
106
108 void WriteRootFile(const char* fileName, const char* mapName);
109
110
112 virtual void SetPosition(Double_t x, Double_t y, Double_t z);
113
114
116 virtual void SetScale(Double_t factor) { fScale = factor; }
117
118
120 Double_t GetXmin() const { return fXmin; }
121 Double_t GetYmin() const { return fYmin; }
122 Double_t GetZmin() const { return fZmin; }
123 Double_t GetXmax() const { return fXmax; }
124 Double_t GetYmax() const { return fYmax; }
125 Double_t GetZmax() const { return fZmax; }
126 Double_t GetXstep() const { return fXstep; }
127 Double_t GetYstep() const { return fYstep; }
128 Double_t GetZstep() const { return fZstep; }
129 Int_t GetNx() const { return fNx; }
130 Int_t GetNy() const { return fNy; }
131 Int_t GetNz() const { return fNz; }
132
133
135 Double_t GetPositionX() const { return fPosX; }
136 Double_t GetPositionY() const { return fPosY; }
137 Double_t GetPositionZ() const { return fPosZ; }
138
139
141 Double_t GetScale() const { return fScale; }
142
143
145 TArrayF* GetBx() const { return fBx; }
146 TArrayF* GetBy() const { return fBy; }
147 TArrayF* GetBz() const { return fBz; }
148
149
151 const char* GetFileName() { return fFileName.Data(); }
152
153
155 virtual void Print(Option_t* = "") const;
156
157
158protected:
160 void Reset();
161
162
164 void ReadAsciiFile(const char* fileName);
165
167 void ReadAsciiFile2018(const char* fileName);
168
170 void ReadRootFile(const char* fileName, const char* mapName);
171
172
174 void SetField(const CbmFieldMapData* data);
175
176
180 Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz);
181
182
184 TString fFileName;
185
186
188 Double_t fScale;
189
190
192 Double_t fPosX, fPosY, fPosZ;
193
194
196 Double_t fXmin, fXmax, fXstep;
197 Double_t fYmin, fYmax, fYstep;
198 Double_t fZmin, fZmax, fZstep;
199
200
202 Int_t fNx, fNy, fNz;
203
204
206 TArrayF* fBx;
207 TArrayF* fBy;
208 TArrayF* fBz;
209
210
213 Double_t fHa[2][2][2];
214 Double_t fHb[2][2];
215 Double_t fHc[2];
216
217 Double_t fBxOrigin;
218 Double_t fByOrigin;
219 Double_t fBzOrigin;
220
221private:
224
225 ClassDef(CbmFieldMap, 2)
226};
227
228
229#endif
Double_t fPosZ
Double_t fBxOrigin
Interpolated field (1-dim)
TArrayF * fBy
Int_t GetNy() const
Double_t GetZmax() const
Double_t fPosY
TArrayF * GetBz() const
virtual void SetPosition(Double_t x, Double_t y, Double_t z)
Double_t fYmax
Double_t GetXstep() const
virtual void SetScale(Double_t factor)
Double_t fPosX
Double_t fZmin
Double_t fZmax
virtual void Init()
Double_t fYmin
Double_t fHa[2][2][2]
void WriteRootFile(const char *fileName, const char *mapName)
Double_t GetYmin() const
virtual ~CbmFieldMap()
void ReadAsciiFile(const char *fileName)
virtual void Print(Option_t *="") const
TArrayF * GetBx() const
TArrayF * fBx
Double_t fHb[2][2]
Field at corners of a grid cell.
virtual Bool_t IsInside(Double_t x, Double_t y, Double_t z, Int_t &ix, Int_t &iy, Int_t &iz, Double_t &dx, Double_t &dy, Double_t &dz)
TArrayF * fBz
Double_t GetPositionY() const
void SetField(const CbmFieldMapData *data)
Double_t fXmin
Double_t GetYmax() const
void ReadAsciiFile2018(const char *fileName)
TString fFileName
Double_t GetYstep() const
Double_t GetPositionZ() const
Double_t fYstep
CbmFieldMap(const CbmFieldMap &)
z-component of the field at the origin
Double_t fZstep
Double_t GetXmin() const
Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz)
Int_t GetNz() const
Double_t GetPositionX() const
Double_t fHc[2]
Interpolated field (2-dim)
Int_t GetNx() const
void ReadRootFile(const char *fileName, const char *mapName)
const char * GetFileName()
void WriteAsciiFile(const char *fileName)
Double_t fXstep
CbmFieldMap & operator=(const CbmFieldMap &)
Double_t fBzOrigin
y-component of the field at the origin
Double_t GetXmax() const
Double_t GetZmin() const
Double_t GetZstep() const
Double_t fScale
Double_t fByOrigin
x-component of the field at the origin
Double_t GetScale() const
TArrayF * GetBy() const
Double_t fXmax