]>
Commit | Line | Data |
---|---|---|
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 | ||
24 | ClassImp(AliMagWrapCheb) | |
25 | ||
26 | ||
27 | //_______________________________________________________________________ | |
28 | AliMagWrapCheb::AliMagWrapCheb(): | |
29 | AliMagF(), | |
a93040ed | 30 | fMeasuredMap(0), |
31 | fSolenoid(5.) | |
a1dde210 | 32 | { |
33 | // Default constructor | |
34 | // | |
35 | } | |
36 | ||
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), | |
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 | //_______________________________________________________________________ | |
76 | AliMagWrapCheb::AliMagWrapCheb(const AliMagWrapCheb &src): | |
77 | AliMagF(src), | |
a93040ed | 78 | fMeasuredMap(0), |
79 | fSolenoid(src.fSolenoid) | |
a1dde210 | 80 | { |
81 | if (src.fMeasuredMap) fMeasuredMap = new AliMagFCheb(*src.fMeasuredMap); | |
82 | } | |
83 | ||
84 | //_______________________________________________________________________ | |
85 | AliMagWrapCheb::~AliMagWrapCheb() | |
86 | { | |
87 | delete fMeasuredMap; | |
88 | } | |
89 | ||
90 | //_______________________________________________________________________ | |
91 | void 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 | // | |
95 | if (fMeasuredMap) fMeasuredMap->GetTPCInt(xyz,b); | |
96 | for (int i=3;i--;) b[i] *= fFactor; | |
97 | } | |
98 | ||
99 | //_______________________________________________________________________ | |
100 | void AliMagWrapCheb::GetTPCIntCyl(Float_t *rphiz, Float_t *b) const | |
101 | { | |
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; | |
106 | } | |
107 | ||
108 | //_______________________________________________________________________ | |
109 | void AliMagWrapCheb::Field(Float_t *xyz, Float_t *b) const | |
110 | { | |
111 | // Method to calculate the field at point xyz | |
112 | // | |
113 | if (fMeasuredMap) fMeasuredMap->Field(xyz,b); | |
114 | for (int i=3;i--;) b[i] *= fFactor; | |
115 | } | |
116 | ||
117 | //_______________________________________________________________________ | |
118 | AliMagWrapCheb& AliMagWrapCheb::operator=(const AliMagWrapCheb& maps) | |
119 | { | |
a93040ed | 120 | fSolenoid=maps.fSolenoid; |
a1dde210 | 121 | if (this != &maps && maps.fMeasuredMap) { |
122 | if (fMeasuredMap) delete fMeasuredMap; | |
123 | fMeasuredMap = new AliMagFCheb(*maps.fMeasuredMap); | |
124 | } | |
125 | return *this; | |
126 | } |