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