PandaRoot
PndFieldMap.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // -------------------------------------------------------------------------
14 // ----- PndFieldMap header file -----
15 // ----- Created 12/01/04 by M. Al/Turany -----
16 // -------------------------------------------------------------------------
17 
24 #ifndef PNDFIELDMAP_H
25 #define PNDFIELDMAP_H 1
26 
27 #include "FairField.h"
28 
29 class TArrayF;
30 class PndFieldMapData;
31 class PndFieldPar;
32 
33 class PndFieldMap : public FairField {
34 
35  public:
37  PndFieldMap();
38 
43  PndFieldMap(const char *mapName, const char *fileType = "R");
44 
46  PndFieldMap(PndFieldPar *fieldPar);
47 
49  virtual ~PndFieldMap();
50 
52  virtual void Init();
53 
58  virtual Double_t GetBx(Double_t x, Double_t y, Double_t z);
59  virtual Double_t GetBy(Double_t x, Double_t y, Double_t z);
60  virtual Double_t GetBz(Double_t x, Double_t y, Double_t z);
61 
68  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);
69 
71  void WriteAsciiFile(const char *fileName);
72 
74  void WriteRootFile(const char *fileName, const char *mapName);
75 
77  void SetPosition(Double_t x, Double_t y, Double_t z);
78 
80  void SetScale(Double_t factor) { fScale = factor; }
81 
83  Double_t GetXmin() const { return fXmin; }
84  Double_t GetYmin() const { return fYmin; }
85  Double_t GetZmin() const { return fZmin; }
86  Double_t GetXmax() const { return fXmax; }
87  Double_t GetYmax() const { return fYmax; }
88  Double_t GetZmax() const { return fZmax; }
89  Double_t GetXstep() const { return fXstep; }
90  Double_t GetYstep() const { return fYstep; }
91  Double_t GetZstep() const { return fZstep; }
92  Int_t GetNx() const { return fNx; }
93  Int_t GetNy() const { return fNy; }
94  Int_t GetNz() const { return fNz; }
95 
96  Double_t GetUnit() const { return funit; }
97 
99  Double_t GetPositionX() const { return fPosX; }
100  Double_t GetPositionY() const { return fPosY; }
101  Double_t GetPositionZ() const { return fPosZ; }
102 
104  Double_t GetScale() const { return fScale; }
105 
107  TArrayF *GetBx() const { return fBx; }
108  TArrayF *GetBy() const { return fBy; }
109  TArrayF *GetBz() const { return fBz; }
110 
112  const char *GetFileName() { return fFileName.Data(); }
113 
115  virtual void Print();
116 
117  private:
118  PndFieldMap(const PndFieldMap &L);
119  PndFieldMap &operator=(const PndFieldMap &) { return *this; };
120 
121  protected:
123  void Reset();
124 
126  void ReadAsciiFile(const char *fileName);
127 
129  void ReadRootFile(const char *fileName, const char *mapName);
130 
132  void SetField(const PndFieldMapData *data);
133 
137  Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz);
138 
140  TString fFileName;
141 
143  Double_t fScale;
144 
146  Double_t funit;
147 
149  Double_t fPosX, fPosY, fPosZ;
150 
152  Double_t fXmin, fXmax, fXstep;
153  Double_t fYmin, fYmax, fYstep;
154  Double_t fZmin, fZmax, fZstep;
155 
157  Int_t fNx, fNy, fNz;
158 
160  TArrayF *fBx;
161  TArrayF *fBy;
162  TArrayF *fBz;
163 
166  Double_t fHa[2][2][2];
167  Double_t fHb[2][2];
168  Double_t fHc[2];
169  ClassDef(PndFieldMap, 1)
170 };
171 
172 #endif
Double_t fHa[2][2][2]
Definition: PndFieldMap.h:166
Double_t funit
Definition: PndFieldMap.h:146
Double_t GetPositionZ() const
Definition: PndFieldMap.h:101
Double_t GetPositionX() const
Definition: PndFieldMap.h:99
Double_t fYmin
Definition: PndFieldMap.h:153
Int_t GetNy() const
Definition: PndFieldMap.h:93
void WriteAsciiFile(const char *fileName)
Int_t GetNx() const
Definition: PndFieldMap.h:92
Double_t fHb[2][2]
Field at corners of a grid cell.
Definition: PndFieldMap.h:167
Double_t fZstep
Definition: PndFieldMap.h:154
void SetScale(Double_t factor)
Definition: PndFieldMap.h:80
void WriteRootFile(const char *fileName, const char *mapName)
Double_t GetYmin() const
Definition: PndFieldMap.h:84
Double_t GetYstep() const
Definition: PndFieldMap.h:90
Double_t fZmin
Definition: PndFieldMap.h:154
TArrayF * GetBz() const
Definition: PndFieldMap.h:109
Double_t GetZstep() const
Definition: PndFieldMap.h:91
Double_t fYmax
Definition: PndFieldMap.h:153
TArrayF * fBz
Definition: PndFieldMap.h:162
Double_t fXstep
Definition: PndFieldMap.h:152
Double_t fXmax
Definition: PndFieldMap.h:152
TString fFileName
Definition: PndFieldMap.h:140
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:96
Double_t fHc[2]
Interpolated field (2-dim)
Definition: PndFieldMap.h:168
Double_t fPosZ
Definition: PndFieldMap.h:149
Double_t fScale
Definition: PndFieldMap.h:143
void SetPosition(Double_t x, Double_t y, Double_t z)
Double_t GetZmin() const
Definition: PndFieldMap.h:85
TArrayF * GetBx() const
Definition: PndFieldMap.h:107
Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz)
Double_t GetPositionY() const
Definition: PndFieldMap.h:100
Double_t GetXmax() const
Definition: PndFieldMap.h:86
Double_t GetXmin() const
Definition: PndFieldMap.h:83
virtual void Print()
Double_t fPosY
Definition: PndFieldMap.h:149
TArrayF * fBy
Definition: PndFieldMap.h:161
const char * GetFileName()
Definition: PndFieldMap.h:112
virtual ~PndFieldMap()
Int_t GetNz() const
Definition: PndFieldMap.h:94
void SetField(const PndFieldMapData *data)
TArrayF * fBx
Definition: PndFieldMap.h:160
Double_t fPosX
Definition: PndFieldMap.h:149
Double_t fYstep
Definition: PndFieldMap.h:153
TArrayF * GetBy() const
Definition: PndFieldMap.h:108
Double_t GetXstep() const
Definition: PndFieldMap.h:89
virtual void Init()
Double_t fZmax
Definition: PndFieldMap.h:154
Double_t GetZmax() const
Definition: PndFieldMap.h:88
void Reset()
void ReadAsciiFile(const char *fileName)
Double_t GetYmax() const
Definition: PndFieldMap.h:87
void ReadRootFile(const char *fileName, const char *mapName)
Double_t GetScale() const
Definition: PndFieldMap.h:104
Double_t fXmin
Definition: PndFieldMap.h:152