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"
35 //_______________________________________________________________________
36 AliMagFMaps::AliMagFMaps():
43 // Default constructor
45 fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0;
48 //_______________________________________________________________________
49 AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ,
50 const Float_t factor, const Float_t fmax, const Int_t map,
52 AliMagF(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;
112 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
113 file = new TFile(fname);
114 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"));
130 } else if (fMap == k4kG) {
133 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
134 file = new TFile(fname);
135 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"));
146 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
147 file = new TFile(fname);
148 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04"));
151 } else if (fMap == k5kG) {
154 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
155 file = new TFile(fname);
156 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"));
178 fFieldMap[0] = new AliFieldMap();
179 fFieldMap[0] -> SetLimits(-800., 800., -800., 800., -700., 700.);
191 fSolenoidUser = fSolenoid;
195 //_______________________________________________________________________
196 Float_t AliMagFMaps::SolenoidField() const
199 // Returns max. L3 (solenoid) field strength
200 // according to field map setting
205 //_______________________________________________________________________
206 void AliMagFMaps::Field(Float_t *x, Float_t *b)
209 // Method to calculate the magnetic field
211 // --- find the position in the grid ---
213 if (!fFieldRead) ReadField();
216 AliFieldMap* map = 0;
217 if (fFieldMap[0]->Inside(x[0], x[1], x[2])) {
221 // Constant L3 field, if this option was selected
223 b[2] = fSolenoidUser;
226 } else if (fFieldMap[1]->Inside(x[0], x[1], x[2])) {
228 } else if (fFieldMap[2]->Inside(x[0], x[1], x[2])) {
235 //This is the ZDC part
236 Float_t rad2=x[0]*x[0]+x[1]*x[1];
237 if(x[2]>kCORBEG2 && x[2]<kCOREND2){
241 } else if(x[2]>kZ1BEG && x[2]<kZ1END){
246 } else if(x[2]>kZ2BEG && x[2]<kZ2END){
252 else if(x[2]>kZ3BEG && x[2]<kZ3END){
258 else if(x[2]>kZ4BEG && x[2]<kZ4END){
264 else if(x[2]>kD1BEG && x[2]<kD1END){
269 else if(x[2]>kD2BEG && x[2]<kD2END){
270 if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
271 || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
283 //_______________________________________________________________________
284 void AliMagFMaps::Copy(AliMagFMaps & /* magf */) const
287 // Copy *this onto magf -- Not implemented
289 Fatal("Copy","Not implemented!\n");
292 //_______________________________________________________________________
293 void AliMagFMaps::Streamer(TBuffer &R__b)
295 // Stream an object of class AliMagFMaps.
296 if (R__b.IsReading()) {
297 AliMagFMaps::Class()->ReadBuffer(R__b, this);
300 AliMagFMaps::Class()->WriteBuffer(R__b, this);