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 **************************************************************************/
21 // Author: Andreas Morsch <andreas.morsch@cern.ch>
26 #include "AliFieldMap.h"
27 #include "AliMagFMaps.h"
32 //________________________________________
33 AliMagFMaps::AliMagFMaps(const char *name, const char *title, const Int_t integ,
34 const Float_t factor, const Float_t fmax, const Int_t map)
35 : AliMagF(name,title,integ,factor,fmax)
38 // Standard constructor
46 if(fDebug>-1) printf("%s: Constant Mesh Field %s created: map= %d, factor= %f, file= %s\n",
47 ClassName(),fName.Data(), fMap, factor,fTitle.Data());
50 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B02.root");
51 file = new TFile(fname);
52 fFieldMap[0] = (AliFieldMap*) file->Get("L3B02");
56 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB02.root");
57 file = new TFile(fname);
58 fFieldMap[1] = (AliFieldMap*) file->Get("DipB02");
62 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB02.root");
63 file = new TFile(fname);
64 fFieldMap[2] = (AliFieldMap*) file->Get("ExtB02");
68 Fatal("AliMagFMaps", "Bcent = 0.2 T not yet available");
71 } else if (fMap == k4kG) {
72 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B04.root");
73 file = new TFile(fname);
74 fFieldMap[0] = (AliFieldMap*) file->Get("L3B04");
78 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB04.root");
79 file = new TFile(fname);
80 fFieldMap[1] = (AliFieldMap*) file->Get("DipB04");
84 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB04.root");
85 file = new TFile(fname);
86 fFieldMap[2] = (AliFieldMap*) file->Get("ExtB04");
90 } else if (fMap == k5kG) {
91 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/L3B05.root");
92 file = new TFile(fname);
93 fFieldMap[0] = (AliFieldMap*) file->Get("L3B05");
97 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/DipB05.root");
98 file = new TFile(fname);
99 fFieldMap[1] = (AliFieldMap*) file->Get("DipB05");
103 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/ExtB05.root");
104 file = new TFile(fname);
105 fFieldMap[2] = (AliFieldMap*) file->Get("ExtB05");
114 //________________________________________
115 AliMagFMaps::AliMagFMaps(const AliMagFMaps &magf)
123 AliMagFMaps::~AliMagFMaps()
134 Float_t AliMagFMaps::SolenoidField() const
137 // Returns max. L3 (solenoid) field strength
138 // according to field map setting
145 //________________________________________
146 void AliMagFMaps::Field(Float_t *x, Float_t *b)
149 // Method to calculate the magnetic field
151 Double_t ratx, raty, ratz, hix, hiy, hiz, ratx1, raty1, ratz1,
152 bhyhz, bhylz, blyhz, blylz, bhz, blz, xl[3];
153 const Double_t kone=1;
156 // --- find the position in the grid ---
159 AliFieldMap* map = 0;
161 if (fFieldMap[0]->Inside(x[0], x[1], x[2])) {
165 // Constant L3 field, if this option was selected
170 } else if (fFieldMap[1]->Inside(x[0], x[1], x[2])) {
172 } else if (fFieldMap[2]->Inside(x[0], x[1], x[2])) {
179 //This is the ZDC part
180 Float_t rad2=x[0]*x[0]+x[1]*x[1];
181 if(x[2]>kCORBEG2 && x[2]<kCOREND2){
186 else if(x[2]>kZ1BEG && x[2]<kZ1END){
192 else if(x[2]>kZ2BEG && x[2]<kZ2END){
198 else if(x[2]>kZ3BEG && x[2]<kZ3END){
204 else if(x[2]>kZ4BEG && x[2]<kZ4END){
210 else if(x[2]>kD1BEG && x[2]<kD1END){
215 else if(x[2]>kD2BEG && x[2]<kD2END){
216 if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
217 || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
229 //________________________________________
230 void AliMagFMaps::Copy(AliMagFMaps & /* magf */) const
233 // Copy *this onto magf -- Not implemented
235 Fatal("Copy","Not implemented!\n");
238 //________________________________________
239 AliMagFMaps & AliMagFMaps::operator =(const AliMagFMaps &magf)