84737f5e |
1 | #ifndef ALIFIELDMAP_H |
2 | #define ALIFIELDMAP_H |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
4 | * See cxx source for full Copyright notice */ |
5 | |
6 | /* $Id$ */ |
7 | |
8 | // |
9 | // Author: Andreas Morsch <andreas.morsch@cern.ch> |
10 | // |
11 | #include <TNamed.h> |
116cbefd |
12 | class TVector; |
84737f5e |
13 | |
14 | class AliFieldMap : public TNamed |
15 | { |
16 | //Alice Magnetic Field with constant mesh |
17 | |
18 | public: |
19 | AliFieldMap(); |
20 | AliFieldMap(const char *name, const char *title); |
21 | AliFieldMap(const AliFieldMap &mag); |
22 | virtual ~AliFieldMap(); |
23 | void Copy(AliFieldMap &map) const; |
24 | virtual AliFieldMap & operator=(const AliFieldMap &map); |
25 | |
26 | virtual void Field(Float_t *x, Float_t *b); |
27 | Float_t Bx(const Int_t ix, const Int_t iy, const Int_t iz) { |
28 | return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)); |
29 | } |
30 | Float_t By(const Int_t ix, const Int_t iy, const Int_t iz) { |
31 | return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)+1); |
32 | } |
33 | Float_t Bz(const Int_t ix, const Int_t iy, const Int_t iz) { |
34 | return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)+2); |
35 | } |
36 | |
116cbefd |
37 | Bool_t Inside(Float_t x, Float_t y, Float_t z) const |
84737f5e |
38 | { return (x > fXbeg && x <= fXend && |
39 | y > fYbeg && y <= fYend && |
40 | z > fZbeg && z <= fZend); |
41 | } |
116cbefd |
42 | Float_t Xmin() const {return fXbeg;} |
43 | Float_t Xmax() const {return fXend;} |
44 | Float_t DelX() const {return fXdel;} |
45 | Float_t DeliX() const {return fXdeli;} |
84737f5e |
46 | |
116cbefd |
47 | Float_t Ymin() const {return fYbeg;} |
48 | Float_t Ymax() const {return fYend;} |
49 | Float_t DelY() const {return fYdel;} |
50 | Float_t DeliY() const {return fYdeli;} |
84737f5e |
51 | |
116cbefd |
52 | Float_t Zmin() const {return fZbeg;} |
53 | Float_t Zmax() const {return fZend;} |
54 | Float_t DelZ() const {return fZdel;} |
55 | Float_t DeliZ() const {return fZdeli;} |
0871c0cc |
56 | void SetLimits(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, |
57 | Float_t zmin, Float_t zmax) |
58 | { |
59 | fXbeg = xmin; fXend = xmax; fYbeg = ymin; fYend = ymax; |
60 | fZbeg = zmin; fZend = zmax; |
61 | } |
7b6cddfa |
62 | void SetWriteEnable(Int_t flag = 1) {fWriteEnable = flag;} |
84737f5e |
63 | protected: |
84737f5e |
64 | |
7b6cddfa |
65 | Float_t fXbeg; // Start of mesh in x |
66 | Float_t fYbeg; // Start of mesh in y |
67 | Float_t fZbeg; // Start of mesh in z |
68 | Float_t fXend; // End of mesh in x |
69 | Float_t fYend; // End of mesh in y |
70 | Float_t fZend; // End of mesh in z |
71 | Float_t fXdel; // Mesh step in x |
72 | Float_t fYdel; // Mesh step in y |
73 | Float_t fZdel; // Mesh step in z |
74 | Double_t fXdeli; // Inverse of Mesh step in x |
75 | Double_t fYdeli; // Inverse of Mesh step in y |
76 | Double_t fZdeli; // Inverse of Mesh step in z |
77 | Int_t fXn; // Number of mesh points in x |
78 | Int_t fYn; // Number of mesh points in y |
79 | Int_t fZn; // Number of mesh points in z |
80 | Int_t fWriteEnable; // Enable flag for writing of field data. |
81 | TVector* fB; // Field map |
82 | |
116cbefd |
83 | private: |
84 | void ReadField(); |
85 | |
7b6cddfa |
86 | ClassDef(AliFieldMap,3) //Class for Field Map |
84737f5e |
87 | }; |
88 | |
89 | #endif |