1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //------------------------------------------------------------------------
19 // Magnetic field composed by 3 maps: the L3 magnet, extended region, and
21 // Used in the configuration macros (macros/Config.C, etc.)
22 // Author: Andreas Morsch <andreas.morsch@cern.ch>
23 //------------------------------------------------------------------------
31 #include "AliFieldMap.h"
32 #include "AliMagFMaps.h"
37 //_______________________________________________________________________
38 AliMagFMaps::AliMagFMaps():
44 // Default constructor
47 // Don't replicate field information in gAlice
48 fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0;
51 //_______________________________________________________________________
52 AliMagFMaps::AliMagFMaps(const char *name, const char *title, Int_t integ,
53 Float_t factor, Float_t fmax, Int_t map,
55 AliMagFC(name,title,integ,factor,fmax),
61 // Standard constructor
69 // Don't replicate field information in gAlice
70 for (Int_t i = 0; i < 3; i++) fFieldMap[i]->SetWriteEnable(0);
74 //_______________________________________________________________________
75 AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf):
87 //_______________________________________________________________________
88 AliMagFMaps::~AliMagFMaps()
98 //_______________________________________________________________________
99 void AliMagFMaps::ReadField()
101 // Read Field Map from file
105 if (!fReadField) return;
114 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
115 file = new TFile(fname);
116 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B02"));
119 delete [] fname; // see documentation to expand filenam
120 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
121 file = new TFile(fname);
122 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB02"));
126 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
127 file = new TFile(fname);
128 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB02"));
132 } else if (fMap == k4kG) {
134 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
135 file = new TFile(fname);
136 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B04"));
140 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
141 file = new TFile(fname);
142 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04"));
147 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
148 file = new TFile(fname);
149 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04"));
153 } else if (fMap == k5kG) {
155 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
156 file = new TFile(fname);
157 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B05"));
161 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
162 file = new TFile(fname);
163 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05"));
167 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
168 file = new TFile(fname);
169 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05"));
175 if (!fL3Option) fSolenoidUser = fSolenoid;
179 //_______________________________________________________________________
180 Float_t AliMagFMaps::SolenoidField() const
183 // Returns max. L3 (solenoid) field strength
184 // according to field map setting
186 return -Factor()*fSolenoid;
189 //_______________________________________________________________________
190 void AliMagFMaps::Field(Float_t *x, Float_t *b) const
193 // Method to calculate the magnetic field
195 // --- find the position in the grid ---
199 // if (!fFieldRead) ReadField();
202 // Field Maps have been calculated for the coordinate system in which
203 // the Muon Spectrometer is placed at z > 0
204 // Transform coordinates corresponingly
213 AliFieldMap* map = 0;
214 if (fFieldMap[0]->Inside(xm[0], xm[1], xm[2])) {
216 Float_t r = TMath::Sqrt(xm[0] * xm[0] + xm[1] * xm[1]);
218 if (!fL3Option && TMath::Abs(xm[2]) < 370. && r < 550.) {
220 // Constant L3 field , if this option was selected
222 b[2] = (- fSolenoid)*fFactor;
225 } else if (fFieldMap[1]->Inside(xm[0], xm[1], xm[2])) {
227 } else if (fFieldMap[2]->Inside(xm[0], xm[1], xm[2])) {
237 //This is the ZDC part
249 //_______________________________________________________________________
250 void AliMagFMaps::Copy(TObject & /* magf */) const
253 // Copy *this onto magf -- Not implemented
255 AliFatal("Not implemented!");
258 //_______________________________________________________________________
259 void AliMagFMaps::Streamer(TBuffer &R__b)
261 // Stream an object of class AliMagFMaps.
262 if (R__b.IsReading()) {
263 R__b.ReadClassBuffer(AliMagFMaps::Class(), this);
268 R__b.WriteClassBuffer(AliMagFMaps::Class(), this);