CbmRoot
CbmFieldMap.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmFieldMap header file -----
3 // ----- Created 12/01/04 by M. Al/Turany (CbmField.h) -----
4 // ----- Redesign 13/02/06 by V. Friese -----
5 // -------------------------------------------------------------------------
6 
7 
19 #ifndef CBMFIELDMAP_H
20 #define CBMFIELDMAP_H 1
21 
22 
23 #include <Rtypes.h> // for THashConsistencyHolder, ClassDef
24 #include <RtypesCore.h> // for Double_t, Int_t, Bool_t, Option_t
25 #include <TString.h> // for TString
26 
27 #include <FairField.h> // for FairField
28 
29 class CbmFieldMapCreator;
30 class CbmFieldMapData;
31 class CbmFieldPar;
32 class TArrayF;
33 
34 class CbmFieldMap : public FairField {
35 
36 
37 public:
39  CbmFieldMap();
40 
41 
46  CbmFieldMap(const char* mapName, const char* fileType = "R");
47 
48 
50  CbmFieldMap(CbmFieldPar* fieldPar);
51 
52 
55 
56 
58  virtual ~CbmFieldMap();
59 
60 
62  virtual void Init();
63 
64 
76  virtual void Init(Int_t nX,
77  Double_t xMin,
78  Double_t xMax,
79  Int_t nY,
80  Double_t yMin,
81  Double_t yMax,
82  Int_t nZ,
83  Double_t zMin,
84  Double_t zMax,
85  TArrayF* bx,
86  TArrayF* by,
87  TArrayF* bz);
88 
89 
94  virtual Double_t GetBx(Double_t x, Double_t y, Double_t z);
95  virtual Double_t GetBy(Double_t x, Double_t y, Double_t z);
96  virtual Double_t GetBz(Double_t x, Double_t y, Double_t z);
97 
98 
105  virtual Bool_t IsInside(Double_t x,
106  Double_t y,
107  Double_t z,
108  Int_t& ix,
109  Int_t& iy,
110  Int_t& iz,
111  Double_t& dx,
112  Double_t& dy,
113  Double_t& dz);
114 
115 
117  void WriteAsciiFile(const char* fileName);
118 
119 
121  void WriteRootFile(const char* fileName, const char* mapName);
122 
123 
125  virtual void SetPosition(Double_t x, Double_t y, Double_t z);
126 
127 
129  virtual void SetScale(Double_t factor) { fScale = factor; }
130 
131 
133  Double_t GetXmin() const { return fXmin; }
134  Double_t GetYmin() const { return fYmin; }
135  Double_t GetZmin() const { return fZmin; }
136  Double_t GetXmax() const { return fXmax; }
137  Double_t GetYmax() const { return fYmax; }
138  Double_t GetZmax() const { return fZmax; }
139  Double_t GetXstep() const { return fXstep; }
140  Double_t GetYstep() const { return fYstep; }
141  Double_t GetZstep() const { return fZstep; }
142  Int_t GetNx() const { return fNx; }
143  Int_t GetNy() const { return fNy; }
144  Int_t GetNz() const { return fNz; }
145 
146 
148  Double_t GetPositionX() const { return fPosX; }
149  Double_t GetPositionY() const { return fPosY; }
150  Double_t GetPositionZ() const { return fPosZ; }
151 
152 
154  Double_t GetScale() const { return fScale; }
155 
156 
158  TArrayF* GetBx() const { return fBx; }
159  TArrayF* GetBy() const { return fBy; }
160  TArrayF* GetBz() const { return fBz; }
161 
162 
164  const char* GetFileName() { return fFileName.Data(); }
165 
166 
168  virtual void Print(Option_t* = "") const;
169 
170 
171 protected:
173  void Reset();
174 
175 
177  void ReadAsciiFile(const char* fileName);
178 
180  void ReadAsciiFile2018(const char* fileName);
181 
183  void ReadRootFile(const char* fileName, const char* mapName);
184 
185 
187  void SetField(const CbmFieldMapData* data);
188 
189 
193  Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz);
194 
195 
197  TString fFileName;
198 
199 
201  Double_t fScale;
202 
203 
205  Double_t fPosX, fPosY, fPosZ;
206 
207 
209  Double_t fXmin, fXmax, fXstep;
210  Double_t fYmin, fYmax, fYstep;
211  Double_t fZmin, fZmax, fZstep;
212 
213 
215  Int_t fNx, fNy, fNz;
216 
217 
219  TArrayF* fBx;
220  TArrayF* fBy;
221  TArrayF* fBz;
222 
223 
226  Double_t fHa[2][2][2];
227  Double_t fHb[2][2];
228  Double_t fHc[2];
229 
230  Double_t fBxOrigin;
231  Double_t fByOrigin;
232  Double_t fBzOrigin;
233 
234 private:
237 
238  ClassDef(CbmFieldMap, 2)
239 };
240 
241 
242 #endif
CbmFieldMap::GetYstep
Double_t GetYstep() const
Definition: CbmFieldMap.h:140
CbmFieldMap::GetZstep
Double_t GetZstep() const
Definition: CbmFieldMap.h:141
CbmFieldMap::fFileName
TString fFileName
Definition: CbmFieldMap.h:197
CbmFieldMap::Interpolate
Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz)
Definition: CbmFieldMap.cxx:786
CbmFieldMap::ReadRootFile
void ReadRootFile(const char *fileName, const char *mapName)
Definition: CbmFieldMap.cxx:698
CbmFieldMap::fYmin
Double_t fYmin
Definition: CbmFieldMap.h:210
CbmFieldMap::fScale
Double_t fScale
Definition: CbmFieldMap.h:201
CbmFieldMap::fBxOrigin
Double_t fBxOrigin
Interpolated field (1-dim)
Definition: CbmFieldMap.h:230
CbmFieldMap::GetBy
TArrayF * GetBy() const
Definition: CbmFieldMap.h:159
CbmFieldMap::GetPositionY
Double_t GetPositionY() const
Definition: CbmFieldMap.h:149
CbmFieldMapCreator
Definition: CbmFieldMapCreator.h:30
CbmFieldMap::fXmin
Double_t fXmin
Definition: CbmFieldMap.h:209
CbmFieldMap::fPosZ
Double_t fPosZ
Definition: CbmFieldMap.h:205
CbmFieldMap::Print
virtual void Print(Option_t *="") const
Definition: CbmFieldMap.cxx:558
CbmFieldMap::fNz
Int_t fNz
Definition: CbmFieldMap.h:215
CbmFieldMap::GetXmin
Double_t GetXmin() const
Definition: CbmFieldMap.h:133
CbmFieldMap::fNy
Int_t fNy
Definition: CbmFieldMap.h:215
CbmFieldMap::GetNx
Int_t GetNx() const
Definition: CbmFieldMap.h:142
CbmFieldMap::GetNy
Int_t GetNy() const
Definition: CbmFieldMap.h:143
CbmFieldMap::GetPositionZ
Double_t GetPositionZ() const
Definition: CbmFieldMap.h:150
CbmFieldMap::fXstep
Double_t fXstep
Definition: CbmFieldMap.h:209
CbmFieldMap::GetXmax
Double_t GetXmax() const
Definition: CbmFieldMap.h:136
CbmFieldMap::SetPosition
virtual void SetPosition(Double_t x, Double_t y, Double_t z)
Definition: CbmFieldMap.cxx:549
CbmFieldMap::fPosX
Double_t fPosX
Definition: CbmFieldMap.h:205
CbmFieldMap::fBzOrigin
Double_t fBzOrigin
y-component of the field at the origin
Definition: CbmFieldMap.h:232
CbmFieldMap::fZstep
Double_t fZstep
Definition: CbmFieldMap.h:211
CbmFieldMap::SetField
void SetField(const CbmFieldMapData *data)
Definition: CbmFieldMap.cxx:732
CbmFieldMap::SetScale
virtual void SetScale(Double_t factor)
Definition: CbmFieldMap.h:129
CbmFieldMap::fZmin
Double_t fZmin
Definition: CbmFieldMap.h:211
CbmFieldMap::fBz
TArrayF * fBz
Definition: CbmFieldMap.h:221
CbmFieldMap::fBy
TArrayF * fBy
Definition: CbmFieldMap.h:220
CbmFieldMap::GetBz
TArrayF * GetBz() const
Definition: CbmFieldMap.h:160
CbmFieldMap
Definition: CbmFieldMap.h:34
CbmFieldMap::fHc
Double_t fHc[2]
Interpolated field (2-dim)
Definition: CbmFieldMap.h:228
CbmFieldMap::GetXstep
Double_t GetXstep() const
Definition: CbmFieldMap.h:139
CbmFieldMap::ReadAsciiFile2018
void ReadAsciiFile2018(const char *fileName)
CbmFieldMap::fPosY
Double_t fPosY
Definition: CbmFieldMap.h:205
CbmFieldMap::GetZmin
Double_t GetZmin() const
Definition: CbmFieldMap.h:135
CbmFieldMap::CbmFieldMap
CbmFieldMap(const CbmFieldMap &)
z-component of the field at the origin
CbmFieldMap::operator=
CbmFieldMap & operator=(const CbmFieldMap &)
CbmFieldMap::GetYmax
Double_t GetYmax() const
Definition: CbmFieldMap.h:137
CbmFieldMap::fBx
TArrayF * fBx
Definition: CbmFieldMap.h:219
CbmFieldMap::IsInside
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)
Definition: CbmFieldMap.cxx:446
CbmFieldMap::WriteRootFile
void WriteRootFile(const char *fileName, const char *mapName)
Definition: CbmFieldMap.cxx:536
CbmFieldMap::ReadAsciiFile
void ReadAsciiFile(const char *fileName)
Definition: CbmFieldMap.cxx:615
CbmFieldMap::fYstep
Double_t fYstep
Definition: CbmFieldMap.h:210
CbmFieldMap::fYmax
Double_t fYmax
Definition: CbmFieldMap.h:210
CbmFieldMap::fZmax
Double_t fZmax
Definition: CbmFieldMap.h:211
CbmFieldMap::GetNz
Int_t GetNz() const
Definition: CbmFieldMap.h:144
CbmFieldMap::GetZmax
Double_t GetZmax() const
Definition: CbmFieldMap.h:138
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmFieldMapData
Definition: CbmFieldMapData.h:29
CbmFieldMap::WriteAsciiFile
void WriteAsciiFile(const char *fileName)
Definition: CbmFieldMap.cxx:486
CbmFieldMap::GetFileName
const char * GetFileName()
Definition: CbmFieldMap.h:164
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmFieldMap::fHb
Double_t fHb[2][2]
Field at corners of a grid cell.
Definition: CbmFieldMap.h:227
CbmFieldMap::Init
virtual void Init()
Definition: CbmFieldMap.cxx:271
CbmFieldMap::fHa
Double_t fHa[2][2][2]
Definition: CbmFieldMap.h:226
CbmFieldMap::GetScale
Double_t GetScale() const
Definition: CbmFieldMap.h:154
CbmFieldMap::fNx
Int_t fNx
Definition: CbmFieldMap.h:215
CbmFieldMap::CbmFieldMap
CbmFieldMap()
Definition: CbmFieldMap.cxx:34
CbmFieldPar
Definition: CbmFieldPar.h:31
CbmFieldMap::fByOrigin
Double_t fByOrigin
x-component of the field at the origin
Definition: CbmFieldMap.h:231
CbmFieldMap::Reset
void Reset()
Definition: CbmFieldMap.cxx:591
CbmFieldMap::fXmax
Double_t fXmax
Definition: CbmFieldMap.h:209
CbmFieldMap::~CbmFieldMap
virtual ~CbmFieldMap()
Definition: CbmFieldMap.cxx:262
CbmFieldMap::GetPositionX
Double_t GetPositionX() const
Definition: CbmFieldMap.h:148
CbmFieldMap::GetYmin
Double_t GetYmin() const
Definition: CbmFieldMap.h:134
CbmFieldMap::GetBx
TArrayF * GetBx() const
Definition: CbmFieldMap.h:158