51 :histName(
"histfile"),nbinStep(0),nbinEn(0),nbinTt(0),nbinTb(0),
52 nbinTsec(0),nbinTh(0),nbinThback(0),nbinR(0),nbinGamma(0),
58 EnergySumAbs = EnergySquareSumAbs = tlSumAbs = tlsquareSumAbs =
59 nStepSumCharged = nStepSum2Charged= nStepSumNeutral = nStepSum2Neutral=
60 TotNbofEvents = SumCharged= SumNeutral=Sum2Charged=Sum2Neutral=Selectron=
61 Spositron=Transmitted=Reflected =dStep=entryStep=underStep=overStep=
62 dEn = entryEn= underEn=overEn=dTt = entryTt=underTt=overTt=Ttmean=
63 Tt2mean=dTb = entryTb=underTb=overTb=Tbmean=Tb2mean=dTsec =entryTsec=
64 underTsec=overTsec=dTh = entryTh=underTh=overTh=dThback =entryThback=
65 underThback=overThback=dR =entryR =underR =overR =Rmean=R2mean=dEGamma=
66 entryGamma = underGamma=overGamma=dz=entryvertexz=undervertexz=
79 void Em10RunAction::bookHisto()
99 if(pVVisManager) UI->
ApplyCommand(
"/vis/scene/notifyHandlers");
103 EnergySquareSumAbs = 0.;
105 tlsquareSumAbs = 0. ;
106 nStepSumCharged = 0. ;
107 nStepSum2Charged= 0. ;
108 nStepSumNeutral = 0. ;
109 nStepSum2Neutral= 0. ;
125 dStep=(Stephigh-Steplow)/nbinStep;
129 for(
G4int ist=0; ist<200; ist++)
136 dEn = (Enhigh-Enlow)/nbinEn ;
141 for (
G4int ien=0; ien<200; ien++) distEn[ien]=0.;
145 dTt = (Tthigh-Ttlow)/nbinTt ;
150 for (
G4int itt=0; itt<200; itt++) distTt[itt]=0.;
157 dTb = (Tbhigh-Tblow)/nbinTb ;
161 for (
G4int itt=0; itt<200; itt++)
170 dTsec = (Tsechigh-Tseclow)/nbinTsec ;
174 for (
G4int its=0; its<200; its++)
181 dTh = (Thhigh-Thlow)/nbinTh ;
185 for (
G4int ith=0; ith<200; ith++)
193 dThback = (Thhighback-Thlowback)/nbinThback ;
197 for (
G4int ithback=0; ithback<200; ithback++)
199 distThback[ithback]=0.;
206 dR = (Rhigh-Rlow)/nbinR ;
210 for (
G4int ir =0; ir<200; ir++)
220 dEGamma = std::log(EhighGamma/ElowGamma)/nbinGamma ;
224 for (
G4int ig=0; ig<200; ig++)
231 dz=(zhigh-zlow)/nbinvertexz;
248 G4double sAbs,sigAbs,sigstep,sigcharged,signeutral;
249 if(0.0 >= TotNbofEvents) {
return; }
251 tlSumAbs /= TotNbofEvents ;
252 sAbs = tlsquareSumAbs/TotNbofEvents-tlSumAbs*tlSumAbs ;
254 sAbs = std::sqrt(sAbs/TotNbofEvents) ;
258 EnergySumAbs /= TotNbofEvents ;
259 sigAbs = EnergySquareSumAbs/TotNbofEvents-EnergySumAbs*EnergySumAbs;
261 sigAbs = std::sqrt(sigAbs/TotNbofEvents);
265 nStepSumCharged /= TotNbofEvents ;
266 sigstep = nStepSum2Charged/TotNbofEvents-nStepSumCharged*nStepSumCharged;
268 sigstep = std::sqrt(sigstep/TotNbofEvents);
273 nStepSumNeutral /= TotNbofEvents ;
274 sigstep = nStepSum2Neutral/TotNbofEvents-nStepSumNeutral*nStepSumNeutral;
276 sigstep = std::sqrt(sigstep/TotNbofEvents);
281 SumCharged /= TotNbofEvents;
282 sigcharged = Sum2Charged/TotNbofEvents-SumCharged*SumCharged;
284 sigcharged = std::sqrt(sigcharged/TotNbofEvents);
288 SumNeutral /= TotNbofEvents;
289 signeutral = Sum2Neutral/TotNbofEvents-SumNeutral*SumNeutral;
291 signeutral = std::sqrt(signeutral/TotNbofEvents);
295 Selectron /= TotNbofEvents ;
296 Spositron /= TotNbofEvents ;
298 Transmitted /=TotNbofEvents ;
299 Reflected /=TotNbofEvents ;
300 G4cout <<
" ================== run summary =====================" <<
G4endl;
302 G4cout <<
" end of Run TotNbofEvents = " <<
304 G4cout <<
" mean charged track length in absorber=" <<
305 tlSumAbs/
mm <<
" +- " << sAbs/
mm <<
308 G4cout <<
" mean energy deposit in absorber=" <<
309 EnergySumAbs/
MeV <<
" +- " << sigAbs/
MeV <<
312 G4cout <<
" mean number of steps in absorber (charged) =" <<
313 nStepSumCharged <<
" +- " << sigch <<
315 G4cout <<
" mean number of steps in absorber (neutral) =" <<
316 nStepSumNeutral <<
" +- " << signe <<
319 G4cout <<
" mean number of charged secondaries = " <<
320 SumCharged <<
" +- " << sigcharged <<
G4endl;
322 G4cout <<
" mean number of neutral secondaries = " <<
323 SumNeutral <<
" +- " << signeutral <<
G4endl;
326 G4cout <<
" mean number of e-s =" << Selectron <<
327 " and e+s =" << Spositron <<
G4endl;
330 G4cout <<
"(number) transmission coeff=" << Transmitted <<
331 " reflection coeff=" << Reflected <<
G4endl;
336 G4cout <<
" step number/event distribution " <<
G4endl ;
337 G4cout <<
"#entries=" << entryStep <<
" #underflows=" << underStep <<
338 " #overflows=" << overStep <<
G4endl ;
341 E = Steplow - dStep ;
342 norm = TotNbofEvents ;
343 G4cout <<
" bin nb nsteplow entries normalized " <<
G4endl ;
344 for(
G4int iss=0; iss<nbinStep; iss++)
347 dnorm = distStep[iss]/
norm;
348 G4cout << std::setw(5) << iss << std::setw(10) << E <<
349 std::setw(12) << distStep[iss] <<
350 std::setw(12) << dnorm <<
G4endl ;
357 std::ofstream fileOut(
"distribution.out", std::ios::out ) ;
358 fileOut.setf( std::ios::scientific, std::ios::floatfield );
360 std::ofstream normOut(
"normDist.out", std::ios::out ) ;
361 normOut.setf( std::ios::scientific, std::ios::floatfield );
366 G4cout <<
"#entries=" << entryEn <<
" #underflows=" << underEn <<
367 " #overflows=" << overEn <<
G4endl ;
371 norm = TotNbofEvents*1.0 ;
372 G4cout <<
" bin nb Elow entries normalized " <<
G4endl ;
375 for(
G4int ien=0; ien<nbinEn; ien++)
384 dnorm = distEn[ien]/
norm;
386 G4cout << std::setw(5) << ien << std::setw(10) << E/
keV <<
387 std::setw(12) << distEn[ien] <<
388 std::setw(12) << dnorm <<
G4endl ;
390 fileOut << E/
keV <<
"\t"<< distEn[ien] <<
G4endl ;
391 normOut << E/
keV <<
"\t"<< dnorm <<
G4endl ;
401 for(
G4int i1=0; i1<nbinEn; i1++)
406 if(distEn[i1] >= 0.5*fmax)
415 for(
G4int i2=0; i2<nbinEn; i2++)
419 if(distEn[i2] >= 0.5*fmax) E2=E ;
421 G4cout <<
" Emp = " << std::setw(15) << Emp/
MeV <<
" width="
422 << std::setw(15) << (E2-E1)/
MeV <<
" MeV " << G4endl;
429 G4cout <<
" transmitted energy distribution " <<
G4endl ;
430 G4cout <<
"#entries=" << entryTt <<
" #underflows=" << underTt <<
431 " #overflows=" << overTt <<
G4endl ;
435 sig=Tt2mean/entryTt-Ttmean*Ttmean ;
439 sig=std::sqrt(sig/entryTt) ;
440 G4cout <<
" mean energy of transmitted particles=" << Ttmean/
keV <<
443 norm = TotNbofEvents*dTt ;
444 G4cout <<
" bin nb Elow entries normalized " <<
G4endl ;
445 for(
G4int itt=0; itt<nbinTt; itt++)
448 dnorm = distTt[itt]/
norm;
449 G4cout << std::setw(5) << itt << std::setw(10) << E <<
450 std::setw(12) << distTt[itt] <<
451 std::setw(12) << dnorm <<
G4endl ;
459 G4cout <<
" backscattered energy distribution " <<
G4endl ;
460 G4cout <<
"#entries=" << entryTb <<
" #underflows=" << underTb <<
461 " #overflows=" << overTb <<
G4endl ;
465 sig=Tb2mean/entryTb-Tbmean*Tbmean ;
469 sig=std::sqrt(sig/entryTb) ;
470 G4cout <<
" mean energy of backscattered particles=" << Tbmean/
keV <<
473 norm = TotNbofEvents*dTb ;
474 G4cout <<
" bin nb Elow entries normalized " <<
G4endl ;
475 for(
G4int itt=0; itt<nbinTb; itt++)
478 dnorm = distTb[itt]/
norm;
479 G4cout << std::setw(5) << itt << std::setw(10) << E <<
480 std::setw(12) << distTb[itt] <<
481 std::setw(12) << dnorm <<
G4endl ;
488 G4cout <<
" energy distribution of charged secondaries " <<
G4endl ;
489 G4cout <<
"#entries=" << entryTsec <<
" #underflows=" << underTsec <<
490 " #overflows=" << overTsec <<
G4endl ;
493 E = Tseclow - dTsec ;
494 norm = TotNbofEvents*dTsec ;
495 G4cout <<
" bin nb Elow entries normalized " <<
G4endl ;
496 for(
G4int itt=0; itt<nbinTsec; itt++)
499 dnorm = distTsec[itt]/
norm;
500 G4cout << std::setw(5) << itt << std::setw(10) << E <<
501 std::setw(12) << distTsec[itt] <<
502 std::setw(12) << dnorm <<
G4endl ;
511 G4cout <<
"#entries=" << entryR <<
" #underflows=" << underR <<
512 " #overflows=" << overR <<
G4endl ;
516 sig = R2mean/entryR - Rmean*Rmean;
518 else sig = std::sqrt(sig/entryR) ;
519 G4cout <<
" mean lateral displacement at exit=" << Rmean/
mm <<
" +- "
522 norm = TotNbofEvents*dR ;
523 G4cout <<
" bin nb Rlow entries normalized " <<
G4endl ;
524 for(
G4int ier=0; ier<nbinR ; ier++)
527 dnorm = distR[ier]/
norm;
528 G4cout << std::setw(5) << ier << std::setw(10) << R <<
529 std::setw(12) << distR[ier] <<
530 std::setw(12) << dnorm <<
G4endl ;
537 {
G4double Th,Thdeg, dnorm,
norm,fac0,fnorm,pere,Thpere,Thmean,sum;
539 G4cout <<
"#entries=" << entryTh <<
" #underflows=" << underTh <<
540 " #overflows=" << overTh <<
G4endl ;
544 norm = TotNbofEvents ;
548 fac0 = 1./distTh[0] ;
549 pere = 1./std::exp(1.) ;
551 G4cout <<
" bin nb Thlowdeg Thlowrad " <<
552 " entries normalized " <<
G4endl ;
556 for(
G4int ien=0; ien<nbinTh; ien++)
561 Thmean += distTh[ien]*(Th+0.5*dTh) ;
562 dnorm = distTh[ien]/
norm;
563 fnorm = fac0*distTh[ien] ;
566 G4cout << std::setw(5) << ien << std::setw(10) << Thdeg <<
" " <<
567 std::setw(10) << Th <<
" " <<
568 std::setw(12) << distTh[ien] <<
" " <<
569 std::setw(12) << dnorm <<
" " << std::setw(12) << fnorm <<
G4endl ;
573 G4cout <<
" mean = " << Thmean <<
" rad or " << 180.*Thmean/
pi <<
575 G4cout <<
" theta(1/e)=" << Thpere <<
" - " << Thpere+dTh <<
" rad "
576 <<
" or " << 180.*Thpere/
pi <<
" - " << 180.*(Thpere+dTh)/
pi
577 <<
" deg." << G4endl;
583 {
G4double Thb,Thdegb, dnormb, normb,fac0b,fnormb,pereb,Thpereb,Thmeanb,sumb;
584 G4cout <<
" backscattering angle distribution " <<
G4endl ;
585 G4cout <<
"#entries=" << entryThback <<
" #underflows=" << underThback <<
586 " #overflows=" << overThback <<
G4endl ;
589 Thb= Thlowback - dThback ;
590 normb = TotNbofEvents ;
591 if(distThback[0] == 0.)
594 fac0b = 1./distThback[0] ;
595 pereb = 1./std::exp(1.) ;
597 G4cout <<
" bin nb Thlowdeg Thlowrad " <<
598 " entries normalized " <<
G4endl ;
602 for(
G4int ien=0; ien<nbinThback; ien++)
605 Thdegb = Thb*180./
pi ;
606 sumb += distThback[ien] ;
607 Thmeanb += distThback[ien]*(Thb+0.5*dThback) ;
608 dnormb = distThback[ien]/normb;
609 fnormb = fac0b*distThback[ien] ;
612 G4cout << std::setw(5) << ien << std::setw(10) << Thdegb <<
" " <<
613 std::setw(10) << Thb <<
" " <<
614 std::setw(12) << distThback[ien] <<
" " <<
615 std::setw(12) << dnormb <<
" " << std::setw(12) << fnormb <<
G4endl ;
619 G4cout <<
" mean = " << Thmeanb <<
" rad or " << 180.*Thmeanb/
pi <<
621 G4cout <<
" theta(1/e)=" << Thpereb <<
" - " << Thpereb+dThback <<
" rad "
622 <<
" or " << 180.*Thpereb/
pi <<
" - " << 180.*(Thpereb+dThback)/
pi
623 <<
" deg." << G4endl;
631 G4cout <<
"#entries=" << entryGamma <<
" #underflows=" << underGamma <<
632 " #overflows=" << overGamma <<
G4endl ;
635 fact=std::exp(dEGamma) ;
637 norm = TotNbofEvents*dEGamma;
638 G4cout <<
" bin nb Elow entries normalized " <<
G4endl ;
639 for(
G4int itt=0; itt<nbinGamma; itt++)
642 dnorm = distGamma[itt]/
norm;
643 G4cout << std::setw(5) << itt << std::setw(13) << E <<
644 std::setw(12) << distGamma[itt] <<
645 std::setw(15) << dnorm <<
G4endl ;
654 G4cout <<
"#entries=" << entryvertexz <<
" #underflows=" << undervertexz <<
655 " #overflows=" << oververtexz <<
G4endl ;
656 if( entryvertexz >0.)
659 norm = TotNbofEvents*dz ;
660 G4cout <<
" bin nb zlow entries normalized " <<
G4endl ;
661 for(
G4int iez=0; iez<nbinvertexz ; iez++)
664 if(std::fabs(z)<1.
e-12) z=0.;
665 dnorm = distvertexz[iez]/
norm;
666 G4cout << std::setw(5) << iez << std::setw(10) << z <<
667 std::setw(12) << distvertexz[iez] <<
668 std::setw(12) << dnorm <<
G4endl ;
694 TotNbofEvents += 1. ;
701 nStepSumCharged += nstp;
702 nStepSum2Charged += nstp*nstp;
709 nStepSumNeutral += nstp;
710 nStepSum2Neutral += nstp*nstp;
717 EnergySumAbs += Eabs;
718 EnergySquareSumAbs += Eabs*Eabs;
726 tlsquareSumAbs += tlabs*tlabs ;
753 if(En < Enlow) underEn += 1. ;
754 else if( En >= Enhigh) overEn += 1. ;
757 bin = (En-Enlow)/dEn;
759 if(ibin < 0) { ibin = 0; }
760 if(ibin > 199) { ibin = 199; }
824 if(nbin> 0 && nbin<= 200) {
826 G4cout <<
" Nb of bins in #step plot = " << nbinStep <<
G4endl ;
834 G4cout <<
" low in the #step plot = " << Steplow <<
G4endl ;
841 G4cout <<
" high in the #step plot = " << Stephigh <<
G4endl ;
849 if(nbin > 0 && nbin <= 200) {
851 G4cout <<
" Nb of bins in Edep plot = " << nbinEn <<
G4endl ;
859 G4cout <<
" Elow in the Edep plot = " << Enlow <<
G4endl ;
867 G4cout <<
" Ehigh in the Edep plot = " << Enhigh <<
G4endl ;
875 if(nbin > 0 && nbin <= 200) {
877 G4cout <<
" Nb of bins in gamma spectrum plot = " << nbinGamma <<
G4endl ;
885 G4cout <<
" Elow in the gamma spectrum plot = " << ElowGamma <<
G4endl ;
893 G4cout <<
" Ehigh in the gamma spectrum plot = " << EhighGamma <<
G4endl ;
899 if(nbin > 0 && nbin <= 200) {
901 G4cout <<
" Nb of bins in Etransmisssion plot = " << nbinTt <<
G4endl ;
909 G4cout <<
" Elow in the Etransmission plot = " << Ttlow <<
G4endl ;
917 G4cout <<
" Ehigh in the Etransmission plot = " << Tthigh <<
G4endl ;
923 if(nbin > 0 && nbin <= 200) {
925 G4cout <<
" Nb of bins in Ebackscattered plot = " << nbinTb <<
G4endl ;
933 G4cout <<
" Elow in the Ebackscattered plot = " << Tblow <<
G4endl ;
939 G4cout <<
" Ehigh in the Ebackscattered plot = " << Tbhigh <<
G4endl ;
944 if(nbin > 0 && nbin <= 200) {
946 G4cout <<
" Nb of bins in Tsecondary plot = " << nbinTsec <<
G4endl ;
953 G4cout <<
" Elow in the Tsecondary plot = " << Tseclow <<
G4endl ;
959 G4cout <<
" Ehigh in the Tsecondary plot = " << Tsechigh <<
G4endl ;
964 if(nbin > 0 && nbin <= 200) {
966 G4cout <<
" Nb of bins in R plot = " << nbinR <<
G4endl ;
979 G4cout <<
" Rhigh in the R plot = " << Rhigh <<
G4endl ;
984 if(nbin > 0 && nbin <= 200) {
986 G4cout <<
" Nb of bins in Z plot = " << nbinvertexz <<
G4endl ;
999 G4cout <<
" zhigh in the Z plot = " << zhigh <<
G4endl ;
1004 if(nbin > 0 && nbin <= 200) {
1006 G4cout <<
" Nb of bins in Theta plot = " << nbinTh <<
G4endl ;
1013 G4cout <<
" Tlow in the Theta plot = " << Thlow <<
G4endl ;
1019 G4cout <<
" Thigh in the Theta plot = " << Thhigh <<
G4endl ;
1024 if(nbin > 0 && nbin <= 200) {
1026 G4cout <<
" Nb of bins in Theta plot = " << nbinThback <<
G4endl ;
1033 G4cout <<
" Tlow in the Theta plot = " << Thlowback <<
G4endl ;
1038 Thhighback = Thigh ;
1039 G4cout <<
" Thigh in the Theta plot = " << Thhighback <<
G4endl ;
1046 Sum2Charged += nch*nch ;
1047 Sum2Neutral += nne*nne ;