34 #include "RunAction.hh"
35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "HistoManager.hh"
52 :fDetector(det), fPrimary(kin), fHistoManager(histo)
66 fHistoManager->
book();
80 if (TotNbofEvents == 0)
return;
93 G4cout <<
"\n ======================== run summary ======================\n";
97 G4cout <<
"\n The run was " << TotNbofEvents <<
" " << partName <<
" of "
100 << material->
GetName() <<
" (density: "
107 G4double fac = 1./(double(TotNbofEvents));
116 fHistoManager->
save();
134 fNbBins = fHistoManager->
GetNbins(ih);
136 fluence.resize(fNbBins, 0.);
137 fluence1.resize(fNbBins, 0.);
138 fluence2.resize(fNbBins, 0.);
139 fNbEntries.resize(fNbBins, 0);
147 if (ibin >= fNbBins)
return;
150 fluence2[ibin] += fl*fl;
164 ds =
twopi*rmean*fDr;
166 fluence2[
bin] /= (ds*ds);
168 if (fNbEntries[
bin] > 0)
169 variance = fluence2[
bin] - (fluence[
bin]*fluence[
bin])/fNbEntries[
bin];
171 if(variance > 0.) rms = std::sqrt(variance);
177 G4double rnorm(4*
mm), radius(0.), fnorm(0.), fnorm2(0.);
180 inorm++; radius += fDr; fnorm += fluence[inorm]; fnorm2 += fluence2[inorm];
181 }
while (radius < rnorm);
187 G4double err0 = fnorm2/fnorm, err1 = 0.;
195 err1 = fluence2[
bin]/fluence[
bin];
196 error = ratio*std::sqrt(err1*err1 + err0*err0);
198 fluence1[
bin] = ratio;
199 fluence2[
bin] = error;
212 G4String fileName = name +
".ascii";
213 std::ofstream File(fileName, std::ios::out);
215 std::ios::fmtflags mode = File.flags();
216 File.setf( std::ios::scientific, std::ios::floatfield );
217 G4int prec = File.precision(3);
219 File <<
" Fluence density distribution \n "
220 <<
"\n ibin \t radius (mm) \t Nb \t fluence\t norma fl\t rms/nfl (%) \n"
227 if (fluence1[
bin] > 0.) error = 100*fluence2[
bin]/fluence1[
bin];
228 File <<
" " <<
bin <<
"\t " << rmean/
mm <<
"\t " << fNbEntries[
bin]
229 <<
"\t " << fluence[
bin]/double(TotEvents) <<
"\t " << fluence1[
bin]
235 File.setf(mode,std::ios::floatfield);
236 File.precision(prec);