1 |
|
2 |
void BX ( Double_t &K){ |
3 |
return pamfield->GetBX((float *)K) |
4 |
} |
5 |
|
6 |
void Field(){ |
7 |
TString PL = gSystem->Getenv("PAM_LIB"); |
8 |
gSystem->Load(PL+"/libyoda.so"); |
9 |
gSystem->Load(PL+"/libDarthVader.so"); |
10 |
gSystem->Load(PL+"/libPamLevel2.so"); |
11 |
TString Calib=gSystem->Getenv("PAM_CALIB"); |
12 |
TrkLevel2* pamfield = new TrkLevel2(); |
13 |
pamfield->LoadField(Calib+"/trk-param/field_param-0/"); |
14 |
//Double_t K[3]=(.0,.0,-30.); |
15 |
// pamfield->GetBX((float *)x); |
16 |
// pamfield->GetBY((float *)x); |
17 |
// pamfield->GetBZ((float *)x); |
18 |
const Int_t n = 200; |
19 |
Double_t x[n]; |
20 |
Double_t Bx[n]; |
21 |
Double_t By[n]; |
22 |
Double_t Bz[n]; |
23 |
Double_t K[3]=(.0,.0,.0); |
24 |
for (Int_t i=0; i<n; i++){ |
25 |
x[i]=-100+i; |
26 |
|
27 |
|
28 |
// K[0]=x[i]; |
29 |
Bx[i]=pamfield->GetBX((float *)K); |
30 |
By[i]=pamfield->GetBY((float *)K); |
31 |
Bz[i]=pamfield->GetBZ((float *)K); |
32 |
// delete K; |
33 |
} |
34 |
TGraph *bx = new TGraph(n,x,Bx); |
35 |
TGraph *by = new TGraph(n,x,By); |
36 |
TGraph *bz = new TGraph(n,x,Bz); |
37 |
TMultiGraph *mg = new TMultiGraph(); |
38 |
mg->Add(bx); |
39 |
mg->Add(by); |
40 |
mg->Add(bz); |
41 |
TCanvas *c = new TCanvas("Mag","Magnetic Field",200,10,600,400); |
42 |
mg->Draw("AC"); |
43 |
} |