]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliMagFMapsV1.cxx
The data members fEMCALClusterCluster and fPHOSCluster are removed from AliESDCaloClu...
[u/mrichter/AliRoot.git] / STEER / AliMagFMapsV1.cxx
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
35 ClassImp(AliMagFMapsV1)
36     
37
38 //_______________________________________________________________________
39 AliMagFMapsV1::AliMagFMapsV1():
40     AliMagFMaps()
41 {
42   //
43   // Default constructor
44   //
45 }
46
47 //_______________________________________________________________________
48 AliMagFMapsV1::AliMagFMapsV1(const char *name, const char *title, Int_t integ, 
49                              Float_t factor, Float_t fmax, Int_t map, 
50                              Int_t l3):
51     AliMagFMaps(name, title, integ, factor, fmax, map, l3),
52     fMeasuredMap(0) 
53 {
54     //
55     // Constructor
56     //
57     char* fname;
58     fname = gSystem->ExpandPathName("$(ALICE_ROOT)/data/maps/mfcheb.root");
59     TFile* file = new TFile(fname);
60     if (fMap == k2kG) {
61         fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get("Sol12_Dip6_Hole"));
62         fSolenoid = 0.2; // T
63     } else if (fMap == k5kG) {
64         fMeasuredMap = dynamic_cast<AliMagFCheb*>(file->Get("Sol30_Dip6_Hole"));
65         fSolenoid = 0.5; // T
66     } else if (fMap == k4kG){
67         fMeasuredMap = 0;
68         fSolenoid = 0.4; // T
69     }
70     
71     
72     
73     file->Close();
74     delete file;
75 }
76
77 //_______________________________________________________________________
78 AliMagFMapsV1::~AliMagFMapsV1()
79 {
80     // Destructor
81     delete fMeasuredMap;
82 }
83
84 //_______________________________________________________________________
85 void AliMagFMapsV1::Field(Float_t *x, Float_t *b) const
86 {
87   //
88   // Method to calculate the magnetic field at position x
89   //
90     const Float_t kRmax2 = 500. * 500.;
91     const Float_t kZmax  = 550.; 
92     const Float_t kTeslaTokG = 10.;
93     const Float_t kScale = 0.98838; // matching factor
94     
95     // Check if position inside measured map
96     Float_t r2 = x[0] * x[0] + x[1] * x[1];
97     if (fMeasuredMap              &&
98         r2 < kRmax2               && 
99         TMath::Abs(x[2]) < kZmax
100         ) 
101     {
102         fMeasuredMap->Field(x, b);
103         b[0] *= kTeslaTokG;
104         b[1] *= kTeslaTokG;
105         b[2] *= kTeslaTokG;
106     } else {
107         AliMagFMaps::Field(x, b);
108         // Match to measure map
109         b[0] = - b[0] * kScale;
110         b[2] = - b[2] * kScale;
111         b[1] = - b[1] * kScale;
112     }
113 }
114
115
116 Float_t AliMagFMapsV1::SolenoidField() const
117 {
118   //
119   // Returns max. L3 (solenoid) field strength 
120   // according to field map setting 
121   //
122         return fSolenoid;
123 }
124