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 **************************************************************************/
19 // Author: Andreas Morsch <andreas.morsch@cern.ch>
26 #include "AliFieldMap.h"
27 #include "AliMagFMaps.h"
32 //_______________________________________________________________________
33 AliMagFMaps::AliMagFMaps():
39 // Default constructor
41 fFieldMap[0] = fFieldMap[1] = fFieldMap[2] = 0;
44 //_______________________________________________________________________
45 AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ,
46 const Float_t factor, const Float_t fmax, const Int_t map,
48 AliMagF(name,title,integ,factor,fmax),
54 // Standard constructor
64 // Don't replicate field information in gAlice
65 for (Int_t i = 0; i < 3; i++) fFieldMap[i]->SetWriteEnable(0);
69 //_______________________________________________________________________
70 AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf):
82 //_______________________________________________________________________
83 AliMagFMaps::~AliMagFMaps()
93 //_______________________________________________________________________
94 void AliMagFMaps::ReadField()
96 // Read Field Map from file
100 if (fFieldRead) return;
107 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
108 file = new TFile(fname);
109 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B02"));
113 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
114 file = new TFile(fname);
115 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB02"));
119 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
120 file = new TFile(fname);
121 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB02"));
125 } else if (fMap == k4kG) {
127 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
128 file = new TFile(fname);
129 fFieldMap[0] = dynamic_cast<AliFieldMap*>(file->Get("L3B04"));
134 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
135 file = new TFile(fname);
136 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB04"));
140 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
141 file = new TFile(fname);
142 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"));
155 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
156 file = new TFile(fname);
157 fFieldMap[1] = dynamic_cast<AliFieldMap*>(file->Get("DipB05"));
161 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
162 file = new TFile(fname);
163 fFieldMap[2] = dynamic_cast<AliFieldMap*>(file->Get("ExtB05"));
173 fFieldMap[0] = new AliFieldMap();
174 fFieldMap[0] -> SetLimits(-800., 800., -800., 800., -700., 700.);
178 //_______________________________________________________________________
179 Float_t AliMagFMaps::SolenoidField() const
182 // Returns max. L3 (solenoid) field strength
183 // according to field map setting
188 //_______________________________________________________________________
189 void AliMagFMaps::Field(Float_t *x, Float_t *b)
192 // Method to calculate the magnetic field
194 // --- find the position in the grid ---
196 if (!fFieldRead) ReadField();
199 AliFieldMap* map = 0;
200 if (fFieldMap[0]->Inside(x[0], x[1], x[2])) {
204 // Constant L3 field, if this option was selected
209 } else if (fFieldMap[1]->Inside(x[0], x[1], x[2])) {
211 } else if (fFieldMap[2]->Inside(x[0], x[1], x[2])) {
218 //This is the ZDC part
219 Float_t rad2=x[0]*x[0]+x[1]*x[1];
220 if(x[2]>kCORBEG2 && x[2]<kCOREND2){
225 else if(x[2]>kZ1BEG && x[2]<kZ1END){
231 else if(x[2]>kZ2BEG && x[2]<kZ2END){
237 else if(x[2]>kZ3BEG && x[2]<kZ3END){
243 else if(x[2]>kZ4BEG && x[2]<kZ4END){
249 else if(x[2]>kD1BEG && x[2]<kD1END){
254 else if(x[2]>kD2BEG && x[2]<kD2END){
255 if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
256 || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
268 //_______________________________________________________________________
269 void AliMagFMaps::Copy(AliMagFMaps & /* magf */) const
272 // Copy *this onto magf -- Not implemented
274 Fatal("Copy","Not implemented!\n");
277 //_______________________________________________________________________
278 void AliMagFMaps::Streamer(TBuffer &R__b)
280 // Stream an object of class AliMagFMaps.
281 if (R__b.IsReading()) {
282 AliMagFMaps::Class()->ReadBuffer(R__b, this);
285 AliMagFMaps::Class()->WriteBuffer(R__b, this);