]>
Commit | Line | Data |
---|---|---|
f9e85e5d | 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 | /* $Id$ */ | |
17 | ||
18 | //------------------------------------------------------------------------ | |
19 | // Magnetic field composed by 4 maps: the L3 magnet (inside and outside measured region), | |
20 | // extended region, and dipole magnet. | |
21 | // Used in the configuration macros (macros/Config.C, etc.) | |
22 | // Author: Andreas Morsch <andreas.morsch@cern.ch> | |
23 | //------------------------------------------------------------------------ | |
24 | ||
25 | #include <TClass.h> | |
26 | #include <TFile.h> | |
27 | #include <TMath.h> | |
28 | #include <TSystem.h> | |
29 | ||
30 | #include "AliLog.h" | |
31 | #include "AliFieldMap.h" | |
32 | #include "AliMagFMapsV1.h" | |
f9e85e5d | 33 | |
34 | ClassImp(AliMagFMapsV1) | |
35 | ||
36 | ||
37 | //_______________________________________________________________________ | |
38 | AliMagFMapsV1::AliMagFMapsV1(): | |
0cd61c1d | 39 | AliMagFMaps(), |
40 | fMeasuredMap(0) | |
f9e85e5d | 41 | { |
42 | // | |
43 | // Default constructor | |
44 | // | |
45 | } | |
46 | ||
47 | //_______________________________________________________________________ | |
48 | AliMagFMapsV1::AliMagFMapsV1(const char *name, const char *title, Int_t integ, | |
49 | Float_t factor, Float_t fmax, Int_t map, | |
50 | Int_t l3): | |
51 | AliMagFMaps(name, title, integ, factor, fmax, map, l3), | |
52 | fMeasuredMap(0) | |
53 | { | |
54 | // | |
55 | // Constructor | |
56 | // | |
57 | char* fname; | |
58 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/mfcheb.root"); | |
59 | TFile* file = new TFile(fname); | |
60 | if (fMap == k2kG) { | |
61 | fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get("Sol12_Dip6_Hole")); | |
62 | fSolenoid = 0.2; // T | |
63 | } else if (fMap == k5kG) { | |
64 | fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get("Sol30_Dip6_Hole")); | |
65 | fSolenoid = 0.5; // T | |
66 | } else if (fMap == k4kG){ | |
67 | fMeasuredMap = 0; | |
68 | fSolenoid = 0.4; // T | |
69 | } | |
70 | ||
71 | ||
72 | ||
73 | file->Close(); | |
74 | delete file; | |
75 | } | |
76 | ||
238ad248 | 77 | |
78 | //_______________________________________________________________________ | |
79 | AliMagFMapsV1::AliMagFMapsV1(const AliMagFMapsV1 &magf): | |
896dc8be | 80 | AliMagFMaps(magf), |
238ad248 | 81 | fMeasuredMap(0) |
82 | { | |
83 | // | |
84 | // Copy constructor | |
85 | // | |
86 | magf.Copy(*this); | |
87 | } | |
88 | ||
f9e85e5d | 89 | //_______________________________________________________________________ |
90 | AliMagFMapsV1::~AliMagFMapsV1() | |
91 | { | |
92 | // Destructor | |
93 | delete fMeasuredMap; | |
94 | } | |
95 | ||
96 | //_______________________________________________________________________ | |
611fa94a | 97 | void AliMagFMapsV1::Field(const float *x, float *b) const |
f9e85e5d | 98 | { |
99 | // | |
100 | // Method to calculate the magnetic field at position x | |
101 | // | |
ff66b122 | 102 | const float kRmax2 = 500. * 500.; |
103 | const float kZmax = 550.; | |
104 | const float kTeslaTokG = 10.; | |
105 | const float kScale = 0.98838; // matching factor | |
f9e85e5d | 106 | |
107 | // Check if position inside measured map | |
ff66b122 | 108 | float r2 = x[0] * x[0] + x[1] * x[1]; |
109 | if (fMeasuredMap && | |
110 | r2 < kRmax2 && | |
111 | TMath::Abs(x[2]) < kZmax | |
112 | ) | |
113 | { | |
114 | fMeasuredMap->Field(x, b); | |
115 | b[0] *= kTeslaTokG; | |
116 | b[1] *= kTeslaTokG; | |
117 | b[2] *= kTeslaTokG; | |
118 | } else { | |
119 | AliMagFMaps::Field(x, b); | |
120 | // Match to measure map | |
121 | b[0] = - b[0] * kScale; | |
122 | b[2] = - b[2] * kScale; | |
123 | b[1] = - b[1] * kScale; | |
124 | } | |
125 | } | |
126 | ||
127 | //_______________________________________________________________________ | |
611fa94a | 128 | void AliMagFMapsV1::Field(const double *x, double *b) const |
ff66b122 | 129 | { |
130 | // | |
131 | // Method to calculate the magnetic field at position x | |
132 | // | |
133 | const double kRmax2 = 500. * 500.; | |
134 | const double kZmax = 550.; | |
135 | const double kTeslaTokG = 10.; | |
136 | const double kScale = 0.98838; // matching factor | |
137 | ||
138 | // Check if position inside measured map | |
139 | double r2 = x[0] * x[0] + x[1] * x[1]; | |
f9e85e5d | 140 | if (fMeasuredMap && |
141 | r2 < kRmax2 && | |
142 | TMath::Abs(x[2]) < kZmax | |
143 | ) | |
144 | { | |
145 | fMeasuredMap->Field(x, b); | |
146 | b[0] *= kTeslaTokG; | |
147 | b[1] *= kTeslaTokG; | |
148 | b[2] *= kTeslaTokG; | |
149 | } else { | |
150 | AliMagFMaps::Field(x, b); | |
7207d832 | 151 | // Match to measure map |
152 | b[0] = - b[0] * kScale; | |
153 | b[2] = - b[2] * kScale; | |
9f806b7f | 154 | b[1] = - b[1] * kScale; |
f9e85e5d | 155 | } |
156 | } | |
157 | ||
158 | ||
159 | Float_t AliMagFMapsV1::SolenoidField() const | |
160 | { | |
161 | // | |
162 | // Returns max. L3 (solenoid) field strength | |
163 | // according to field map setting | |
164 | // | |
165 | return fSolenoid; | |
166 | } | |
167 | ||
238ad248 | 168 | void AliMagFMapsV1::Copy(TObject &fm) const |
169 | { | |
170 | // dummy since the base class constructor is dummy | |
171 | AliMagFMaps::Copy(fm); | |
172 | AliMagFMapsV1* fmp = (AliMagFMapsV1*) &fm; | |
173 | fmp->SetMeasuredMap(fMeasuredMap); | |
174 | } |