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():
33 // Default constructor
37 //_______________________________________________________________________
38 AliMagWrapCheb::AliMagWrapCheb(const char *name, const char *title, Int_t integ,
39 Float_t factor, Float_t fmax, Int_t map,
40 Bool_t dipoleON,const char* path):
41 AliMagF(name, title, integ, factor, fmax),
47 char* fname = gSystem->ExpandPathName(path);
48 TFile* file = TFile::Open(fname);
50 AliError(Form("Failed to open magnetic field data file %s\n",fname));
53 const char* parname = 0;
56 parname = dipoleON ? "Sol12_Dip6_Hole":"Sol12_Dip0_Hole";
57 } else if (fMap == k5kG) {
59 parname = dipoleON ? "Sol30_Dip6_Hole":"Sol30_Dip0_Hole";
61 AliError(Form("Unknown field identifier %d is requested\n",fMap));
65 fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get(parname));
67 AliError(Form("Did not find field %s in %s\n",parname,fname));
75 //_______________________________________________________________________
76 AliMagWrapCheb::AliMagWrapCheb(const AliMagWrapCheb &src):
79 fSolenoid(src.fSolenoid)
81 if (src.fMeasuredMap) fMeasuredMap = new AliMagFCheb(*src.fMeasuredMap);
84 //_______________________________________________________________________
85 AliMagWrapCheb::~AliMagWrapCheb()
90 //_______________________________________________________________________
91 void AliMagWrapCheb::GetTPCInt(Float_t *xyz, Float_t *b) const
93 // Method to calculate the integral of magnetic integral from xyz to nearest cathode plane
95 if (fMeasuredMap) fMeasuredMap->GetTPCInt(xyz,b);
96 for (int i=3;i--;) b[i] *= fFactor;
99 //_______________________________________________________________________
100 void AliMagWrapCheb::GetTPCIntCyl(Float_t *rphiz, Float_t *b) const
102 // Method to calculate the integral of magnetic integral from point to nearest cathode plane
103 // in cylindrical coordiates ( -pi<phi<pi convention )
104 if (fMeasuredMap) fMeasuredMap->GetTPCIntCyl(rphiz,b);
105 for (int i=3;i--;) b[i] *= fFactor;
108 //_______________________________________________________________________
109 void AliMagWrapCheb::Field(Float_t *xyz, Float_t *b) const
111 // Method to calculate the field at point xyz
113 if (fMeasuredMap) fMeasuredMap->Field(xyz,b);
114 for (int i=3;i--;) b[i] *= fFactor;
117 //_______________________________________________________________________
118 AliMagWrapCheb& AliMagWrapCheb::operator=(const AliMagWrapCheb& maps)
120 fSolenoid=maps.fSolenoid;
121 if (this != &maps && maps.fMeasuredMap) {
122 if (fMeasuredMap) delete fMeasuredMap;
123 fMeasuredMap = new AliMagFCheb(*maps.fMeasuredMap);