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 Revision 1.8 2002/10/14 14:57:32 hristov
19 Merging the VirtualMC branch to the main development branch (HEAD)
21 Revision 1.5.6.2 2002/08/01 15:35:30 alibrary
24 Revision 1.7 2002/08/01 12:34:48 morsch
25 Initialize maps in first call to Field() after streaming in.
27 Revision 1.6 2002/04/11 11:17:48 morsch
28 ReadField() used in Constructor.
30 Revision 1.5 2002/02/26 09:48:14 morsch
31 Extra argument in constructor for l3 map choice.
33 Revision 1.4 2002/02/22 14:00:20 morsch
34 Protection against replication of fieldmap data in gAlice.
36 Revision 1.3 2002/02/21 09:23:41 morsch
37 Create dummy field map for L3 in case no detailed map is needed.
39 Revision 1.2 2002/02/19 16:14:35 morsch
40 Reading of 0.2 T solenoid field map enabled.
42 Revision 1.1 2002/02/14 11:41:28 morsch
43 Magnetic field map for ALICE for L3+muon spectrometer stored in 3 seperate
49 // Author: Andreas Morsch <andreas.morsch@cern.ch>
55 #include "AliFieldMap.h"
56 #include "AliMagFMaps.h"
61 //_______________________________________________________________________
62 AliMagFMaps::AliMagFMaps():
68 // Default constructor
70 fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0;
73 //_______________________________________________________________________
74 AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ,
75 const Float_t factor, const Float_t fmax, const Int_t map,
77 AliMagF(name,title,integ,factor,fmax),
83 // Standard constructor
93 // Don't replicate field information in gAlice
94 for (Int_t i = 0; i < 3; i++) fFieldMap[i]->SetWriteEnable(0);
98 //_______________________________________________________________________
99 AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf):
111 //_______________________________________________________________________
112 AliMagFMaps::~AliMagFMaps()
122 //_______________________________________________________________________
123 void AliMagFMaps::ReadField()
125 // Read Field Map from file
129 if (fFieldRead) return;
136 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
137 file = new TFile(fname);
138 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B02"));
142 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
143 file = new TFile(fname);
144 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB02"));
148 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
149 file = new TFile(fname);
150 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB02"));
154 } else if (fMap == k4kG) {
156 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
157 file = new TFile(fname);
158 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B04"));
163 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
164 file = new TFile(fname);
165 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04"));
169 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
170 file = new TFile(fname);
171 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB04"));
175 } else if (fMap == k5kG) {
177 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
178 file = new TFile(fname);
179 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B05"));
184 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
185 file = new TFile(fname);
186 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05"));
190 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
191 file = new TFile(fname);
192 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05"));
202 fFieldMap[0] = new AliFieldMap();
203 fFieldMap[0] -> SetLimits(-800., 800., -800., 800., -700., 700.);
207 //_______________________________________________________________________
208 Float_t AliMagFMaps::SolenoidField() const
211 // Returns max. L3 (solenoid) field strength
212 // according to field map setting
217 //_______________________________________________________________________
218 void AliMagFMaps::Field(Float_t *x, Float_t *b)
221 // Method to calculate the magnetic field
223 // --- find the position in the grid ---
225 if (!fFieldRead) ReadField();
228 AliFieldMap* map = 0;
229 if (fFieldMap[0]->Inside(x[0], x[1], x[2])) {
233 // Constant L3 field, if this option was selected
238 } else if (fFieldMap[1]->Inside(x[0], x[1], x[2])) {
240 } else if (fFieldMap[2]->Inside(x[0], x[1], x[2])) {
247 //This is the ZDC part
248 Float_t rad2=x[0]*x[0]+x[1]*x[1];
249 if(x[2]>kCORBEG2 && x[2]<kCOREND2){
254 else if(x[2]>kZ1BEG && x[2]<kZ1END){
260 else if(x[2]>kZ2BEG && x[2]<kZ2END){
266 else if(x[2]>kZ3BEG && x[2]<kZ3END){
272 else if(x[2]>kZ4BEG && x[2]<kZ4END){
278 else if(x[2]>kD1BEG && x[2]<kD1END){
283 else if(x[2]>kD2BEG && x[2]<kD2END){
284 if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
285 || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
297 //_______________________________________________________________________
298 void AliMagFMaps::Copy(AliMagFMaps & /* magf */) const
301 // Copy *this onto magf -- Not implemented
303 Fatal("Copy","Not implemented!\n");
306 //_______________________________________________________________________
307 void AliMagFMaps::Streamer(TBuffer &R__b)
309 // Stream an object of class AliMagFMaps.
310 if (R__b.IsReading()) {
311 AliMagFMaps::Class()->ReadBuffer(R__b, this);
314 AliMagFMaps::Class()->WriteBuffer(R__b, this);