38 if(
fDebug>0)
printf(
"FieldMaps is initializing field maps... ");
39 fEr =
new TH3F(
"Er",
"Er [V/cm];Radial [cm];Azimuthal [rad];Longitudinal [cm]",
43 fEp =
new TH3F(
"Ep",
"Ephi [V/cm];Radial [cm];Azimuthal [rad];Longitudinal [cm]",
47 fEz =
new TH3F(
"Ez",
"Ez [V/cm];Radial [cm];Azimuthal [rad];Longitudinal [cm]",
57 if(
fDebug>0)
printf(
"FieldMaps is reading from %s... ",inputfile);
58 TFile *ifile =
new TFile(inputfile);
59 if(ifile->IsZombie()) ifile=NULL;
61 fRho = (TH3F*) ifile->Get(
"rho");
70 if(
fDebug>1)
printf(
"FieldMaps saving field maps into %s... ",filename.Data());
71 TFile *
ofile =
new TFile(filename.Data(),
"RECREATE");
72 ofile->WriteObject(
fEr,
"Er");
73 ofile->WriteObject(
fEp,
"Ep");
74 ofile->WriteObject(
fEz,
"Ez");
80 int brmin =
fRho->GetXaxis()->FindBin(rprime - dr/2 + 1
e-8);
81 int brmax =
fRho->GetXaxis()->FindBin(rprime + dr/2 - 1
e-8);
82 int bpmin =
fRho->GetYaxis()->FindBin(phiprime - dphi/2 + 1
e-8);
83 int bpmax =
fRho->GetYaxis()->FindBin(phiprime + dphi/2 - 1
e-8);
84 int bzmin =
fRho->GetZaxis()->FindBin(zprime - dz/2 + 1
e-8);
85 int bzmax =
fRho->GetZaxis()->FindBin(zprime + dz/2 - 1
e-8);
86 if(brmin<1||bpmin<1||bzmin<1)
return 0;
87 if(brmax<brmin) brmax = brmin +1;
88 if(bpmax<bpmin) bpmax = bpmin +1;
89 if(bzmax<bzmin) bzmax = bzmin +1;
91 float ddr =
fRho->GetXaxis()->GetBinWidth(1);
92 float ddp =
fRho->GetYaxis()->GetBinWidth(1);
93 float ddz =
fRho->GetZaxis()->GetBinWidth(1);
95 for(
int br=brmin; br!=brmax+1; ++br)
96 for(
int bp=bpmin; bp!=bpmax+1; ++bp)
97 for(
int bz=bzmin; bz!=bzmax+1; ++bz) {
98 float rho =
fRho->GetBinContent(br,bp,bz);
99 float r =
fRho->GetXaxis()->GetBinCenter( br );
100 float dv = r*ddp*ddr*ddz;