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