]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMagFC.cxx
Reverting the changes, additional modifications are needed to make it working
[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
31//________________________________________
d0f1ee3b 32AliMagFC::AliMagFC(const char *name, const char *title, Int_t integ,
33 Float_t factor, Float_t fmax)
d8408e76 34 : AliMagF(name,title,integ,factor,fmax)
aee8290b 35{
36 //
37 // Standard constructor
38 //
aee8290b 39 fType = kConst;
d8408e76 40 fMap = 1;
aee8290b 41}
42
43//________________________________________
6f3038e9 44void AliMagFC::Field(Float_t *x, Float_t *b) const
aee8290b 45{
46 //
47 // Method to return the field in a point
48 //
49 b[0]=b[1]=b[2]=0;
50 if(fMap==1) {
51 if(TMath::Abs(x[2])<700 && x[0]*x[0]+(x[1]+30)*(x[1]+30) < 560*560) {
52 b[2]=2;
53 } else {
575c700d 54 if ( -725 >= x[2] && x[2] >= -1225 ) {
55 Float_t dz = TMath::Abs(-975-x[2])*0.01;
56 b[0] = - (1-0.1*dz*dz)*7;
aee8290b 57 }
58 else {
575c700d 59 ZDCField(x, b);
d95ea23f 60 }
61 }
575c700d 62 if(fFactor!=1) {
63 b[0]*=fFactor;
64 b[1]*=fFactor;
65 b[2]*=fFactor;
d95ea23f 66 }
575c700d 67 } else {
594d8990 68 AliFatal(Form("Invalid field map for constant field %d",fMap));
575c700d 69 }
70}
71
72
6f3038e9 73void AliMagFC::ZDCField(Float_t *x, Float_t *b) const
575c700d 74{
75//This is the ZDC part
76 Float_t rad2=x[0]*x[0]+x[1]*x[1];
2e9eb88a 77
575c700d 78 if(x[2] < kCORBEG2 && x[2] > kCOREND2){
79 if(rad2<kCOR2RA2){
80 b[0] = - kFCORN2;
81 }
d95ea23f 82 }
575c700d 83 else if(x[2] < kZ1BEG && x[2] > kZ1END){
84 if(rad2<kZ1RA2){
85 b[0] = kG1*x[1];
53cc0d31 86 b[1] = kG1*x[0];
575c700d 87 }
d95ea23f 88 }
575c700d 89 else if(x[2] < kZ2BEG && x[2] > kZ2END){
90 if(rad2<kZ2RA2){
91 b[0] = -kG1*x[1];
53cc0d31 92 b[1] = -kG1*x[0];
575c700d 93 }
d95ea23f 94 }
575c700d 95 else if(x[2] < kZ3BEG && x[2] > kZ3END){
96 if(rad2<kZ3RA2){
97 b[0] = -kG1*x[1];
53cc0d31 98 b[1] = -kG1*x[0];
575c700d 99 }
d95ea23f 100 }
575c700d 101 else if(x[2] < kZ4BEG && x[2] > kZ4END){
102 if(rad2<kZ4RA2){
103 b[0] = kG1*x[1];
53cc0d31 104 b[1] = kG1*x[0];
575c700d 105 }
d95ea23f 106 }
575c700d 107 else if(x[2] < kD1BEG && x[2] > kD1END){
108 if(rad2<kD1RA2){
109 b[1] = -kFDIP;
110 }
aee8290b 111 }
575c700d 112 else if(x[2] < kD2BEG && x[2] > kD2END){
113 if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
114 || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
115 b[1] = kFDIP;
116 }
aee8290b 117 }
575c700d 118
aee8290b 119}