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