StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
test_magF.C
1 // $Id: test_magF.C,v 1.4 2011/05/11 11:55:46 jcs Exp $
2 //
3 // $Log: test_magF.C,v $
4 // Revision 1.4 2011/05/11 11:55:46 jcs
5 // had to change order of library loading to avoid undefined symbols
6 //
7 // Revision 1.3 2008/05/16 18:36:57 jcs
8 // update FTPC calibration macros
9 //
10 // Revision 1.2 2006/03/15 15:14:06 jcs
11 // add lines for listing CVS update info
12 //
13 
14 void test_magF()
15 {
16 // macro to read in and run over the magnetic field map grid.
17  gROOT->Reset();
18 
19  if (gClassTable->GetID("TTable") < 0) gSystem->Load("libStar");
20  gSystem->Load("St_base");
21  gSystem->Load("StChain");
22  gSystem->Load("St_Tables");
23  gSystem->Load("StUtilities");
24  gSystem->Load("StarMagField");
25  gSystem->Load("StMagF");
26  gSystem->Load("StDetectorDbMaker.so");
27  gSystem->Load("StTpcDb");
28  gSystem->Load("StDbUtilities");
29  gSystem->Load("StDbLib");
30  gSystem->Load("StDbBroker");
31  gSystem->Load("St_db_Maker");
32  gSystem->Load("StarClassLibrary");
33  gSystem->Load("StEvent");
34  gSystem->Load("StFtpcLaserMaker");
35  gSystem->Load("libftpc_Tables");
36  gSystem->Load("StFtpcClusterMaker");
37  gSystem->Load("StFtpcTrackMaker");
38 
39  // .L StMagF.so;
40  // make a field object at reversed polarity;
41  //f = new StMagF("Star Full Reversed Field",
42  // "$STAR/StarDb/StMagF/bfield_full_positive_3D.dat",2,-1.0)
43 
44  Float_t pt[3] = new Float_t;
45  Float_t B[3] = new Float_t;
46  //Float_t Br[3] = new Float_t;
47  //Float_t Bz[3] = new Float_t;
48 
49  Float_t Br=0;
50  Float_t Bz=0;
51 
52  for (int i=0;i<3;i++)
53  {
54  pt[i]=B[i]=0;
55  //Br[i]=Bz[i]=0;
56  }
57 
58 
59  //pt[0] = 10.0;
60  //pt[1] = 10.0;
61  //pt[2] = -275.0;
62 
63 
64  // -----------------------------------------------------
65 
66  cout<<endl;
67  //StMagUtilities *magf=new StMagUtilities();
68 
69  StMagUtilities *magf=new StMagUtilities(2,1,0);
70  // 2 = mapped field => auswahl mit 0,0.5,1
71  //StMagUtilities *magf=new StMagUtilities("/.na49/data1pcc/star/packages/DEV/StarDb/StMagF/bfp112.map",1.0,0);
72 
73  // -----------------------------------------------------
74 
75  cout<<endl;
76 
77  cout<<"2D B-field :"<<endl;
78  magf->BField(&pt[],&B[]);
79  cout<<endl;
80 
81  printf(" xyz = %7.2f %7.2f %7.2f Bxyz= %7.4f %7.4f %7.4f \n", pt[0],pt[1],pt[2],B[0],B[1],B[2]);
82 
83  Float_t r=0;
84  const Float_t z=275;
85 
86  cout<<endl;
87  for (int k=0;k<31;k++)
88  {
89  r=(float) k;
90  magf->BrBzField(r,z,Br,Bz);
91 
92  //cout<<endl;
93  //printf(" rz = %7.2f %7.2f Brz= %7.4f %7.4f \n", r,z,Br,Bz);
94  }
95 
96  cout<<endl;
97 
98  // ???? 3D map wie laden usw. !???
99 
100  for (int i=0;i<3;i++)
101  {
102  pt[i]=B[i]=0;
103  //Br[i]=Bz[i]=0;
104  }
105 
106  cout<<"3D B-field :"<<endl;
107  magf->B3DField(&pt[],&B[]);
108 
109  cout<<endl;
110 
111  printf(" xyz = %7.2f %7.2f %7.2f Bxyz= %7.4f %7.4f %7.4f \n", pt[0],pt[1],pt[2],B[0],B[1],B[2]);
112 
113  cout<<endl;
114  delete magf;
115 
116 }