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