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 AliMagFC(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
96 if (fMeasuredMap) fMeasuredMap->GetTPCInt(xyz,b);
97 for (int i=3;i--;) b[i] *= fFactor;
100 //_______________________________________________________________________
101 void AliMagWrapCheb::GetTPCIntCyl(Float_t *rphiz, Float_t *b) const
103 // Method to calculate the integral of magnetic integral from point to nearest cathode plane
104 // in cylindrical coordiates ( -pi<phi<pi convention )
106 if (fMeasuredMap) fMeasuredMap->GetTPCIntCyl(rphiz,b);
107 for (int i=3;i--;) b[i] *= fFactor;
110 //_______________________________________________________________________
111 void AliMagWrapCheb::Field(Float_t *xyz, Float_t *b) const
113 // Method to calculate the field at point xyz
116 if (xyz[2] > 919. || xyz[2] < -1972.) {
119 if (fMeasuredMap && fFactor !=0.) {
120 fMeasuredMap->Field(xyz,b);
121 for (int i=3;i--;) b[i] *= fFactor;
126 //_______________________________________________________________________
127 AliMagWrapCheb& AliMagWrapCheb::operator=(const AliMagWrapCheb& maps)
129 fSolenoid=maps.fSolenoid;
130 if (this != &maps && maps.fMeasuredMap) {
131 if (fMeasuredMap) delete fMeasuredMap;
132 fMeasuredMap = new AliMagFCheb(*maps.fMeasuredMap);