]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMagFMapsV1.cxx
Using the global QA by default
[u/mrichter/AliRoot.git] / STEER / AliMagFMapsV1.cxx
CommitLineData
f9e85e5d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18//------------------------------------------------------------------------
19// Magnetic field composed by 4 maps: the L3 magnet (inside and outside measured region),
20// extended region, and dipole magnet.
21// Used in the configuration macros (macros/Config.C, etc.)
22// Author: Andreas Morsch <andreas.morsch@cern.ch>
23//------------------------------------------------------------------------
24
25#include <TClass.h>
26#include <TFile.h>
27#include <TMath.h>
28#include <TSystem.h>
29
30#include "AliLog.h"
31#include "AliFieldMap.h"
32#include "AliMagFMapsV1.h"
33#include "AliMagFCheb.h"
34
35ClassImp(AliMagFMapsV1)
36
37
38//_______________________________________________________________________
39AliMagFMapsV1::AliMagFMapsV1():
0cd61c1d 40 AliMagFMaps(),
41 fMeasuredMap(0)
f9e85e5d 42{
43 //
44 // Default constructor
45 //
46}
47
48//_______________________________________________________________________
49AliMagFMapsV1::AliMagFMapsV1(const char *name, const char *title, Int_t integ,
50 Float_t factor, Float_t fmax, Int_t map,
51 Int_t l3):
52 AliMagFMaps(name, title, integ, factor, fmax, map, l3),
53 fMeasuredMap(0)
54{
55 //
56 // Constructor
57 //
58 char* fname;
59 fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/mfcheb.root");
60 TFile* file = new TFile(fname);
61 if (fMap == k2kG) {
62 fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get("Sol12_Dip6_Hole"));
63 fSolenoid = 0.2; // T
64 } else if (fMap == k5kG) {
65 fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get("Sol30_Dip6_Hole"));
66 fSolenoid = 0.5; // T
67 } else if (fMap == k4kG){
68 fMeasuredMap = 0;
69 fSolenoid = 0.4; // T
70 }
71
72
73
74 file->Close();
75 delete file;
76}
77
78//_______________________________________________________________________
79AliMagFMapsV1::~AliMagFMapsV1()
80{
81 // Destructor
82 delete fMeasuredMap;
83}
84
85//_______________________________________________________________________
86void AliMagFMapsV1::Field(Float_t *x, Float_t *b) const
87{
88 //
89 // Method to calculate the magnetic field at position x
90 //
91 const Float_t kRmax2 = 500. * 500.;
92 const Float_t kZmax = 550.;
93 const Float_t kTeslaTokG = 10.;
7207d832 94 const Float_t kScale = 0.98838; // matching factor
f9e85e5d 95
96 // Check if position inside measured map
97 Float_t r2 = x[0] * x[0] + x[1] * x[1];
98 if (fMeasuredMap &&
99 r2 < kRmax2 &&
100 TMath::Abs(x[2]) < kZmax
101 )
102 {
103 fMeasuredMap->Field(x, b);
104 b[0] *= kTeslaTokG;
105 b[1] *= kTeslaTokG;
106 b[2] *= kTeslaTokG;
107 } else {
108 AliMagFMaps::Field(x, b);
7207d832 109 // Match to measure map
110 b[0] = - b[0] * kScale;
111 b[2] = - b[2] * kScale;
9f806b7f 112 b[1] = - b[1] * kScale;
f9e85e5d 113 }
114}
115
116
117Float_t AliMagFMapsV1::SolenoidField() const
118{
119 //
120 // Returns max. L3 (solenoid) field strength
121 // according to field map setting
122 //
123 return fSolenoid;
124}
125