]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMagFC.cxx
updated the version of START to 1
[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
16/*
17$Log$
006cb30c 18Revision 1.3 2000/11/10 18:09:55 fca
19New field map for the ZDC
20
d95ea23f 21Revision 1.2 2000/07/12 08:56:25 fca
22Coding convention correction and warning removal
23
8918e700 24Revision 1.1 2000/07/11 18:24:59 fca
25Coding convention corrections + few minor bug fixes
26
aee8290b 27*/
28
29#include "AliMagFC.h"
8918e700 30#include <stdlib.h>
aee8290b 31
32ClassImp(AliMagFC)
33
34//________________________________________
35AliMagFC::AliMagFC(const char *name, const char *title, const Int_t integ,
36 const Int_t map, const Float_t factor, const Float_t fmax)
37 : AliMagF(name,title,integ,map,factor,fmax)
38{
39 //
40 // Standard constructor
41 //
42 printf("Constant Field %s created: map= %d, factor= %f\n",fName.Data(),map,
43 factor);
44 fType = kConst;
45}
46
47//________________________________________
48void AliMagFC::Field(Float_t *x, Float_t *b)
49{
50 //
51 // Method to return the field in a point
52 //
53 b[0]=b[1]=b[2]=0;
54 if(fMap==1) {
55 if(TMath::Abs(x[2])<700 && x[0]*x[0]+(x[1]+30)*(x[1]+30) < 560*560) {
56 b[2]=2;
57 } else {
58 if ( 725 <= x[2] && x[2] <= 1225 ) {
59 Float_t dz = TMath::Abs(975-x[2])*0.01;
60 b[0]=(1-0.1*dz*dz)*7;
61 }
62 else {
63//This is the ZDC part
d95ea23f 64 Float_t rad2=x[0]*x[0]+x[1]*x[1];
006cb30c 65 if(x[2]>kCORBEG2 && x[2]<kCOREND2){
d95ea23f 66 if(rad2<kCOR2RA2){
67 b[0] = kFCORN2;
68 }
69 }
70 else if(x[2]>kZ1BEG && x[2]<kZ1END){
71 if(rad2<kZ1RA2){
72 b[0] = -kG1*x[1];
73 b[1] = -kG1*x[0];
74 }
75 }
76 else if(x[2]>kZ2BEG && x[2]<kZ2END){
77 if(rad2<kZ2RA2){
78 b[0] = kG1*x[1];
79 b[1] = kG1*x[0];
80 }
81 }
82 else if(x[2]>kZ3BEG && x[2]<kZ3END){
83 if(rad2<kZ3RA2){
84 b[0] = kG1*x[1];
85 b[1] = kG1*x[0];
86 }
87 }
88 else if(x[2]>kZ4BEG && x[2]<kZ4END){
89 if(rad2<kZ4RA2){
90 b[0] = -kG1*x[1];
91 b[1] = -kG1*x[0];
92 }
93 }
94 else if(x[2]>kD1BEG && x[2]<kD1END){
95 if(rad2<kD1RA2){
96 b[1] = -kFDIP;
97 }
98 }
99 else if(x[2]>kD2BEG && x[2]<kD2END){
100 if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
101 || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
102 b[1] = kFDIP;
103 }
104 }
105
aee8290b 106 }
107 }
108 if(fFactor!=1) {
109 b[0]*=fFactor;
110 b[1]*=fFactor;
111 b[2]*=fFactor;
112 }
113 } else {
114 printf("Invalid field map for constant field %d\n",fMap);
115 exit(1);
116 }
117}
118