er  dev
ERFieldMap.h
1 // -------------------------------------------------------------------------
2 // ----- ERFieldMap header file -----
3 // ----- Created 05/17 by V.Schetinin -----
4 // -------------------------------------------------------------------------
10 #ifndef ERFieldMap_H
11 #define ERFieldMap_H 1
12 
13 #include "TGeoNode.h"
14 
15 #include "FairField.h"
16 
17 class TArrayF;
18 
19 class ERFieldPar;
20 
21 class ERFieldMap : public FairField {
22 public:
24  ERFieldMap();
29  ERFieldMap(const char* mapName, const char* fileType = "R");
31  ERFieldMap(ERFieldPar* fieldPar);
33  virtual ~ERFieldMap();
35  virtual void Init();
40  virtual Double_t GetBx(Double_t x, Double_t y, Double_t z);
41  virtual Double_t GetBy(Double_t x, Double_t y, Double_t z);
42  virtual Double_t GetBz(Double_t x, Double_t y, Double_t z);
49  virtual Bool_t IsInside(Double_t x, Double_t y, Double_t z,
50  Int_t& ix, Int_t& iy, Int_t& iz,
51  Double_t& dx, Double_t& dy, Double_t& dz);
52 
54  void WriteAsciiFile(const char* fileName);
55 
57  void WriteRootFile(const char* fileName, const char* mapName);
59  virtual void SetPosition(Double_t x, Double_t y, Double_t z);
60 
61 //void SetLocalNode(TGeoNode* localMagFieldNode) {fLocalMagFieldNode = localMagFieldNode;}
62  void SetVolume(TString localMagFieldVolName) {fLocalMagFieldVolName = localMagFieldVolName;}
64  virtual void SetScale(Double_t factor) { fScale = factor; }
66  Double_t GetXmin() const { return fXmin; }
67  Double_t GetYmin() const { return fYmin; }
68  Double_t GetZmin() const { return fZmin; }
69  Double_t GetXmax() const { return fXmax; }
70  Double_t GetYmax() const { return fYmax; }
71  Double_t GetZmax() const { return fZmax; }
72  Double_t GetXstep() const { return fXstep; }
73  Double_t GetYstep() const { return fYstep; }
74  Double_t GetZstep() const { return fZstep; }
75  Int_t GetNx() const { return fNx; }
76  Int_t GetNy() const { return fNy; }
77  Int_t GetNz() const { return fNz; }
79  Double_t GetPositionX() const { return fPosX; }
80  Double_t GetPositionY() const { return fPosY; }
81  Double_t GetPositionZ() const { return fPosZ; }
83  Double_t GetScale() const { return fScale; }
85  TArrayF* GetBx() const { return fBx; }
86  TArrayF* GetBy() const { return fBy; }
87  TArrayF* GetBz() const { return fBz; }
89  const char* GetFileName() { return fFileName.Data(); }
91  virtual void Print(Option_t* = "") const;
92 
93 
94  protected:
96  void Reset();
98  void ReadAsciiFile(const char* fileName);
100  void ReadRootFile(const char* fileName, const char* mapName);
102  /*void SetField(const ERFieldMapData* data);*/
106  Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz);
108  TString fFileName;
110  Double_t fScale;
112  Double_t fPosX, fPosY, fPosZ;
114  Double_t fXmin, fXmax, fXstep;
115  Double_t fYmin, fYmax, fYstep;
116  Double_t fZmin, fZmax, fZstep;
118  Int_t fNx, fNy, fNz;
120  TArrayF* fBx;
121  TArrayF* fBy;
122  TArrayF* fBz;
125  Double_t fHa[2][2][2];
126  Double_t fHb[2][2];
127  Double_t fHc[2];
128  Double_t fBxOrigin;
129  Double_t fByOrigin;
130  Double_t fBzOrigin;
131 
133  TString fLocalMagFieldVolName;
134  private:
135  ERFieldMap(const ERFieldMap&);
136  ERFieldMap& operator=(const ERFieldMap&);
137  ClassDef(ERFieldMap,2)
138 };
139 #endif
Double_t fHa[2][2][2]
Definition: ERFieldMap.h:125
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: ERFieldMap.cxx:363
virtual void SetPosition(Double_t x, Double_t y, Double_t z)
Definition: ERFieldMap.cxx:449
Double_t GetPositionX() const
Definition: ERFieldMap.h:79
TArrayF * GetBx() const
Definition: ERFieldMap.h:85
TArrayF * fBx
Definition: ERFieldMap.h:120
void ReadAsciiFile(const char *fileName)
Definition: ERFieldMap.cxx:498
virtual void Init()
Definition: ERFieldMap.cxx:196
TGeoNode * fLocalMagFieldNode
z-component of the field at the origin
Definition: ERFieldMap.h:132
Double_t fHb[2][2]
Field at corners of a grid cell.
Definition: ERFieldMap.h:126
Double_t fBzOrigin
y-component of the field at the origin
Definition: ERFieldMap.h:130
Double_t GetScale() const
Definition: ERFieldMap.h:83
virtual void SetScale(Double_t factor)
Definition: ERFieldMap.h:64
Double_t fHc[2]
Interpolated field (2-dim)
Definition: ERFieldMap.h:127
Double_t fBxOrigin
Interpolated field (1-dim)
Definition: ERFieldMap.h:128
Double_t fPosX
Definition: ERFieldMap.h:112
void WriteRootFile(const char *fileName, const char *mapName)
Definition: ERFieldMap.cxx:436
void ReadRootFile(const char *fileName, const char *mapName)
Definition: ERFieldMap.cxx:583
Double_t fXmin
Definition: ERFieldMap.h:114
void Reset()
Definition: ERFieldMap.cxx:485
void WriteAsciiFile(const char *fileName)
Definition: ERFieldMap.cxx:390
Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz)
Definition: ERFieldMap.cxx:614
Int_t fNx
Definition: ERFieldMap.h:118
TString fFileName
Definition: ERFieldMap.h:108
Double_t fScale
Definition: ERFieldMap.h:110
Double_t fByOrigin
x-component of the field at the origin
Definition: ERFieldMap.h:129
virtual ~ERFieldMap()
Definition: ERFieldMap.cxx:189
Double_t GetXmin() const
Definition: ERFieldMap.h:66
virtual void Print(Option_t *="") const
Definition: ERFieldMap.cxx:456
const char * GetFileName()
Definition: ERFieldMap.h:89