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 //------------------------------------------------------------------------
30 #include "AliFieldMap.h"
31 #include "AliMagFMaps.h"
36 //_______________________________________________________________________
37 AliMagFMaps::AliMagFMaps():
43 // Default constructor
46 // Don't replicate field information in gAlice
47 fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0;
50 //_______________________________________________________________________
51 AliMagFMaps::AliMagFMaps(const char *name, const char *title, Int_t integ,
52 Float_t factor, Float_t fmax, Int_t map,
54 AliMagFC(name,title,integ,factor,fmax),
60 // 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()
98 //_______________________________________________________________________
99 void AliMagFMaps::ReadField()
101 // Read Field Map from file
105 if (!fgReadField) return;
112 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
113 file = new TFile(fname);
114 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) {
130 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
131 file = new TFile(fname);
132 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B04"));
135 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
136 file = new TFile(fname);
137 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04"));
141 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
142 file = new TFile(fname);
143 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04"));
146 } else if (fMap == k5kG) {
148 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
149 file = new TFile(fname);
150 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B05"));
153 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
154 file = new TFile(fname);
155 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05"));
159 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
160 file = new TFile(fname);
161 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05"));
166 if (!fL3Option) fSolenoidUser = fSolenoid;
170 //_______________________________________________________________________
171 Float_t AliMagFMaps::SolenoidField() const
174 // Returns max. L3 (solenoid) field strength
175 // according to field map setting
177 return -Factor()*fSolenoid;
180 //_______________________________________________________________________
181 void AliMagFMaps::Field(Float_t *x, Float_t *b) const
184 // Method to calculate the magnetic field
186 // --- find the position in the grid ---
190 // if (!fFieldRead) ReadField();
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
204 AliFieldMap* map = 0;
205 if (fFieldMap[0]->Inside(xm[0], xm[1], xm[2])) {
207 Float_t r = TMath::Sqrt(xm[0] * xm[0] + xm[1] * xm[1]);
209 if (!fL3Option && TMath::Abs(xm[2]) < 370. && r < 550.) {
211 // Constant L3 field , if this option was selected
213 b[2] = (- fSolenoid)*fFactor;
216 } else if (fFieldMap[1]->Inside(xm[0], xm[1], xm[2])) {
218 } else if (fFieldMap[2]->Inside(xm[0], xm[1], xm[2])) {
228 //This is the ZDC part
240 //_______________________________________________________________________
241 void AliMagFMaps::Copy(TObject & /* magf */) const
244 // Copy *this onto magf -- Not implemented
246 AliFatal("Not implemented!");
249 //_______________________________________________________________________
250 void AliMagFMaps::Streamer(TBuffer &R__b)
252 // Stream an object of class AliMagFMaps.
253 if (R__b.IsReading()) {
254 AliMagFMaps::Class()->ReadBuffer(R__b, this);
257 AliMagFMaps::Class()->WriteBuffer(R__b, this);