]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMagWrapCheb.cxx
Obsolete.
[u/mrichter/AliRoot.git] / STEER / AliMagWrapCheb.cxx
CommitLineData
a1dde210 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16
17#include <TClass.h>
18#include <TFile.h>
19#include <TSystem.h>
20
21#include "AliMagWrapCheb.h"
22#include "AliLog.h"
23
24ClassImp(AliMagWrapCheb)
25
26
27//_______________________________________________________________________
28AliMagWrapCheb::AliMagWrapCheb():
5de97576 29 AliMagFC(),
a93040ed 30 fMeasuredMap(0),
31 fSolenoid(5.)
a1dde210 32{
33 // Default constructor
34 //
35}
36
37//_______________________________________________________________________
38AliMagWrapCheb::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):
5de97576 41 AliMagFC(name, title, integ, factor, fmax),
a93040ed 42 fMeasuredMap(0),
43 fSolenoid(5.)
a1dde210 44{
45 //
46 fMap = map;
47 char* fname = gSystem->ExpandPathName(path);
48 TFile* file = TFile::Open(fname);
49 if (!file) {
50 AliError(Form("Failed to open magnetic field data file %s\n",fname));
51 return;
52 }
53 const char* parname = 0;
a93040ed 54 if (fMap == k2kG) {
55 fSolenoid = 2.;
56 parname = dipoleON ? "Sol12_Dip6_Hole":"Sol12_Dip0_Hole";
57 } else if (fMap == k5kG) {
58 fSolenoid = 5.;
59 parname = dipoleON ? "Sol30_Dip6_Hole":"Sol30_Dip0_Hole";
60 } else {
a1dde210 61 AliError(Form("Unknown field identifier %d is requested\n",fMap));
62 return;
63 }
64 //
65 fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get(parname));
66 if (!fMeasuredMap) {
67 AliError(Form("Did not find field %s in %s\n",parname,fname));
68 return;
69 }
70 file->Close();
71 delete file;
72}
73
74
75//_______________________________________________________________________
76AliMagWrapCheb::AliMagWrapCheb(const AliMagWrapCheb &src):
5de97576 77 AliMagFC(src),
a93040ed 78 fMeasuredMap(0),
79 fSolenoid(src.fSolenoid)
a1dde210 80{
81 if (src.fMeasuredMap) fMeasuredMap = new AliMagFCheb(*src.fMeasuredMap);
82}
83
84//_______________________________________________________________________
85AliMagWrapCheb::~AliMagWrapCheb()
86{
87 delete fMeasuredMap;
88}
89
90//_______________________________________________________________________
91void AliMagWrapCheb::GetTPCInt(Float_t *xyz, Float_t *b) const
92{
93 // Method to calculate the integral of magnetic integral from xyz to nearest cathode plane
94 //
a3d08d4c 95 b[0]=b[1]=b[2]=0.0;
a1dde210 96 if (fMeasuredMap) fMeasuredMap->GetTPCInt(xyz,b);
97 for (int i=3;i--;) b[i] *= fFactor;
98}
99
100//_______________________________________________________________________
101void AliMagWrapCheb::GetTPCIntCyl(Float_t *rphiz, Float_t *b) const
102{
103 // Method to calculate the integral of magnetic integral from point to nearest cathode plane
104 // in cylindrical coordiates ( -pi<phi<pi convention )
a3d08d4c 105 b[0]=b[1]=b[2]=0.0;
a1dde210 106 if (fMeasuredMap) fMeasuredMap->GetTPCIntCyl(rphiz,b);
107 for (int i=3;i--;) b[i] *= fFactor;
108}
109
110//_______________________________________________________________________
111void AliMagWrapCheb::Field(Float_t *xyz, Float_t *b) const
112{
113 // Method to calculate the field at point xyz
114 //
a3d08d4c 115 b[0]=b[1]=b[2]=0.0;
5de97576 116 if (xyz[2] > 919. || xyz[2] < -1972.) {
117 ZDCField(xyz, b);
118 } else {
95d9681f 119 if (fMeasuredMap && fFactor !=0.) {
120 fMeasuredMap->Field(xyz,b);
121 for (int i=3;i--;) b[i] *= fFactor;
122 }
5de97576 123 }
a1dde210 124}
125
126//_______________________________________________________________________
127AliMagWrapCheb& AliMagWrapCheb::operator=(const AliMagWrapCheb& maps)
128{
a93040ed 129 fSolenoid=maps.fSolenoid;
a1dde210 130 if (this != &maps && maps.fMeasuredMap) {
131 if (fMeasuredMap) delete fMeasuredMap;
132 fMeasuredMap = new AliMagFCheb(*maps.fMeasuredMap);
133 }
134 return *this;
135}