17 fI =
new TH3D(
"fI",
"fI;r;phi;z",nr,rmin,rmax,np,pmin,pmax,nz,-hz,hz);
18 fE =
new TH3D(
"fE",
"fE;r;phi;z",nr,rmin,rmax,np,pmin,pmax,nz,-hz,hz);
22 TCanvas *
main =
new TCanvas();
24 TH2D *
tmp = (TH2D*)
fI->Project3D(
"xz");
25 tmp->SetTitle(Form(
"IonMap (ev==%d)",n));
26 main->cd(1)->SetLogz(1); tmp->Draw(
"colz");
27 TH2D *tmp2 = (TH2D*)
fE->Project3D(
"xz");
28 tmp2->SetTitle(Form(
"ElectronMap (ev==%d)",n));
29 main->cd(2)->SetLogz(1); tmp2->Draw(
"colz");
30 TH1D *tmp1 =
fI->ProjectionZ(
"IonMapZ");
31 tmp1->SetTitle(Form(
"IonMapZ (ev==%d)",n));
33 main->cd(3); tmp1->Draw(
"hist");
34 TH1D *tmp12 =
fE->ProjectionZ(
"ElectronMapZ");
35 tmp12->SetTitle(Form(
"ElectronMapZ (ev==%d)",n));
37 main->cd(4); tmp12->Draw(
"hist");
38 main->SaveAs( Form(
"%s.%s",name,ext),ext);
51 int nr =
fI->GetXaxis()->GetNbins();
52 int np =
fI->GetYaxis()->GetNbins();
53 int nz =
fI->GetZaxis()->GetNbins();
54 nrad = TMath::Max( nr, nrad );
55 nphi = TMath::Max( np, nphi );
56 nhz = TMath::Max( nz, nhz );
57 TH3F *
rho =
new TH3F(
"rho",
"ChargeDensity [fC/cm^3];Radial [cm];Azimuthal [rad];Longitudinal [cm]",
58 nrad,
fI->GetXaxis()->GetBinLowEdge(1),
fI->GetXaxis()->GetBinLowEdge( nr+1 ),
60 nz,
fI->GetZaxis()->GetBinLowEdge(1),
fI->GetZaxis()->GetBinLowEdge( nz+1 ));
61 for(
int i=0;
i!=nrad; ++
i) {
62 float rmin = rho->GetXaxis()->GetBinLowEdge(
i+1);
63 float rmax = rho->GetXaxis()->GetBinLowEdge(
i+2);
64 int brmin =
fI->GetXaxis()->FindBin( rmin+1
e-6 );
65 int brmax =
fI->GetXaxis()->FindBin( rmax-1
e-6 );
67 for(
int k=0;
k!=nhz; ++
k) {
68 float zmin = rho->GetZaxis()->GetBinLowEdge(
k+1);
69 float zmax = rho->GetZaxis()->GetBinLowEdge(
k+2);
70 int bzmin =
fI->GetZaxis()->FindBin( zmin+1
e-6 );
71 int bzmax =
fI->GetZaxis()->FindBin( zmax-1
e-6 );
73 for(
int ii=brmin; ii!=brmax+1; ++ii)
74 for(
int jj=1; jj!=np+1; ++jj)
75 for(
int kk=bzmin; kk!=bzmax+1; ++kk)
76 n +=
fI->GetBinContent( ii, jj, kk );
77 float dv = TMath::Power(0.5*(rmax+rmin),2)*(rmax-rmin)*(zmax-zmin)*
TMath::TwoPi()*(1./
nphi);
78 float drho = n / (dv*10000) * 1.602;
80 rho->SetBinContent(
i+1,
j+1,
k+1, drho );
88 int vd1 =
fI->GetZaxis()->FindBin(
double(0));
89 int vd2 =
fI->GetZaxis()->FindBin(z);
91 if(w<0)
fE->Fill(r,p,z,TMath::Abs(w));
92 else fI->Fill(r,p,z,w);
96 int NZ =
fI->GetZaxis()->GetNbins();
99 int fIDis =
fIcmperms*ms /
fI->GetZaxis()->GetBinWidth(1);
102 printf(
"Improve grid!!!!\n");
108 int vd =
fI->GetZaxis()->FindBin(
double(0));
110 for(
int nz=vd-1;
nz!=0; --
nz) {
112 if(newz>=vd) newz = 0;
113 for(
int nr=0; nr!=
fI->GetXaxis()->GetNbins(); ++nr)
114 for(
int np=0; np!=
fI->GetYaxis()->GetNbins(); ++np) {
115 float nc =
fI->GetBinContent(nr+1,np+1,newz) +
fI->GetBinContent(nr+1,np+1,
nz);
116 fI->SetBinContent(nr+1,np+1,
nz, 0.0);
117 fI->SetBinContent(nr+1,np+1,newz, nc );
121 for(
int nz=vd+1;
nz!=NZ+1; ++
nz) {
123 if(newz<=vd) newz = NZ + 1;
124 for(
int nr=0; nr!=
fI->GetXaxis()->GetNbins(); ++nr)
125 for(
int np=0; np!=
fI->GetYaxis()->GetNbins(); ++np) {
126 float nc =
fI->GetBinContent(nr+1,np+1,newz) +
fI->GetBinContent(nr+1,np+1,
nz);
127 fI->SetBinContent(nr+1,np+1,
nz,0.0);
128 fI->SetBinContent(nr+1,np+1,newz, nc );
139 for(
int nz=1;
nz!=vd; ++
nz) {
140 float dz =
fE->GetZaxis()->GetBinCenter(
nz) -
fE->GetZaxis()->GetBinLowEdge(1);
142 float msres = ms - t2ep/1000;
146 int newz = 1+
fIcmperms*msres /
fI->GetZaxis()->GetBinWidth(1);
148 if(newz>=vd) newz = 0;
149 for(
int nr=0; nr!=
fI->GetXaxis()->GetNbins(); ++nr)
150 for(
int np=0; np!=
fI->GetYaxis()->GetNbins(); ++np) {
151 float nc =
fE->GetBinContent(nr+1,np+1,
nz);
153 nc =
fI->GetBinContent(nr+1,np+1,newz) + fBF*
fE->GetBinContent(nr+1,np+1,
nz);
155 fE->SetBinContent(nr+1,np+1,
nz,0);
156 fI->SetBinContent(nr+1,np+1,newz, nc );
161 std::cout <<
" Electron Deltacm " <<
fEcmperus*ms*1000 << std::endl;
162 std::cout <<
" Electron bin width " <<
fE->GetZaxis()->GetBinWidth(1) << std::endl;
163 float fEDis =
fEcmperus*ms*1000 /
fE->GetZaxis()->GetBinWidth(1);
164 std::cout <<
" DeltaBin " << fEDis << std::endl;
167 for(
int nr=0; nr!=
fI->GetXaxis()->GetNbins(); ++nr)
168 for(
int np=0; np!=
fI->GetYaxis()->GetNbins(); ++np) {
169 float nc =
fE->GetBinContent(nr+1,np+1,newz) +
fE->GetBinContent(nr+1,np+1,
nz);
170 fE->SetBinContent(nr+1,np+1,
nz,0);
171 fE->SetBinContent(nr+1,np+1,newz, nc );
176 for(
int nz=vd+1;
nz!=NZ+1; ++
nz) {
177 float dz =
fE->GetZaxis()->GetBinLowEdge(NZ+1) -
fE->GetZaxis()->GetBinCenter(
nz);
179 float msres = ms - t2ep/1000;
183 int newz = NZ -
fIcmperms*msres /
fI->GetZaxis()->GetBinWidth(1);
185 if(newz<=vd) newz = NZ+1;
186 for(
int nr=0; nr!=
fI->GetXaxis()->GetNbins(); ++nr)
187 for(
int np=0; np!=
fI->GetYaxis()->GetNbins(); ++np) {
188 float nc =
fE->GetBinContent(nr+1,np+1,
nz);
190 nc =
fI->GetBinContent(nr+1,np+1,newz) + fBF*
fE->GetBinContent(nr+1,np+1,
nz);
192 fE->SetBinContent(nr+1,np+1,
nz,0);
198 std::cout <<
" Electron Deltacm " <<
fEcmperus*ms*1000 << std::endl;
199 std::cout <<
" Electron bin width " <<
fE->GetZaxis()->GetBinWidth(1) << std::endl;
200 float fEDis =
fEcmperus*ms*1000 /
fE->GetZaxis()->GetBinWidth(1);
201 std::cout <<
" DeltaBin " << fEDis << std::endl;
203 if(newz>NZ) newz = NZ+1;
204 for(
int nr=0; nr!=
fI->GetXaxis()->GetNbins(); ++nr)
205 for(
int np=0; np!=
fI->GetYaxis()->GetNbins(); ++np) {
206 float nc =
fE->GetBinContent(nr+1,np+1,newz) +
fE->GetBinContent(nr+1,np+1,
nz);
207 fE->SetBinContent(nr+1,np+1,
nz,0);
208 fE->SetBinContent(nr+1,np+1,newz, nc );