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.1 2002/02/14 11:41:28 morsch
19 Magnetic field map for ALICE for L3+muon spectrometer stored in 3 seperate
25 // Author: Andreas Morsch <andreas.morsch@cern.ch>
30 #include "AliFieldMap.h"
31 #include "AliMagFMaps.h"
36 //________________________________________
37 AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ,
38 const Float_t factor, const Float_t fmax, const Int_t map)
39 : AliMagF(name,title,integ,factor,fmax)
42 // Standard constructor
50 if(fDebug>-1) printf("%s: Constant Mesh Field %s created: map= %d, factor= %f, file= %s\n",
51 ClassName(),fName.Data(), fMap, factor,fTitle.Data());
53 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
54 file = new TFile(fname);
55 fFieldMap[0] = (AliFieldMap*) file->Get("L3B02");
59 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
60 file = new TFile(fname);
61 fFieldMap[1] = (AliFieldMap*) file->Get("DipB02");
65 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
66 file = new TFile(fname);
67 fFieldMap[2] = (AliFieldMap*) file->Get("ExtB02");
72 } else if (fMap == k4kG) {
73 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
74 file = new TFile(fname);
75 fFieldMap[0] = (AliFieldMap*) file->Get("L3B04");
79 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
80 file = new TFile(fname);
81 fFieldMap[1] = (AliFieldMap*) file->Get("DipB04");
85 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
86 file = new TFile(fname);
87 fFieldMap[2] = (AliFieldMap*) file->Get("ExtB04");
91 } else if (fMap == k5kG) {
92 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
93 file = new TFile(fname);
94 fFieldMap[0] = (AliFieldMap*) file->Get("L3B05");
98 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
99 file = new TFile(fname);
100 fFieldMap[1] = (AliFieldMap*) file->Get("DipB05");
104 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
105 file = new TFile(fname);
106 fFieldMap[2] = (AliFieldMap*) file->Get("ExtB05");
115 //________________________________________
116 AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf)
124 AliMagFMaps::~AliMagFMaps()
135 Float_t AliMagFMaps::SolenoidField() const
138 // Returns max. L3 (solenoid) field strength
139 // according to field map setting
146 //________________________________________
147 void AliMagFMaps::Field(Float_t *x, Float_t *b)
150 // Method to calculate the magnetic field
152 Double_t ratx, raty, ratz, hix, hiy, hiz, ratx1, raty1, ratz1,
153 bhyhz, bhylz, blyhz, blylz, bhz, blz, xl[3];
154 const Double_t kone=1;
157 // --- find the position in the grid ---
160 AliFieldMap* map = 0;
162 if (fFieldMap[0]->Inside(x[0], x[1], x[2])) {
166 // Constant L3 field, if this option was selected
171 } else if (fFieldMap[1]->Inside(x[0], x[1], x[2])) {
173 } else if (fFieldMap[2]->Inside(x[0], x[1], x[2])) {
180 //This is the ZDC part
181 Float_t rad2=x[0]*x[0]+x[1]*x[1];
182 if(x[2]>kCORBEG2 && x[2]<kCOREND2){
187 else if(x[2]>kZ1BEG && x[2]<kZ1END){
193 else if(x[2]>kZ2BEG && x[2]<kZ2END){
199 else if(x[2]>kZ3BEG && x[2]<kZ3END){
205 else if(x[2]>kZ4BEG && x[2]<kZ4END){
211 else if(x[2]>kD1BEG && x[2]<kD1END){
216 else if(x[2]>kD2BEG && x[2]<kD2END){
217 if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
218 || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
230 //________________________________________
231 void AliMagFMaps::Copy(AliMagFMaps & /* magf */) const
234 // Copy *this onto magf -- Not implemented
236 Fatal("Copy","Not implemented!\n");
239 //________________________________________
240 AliMagFMaps & AliMagFMaps::operator =(const AliMagFMaps &magf)