1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
21 #include "AliMagWrapCheb.h"
24 ClassImp(AliMagWrapCheb)
27 //_______________________________________________________________________
28 AliMagWrapCheb::AliMagWrapCheb():
32 // Default constructor
36 //_______________________________________________________________________
37 AliMagWrapCheb::AliMagWrapCheb(const char *name, const char *title, Int_t integ,
38 Float_t factor, Float_t fmax, Int_t map,
39 Bool_t dipoleON,const char* path):
40 AliMagF(name, title, integ, factor, fmax),
45 char* fname = gSystem->ExpandPathName(path);
46 TFile* file = TFile::Open(fname);
48 AliError(Form("Failed to open magnetic field data file %s\n",fname));
51 const char* parname = 0;
52 if (fMap == k2kG) parname = dipoleON ? "Sol12_Dip6_Hole":"Sol12_Dip0_Hole";
53 else if (fMap == k5kG) parname = dipoleON ? "Sol30_Dip6_Hole":"Sol30_Dip0_Hole";
55 AliError(Form("Unknown field identifier %d is requested\n",fMap));
59 fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get(parname));
61 AliError(Form("Did not find field %s in %s\n",parname,fname));
69 //_______________________________________________________________________
70 AliMagWrapCheb::AliMagWrapCheb(const AliMagWrapCheb &src):
74 if (src.fMeasuredMap) fMeasuredMap = new AliMagFCheb(*src.fMeasuredMap);
77 //_______________________________________________________________________
78 AliMagWrapCheb::~AliMagWrapCheb()
83 //_______________________________________________________________________
84 void AliMagWrapCheb::GetTPCInt(Float_t *xyz, Float_t *b) const
86 // Method to calculate the integral of magnetic integral from xyz to nearest cathode plane
88 if (fMeasuredMap) fMeasuredMap->GetTPCInt(xyz,b);
89 for (int i=3;i--;) b[i] *= fFactor;
92 //_______________________________________________________________________
93 void AliMagWrapCheb::GetTPCIntCyl(Float_t *rphiz, Float_t *b) const
95 // Method to calculate the integral of magnetic integral from point to nearest cathode plane
96 // in cylindrical coordiates ( -pi<phi<pi convention )
97 if (fMeasuredMap) fMeasuredMap->GetTPCIntCyl(rphiz,b);
98 for (int i=3;i--;) b[i] *= fFactor;
101 //_______________________________________________________________________
102 void AliMagWrapCheb::Field(Float_t *xyz, Float_t *b) const
104 // Method to calculate the field at point xyz
106 if (fMeasuredMap) fMeasuredMap->Field(xyz,b);
107 for (int i=3;i--;) b[i] *= fFactor;
110 //_______________________________________________________________________
111 AliMagWrapCheb& AliMagWrapCheb::operator=(const AliMagWrapCheb& maps)
113 if (this != &maps && maps.fMeasuredMap) {
114 if (fMeasuredMap) delete fMeasuredMap;
115 fMeasuredMap = new AliMagFCheb(*maps.fMeasuredMap);