/[PAMELA software]/trieste/pamVMC/field.C
ViewVC logotype

Annotation of /trieste/pamVMC/field.C

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Wed Mar 4 12:51:02 2009 UTC (15 years, 8 months ago) by pamelats
Branch: MAIN, pamVMC
CVS Tags: start, v0r00, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Test pamVMC

1 pamelats 1.1 #define ZCAL 13.05
2     #define CALS 10.639
3     #define ZSPEB 2.97
4     #define HORMG 22.57
5    
6    
7     void Field(){
8     TString PL = gSystem->Getenv("PAM_LIB");
9     gSystem->Load("libTree.so");
10     gSystem->Load(PL+"/libyoda.so");
11     gSystem->Load(PL+"/libDarthVader.so");
12     gSystem->Load(PL+"/libPamLevel2.so");
13     gSystem->Load(PL+"/libTrkParams.so");
14     TString Calib=gSystem->Getenv("PAM_CALIB");
15     TString pamcal = Calib+"/field_param-0/";
16     TrkParams::SetPrecisionFactor(0.0000001);
17     TrkParams::SetStepMin(10000);
18     TrkParams::Set(pamcal,1);
19     TrkParams::Load(1);
20    
21     float x[3]; // this is example when Bx=0;
22    
23     const Int_t n = 101;
24    
25     Double_t Bx[n];
26     Double_t By[n];
27     Double_t Bz[n];
28     Double_t k[n];
29    
30     x[0]=.0;
31     x[1]=.0;
32     x[2]=-.5;
33    
34     x[2]=x[2]+(ZCAL+CALS+ZSPEB+HORMG);
35    
36     for (Int_t i=0; i<n; i++){
37     x[2]=-50.+(float)i;
38    
39     Bx[i]=TrkParams::GetBX((float *)x)*10.;
40     By[i]=TrkParams::GetBY((float *)x)*10.;
41     Bz[i]=TrkParams::GetBZ((float *)x)*10.;
42     x[2]=x[2]+(ZCAL+CALS+ZSPEB+HORMG);
43     cout<<"X="<<x[0]<<" Y="<<x[1]<<" Z="<<x[2]<<" Bx="<<Bx[i]<<" By="<<By[i]<<" Bz="<<Bz[i]<<endl;
44     k[i]=x[2];
45     }
46    
47     TGraph *bx = new TGraph(n,k,Bx);
48     TGraph *by = new TGraph(n,k,By);
49     TGraph *bz = new TGraph(n,k,Bz);
50     TMultiGraph *mg = new TMultiGraph();
51     mg->Add(bx);
52     mg->Add(by);
53     mg->Add(bz);
54     TCanvas *c = new TCanvas("Mag","Magnetic Field",200,10,600,400);
55     mg->Draw("AC");
56    
57     }

  ViewVC Help
Powered by ViewVC 1.1.23