]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMagFC.cxx
Removing an obsolete grp field
[u/mrichter/AliRoot.git] / STEER / AliMagFC.cxx
CommitLineData
aee8290b 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
acd84897 16/* $Id$ */
d8408e76 17
116cbefd 18//-------------------------------------------------------------------------
116cbefd 19// Constant magnetic field class
5d8718b8 20// Used by AliRun class
21// Author:
116cbefd 22//-------------------------------------------------------------------------
23
fb17acd4 24#include <stdlib.h>
aee8290b 25
594d8990 26#include "AliLog.h"
aee8290b 27#include "AliMagFC.h"
28
29ClassImp(AliMagFC)
30
60378f15 31//________________________________________
32AliMagFC::AliMagFC()
33 :AliMagF(),
34 fCompensator(kFALSE),
35 fBeamType(kBeamTypepp),
36 fBeamEnergy(0),
37 fQuadGradient(0),
38 fDipoleField(0),
39 fCCorrField(0),
40 fACorr1Field(0),
41 fACorr2Field(0)
42{
43 //
44 // Default constructor
45 //
46}
47
aee8290b 48//________________________________________
d0f1ee3b 49AliMagFC::AliMagFC(const char *name, const char *title, Int_t integ,
50 Float_t factor, Float_t fmax)
c28c3a0b 51 : AliMagF(name,title,integ,factor,fmax),
60378f15 52 fCompensator(kFALSE),
53 fBeamType(kBeamTypepp),
54 fBeamEnergy(7000.),
55 fQuadGradient(0),
56 fDipoleField(0),
57 fCCorrField(0),
58 fACorr1Field(0),
59 fACorr2Field(0)
60
aee8290b 61{
62 //
63 // Standard constructor
64 //
aee8290b 65 fType = kConst;
d8408e76 66 fMap = 1;
60378f15 67
68 //////////////////////////////////////////////////////////////////////
69 // ---- Magnetic field values (according to beam type and energy) ----
70 // p-p @ 5+5 TeV
71 if(fBeamType==kBeamTypepp && fBeamEnergy==5000.){
72 fQuadGradient = 15.7145;
73 fDipoleField = 27.0558;
74 // SIDE C
75 fCCorrField = 9.7017;
76 // SIDE A
77 fACorr1Field = -13.2143;
78 fACorr2Field = -11.9909;
79 }
80 // Pb-Pb @ 2.7+2.7 TeV or p-p @ 7+7 TeV
81 else{
82 fQuadGradient = 22.0002;
83 fDipoleField = 37.8781;
84 // SIDE C
85 fCCorrField = 9.6908;
86 // SIDE A
87 fACorr1Field = -13.2014;
88 fACorr2Field = -9.6908;
89 }
aee8290b 90}
91
92//________________________________________
6f3038e9 93void AliMagFC::Field(Float_t *x, Float_t *b) const
aee8290b 94{
95 //
96 // Method to return the field in a point
97 //
98 b[0]=b[1]=b[2]=0;
99 if(fMap==1) {
100 if(TMath::Abs(x[2])<700 && x[0]*x[0]+(x[1]+30)*(x[1]+30) < 560*560) {
101 b[2]=2;
60378f15 102 }
103 else {
104 if(-725 >= x[2] && x[2] >= -1225 ){
575c700d 105 Float_t dz = TMath::Abs(-975-x[2])*0.01;
106 b[0] = - (1-0.1*dz*dz)*7;
aee8290b 107 }
108 else {
575c700d 109 ZDCField(x, b);
d95ea23f 110 }
111 }
575c700d 112 if(fFactor!=1) {
113 b[0]*=fFactor;
114 b[1]*=fFactor;
115 b[2]*=fFactor;
d95ea23f 116 }
60378f15 117 }
118 else {
594d8990 119 AliFatal(Form("Invalid field map for constant field %d",fMap));
575c700d 120 }
121}
122
60378f15 123//___________________________________________________
6f3038e9 124void AliMagFC::ZDCField(Float_t *x, Float_t *b) const
575c700d 125{
60378f15 126 // ---- This is the ZDC part
127
128 Float_t rad2 = x[0] * x[0] + x[1] * x[1];
129
130 // SIDE C **************************************************
131 if(x[2]<0.){
132 if(x[2] < kCCorrBegin && x[2] > kCCorrEnd && rad2 < kCCorrSqRadius){
133 b[0] = fCCorrField;
c28c3a0b 134 b[1] = 0.;
135 b[2] = 0.;
c28c3a0b 136 }
60378f15 137 else if(x[2] < kCQ1Begin && x[2] > kCQ1End && rad2 < kCQ1SqRadius){
138 b[0] = fQuadGradient*x[1];
139 b[1] = fQuadGradient*x[0];
140 b[2] = 0.;
d95ea23f 141 }
60378f15 142 else if(x[2] < kCQ2Begin && x[2] > kCQ2End && rad2 < kCQ2SqRadius){
143 b[0] = -fQuadGradient*x[1];
144 b[1] = -fQuadGradient*x[0];
145 b[2] = 0.;
d95ea23f 146 }
60378f15 147 else if(x[2] < kCQ3Begin && x[2] > kCQ3End && rad2 < kCQ3SqRadius){
148 b[0] = -fQuadGradient*x[1];
149 b[1] = -fQuadGradient*x[0];
150 b[2] = 0.;
d95ea23f 151 }
60378f15 152 else if(x[2] < kCQ4Begin && x[2] > kCQ4End && rad2 < kCQ4SqRadius){
153 b[0] = fQuadGradient*x[1];
154 b[1] = fQuadGradient*x[0];
155 b[2] = 0.;
d95ea23f 156 }
60378f15 157 else if(x[2] < kCD1Begin && x[2] > kCD1End && rad2 < kCD1SqRadius){
158 b[1] = fDipoleField;
159 b[2] = 0.;
160 b[2] = 0.;
d95ea23f 161 }
60378f15 162 else if(x[2] < kCD2Begin && x[2] > kCD2End){
163 if(((x[0]-kCD2XCentre1)*(x[0]-kCD2XCentre1)+(x[1]*x[1]))<kCD2SqRadius
164 || ((x[0]-kCD2XCentre2)*(x[0]-kCD2XCentre2)+(x[1]*x[1]))<kCD2SqRadius){
165 b[1] = -fDipoleField;
166 b[2] = 0.;
167 b[2] = 0.;
575c700d 168 }
aee8290b 169 }
60378f15 170 }
171
172 // SIDE A **************************************************
173 else{
174 if(fCompensator && (x[2] > kACorr1Begin && x[2] < kACorr1End) && rad2 < kCCorr1SqRadius) {
175 // Compensator magnet at z = 1075 m
176 b[0] = fACorr1Field;
177 b[1] = 0.;
178 b[2] = 0.;
179 return;
aee8290b 180 }
575c700d 181
60378f15 182 if(x[2] > kACorr2Begin && x[2] < kACorr2End && rad2 < kCCorr2SqRadius){
183 b[0] = fACorr2Field;
184 b[1] = 0.;
185 b[2] = 0.;
5ba7c883 186 }
60378f15 187 else if(x[2] > kAQ1Begin && x[2] < kAQ1End && rad2 < kAQ1SqRadius){
5ba7c883 188 // First quadrupole of inner triplet de-focussing in x-direction
60378f15 189 b[0] = -fQuadGradient*x[1];
190 b[1] = -fQuadGradient*x[0];
191 b[2] = 0.;
5ba7c883 192 }
60378f15 193 else if(x[2] > kAQ2Begin && x[2] < kAQ2End && rad2 < kAQ2SqRadius){
194 b[0] = fQuadGradient*x[1];
195 b[1] = fQuadGradient*x[0];
196 b[2] = 0.;
5ba7c883 197 }
60378f15 198 else if(x[2] > kAQ3Begin && x[2] < kAQ3End && rad2 < kAQ3SqRadius){
199 b[0] = fQuadGradient*x[1];
200 b[1] = fQuadGradient*x[0];
201 b[2] = 0.;
5ba7c883 202 }
60378f15 203 else if(x[2] > kAQ4Begin && x[2] < kAQ4End && rad2 < kAQ4SqRadius){
204 b[0] = -fQuadGradient*x[1];
205 b[1] = -fQuadGradient*x[0];
206 b[2] = 0.;
5ba7c883 207 }
60378f15 208 else if(x[2] > kAD1Begin && x[2] < kAD1End && rad2 < kAD1SqRadius){
209 b[0] = 0.;
210 b[1] = -fDipoleField;
211 b[2] = 0.;
5ba7c883 212 }
60378f15 213 else if(x[2] > kAD2Begin && x[2] < kAD2End){
214 if(((x[0]-kAD2XCentre1)*(x[0]-kAD2XCentre1)+(x[1]*x[1])) < kAD2SqRadius
215 || ((x[0]-kAD2XCentre2)*(x[0]-kAD2XCentre2)+(x[1]*x[1])) < kAD2SqRadius){
216 b[1] = fDipoleField;
5ba7c883 217 }
218 }
60378f15 219 }
5ba7c883 220
aee8290b 221}
60378f15 222