X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliMagFCheb.h;h=6b381d4e16ddab345836a0055cd6205c1862e360;hb=bb91052d97495ff5fe267e203a295e81f7f2edab;hp=492ec4f36eb23b38bb5d7b040a357eb5e12d5889;hpb=0bc7b4144ebfb60509d1f5f93139d69bec180484;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliMagFCheb.h b/STEER/AliMagFCheb.h index 492ec4f36eb..6b381d4e16d 100644 --- a/STEER/AliMagFCheb.h +++ b/STEER/AliMagFCheb.h @@ -1,13 +1,6 @@ -#ifndef ALIMAGFCHEB_H -#define ALIMAGFCHEB_H -/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * See cxx source for full Copyright notice */ - -/* $Id$ */ - // Author: ruben.shahoyan@cern.ch 20/03/2007 -// + /////////////////////////////////////////////////////////////////////////////////// // // // Wrapper for the set of mag.field parameterizations by Chebyshev polinomials // @@ -16,8 +9,7 @@ // For cylindrical coordinates/components: // // FieldCyl(float* rphiz, float* brphiz) // // // -// For the moment only the solenoid part is parameterized in the volume defined // -// by R<500, -550 #include +#include #include "AliCheb3D.h" class AliMagFCheb: public TNamed { public: - AliMagFCheb(); - AliMagFCheb(const char* inputFile); - AliMagFCheb(const AliMagFCheb &cheb); - AliMagFCheb& operator= (const AliMagFCheb &cheb) { - // Assignment operator - cheb.Copy(*this); - return *this; - } - - ~AliMagFCheb(); + AliMagFCheb(); + AliMagFCheb(const AliMagFCheb& src); + ~AliMagFCheb() {Clear();} // - void AddParamSol(AliCheb3D* param); - void AddParamDip(AliCheb3D* param); - void BuildTableSol(); + void CopyFrom(const AliMagFCheb& src); + AliMagFCheb& operator=(const AliMagFCheb& rhs); + virtual void Clear(Option_t * = ""); // Int_t GetNParamsSol() const {return fNParamsSol;} Int_t GetNSegZSol() const {return fNSegZSol;} - Int_t GetNSegRSol(int iz) const {return izUncheckedAt(ipar);} + AliCheb3D* GetParamTPCInt(Int_t ipar) const {return (AliCheb3D*)fParamsTPCInt->UncheckedAt(ipar);} AliCheb3D* GetParamDip(Int_t ipar) const {return (AliCheb3D*)fParamsDip->UncheckedAt(ipar);} // - void LoadData(const char* inpfile); - // virtual void Print(Option_t * = "") const; // virtual void Field(Float_t *xyz, Float_t *b) const; virtual void FieldCyl(Float_t *rphiz, Float_t *b) const; // + virtual void GetTPCInt(Float_t *xyz, Float_t *b) const; + virtual void GetTPCIntCyl(Float_t *rphiz, Float_t *b) const; + // + static void CylToCartCylB(float *rphiz, float *brphiz,float *bxyz); + static void CylToCartCartB(float *xyz, float *brphiz,float *bxyz); + static void CartToCylCartB(float *xyz, float *bxyz, float *brphiz); + static void CartToCylCylB(float *rphiz, float *bxyz, float *brphiz); + static void CartToCyl(float *xyz, float *rphiz); + static void CylToCart(float *rphiz,float *xyz); // #ifdef _INC_CREATION_ALICHEB3D_ // see AliCheb3D.h for explanation - void SaveData(const char* outfile) const; + void LoadData(const char* inpfile); + // + AliMagFCheb(const char* inputFile); + void SaveData(const char* outfile) const; + Int_t SegmentDipDimension(float** seg,const TObjArray* par,int npar, int dim, + float xmn,float xmx,float ymn,float ymx,float zmn,float zmx); + // + void AddParamSol(AliCheb3D* param); + void AddParamTPCInt(AliCheb3D* param); + void AddParamDip(AliCheb3D* param); + void BuildTableDip(); + void BuildTableSol(); + void BuildTableTPCInt(); + void ResetTPCInt(); + #endif // protected: - void Init0(); virtual void FieldCylSol(Float_t *rphiz, Float_t *b) const; - private: - void Copy (TObject &cheb) const; // protected: // Int_t fNParamsSol; // Total number of parameterization pieces for Sol - Int_t fNSegZSol; // Number of segments is Z + Int_t fNSegZSol; // Number of segments in Z for Solenoid field + // + Int_t fNParamsTPCInt; // Total number of parameterization pieces for TPC field integral + Int_t fNSegZTPCInt; // Number of segments in Z for TPC field integral // Int_t fNParamsDip; // Total number of parameterization pieces for dipole + Int_t fNZSegDip; // number of distinct Z segments in Dipole + Int_t fNYSegDip; // number of distinct Y segments in Dipole + Int_t fNXSegDip; // number of distinct X segments in Dipole + // + Float_t* fSegZSol; //[fNSegZSol] upper boundaries of Z segments + Float_t* fSegRSol; //[fNParamsSol] upper boundaries of R segments + // + Float_t* fSegZTPCInt; //[fNSegZTPCInt] upper boundaries of Z segments + Float_t* fSegRTPCInt; //[fNParamsTPCInt] upper boundaries of R segments + // + Float_t* fSegZDip; //[fNZSegDip] coordinates of distinct Z segments in Dipole + Float_t* fSegYDip; //[fNYSegDip] coordinated of Y segments for each Zsegment in Dipole + Float_t* fSegXDip; //[fNXSegDip] coordinated of X segments for each Ysegment in Dipole // - Float_t* fSegZSol; //[fNSegZSol] upper boundaries of Z segments - Float_t* fSegRSol; //[fNParamsSol] upper boundaries of R segments + Int_t* fNSegRSol; //[fNSegZSol] number of R segments for each Z segment + Int_t* fSegZIdSol; //[fNSegZSol] Id of the first R segment of each Z segment in the fSegRSol... // - Int_t* fNSegRSol; //[fNSegZSol] number of R segments for each Z segment - Int_t* fSegZIdSol; //[fNSegZSol] Id of the first R segment of each Z segment in the fSegRSol... + Int_t* fNSegRTPCInt; //[fNSegZTPCInt] number of R segments for each Z segment + Int_t* fSegZIdTPCInt; //[fNSegZTPCInt] Id of the first R segment of each Z segment in the fSegRTPCInt... + // + Int_t* fBegSegYDip; //[fNZSegDip] beginning of Y segments array for each Z segment + Int_t* fNSegYDip; //[fNZSegDip] number of Y segments for each Z segment + Int_t* fBegSegXDip; //[fNYSegDip] beginning of X segments array for each Y segment + Int_t* fNSegXDip; //[fNYSegDip] number of X segments for each Y segment + Int_t* fSegIDDip; //[fNXSegDip] ID of the dipole parameterization for given XYZ segment // Float_t fMinZSol; // Min Z of Sol parameterization (in CYL. coordinates) Float_t fMaxZSol; // Max Z of Sol parameterization (in CYL. coordinates) Float_t fMaxRSol; // Max R of Sol parameterization (in CYL. coordinates) // + Float_t fMinZDip; // Min Z of Dipole parameterization + Float_t fMaxZDip; // Max Z of Dipole parameterization + // + Float_t fMinZTPCInt; // Min Z of TPCInt parameterization (in CYL. coordinates) + Float_t fMaxZTPCInt; // Max Z of TPCInt parameterization (in CYL. coordinates) + Float_t fMaxRTPCInt; // Max R of TPCInt parameterization (in CYL. coordinates) + // TObjArray* fParamsSol; // Parameterization pieces for Solenoid field TObjArray* fParamsDip; // Parameterization pieces for Dipole field + TObjArray* fParamsTPCInt; // Parameterization pieces for Solenoid field integrals in TPC region // - ClassDef(AliMagFCheb,1) // Wrapper class for the set of Chebishev parameterizations of Alice mag.field + ClassDef(AliMagFCheb,3) // Wrapper class for the set of Chebishev parameterizations of Alice mag.field // }; @@ -109,8 +167,73 @@ class AliMagFCheb: public TNamed inline void AliMagFCheb::FieldCyl(Float_t *rphiz, Float_t *b) const { // compute field in Cylindircal coordinates - if (rphiz[2]GetMaxZSol() || rphiz[0]>GetMaxRSol()) {for (int i=3;i--;) b[i]=0; return;} + // if (rphiz[2]GetMaxZSol() || rphiz[0]>GetMaxRSol()) {for (int i=3;i--;) b[i]=0; return;} FieldCylSol(rphiz,b); } +//__________________________________________________________________________________________________ +inline void AliMagFCheb::CylToCartCylB(float *rphiz, float *brphiz,float *bxyz) +{ + // convert field in cylindrical coordinates to cartesian system, point is in cyl.system + float btr = TMath::Sqrt(brphiz[0]*brphiz[0]+brphiz[1]*brphiz[1]); + float psiPLUSphi = TMath::ATan2(brphiz[1],brphiz[0]) + rphiz[1]; + bxyz[0] = btr*TMath::Cos(psiPLUSphi); + bxyz[1] = btr*TMath::Sin(psiPLUSphi); + bxyz[2] = brphiz[2]; + // +} + +//__________________________________________________________________________________________________ +inline void AliMagFCheb::CylToCartCartB(float *xyz, float *brphiz,float *bxyz) +{ + // convert field in cylindrical coordinates to cartesian system, point is in cart.system + float btr = TMath::Sqrt(brphiz[0]*brphiz[0]+brphiz[1]*brphiz[1]); + float phiPLUSpsi = TMath::ATan2(xyz[1],xyz[0]) + TMath::ATan2(brphiz[1],brphiz[0]); + bxyz[0] = btr*TMath::Cos(phiPLUSpsi); + bxyz[1] = btr*TMath::Sin(phiPLUSpsi); + bxyz[2] = brphiz[2]; + // +} + +//__________________________________________________________________________________________________ +inline void AliMagFCheb::CartToCylCartB(float *xyz ,float *bxyz, float *brphiz) +{ + // convert field in cylindrical coordinates to cartesian system, poin is in cart.system + float btr = TMath::Sqrt(bxyz[0]*bxyz[0]+bxyz[1]*bxyz[1]); + float psiMINphi = TMath::ATan2(bxyz[1],bxyz[0]) - TMath::ATan2(xyz[1],xyz[0]); + // + brphiz[0] = btr*TMath::Cos(psiMINphi); + brphiz[1] = btr*TMath::Sin(psiMINphi); + brphiz[2] = bxyz[2]; + // +} + +//__________________________________________________________________________________________________ +inline void AliMagFCheb::CartToCylCylB(float *rphiz,float *bxyz, float *brphiz) +{ + // convert field in cylindrical coordinates to cartesian system, point is in cyl.system + float btr = TMath::Sqrt(bxyz[0]*bxyz[0]+bxyz[1]*bxyz[1]); + float psiMINphi = TMath::ATan2(bxyz[1],bxyz[0]) - rphiz[1]; + brphiz[0] = btr*TMath::Cos(psiMINphi); + brphiz[1] = btr*TMath::Sin(psiMINphi); + brphiz[2] = bxyz[2]; + // +} + +//__________________________________________________________________________________________________ +inline void AliMagFCheb::CartToCyl(float *xyz,float *rphiz) +{ + rphiz[0] = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); + rphiz[1] = TMath::ATan2(xyz[1],xyz[0]); + rphiz[2] = xyz[2]; +} + +//__________________________________________________________________________________________________ +inline void AliMagFCheb::CylToCart(float *rphiz,float *xyz) +{ + xyz[0] = rphiz[0]*TMath::Cos(rphiz[1]); + xyz[1] = rphiz[0]*TMath::Sin(rphiz[1]); + xyz[2] = rphiz[2]; +} + #endif