BmnRoot
Loading...
Searching...
No Matches
BmnFieldMap.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------------------
2// ----- BmnFieldMap header file -------------
3// ----- Created 03/02/2015 by P. Batyuk -------------
4// ---------------------------------------------------------------------------------
5#ifndef BMNFIELDMAP_H
6#define BMNFIELDMAP_H 1
7
8#include "BmnFieldMapData.h"
9#include "BmnFieldPar.h"
10#include "FairField.h"
11#include "TArrayF.h"
12
13typedef struct
14{
15 Int_t N;
16 Double_t min;
17 Double_t max;
18 Double_t step;
20
21class BmnFieldMap : public FairField
22{
23 public:
25 BmnFieldMap(const char* mapFileName);
26 BmnFieldMap(BmnFieldPar* fieldPar);
27 virtual ~BmnFieldMap();
28
29 virtual void Init();
30
31 virtual Double_t GetBx(Double_t x, Double_t y, Double_t z) = 0;
32 virtual Double_t GetBy(Double_t x, Double_t y, Double_t z) = 0;
33 virtual Double_t GetBz(Double_t x, Double_t y, Double_t z) = 0;
34
35 virtual Bool_t IsInside(Double_t x,
36 Double_t y,
37 Double_t z,
38 Int_t& ix,
39 Int_t& iy,
40 Int_t& iz,
41 Double_t& dx,
42 Double_t& dy,
43 Double_t& dz) = 0;
44
46 void WriteAsciiFile(const char* asciiFileName);
47
49 void WriteRootFile(const char* rootFileName, const char* mapFileName);
50
52 void SetPosition(Double_t x, Double_t y, Double_t z);
53
55 void SetScale(Double_t factor)
56 {
57 fScale = factor;
58 fIsOff = (factor == 0 ? kTRUE : kFALSE);
59 }
60
62 void SetFieldOff(Bool_t is_off = kTRUE) { fIsOff = is_off; }
63
65 void SetFileName(const char* map_file_name) { fName = map_file_name; }
66
68 Double_t GetXmin() const { return fXmin; }
69 Double_t GetYmin() const { return fYmin; }
70 Double_t GetZmin() const { return fZmin; }
71
72 Double_t GetXmax() const { return fXmax; }
73 Double_t GetYmax() const { return fYmax; }
74 Double_t GetZmax() const { return fZmax; }
75
76 Double_t GetXstep() const { return fXstep; }
77 Double_t GetYstep() const { return fYstep; }
78 Double_t GetZstep() const { return fZstep; }
79
80 Int_t GetNx() const { return fNx; }
81 Int_t GetNy() const { return fNy; }
82 Int_t GetNz() const { return fNz; }
83
85 Double_t GetPositionX() const { return fPosX; }
86 Double_t GetPositionY() const { return fPosY; }
87 Double_t GetPositionZ() const { return fPosZ; }
88
90 Double_t GetScale() const { return fScale; }
91
93 Bool_t IsFieldOff() const { return fIsOff; }
94
96 TArrayF* GetBx() const { return fBx; }
97 TArrayF* GetBy() const { return fBy; }
98 TArrayF* GetBz() const { return fBz; }
99
101 const char* GetFileName() { return fName.Data(); }
102
104 virtual void Print(Option_t*) const;
105
106 virtual void FillParContainer() = 0;
107
109 void Reset();
110
111 protected:
113 // void Reset();
114
116 void ReadAsciiFile(const char* asciiFileName);
117
119 void ReadRootFile(const char* rootFileName);
120 void ReadRootFileNewFormat(const char* rootFileName);
121 void ReadRootFileNewFormatExtrap(const char* rootFileName);
122
124 void SetField(const BmnFieldMapData* data);
125
129 Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz);
130
132 Double_t fScale;
133
135 Double_t fPosX, fPosY, fPosZ;
136 Double_t fPosBx, fPosBy, fPosBz;
137
139 Double_t fXmin, fXmax, fXstep;
140 Double_t fYmin, fYmax, fYstep;
141 Double_t fZmin, fZmax, fZstep;
142
144 Int_t fNx, fNy, fNz;
145
147 TArrayF* fBx;
148 TArrayF* fBy;
149 TArrayF* fBz;
150
153 Double_t fHa[2][2][2];
154 Double_t fHb[2][2];
155 Double_t fHc[2];
156
159 Bool_t fIsOff;
160
161 private:
162 BmnFieldMap(const BmnFieldMap&) = delete;
163 BmnFieldMap& operator=(const BmnFieldMap&) = delete;
164
165 ClassDef(BmnFieldMap, 3)
166};
167
168#endif
void ReadRootFileNewFormat(const char *rootFileName)
Double_t fHa[2][2][2]
TArrayF * fBy
void SetField(const BmnFieldMapData *data)
Bool_t fIsOff
Double_t fPosZ
Int_t GetNz() const
Definition BmnFieldMap.h:82
Double_t fPosBx
virtual void FillParContainer()=0
Double_t GetPositionX() const
Definition BmnFieldMap.h:85
Double_t GetPositionY() const
Definition BmnFieldMap.h:86
TArrayF * GetBx() const
Definition BmnFieldMap.h:96
Bool_t IsFieldOff() const
Definition BmnFieldMap.h:93
void ReadRootFileNewFormatExtrap(const char *rootFileName)
Double_t GetPositionZ() const
Definition BmnFieldMap.h:87
virtual Double_t GetBz(Double_t x, Double_t y, Double_t z)=0
void ReadRootFile(const char *rootFileName)
Double_t fPosY
const char * GetFileName()
TArrayF * GetBy() const
Definition BmnFieldMap.h:97
TArrayF * fBz
Double_t GetYstep() const
Definition BmnFieldMap.h:77
Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz)
Double_t fScale
Double_t fPosX
Double_t fHc[2]
Interpolated field (2-dim)
Double_t GetZstep() const
Definition BmnFieldMap.h:78
virtual ~BmnFieldMap()
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)=0
Double_t GetXstep() const
Definition BmnFieldMap.h:76
void SetFileName(const char *map_file_name)
Definition BmnFieldMap.h:65
void SetPosition(Double_t x, Double_t y, Double_t z)
Double_t fZmin
virtual Double_t GetBy(Double_t x, Double_t y, Double_t z)=0
Double_t GetZmin() const
Definition BmnFieldMap.h:70
Double_t GetYmin() const
Definition BmnFieldMap.h:69
void SetScale(Double_t factor)
Definition BmnFieldMap.h:55
TArrayF * GetBz() const
Definition BmnFieldMap.h:98
virtual Double_t GetBx(Double_t x, Double_t y, Double_t z)=0
Double_t fYmax
void SetFieldOff(Bool_t is_off=kTRUE)
Definition BmnFieldMap.h:62
Double_t fHb[2][2]
Field at corners of a grid cell.
Double_t GetXmax() const
Definition BmnFieldMap.h:72
Int_t GetNy() const
Definition BmnFieldMap.h:81
void WriteRootFile(const char *rootFileName, const char *mapFileName)
Int_t GetNx() const
Definition BmnFieldMap.h:80
virtual void Init()
Bool_t fDebugInfo
Interpolated field (1-dim)
Double_t fPosBy
Double_t fXstep
Double_t GetScale() const
Definition BmnFieldMap.h:90
Double_t fZstep
Double_t fPosBz
Double_t fXmin
Double_t GetXmin() const
Definition BmnFieldMap.h:68
TArrayF * fBx
void ReadAsciiFile(const char *asciiFileName)
Double_t fZmax
Double_t GetZmax() const
Definition BmnFieldMap.h:74
Double_t fYmin
Double_t fYstep
void WriteAsciiFile(const char *asciiFileName)
Double_t fXmax
Double_t GetYmax() const
Definition BmnFieldMap.h:73
virtual void Print(Option_t *) const