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 //------------------------------------------------------------------------
29 #include "AliFieldMap.h"
30 #include "AliMagFMaps.h"
34 //_______________________________________________________________________
35 AliMagFMaps::AliMagFMaps():
42 // Default constructor
44 fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0;
47 //_______________________________________________________________________
48 AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ,
49 const Float_t factor, const Float_t fmax, const Int_t map,
51 AliMagFC(name,title,integ,factor,fmax),
58 // Standard constructor
67 // Don't replicate field information in gAlice
68 for (Int_t i = 0; i < 3; i++) fFieldMap[i]->SetWriteEnable(0);
72 //_______________________________________________________________________
73 AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf):
85 //_______________________________________________________________________
86 AliMagFMaps::~AliMagFMaps()
96 //_______________________________________________________________________
97 void AliMagFMaps::ReadField()
99 // Read Field Map from file
103 if (fFieldRead) return;
111 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
112 file = new TFile(fname);
113 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B02"));
117 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
118 file = new TFile(fname);
119 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB02"));
123 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
124 file = new TFile(fname);
125 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB02"));
128 } else if (fMap == k4kG) {
131 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
132 file = new TFile(fname);
133 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B04"));
138 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
139 file = new TFile(fname);
140 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04"));
144 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
145 file = new TFile(fname);
146 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04"));
149 } else if (fMap == k5kG) {
152 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
153 file = new TFile(fname);
154 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B05"));
159 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
160 file = new TFile(fname);
161 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05"));
165 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
166 file = new TFile(fname);
167 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05"));
176 fFieldMap[0] = new AliFieldMap();
177 fFieldMap[0] -> SetLimits(-800., 800., -800., 800., -700., 700.);
189 fSolenoidUser = fSolenoid;
193 //_______________________________________________________________________
194 Float_t AliMagFMaps::SolenoidField() const
197 // Returns max. L3 (solenoid) field strength
198 // according to field map setting
203 //_______________________________________________________________________
204 void AliMagFMaps::Field(Float_t *x, Float_t *b)
207 // Method to calculate the magnetic field
209 // --- find the position in the grid ---
213 if (!fFieldRead) ReadField();
216 // Field Maps have been calculated for the coordinate system in which
217 // the Muon Spectrometer is placed at z > 0
218 // Transform coordinates corresponingly
227 AliFieldMap* map = 0;
228 if (fFieldMap[0]->Inside(xm[0], xm[1], xm[2])) {
232 // Constant L3 field, if this option was selected
234 b[2] = fSolenoidUser;
237 } else if (fFieldMap[1]->Inside(xm[0], xm[1], xm[2])) {
239 } else if (fFieldMap[2]->Inside(xm[0], xm[1], xm[2])) {
249 //This is the ZDC part
261 //_______________________________________________________________________
262 void AliMagFMaps::Copy(AliMagFMaps & /* magf */) const
265 // Copy *this onto magf -- Not implemented
267 Fatal("Copy","Not implemented!\n");
270 //_______________________________________________________________________
271 void AliMagFMaps::Streamer(TBuffer &R__b)
273 // Stream an object of class AliMagFMaps.
274 if (R__b.IsReading()) {
275 AliMagFMaps::Class()->ReadBuffer(R__b, this);
278 AliMagFMaps::Class()->WriteBuffer(R__b, this);