]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMagFCheb.h
By default all events go into one run-loader's file. Allows to remove the correspondi...
[u/mrichter/AliRoot.git] / STEER / AliMagFCheb.h
CommitLineData
0eea9d4d 1
2// Author: ruben.shahoyan@cern.ch 20/03/2007
d28e407c 3
0eea9d4d 4///////////////////////////////////////////////////////////////////////////////////
5// //
6// Wrapper for the set of mag.field parameterizations by Chebyshev polinomials //
7// To obtain the field in cartesian coordinates/components use //
8// Field(float* xyz, float* bxyz); //
9// For cylindrical coordinates/components: //
10// FieldCyl(float* rphiz, float* brphiz) //
11// //
d28e407c 12// The solenoid part is parameterized in the volume R<500, -550<Z<550 cm //
0eea9d4d 13// //
14// The region R<423 cm, -343.3<Z<481.3 for 30kA and -343.3<Z<481.3 for 12kA //
15// is parameterized using measured data while outside the Tosca calculation //
16// is used (matched to data on the boundary of the measurements) //
17// //
18// If the querried point is outside the validity region no the return values //
19// for the field components are set to 0. //
20// //
d28e407c 21// To obtain the field integral in the TPC region from given point to nearest //
22// cathod plane (+- 250 cm) use: //
23// GetTPCInt(float* xyz, float* bxyz); for Cartesian frame //
24// or //
25// GetTPCIntCyl(Float_t *rphiz, Float_t *b); for Cylindrical frame //
26// //
27// //
28// The units are kiloGauss and cm. //
29// //
0eea9d4d 30///////////////////////////////////////////////////////////////////////////////////
d28e407c 31#ifndef _ALIMAGFCHEB_
32#define _ALIMAGFCHEB_
0eea9d4d 33
0eea9d4d 34#include <TNamed.h>
d28e407c 35#include <TSystem.h>
0eea9d4d 36#include "AliCheb3D.h"
37
38class AliMagFCheb: public TNamed
39{
40 public:
d28e407c 41 AliMagFCheb();
42 AliMagFCheb(const AliMagFCheb& src);
43 ~AliMagFCheb() {Clear();}
0eea9d4d 44 //
d28e407c 45 void CopyFrom(const AliMagFCheb& src);
46 AliMagFCheb& operator=(const AliMagFCheb& rhs);
47 virtual void Clear(Option_t * = "");
0eea9d4d 48 //
49 Int_t GetNParamsSol() const {return fNParamsSol;}
50 Int_t GetNSegZSol() const {return fNSegZSol;}
d28e407c 51 //
52 Int_t GetNParamsTPCInt() const {return fNParamsTPCInt;}
53 Int_t GetNSegZTPCInt() const {return fNSegZTPCInt;}
54 //
55 Int_t GetNParamsDip() const {return fNParamsDip;}
56 Int_t GetNSegZDip() const {return fNZSegDip;}
57 //
0eea9d4d 58 //
59 Float_t GetMinZSol() const {return fMinZSol;}
60 Float_t GetMaxZSol() const {return fMaxZSol;}
61 Float_t GetMaxRSol() const {return fMaxRSol;}
d28e407c 62 //
63 Float_t GetMinZDip() const {return fMinZDip;}
64 Float_t GetMaxZDip() const {return fMaxZDip;}
65 //
66 Float_t GetMinZTPCInt() const {return fMinZTPCInt;}
67 Float_t GetMaxZTPCInt() const {return fMaxZTPCInt;}
68 Float_t GetMaxRTPCInt() const {return fMaxRTPCInt;}
69 //
70 Int_t FindDipSegment(float *xyz) const;
0eea9d4d 71 AliCheb3D* GetParamSol(Int_t ipar) const {return (AliCheb3D*)fParamsSol->UncheckedAt(ipar);}
d28e407c 72 AliCheb3D* GetParamTPCInt(Int_t ipar) const {return (AliCheb3D*)fParamsTPCInt->UncheckedAt(ipar);}
0eea9d4d 73 AliCheb3D* GetParamDip(Int_t ipar) const {return (AliCheb3D*)fParamsDip->UncheckedAt(ipar);}
74 //
0eea9d4d 75 virtual void Print(Option_t * = "") const;
76 //
77 virtual void Field(Float_t *xyz, Float_t *b) const;
78 virtual void FieldCyl(Float_t *rphiz, Float_t *b) const;
ae5ea910 79 //
d28e407c 80 virtual void GetTPCInt(Float_t *xyz, Float_t *b) const;
81 virtual void GetTPCIntCyl(Float_t *rphiz, Float_t *b) const;
0eea9d4d 82 //
d28e407c 83 static void CylToCartCylB(float *rphiz, float *brphiz,float *bxyz);
84 static void CylToCartCartB(float *xyz, float *brphiz,float *bxyz);
85 static void CartToCylCartB(float *xyz, float *bxyz, float *brphiz);
86 static void CartToCylCylB(float *rphiz, float *bxyz, float *brphiz);
87 static void CartToCyl(float *xyz, float *rphiz);
88 static void CylToCart(float *rphiz,float *xyz);
0eea9d4d 89 //
90#ifdef _INC_CREATION_ALICHEB3D_ // see AliCheb3D.h for explanation
1cf34ee8 91 void LoadData(const char* inpfile);
92 //
d28e407c 93 AliMagFCheb(const char* inputFile);
94 void SaveData(const char* outfile) const;
95 Int_t SegmentDipDimension(float** seg,const TObjArray* par,int npar, int dim,
96 float xmn,float xmx,float ymn,float ymx,float zmn,float zmx);
97 //
98 void AddParamSol(AliCheb3D* param);
99 void AddParamTPCInt(AliCheb3D* param);
100 void AddParamDip(AliCheb3D* param);
101 void BuildTableDip();
102 void BuildTableSol();
103 void BuildTableTPCInt();
104 void ResetTPCInt();
105
0eea9d4d 106#endif
107 //
108 protected:
0eea9d4d 109 virtual void FieldCylSol(Float_t *rphiz, Float_t *b) const;
110 //
111 protected:
112 //
113 Int_t fNParamsSol; // Total number of parameterization pieces for Sol
d28e407c 114 Int_t fNSegZSol; // Number of segments in Z for Solenoid field
115 //
116 Int_t fNParamsTPCInt; // Total number of parameterization pieces for TPC field integral
117 Int_t fNSegZTPCInt; // Number of segments in Z for TPC field integral
0eea9d4d 118 //
119 Int_t fNParamsDip; // Total number of parameterization pieces for dipole
d28e407c 120 Int_t fNZSegDip; // number of distinct Z segments in Dipole
121 Int_t fNYSegDip; // number of distinct Y segments in Dipole
122 Int_t fNXSegDip; // number of distinct X segments in Dipole
123 //
124 Float_t* fSegZSol; //[fNSegZSol] upper boundaries of Z segments
125 Float_t* fSegRSol; //[fNParamsSol] upper boundaries of R segments
126 //
127 Float_t* fSegZTPCInt; //[fNSegZTPCInt] upper boundaries of Z segments
128 Float_t* fSegRTPCInt; //[fNParamsTPCInt] upper boundaries of R segments
0eea9d4d 129 //
d28e407c 130 Float_t* fSegZDip; //[fNZSegDip] coordinates of distinct Z segments in Dipole
131 Float_t* fSegYDip; //[fNYSegDip] coordinated of Y segments for each Zsegment in Dipole
132 Float_t* fSegXDip; //[fNXSegDip] coordinated of X segments for each Ysegment in Dipole
0eea9d4d 133 //
d28e407c 134 Int_t* fNSegRSol; //[fNSegZSol] number of R segments for each Z segment
135 Int_t* fSegZIdSol; //[fNSegZSol] Id of the first R segment of each Z segment in the fSegRSol...
136 //
137 Int_t* fNSegRTPCInt; //[fNSegZTPCInt] number of R segments for each Z segment
138 Int_t* fSegZIdTPCInt; //[fNSegZTPCInt] Id of the first R segment of each Z segment in the fSegRTPCInt...
139 //
140 Int_t* fBegSegYDip; //[fNZSegDip] beginning of Y segments array for each Z segment
141 Int_t* fNSegYDip; //[fNZSegDip] number of Y segments for each Z segment
142 Int_t* fBegSegXDip; //[fNYSegDip] beginning of X segments array for each Y segment
143 Int_t* fNSegXDip; //[fNYSegDip] number of X segments for each Y segment
144 Int_t* fSegIDDip; //[fNXSegDip] ID of the dipole parameterization for given XYZ segment
0eea9d4d 145 //
146 Float_t fMinZSol; // Min Z of Sol parameterization (in CYL. coordinates)
147 Float_t fMaxZSol; // Max Z of Sol parameterization (in CYL. coordinates)
148 Float_t fMaxRSol; // Max R of Sol parameterization (in CYL. coordinates)
149 //
d28e407c 150 Float_t fMinZDip; // Min Z of Dipole parameterization
151 Float_t fMaxZDip; // Max Z of Dipole parameterization
152 //
153 Float_t fMinZTPCInt; // Min Z of TPCInt parameterization (in CYL. coordinates)
154 Float_t fMaxZTPCInt; // Max Z of TPCInt parameterization (in CYL. coordinates)
155 Float_t fMaxRTPCInt; // Max R of TPCInt parameterization (in CYL. coordinates)
156 //
0eea9d4d 157 TObjArray* fParamsSol; // Parameterization pieces for Solenoid field
158 TObjArray* fParamsDip; // Parameterization pieces for Dipole field
d28e407c 159 TObjArray* fParamsTPCInt; // Parameterization pieces for Solenoid field integrals in TPC region
0eea9d4d 160 //
d28e407c 161 ClassDef(AliMagFCheb,3) // Wrapper class for the set of Chebishev parameterizations of Alice mag.field
0eea9d4d 162 //
163 };
164
165
166//__________________________________________________________________________________________
167inline void AliMagFCheb::FieldCyl(Float_t *rphiz, Float_t *b) const
168{
169 // compute field in Cylindircal coordinates
d28e407c 170 // if (rphiz[2]<GetMinZSol() || rphiz[2]>GetMaxZSol() || rphiz[0]>GetMaxRSol()) {for (int i=3;i--;) b[i]=0; return;}
0eea9d4d 171 FieldCylSol(rphiz,b);
172}
173
d28e407c 174//__________________________________________________________________________________________________
175inline void AliMagFCheb::CylToCartCylB(float *rphiz, float *brphiz,float *bxyz)
176{
177 // convert field in cylindrical coordinates to cartesian system, point is in cyl.system
178 float btr = TMath::Sqrt(brphiz[0]*brphiz[0]+brphiz[1]*brphiz[1]);
179 float psiPLUSphi = TMath::ATan2(brphiz[1],brphiz[0]) + rphiz[1];
180 bxyz[0] = btr*TMath::Cos(psiPLUSphi);
181 bxyz[1] = btr*TMath::Sin(psiPLUSphi);
182 bxyz[2] = brphiz[2];
183 //
184}
185
186//__________________________________________________________________________________________________
187inline void AliMagFCheb::CylToCartCartB(float *xyz, float *brphiz,float *bxyz)
188{
189 // convert field in cylindrical coordinates to cartesian system, point is in cart.system
190 float btr = TMath::Sqrt(brphiz[0]*brphiz[0]+brphiz[1]*brphiz[1]);
191 float phiPLUSpsi = TMath::ATan2(xyz[1],xyz[0]) + TMath::ATan2(brphiz[1],brphiz[0]);
192 bxyz[0] = btr*TMath::Cos(phiPLUSpsi);
193 bxyz[1] = btr*TMath::Sin(phiPLUSpsi);
194 bxyz[2] = brphiz[2];
195 //
196}
197
198//__________________________________________________________________________________________________
199inline void AliMagFCheb::CartToCylCartB(float *xyz ,float *bxyz, float *brphiz)
200{
201 // convert field in cylindrical coordinates to cartesian system, poin is in cart.system
202 float btr = TMath::Sqrt(bxyz[0]*bxyz[0]+bxyz[1]*bxyz[1]);
203 float psiMINphi = TMath::ATan2(bxyz[1],bxyz[0]) - TMath::ATan2(xyz[1],xyz[0]);
204 //
205 brphiz[0] = btr*TMath::Cos(psiMINphi);
206 brphiz[1] = btr*TMath::Sin(psiMINphi);
207 brphiz[2] = bxyz[2];
208 //
209}
210
211//__________________________________________________________________________________________________
212inline void AliMagFCheb::CartToCylCylB(float *rphiz,float *bxyz, float *brphiz)
213{
214 // convert field in cylindrical coordinates to cartesian system, point is in cyl.system
215 float btr = TMath::Sqrt(bxyz[0]*bxyz[0]+bxyz[1]*bxyz[1]);
216 float psiMINphi = TMath::ATan2(bxyz[1],bxyz[0]) - rphiz[1];
217 brphiz[0] = btr*TMath::Cos(psiMINphi);
218 brphiz[1] = btr*TMath::Sin(psiMINphi);
219 brphiz[2] = bxyz[2];
220 //
221}
222
223//__________________________________________________________________________________________________
224inline void AliMagFCheb::CartToCyl(float *xyz,float *rphiz)
225{
226 rphiz[0] = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
227 rphiz[1] = TMath::ATan2(xyz[1],xyz[0]);
228 rphiz[2] = xyz[2];
229}
230
231//__________________________________________________________________________________________________
232inline void AliMagFCheb::CylToCart(float *rphiz,float *xyz)
233{
234 xyz[0] = rphiz[0]*TMath::Cos(rphiz[1]);
235 xyz[1] = rphiz[0]*TMath::Sin(rphiz[1]);
236 xyz[2] = rphiz[2];
237}
238
0eea9d4d 239#endif