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 //------------------------------------------------------------------------
28 #include "AliFieldMap.h"
29 #include "AliMagFMaps.h"
33 //_______________________________________________________________________
34 AliMagFMaps::AliMagFMaps():
41 // Default constructor
44 // Don't replicate field information in gAlice
45 fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0;
48 //_______________________________________________________________________
49 AliMagFMaps::AliMagFMaps(const char *name, const char *title, Int_t integ,
50 Float_t factor, Float_t fmax, Int_t map,
52 AliMagFC(name,title,integ,factor,fmax),
59 // Standard constructor
68 // Don't replicate field information in gAlice
69 for (Int_t i = 0; i < 3; i++) fFieldMap[i]->SetWriteEnable(0);
73 //_______________________________________________________________________
74 AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf):
86 //_______________________________________________________________________
87 AliMagFMaps::~AliMagFMaps()
97 //_______________________________________________________________________
98 void AliMagFMaps::ReadField()
100 // Read Field Map from file
104 if (fFieldRead) return;
109 printf("Reading map for %d\n", fMap);
113 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
114 file = new TFile(fname);
115 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B02"));
118 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
119 file = new TFile(fname);
120 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB02"));
124 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
125 file = new TFile(fname);
126 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB02"));
129 } 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"));
136 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
137 file = new TFile(fname);
138 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04"));
142 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
143 file = new TFile(fname);
144 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04"));
147 } else if (fMap == k5kG) {
149 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
150 file = new TFile(fname);
151 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B05"));
154 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
155 file = new TFile(fname);
156 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05"));
160 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
161 file = new TFile(fname);
162 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05"));
167 if (!fL3Option) fSolenoidUser = fSolenoid;
171 //_______________________________________________________________________
172 Float_t AliMagFMaps::SolenoidField() const
175 // Returns max. L3 (solenoid) field strength
176 // according to field map setting
181 //_______________________________________________________________________
182 void AliMagFMaps::Field(Float_t *x, Float_t *b) const
185 // Method to calculate the magnetic field
187 // --- find the position in the grid ---
191 // if (!fFieldRead) ReadField();
194 // Field Maps have been calculated for the coordinate system in which
195 // the Muon Spectrometer is placed at z > 0
196 // Transform coordinates corresponingly
205 AliFieldMap* map = 0;
206 if (fFieldMap[0]->Inside(xm[0], xm[1], xm[2])) {
208 Float_t r = TMath::Sqrt(xm[0] * xm[0] + xm[1] * xm[1]);
210 if (!fL3Option && TMath::Abs(xm[2]) < 370. && r < 550.) {
212 // Constant L3 field , if this option was selected
217 } else if (fFieldMap[1]->Inside(xm[0], xm[1], xm[2])) {
219 } else if (fFieldMap[2]->Inside(xm[0], xm[1], xm[2])) {
229 //This is the ZDC part
241 //_______________________________________________________________________
242 void AliMagFMaps::Copy(TObject & /* magf */) const
245 // Copy *this onto magf -- Not implemented
247 Fatal("Copy","Not implemented!\n");
250 //_______________________________________________________________________
251 void AliMagFMaps::Streamer(TBuffer &R__b)
253 // Stream an object of class AliMagFMaps.
254 if (R__b.IsReading()) {
255 AliMagFMaps::Class()->ReadBuffer(R__b, this);
259 AliMagFMaps::Class()->WriteBuffer(R__b, this);