]>
Commit | Line | Data |
---|---|---|
84737f5e | 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 | ||
acd84897 | 16 | /* $Id$ */ |
84737f5e | 17 | |
5d8718b8 | 18 | //------------------------------------------------------------------------ |
19 | // Magnetic field composed by 3 maps: the L3 magnet, extended region, and | |
20 | // dipole magnet | |
21 | // Used in the configuration macros (macros/Config.C, etc.) | |
84737f5e | 22 | // Author: Andreas Morsch <andreas.morsch@cern.ch> |
5d8718b8 | 23 | //------------------------------------------------------------------------ |
84737f5e | 24 | |
25 | #include <TFile.h> | |
26 | #include <TSystem.h> | |
e2afb3b6 | 27 | |
594d8990 | 28 | #include "AliLog.h" |
84737f5e | 29 | #include "AliFieldMap.h" |
30 | #include "AliMagFMaps.h" | |
31 | ||
84737f5e | 32 | ClassImp(AliMagFMaps) |
a0201063 | 33 | |
84737f5e | 34 | |
e2afb3b6 | 35 | //_______________________________________________________________________ |
36 | AliMagFMaps::AliMagFMaps(): | |
37 | fSolenoid(0), | |
02b50693 | 38 | fSolenoidUser(0.), |
a0201063 | 39 | fL3Option(0) |
e2afb3b6 | 40 | { |
41 | // | |
42 | // Default constructor | |
43 | // | |
10eca208 | 44 | // |
45 | // Don't replicate field information in gAlice | |
e2afb3b6 | 46 | fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0; |
47 | } | |
48 | ||
49 | //_______________________________________________________________________ | |
d0f1ee3b | 50 | AliMagFMaps::AliMagFMaps(const char *name, const char *title, Int_t integ, |
51 | Float_t factor, Float_t fmax, Int_t map, | |
52 | Int_t l3): | |
57754f18 | 53 | AliMagFC(name,title,integ,factor,fmax), |
e2afb3b6 | 54 | fSolenoid(0), |
02b50693 | 55 | fSolenoidUser(0), |
a0201063 | 56 | fL3Option(l3) |
84737f5e | 57 | { |
58 | // | |
59 | // Standard constructor | |
60 | // | |
61 | fType = kConMesh; | |
62 | fFieldMap[0] = 0; | |
c2b548d6 | 63 | fMap = map; |
64 | fL3Option = l3; | |
c2b548d6 | 65 | ReadField(); |
e2afb3b6 | 66 | // |
67 | // Don't replicate field information in gAlice | |
7b6cddfa | 68 | for (Int_t i = 0; i < 3; i++) fFieldMap[i]->SetWriteEnable(0); |
e2afb3b6 | 69 | // |
84737f5e | 70 | } |
71 | ||
e2afb3b6 | 72 | //_______________________________________________________________________ |
73 | AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf): | |
57754f18 | 74 | AliMagFC(magf), |
e2afb3b6 | 75 | fSolenoid(0), |
fe12e09c | 76 | fSolenoidUser(0), |
a0201063 | 77 | fL3Option(0) |
84737f5e | 78 | { |
79 | // | |
80 | // Copy constructor | |
81 | // | |
82 | magf.Copy(*this); | |
83 | } | |
84 | ||
e2afb3b6 | 85 | //_______________________________________________________________________ |
84737f5e | 86 | AliMagFMaps::~AliMagFMaps() |
87 | { | |
e2afb3b6 | 88 | // |
89 | // Destructor | |
90 | // | |
91 | delete fFieldMap[0]; | |
92 | delete fFieldMap[1]; | |
93 | delete fFieldMap[2]; | |
3ce3918c | 94 | fgReadField = kTRUE; |
84737f5e | 95 | } |
96 | ||
e2afb3b6 | 97 | //_______________________________________________________________________ |
c2b548d6 | 98 | void AliMagFMaps::ReadField() |
99 | { | |
e2afb3b6 | 100 | // Read Field Map from file |
101 | // | |
102 | // don't read twice | |
103 | // | |
a0201063 | 104 | if (!fgReadField) return; |
105 | fgReadField = 0; | |
e2afb3b6 | 106 | // |
107 | char* fname; | |
108 | TFile* file = 0; | |
109 | if (fMap == k2kG) { | |
b6ee07d3 | 110 | fSolenoid = 2.; |
111 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root"); | |
112 | file = new TFile(fname); | |
113 | fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B02")); | |
114 | file->Close(); | |
115 | delete file; | |
177a7fab | 116 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root"); |
e2afb3b6 | 117 | file = new TFile(fname); |
177a7fab | 118 | fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB02")); |
119 | file->Close(); | |
120 | delete file;; | |
121 | ||
122 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root"); | |
123 | file = new TFile(fname); | |
124 | fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB02")); | |
e2afb3b6 | 125 | file->Close(); |
126 | delete file; | |
e2afb3b6 | 127 | } else if (fMap == k4kG) { |
b6ee07d3 | 128 | fSolenoid = 4.; |
129 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root"); | |
130 | file = new TFile(fname); | |
131 | fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B04")); | |
132 | file->Close(); | |
133 | delete file; | |
177a7fab | 134 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root"); |
e2afb3b6 | 135 | file = new TFile(fname); |
177a7fab | 136 | fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04")); |
137 | file->Close(); | |
138 | delete file; | |
139 | ||
140 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root"); | |
141 | file = new TFile(fname); | |
142 | fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04")); | |
e2afb3b6 | 143 | file->Close(); |
144 | delete file; | |
e2afb3b6 | 145 | } else if (fMap == k5kG) { |
b6ee07d3 | 146 | fSolenoid = 5.; |
147 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root"); | |
148 | file = new TFile(fname); | |
149 | fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B05")); | |
150 | file->Close(); | |
151 | delete file; | |
177a7fab | 152 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root"); |
e2afb3b6 | 153 | file = new TFile(fname); |
177a7fab | 154 | fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05")); |
e2afb3b6 | 155 | file->Close(); |
156 | delete file; | |
177a7fab | 157 | |
158 | fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root"); | |
159 | file = new TFile(fname); | |
160 | fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05")); | |
161 | file->Close(); | |
162 | delete file; | |
e2afb3b6 | 163 | } |
b6ee07d3 | 164 | |
165 | if (!fL3Option) fSolenoidUser = fSolenoid; | |
166 | ||
c2b548d6 | 167 | } |
168 | ||
e2afb3b6 | 169 | //_______________________________________________________________________ |
84737f5e | 170 | Float_t AliMagFMaps::SolenoidField() const |
171 | { | |
e2afb3b6 | 172 | // |
173 | // Returns max. L3 (solenoid) field strength | |
174 | // according to field map setting | |
175 | // | |
7ebb06c3 | 176 | return -Factor()*fSolenoid; |
84737f5e | 177 | } |
178 | ||
e2afb3b6 | 179 | //_______________________________________________________________________ |
6f3038e9 | 180 | void AliMagFMaps::Field(Float_t *x, Float_t *b) const |
84737f5e | 181 | { |
182 | // | |
183 | // Method to calculate the magnetic field | |
184 | // | |
84737f5e | 185 | // --- find the position in the grid --- |
186 | ||
57754f18 | 187 | |
188 | ||
6f3038e9 | 189 | // if (!fFieldRead) ReadField(); |
57754f18 | 190 | |
191 | // | |
192 | // Field Maps have been calculated for the coordinate system in which | |
193 | // the Muon Spectrometer is placed at z > 0 | |
194 | // Transform coordinates corresponingly | |
195 | // | |
e2afb3b6 | 196 | |
84737f5e | 197 | b[0]=b[1]=b[2]=0; |
57754f18 | 198 | Float_t xm[3]; |
199 | xm[0] = - x[0]; | |
200 | xm[1] = x[1]; | |
201 | xm[2] = - x[2]; | |
202 | ||
84737f5e | 203 | AliFieldMap* map = 0; |
57754f18 | 204 | if (fFieldMap[0]->Inside(xm[0], xm[1], xm[2])) { |
177a7fab | 205 | map = fFieldMap[0]; |
0ae44e30 | 206 | Float_t r = TMath::Sqrt(xm[0] * xm[0] + xm[1] * xm[1]); |
207 | ||
208 | if (!fL3Option && TMath::Abs(xm[2]) < 370. && r < 550.) { | |
e2afb3b6 | 209 | // |
b6ee07d3 | 210 | // Constant L3 field , if this option was selected |
e2afb3b6 | 211 | // |
81e97e0d | 212 | b[2] = (- fSolenoid)*fFactor; |
84737f5e | 213 | return; |
b6ee07d3 | 214 | } |
57754f18 | 215 | } else if (fFieldMap[1]->Inside(xm[0], xm[1], xm[2])) { |
88cb7938 | 216 | map = fFieldMap[1]; |
57754f18 | 217 | } else if (fFieldMap[2]->Inside(xm[0], xm[1], xm[2])) { |
88cb7938 | 218 | map = fFieldMap[2]; |
84737f5e | 219 | } |
220 | ||
221 | if(map){ | |
57754f18 | 222 | map->Field(xm,b); |
223 | b[0] = - b[0]; | |
224 | b[2] = - b[2]; | |
225 | ||
84737f5e | 226 | } else { |
57754f18 | 227 | //This is the ZDC part |
228 | ZDCField(x, b); | |
84737f5e | 229 | } |
57754f18 | 230 | |
231 | ||
84737f5e | 232 | if(fFactor!=1) { |
57754f18 | 233 | b[0]*=fFactor; |
234 | b[1]*=fFactor; | |
235 | b[2]*=fFactor; | |
84737f5e | 236 | } |
237 | } | |
238 | ||
e2afb3b6 | 239 | //_______________________________________________________________________ |
6c4904c2 | 240 | void AliMagFMaps::Copy(TObject & /* magf */) const |
84737f5e | 241 | { |
242 | // | |
243 | // Copy *this onto magf -- Not implemented | |
244 | // | |
594d8990 | 245 | AliFatal("Not implemented!"); |
84737f5e | 246 | } |
247 | ||
e2afb3b6 | 248 | //_______________________________________________________________________ |
ee4f31cd | 249 | void AliMagFMaps::Streamer(TBuffer &R__b) |
250 | { | |
e2afb3b6 | 251 | // Stream an object of class AliMagFMaps. |
252 | if (R__b.IsReading()) { | |
253 | AliMagFMaps::Class()->ReadBuffer(R__b, this); | |
10eca208 | 254 | ReadField(); |
e2afb3b6 | 255 | } else { |
256 | AliMagFMaps::Class()->WriteBuffer(R__b, this); | |
257 | } | |
ee4f31cd | 258 | } |