PandaRoot
PndFieldMap.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndFieldMap header file -----
3 // ----- Created 12/01/04 by M. Al/Turany -----
4 // -------------------------------------------------------------------------
5 
12 #ifndef PNDFIELDMAP_H
13 #define PNDFIELDMAP_H 1
14 
15 #include "FairField.h"
16 
17 class TArrayF;
18 class PndFieldMapData;
19 class PndFieldPar;
20 
21 class PndFieldMap : public FairField {
22 
23  public:
25  PndFieldMap();
26 
31  PndFieldMap(const char *mapName, const char *fileType = "R");
32 
34  PndFieldMap(PndFieldPar *fieldPar);
35 
37  virtual ~PndFieldMap();
38 
40  virtual void Init();
41 
46  virtual Double_t GetBx(Double_t x, Double_t y, Double_t z);
47  virtual Double_t GetBy(Double_t x, Double_t y, Double_t z);
48  virtual Double_t GetBz(Double_t x, Double_t y, Double_t z);
49 
56  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);
57 
59  void WriteAsciiFile(const char *fileName);
60 
62  void WriteRootFile(const char *fileName, const char *mapName);
63 
65  void SetPosition(Double_t x, Double_t y, Double_t z);
66 
68  void SetScale(Double_t factor) { fScale = factor; }
69 
71  Double_t GetXmin() const { return fXmin; }
72  Double_t GetYmin() const { return fYmin; }
73  Double_t GetZmin() const { return fZmin; }
74  Double_t GetXmax() const { return fXmax; }
75  Double_t GetYmax() const { return fYmax; }
76  Double_t GetZmax() const { return fZmax; }
77  Double_t GetXstep() const { return fXstep; }
78  Double_t GetYstep() const { return fYstep; }
79  Double_t GetZstep() const { return fZstep; }
80  Int_t GetNx() const { return fNx; }
81  Int_t GetNy() const { return fNy; }
82  Int_t GetNz() const { return fNz; }
83 
84  Double_t GetUnit() const { return funit; }
85 
87  Double_t GetPositionX() const { return fPosX; }
88  Double_t GetPositionY() const { return fPosY; }
89  Double_t GetPositionZ() const { return fPosZ; }
90 
92  Double_t GetScale() const { return fScale; }
93 
95  TArrayF *GetBx() const { return fBx; }
96  TArrayF *GetBy() const { return fBy; }
97  TArrayF *GetBz() const { return fBz; }
98 
100  const char *GetFileName() { return fFileName.Data(); }
101 
103  virtual void Print();
104 
105  private:
106  PndFieldMap(const PndFieldMap &L);
107  PndFieldMap &operator=(const PndFieldMap &) { return *this; };
108 
109  protected:
111  void Reset();
112 
114  void ReadAsciiFile(const char *fileName);
115 
117  void ReadRootFile(const char *fileName, const char *mapName);
118 
120  void SetField(const PndFieldMapData *data);
121 
125  Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz);
126 
128  TString fFileName;
129 
131  Double_t fScale;
132 
134  Double_t funit;
135 
137  Double_t fPosX, fPosY, fPosZ;
138 
140  Double_t fXmin, fXmax, fXstep;
141  Double_t fYmin, fYmax, fYstep;
142  Double_t fZmin, fZmax, fZstep;
143 
145  Int_t fNx, fNy, fNz;
146 
148  TArrayF *fBx;
149  TArrayF *fBy;
150  TArrayF *fBz;
151 
154  Double_t fHa[2][2][2];
155  Double_t fHb[2][2];
156  Double_t fHc[2];
157  ClassDef(PndFieldMap, 1)
158 };
159 
160 #endif
Double_t fHa[2][2][2]
Definition: PndFieldMap.h:154
Double_t funit
Definition: PndFieldMap.h:134
Double_t GetPositionZ() const
Definition: PndFieldMap.h:89
Double_t GetPositionX() const
Definition: PndFieldMap.h:87
Double_t fYmin
Definition: PndFieldMap.h:141
Int_t GetNy() const
Definition: PndFieldMap.h:81
void WriteAsciiFile(const char *fileName)
Int_t GetNx() const
Definition: PndFieldMap.h:80
Double_t fHb[2][2]
Field at corners of a grid cell.
Definition: PndFieldMap.h:155
Double_t fZstep
Definition: PndFieldMap.h:142
void SetScale(Double_t factor)
Definition: PndFieldMap.h:68
void WriteRootFile(const char *fileName, const char *mapName)
Double_t GetYmin() const
Definition: PndFieldMap.h:72
Double_t GetYstep() const
Definition: PndFieldMap.h:78
Double_t fZmin
Definition: PndFieldMap.h:142
TArrayF * GetBz() const
Definition: PndFieldMap.h:97
Double_t GetZstep() const
Definition: PndFieldMap.h:79
Double_t fYmax
Definition: PndFieldMap.h:141
TArrayF * fBz
Definition: PndFieldMap.h:150
Double_t fXstep
Definition: PndFieldMap.h:140
Double_t fXmax
Definition: PndFieldMap.h:140
TString fFileName
Definition: PndFieldMap.h:128
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)
Double_t GetUnit() const
Definition: PndFieldMap.h:84
Double_t fHc[2]
Interpolated field (2-dim)
Definition: PndFieldMap.h:156
Double_t fPosZ
Definition: PndFieldMap.h:137
Double_t fScale
Definition: PndFieldMap.h:131
void SetPosition(Double_t x, Double_t y, Double_t z)
Double_t GetZmin() const
Definition: PndFieldMap.h:73
TArrayF * GetBx() const
Definition: PndFieldMap.h:95
Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz)
Double_t GetPositionY() const
Definition: PndFieldMap.h:88
Double_t GetXmax() const
Definition: PndFieldMap.h:74
Double_t GetXmin() const
Definition: PndFieldMap.h:71
virtual void Print()
Double_t fPosY
Definition: PndFieldMap.h:137
TArrayF * fBy
Definition: PndFieldMap.h:149
const char * GetFileName()
Definition: PndFieldMap.h:100
virtual ~PndFieldMap()
Int_t GetNz() const
Definition: PndFieldMap.h:82
void SetField(const PndFieldMapData *data)
TArrayF * fBx
Definition: PndFieldMap.h:148
Double_t fPosX
Definition: PndFieldMap.h:137
Double_t fYstep
Definition: PndFieldMap.h:141
TArrayF * GetBy() const
Definition: PndFieldMap.h:96
Double_t GetXstep() const
Definition: PndFieldMap.h:77
virtual void Init()
Double_t fZmax
Definition: PndFieldMap.h:142
Double_t GetZmax() const
Definition: PndFieldMap.h:76
void Reset()
void ReadAsciiFile(const char *fileName)
Double_t GetYmax() const
Definition: PndFieldMap.h:75
void ReadRootFile(const char *fileName, const char *mapName)
Double_t GetScale() const
Definition: PndFieldMap.h:92
Double_t fXmin
Definition: PndFieldMap.h:140