2 void viewer(
const char *fname,
double minR = 0.0,
double maxR = 400.0,
3 double minZ = -450.0,
double maxZ = 450.0,
unsigned cvX = 1200,
4 unsigned cvY = 1200,
bool plotBz =
true,
bool plotBr =
false,
11 if (bmf->ValidMapImported()) {
12 bool plot[3] = {plotBz, plotBr, plotBm};
13 unsigned divY = plotBz + plotBr + plotBm;
14 auto cv =
new TCanvas(
"cv",
"", 0, 0, cvX, cvY); cv->Divide(1,divY);
16 unsigned dimR = 200, dimZ = 600;
17 double cellR = (maxR - minR)/dimR, cellZ = (maxZ - minZ)/dimZ;
19 auto hbr =
new TH2D(
"hbr",
"R-component", dimZ, minZ, maxZ, dimR, minR, maxR);
20 auto hbz =
new TH2D(
"hbz",
"Z-component", dimZ, minZ, maxZ, dimR, minR, maxR);
21 auto hbm =
new TH2D(
"hbm",
"SQRT(BR^2+BZ^2)", dimZ, minZ, maxZ, dimR, minR, maxR);
22 TH2D *hh[3] = {hbz, hbr, hbm};
24 for(
unsigned ir=0;
ir<dimR;
ir++)
25 for(
unsigned iz=0; iz<dimZ; iz++) {
27 bmf->GetFieldValue(minR + cellR*(
ir + 0.5), minZ + cellZ*(iz + 0.5), br, bz);
29 hbz->SetBinContent(iz+1,
ir+1, bz);
30 hbr->SetBinContent(iz+1,
ir+1, br);
31 hbm->SetBinContent(iz+1,
ir+1, sqrt(bz*bz+br*br));
35 unsigned iYcurrent = 1;
37 for(
unsigned iy=0; iy<3; iy++)
44 printf(
"\n Was not able to import the field map!\n");