Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Em10RunAction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 // $Id$
31 //
32 //
33 
34 
35 #include "Em10RunAction.hh"
36 #include "Em10RunMessenger.hh"
37 
38 #include "G4Run.hh"
39 #include "G4UImanager.hh"
40 #include "G4VVisManager.hh"
41 #include "G4ios.hh"
42 #include <iomanip>
43 
44 #include "G4PhysicalConstants.hh"
45 #include "G4SystemOfUnits.hh"
46 #include "Randomize.hh"
47 
49 
51  :histName("histfile"),nbinStep(0),nbinEn(0),nbinTt(0),nbinTb(0),
52  nbinTsec(0),nbinTh(0),nbinThback(0),nbinR(0),nbinGamma(0),
53  nbinvertexz(0)
54 {
55  runMessenger = new Em10RunMessenger(this);
56  saveRndm = 1;
57 
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=
67  oververtexz=0.;
68 }
69 
71 
73 {
74  delete runMessenger;
75 }
76 
78 
79 void Em10RunAction::bookHisto()
80 {
81 }
82 
84 
86 {
87  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
88 
89  // save Rndm status
90  if (saveRndm > 0)
91  {
93  CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
94  }
96 
98 
99  if(pVVisManager) UI->ApplyCommand("/vis/scene/notifyHandlers");
100 
101 
102  EnergySumAbs = 0. ;
103  EnergySquareSumAbs = 0.;
104  tlSumAbs = 0. ;
105  tlsquareSumAbs = 0. ;
106  nStepSumCharged = 0. ;
107  nStepSum2Charged= 0. ;
108  nStepSumNeutral = 0. ;
109  nStepSum2Neutral= 0. ;
110  TotNbofEvents = 0. ;
111  SumCharged=0.;
112  SumNeutral=0.;
113  Sum2Charged=0.;
114  Sum2Neutral=0.;
115  Selectron=0.;
116  Spositron=0.;
117 
118  Transmitted=0.;
119  Reflected =0.;
120 
121  // plot definitions
122 
123  if(nbinStep>0)
124  {
125  dStep=(Stephigh-Steplow)/nbinStep;
126  entryStep=0.;
127  underStep=0.;
128  overStep=0.;
129  for(G4int ist=0; ist<200; ist++)
130  {
131  distStep[ist]=0.;
132  }
133  }
134  if(nbinEn>0)
135  {
136  dEn = (Enhigh-Enlow)/nbinEn ;
137  entryEn=0.;
138  underEn=0.;
139  overEn=0.;
140 
141  for (G4int ien=0; ien<200; ien++) distEn[ien]=0.;
142  }
143  if(nbinTt>0)
144  {
145  dTt = (Tthigh-Ttlow)/nbinTt ;
146  entryTt=0.;
147  underTt=0.;
148  overTt=0.;
149 
150  for (G4int itt=0; itt<200; itt++) distTt[itt]=0.;
151 
152  Ttmean=0.;
153  Tt2mean=0.;
154  }
155  if(nbinTb>0)
156  {
157  dTb = (Tbhigh-Tblow)/nbinTb ;
158  entryTb=0.;
159  underTb=0.;
160  overTb=0.;
161  for (G4int itt=0; itt<200; itt++)
162  {
163  distTb[itt]=0.;
164  }
165  Tbmean=0.;
166  Tb2mean=0.;
167  }
168  if(nbinTsec>0)
169  {
170  dTsec = (Tsechigh-Tseclow)/nbinTsec ;
171  entryTsec=0.;
172  underTsec=0.;
173  overTsec=0.;
174  for (G4int its=0; its<200; its++)
175  {
176  distTsec[its]=0.;
177  }
178  }
179  if(nbinTh>0)
180  {
181  dTh = (Thhigh-Thlow)/nbinTh ;
182  entryTh=0.;
183  underTh=0.;
184  overTh=0.;
185  for (G4int ith=0; ith<200; ith++)
186  {
187  distTh[ith]=0.;
188  }
189  }
190 
191  if(nbinThback>0)
192  {
193  dThback = (Thhighback-Thlowback)/nbinThback ;
194  entryThback=0.;
195  underThback=0.;
196  overThback=0.;
197  for (G4int ithback=0; ithback<200; ithback++)
198  {
199  distThback[ithback]=0.;
200  }
201  }
202 
203 
204  if(nbinR >0)
205  {
206  dR = (Rhigh-Rlow)/nbinR ;
207  entryR =0.;
208  underR =0.;
209  overR =0.;
210  for (G4int ir =0; ir<200; ir++)
211  {
212  distR[ir]=0.;
213  }
214  Rmean=0.;
215  R2mean=0.;
216  }
217 
218  if(nbinGamma>0)
219  {
220  dEGamma = std::log(EhighGamma/ElowGamma)/nbinGamma ;
221  entryGamma = 0.;
222  underGamma=0.;
223  overGamma=0.;
224  for (G4int ig=0; ig<200; ig++)
225  {
226  distGamma[ig]=0.;
227  }
228  }
229  if(nbinvertexz>0)
230  {
231  dz=(zhigh-zlow)/nbinvertexz;
232  entryvertexz=0.;
233  undervertexz=0.;
234  oververtexz=0.;
235  for(G4int iz=0; iz<200; iz++)
236  {
237  distvertexz[iz]=0.;
238  }
239  }
240 
241  bookHisto();
242 }
243 
245 
247 {
248  G4double sAbs,sigAbs,sigstep,sigcharged,signeutral;
249  if(0.0 >= TotNbofEvents) { return; }
250 
251  tlSumAbs /= TotNbofEvents ;
252  sAbs = tlsquareSumAbs/TotNbofEvents-tlSumAbs*tlSumAbs ;
253  if(sAbs>0.)
254  sAbs = std::sqrt(sAbs/TotNbofEvents) ;
255  else
256  sAbs = 0. ;
257 
258  EnergySumAbs /= TotNbofEvents ;
259  sigAbs = EnergySquareSumAbs/TotNbofEvents-EnergySumAbs*EnergySumAbs;
260  if(sigAbs>0.)
261  sigAbs = std::sqrt(sigAbs/TotNbofEvents);
262  else
263  sigAbs = 0.;
264 
265  nStepSumCharged /= TotNbofEvents ;
266  sigstep = nStepSum2Charged/TotNbofEvents-nStepSumCharged*nStepSumCharged;
267  if(sigstep>0.)
268  sigstep = std::sqrt(sigstep/TotNbofEvents);
269  else
270  sigstep = 0.;
271  G4double sigch=sigstep ;
272 
273  nStepSumNeutral /= TotNbofEvents ;
274  sigstep = nStepSum2Neutral/TotNbofEvents-nStepSumNeutral*nStepSumNeutral;
275  if(sigstep>0.)
276  sigstep = std::sqrt(sigstep/TotNbofEvents);
277  else
278  sigstep = 0.;
279  G4double signe=sigstep ;
280 
281  SumCharged /= TotNbofEvents;
282  sigcharged = Sum2Charged/TotNbofEvents-SumCharged*SumCharged;
283  if(sigcharged>0.)
284  sigcharged = std::sqrt(sigcharged/TotNbofEvents);
285  else
286  sigcharged = 0. ;
287 
288  SumNeutral /= TotNbofEvents;
289  signeutral = Sum2Neutral/TotNbofEvents-SumNeutral*SumNeutral;
290  if(signeutral>0.)
291  signeutral = std::sqrt(signeutral/TotNbofEvents);
292  else
293  signeutral = 0. ;
294 
295  Selectron /= TotNbofEvents ;
296  Spositron /= TotNbofEvents ;
297 
298  Transmitted /=TotNbofEvents ;
299  Reflected /=TotNbofEvents ;
300  G4cout << " ================== run summary =====================" << G4endl;
301  G4int prec = G4cout.precision(6);
302  G4cout << " end of Run TotNbofEvents = " <<
303  TotNbofEvents << G4endl ;
304  G4cout << " mean charged track length in absorber=" <<
305  tlSumAbs/mm << " +- " << sAbs/mm <<
306  " mm " << G4endl;
307  G4cout << G4endl;
308  G4cout << " mean energy deposit in absorber=" <<
309  EnergySumAbs/MeV << " +- " << sigAbs/MeV <<
310  " MeV " << G4endl ;
311  G4cout << G4endl ;
312  G4cout << " mean number of steps in absorber (charged) =" <<
313  nStepSumCharged << " +- " << sigch <<
314  " " << G4endl ;
315  G4cout << " mean number of steps in absorber (neutral) =" <<
316  nStepSumNeutral << " +- " << signe <<
317  " " << G4endl ;
318  G4cout << G4endl ;
319  G4cout << " mean number of charged secondaries = " <<
320  SumCharged << " +- " << sigcharged << G4endl;
321  G4cout << G4endl ;
322  G4cout << " mean number of neutral secondaries = " <<
323  SumNeutral << " +- " << signeutral << G4endl;
324  G4cout << G4endl ;
325 
326  G4cout << " mean number of e-s =" << Selectron <<
327  " and e+s =" << Spositron << G4endl;
328  G4cout << G4endl;
329 
330  G4cout << "(number) transmission coeff=" << Transmitted <<
331  " reflection coeff=" << Reflected << G4endl;
332  G4cout << G4endl;
333 
334  if(nbinStep>0)
335  {G4double E , dnorm, norm ;
336  G4cout << " step number/event distribution " << G4endl ;
337  G4cout << "#entries=" << entryStep << " #underflows=" << underStep <<
338  " #overflows=" << overStep << G4endl ;
339  if( entryStep>0.)
340  {
341  E = Steplow - dStep ;
342  norm = TotNbofEvents ;
343  G4cout << " bin nb nsteplow entries normalized " << G4endl ;
344  for(G4int iss=0; iss<nbinStep; iss++)
345  {
346  E += dStep ;
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 ;
351  }
352  G4cout << G4endl;
353  }
354  }
355  if(nbinEn > 0)
356  {
357  std::ofstream fileOut("distribution.out", std::ios::out ) ;
358  fileOut.setf( std::ios::scientific, std::ios::floatfield );
359 
360  std::ofstream normOut("normDist.out", std::ios::out ) ;
361  normOut.setf( std::ios::scientific, std::ios::floatfield );
362 
363  G4double E , dnorm, norm,fmax,Emp ;
364  Emp=-999.999 ;
365  G4cout << " energy deposit distribution " << G4endl ;
366  G4cout << "#entries=" << entryEn << " #underflows=" << underEn <<
367  " #overflows=" << overEn << G4endl ;
368  if( entryEn>0.)
369  {
370  E = Enlow - dEn ;
371  norm = TotNbofEvents*1.0 ; // *dEn ;
372  G4cout << " bin nb Elow entries normalized " << G4endl ;
373  fmax = 0. ;
374 
375  for(G4int ien=0; ien<nbinEn; ien++)
376  {
377  E += dEn ;
378 
379  if(distEn[ien]>fmax)
380  {
381  fmax = distEn[ien] ;
382  Emp = E ; // most probable roughly
383  }
384  dnorm = distEn[ien]/norm;
385 
386  G4cout << std::setw(5) << ien << std::setw(10) << E/keV <<
387  std::setw(12) << distEn[ien] <<
388  std::setw(12) << dnorm << G4endl ;
389 
390  fileOut << E/keV << "\t"<< distEn[ien] << G4endl ;
391  normOut << E/keV << "\t"<< dnorm << G4endl ;
392  }
393  G4cout << G4endl;
394  G4int ii ;
395  G4double E1,E2 ;
396  E1=-1.e6 ;
397  E2=+1.e6 ;
398  E = Enlow -dEn ;
399  ii = -1;
400 
401  for(G4int i1=0; i1<nbinEn; i1++)
402  {
403  E += dEn ;
404  if(ii<0)
405  {
406  if(distEn[i1] >= 0.5*fmax)
407  {
408  E1=E ;
409  ii=i1 ;
410  }
411  }
412  }
413  E = Enlow -dEn ;
414 
415  for(G4int i2=0; i2<nbinEn; i2++)
416  {
417  E += dEn ;
418 
419  if(distEn[i2] >= 0.5*fmax) E2=E ;
420  }
421  G4cout << " Emp = " << std::setw(15) << Emp/MeV << " width="
422  << std::setw(15) << (E2-E1)/MeV << " MeV " << G4endl;
423  G4cout << G4endl ;
424  }
425  }
426  if(nbinTt>0)
427  {
428  G4double E , dnorm, norm ,sig;
429  G4cout << " transmitted energy distribution " << G4endl ;
430  G4cout << "#entries=" << entryTt << " #underflows=" << underTt <<
431  " #overflows=" << overTt << G4endl ;
432  if( entryTt>0.)
433  {
434  Ttmean /= entryTt;
435  sig=Tt2mean/entryTt-Ttmean*Ttmean ;
436  if(sig<=0.)
437  sig=0.;
438  else
439  sig=std::sqrt(sig/entryTt) ;
440  G4cout << " mean energy of transmitted particles=" << Ttmean/keV <<
441  " +- " << sig/keV << " keV." << G4endl;
442  E = Ttlow - dTt ;
443  norm = TotNbofEvents*dTt ;
444  G4cout << " bin nb Elow entries normalized " << G4endl ;
445  for(G4int itt=0; itt<nbinTt; itt++)
446  {
447  E += dTt ;
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 ;
452  }
453  G4cout << G4endl;
454  }
455  }
456  if(nbinTb>0)
457  {
458  G4double E , dnorm, norm ,sig;
459  G4cout << " backscattered energy distribution " << G4endl ;
460  G4cout << "#entries=" << entryTb << " #underflows=" << underTb <<
461  " #overflows=" << overTb << G4endl ;
462  if( entryTb>0.)
463  {
464  Tbmean /= entryTb;
465  sig=Tb2mean/entryTb-Tbmean*Tbmean ;
466  if(sig<=0.)
467  sig=0.;
468  else
469  sig=std::sqrt(sig/entryTb) ;
470  G4cout << " mean energy of backscattered particles=" << Tbmean/keV <<
471  " +- " << sig/keV << " keV." << G4endl;
472  E = Tblow - dTb ;
473  norm = TotNbofEvents*dTb ;
474  G4cout << " bin nb Elow entries normalized " << G4endl ;
475  for(G4int itt=0; itt<nbinTb; itt++)
476  {
477  E += dTb ;
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 ;
482  }
483  G4cout << G4endl;
484  }
485  }
486  if(nbinTsec>0)
487  {G4double E , dnorm, norm ;
488  G4cout << " energy distribution of charged secondaries " << G4endl ;
489  G4cout << "#entries=" << entryTsec << " #underflows=" << underTsec <<
490  " #overflows=" << overTsec << G4endl ;
491  if( entryTsec>0.)
492  {
493  E = Tseclow - dTsec ;
494  norm = TotNbofEvents*dTsec ;
495  G4cout << " bin nb Elow entries normalized " << G4endl ;
496  for(G4int itt=0; itt<nbinTsec; itt++)
497  {
498  E += dTsec ;
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 ;
503  }
504  G4cout << G4endl;
505  }
506  }
507 
508  if(nbinR >0)
509  {G4double R , dnorm, norm,sig ;
510  G4cout << " R distribution " << G4endl ;
511  G4cout << "#entries=" << entryR << " #underflows=" << underR <<
512  " #overflows=" << overR << G4endl ;
513  if( entryR >0.)
514  {
515  Rmean /= entryR;
516  sig = R2mean/entryR - Rmean*Rmean;
517  if(sig<=0.) sig=0. ;
518  else sig = std::sqrt(sig/entryR) ;
519  G4cout << " mean lateral displacement at exit=" << Rmean/mm << " +- "
520  << sig/mm << " mm." << G4endl ;
521  R = Rlow - dR ;
522  norm = TotNbofEvents*dR ;
523  G4cout << " bin nb Rlow entries normalized " << G4endl ;
524  for(G4int ier=0; ier<nbinR ; ier++)
525  {
526  R+= dR ;
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 ;
531  }
532  G4cout << G4endl;
533  }
534  }
535 
536  if(nbinTh>0)
537  {G4double Th,Thdeg, dnorm, norm,fac0,fnorm,pere,Thpere,Thmean,sum;
538  G4cout << " angle distribution " << G4endl ;
539  G4cout << "#entries=" << entryTh << " #underflows=" << underTh <<
540  " #overflows=" << overTh << G4endl ;
541  if( entryTh>0.)
542  {
543  Th= Thlow - dTh ;
544  norm = TotNbofEvents ;
545  if(distTh[0] == 0.)
546  fac0 = 1. ;
547  else
548  fac0 = 1./distTh[0] ;
549  pere = 1./std::exp(1.) ;
550 
551  G4cout << " bin nb Thlowdeg Thlowrad " <<
552  " entries normalized " << G4endl ;
553  Thpere = 0. ;
554  sum = 0. ;
555  Thmean = 0. ;
556  for(G4int ien=0; ien<nbinTh; ien++)
557  {
558  Th+= dTh ;
559  Thdeg = Th*180./pi ;
560  sum += distTh[ien] ;
561  Thmean += distTh[ien]*(Th+0.5*dTh) ;
562  dnorm = distTh[ien]/norm;
563  fnorm = fac0*distTh[ien] ;
564  if( fnorm > pere)
565  Thpere = Th ;
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 ;
570  }
571  Thmean /= sum ;
572  G4cout << G4endl;
573  G4cout << " mean = " << Thmean << " rad or " << 180.*Thmean/pi <<
574  " deg." << G4endl;
575  G4cout << " theta(1/e)=" << Thpere << " - " << Thpere+dTh << " rad "
576  << " or " << 180.*Thpere/pi << " - " << 180.*(Thpere+dTh)/pi
577  << " deg." << G4endl;
578  G4cout << G4endl;
579  }
580  }
581 
582  if(nbinThback>0)
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 ;
587  if( entryThback>0.)
588  {
589  Thb= Thlowback - dThback ;
590  normb = TotNbofEvents ;
591  if(distThback[0] == 0.)
592  fac0b = 1. ;
593  else
594  fac0b = 1./distThback[0] ;
595  pereb = 1./std::exp(1.) ;
596 
597  G4cout << " bin nb Thlowdeg Thlowrad " <<
598  " entries normalized " << G4endl ;
599  Thpereb = 0. ;
600  sumb = 0. ;
601  Thmeanb = 0. ;
602  for(G4int ien=0; ien<nbinThback; ien++)
603  {
604  Thb+= dThback ;
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] ;
610  if( fnormb > pereb)
611  Thpereb = Thb ;
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 ;
616  }
617  Thmeanb /= sumb ;
618  G4cout << G4endl;
619  G4cout << " mean = " << Thmeanb << " rad or " << 180.*Thmeanb/pi <<
620  " deg." << G4endl;
621  G4cout << " theta(1/e)=" << Thpereb << " - " << Thpereb+dThback << " rad "
622  << " or " << 180.*Thpereb/pi << " - " << 180.*(Thpereb+dThback)/pi
623  << " deg." << G4endl;
624  G4cout << G4endl;
625  }
626  }
627 
628  if(nbinGamma>0)
629  {G4double E , fact,dnorm, norm ;
630  G4cout << " gamma energy distribution " << G4endl ;
631  G4cout << "#entries=" << entryGamma << " #underflows=" << underGamma <<
632  " #overflows=" << overGamma << G4endl ;
633  if( entryGamma>0.)
634  {
635  fact=std::exp(dEGamma) ;
636  E = ElowGamma/fact ;
637  norm = TotNbofEvents*dEGamma;
638  G4cout << " bin nb Elow entries normalized " << G4endl ;
639  for(G4int itt=0; itt<nbinGamma; itt++)
640  {
641  E *= fact ;
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 ;
646  }
647  G4cout << G4endl;
648  }
649  }
650 
651  if(nbinvertexz >0)
652  {G4double z , dnorm, norm ;
653  G4cout << " vertex Z distribution " << G4endl ;
654  G4cout << "#entries=" << entryvertexz << " #underflows=" << undervertexz <<
655  " #overflows=" << oververtexz << G4endl ;
656  if( entryvertexz >0.)
657  {
658  z =zlow - dz ;
659  norm = TotNbofEvents*dz ;
660  G4cout << " bin nb zlow entries normalized " << G4endl ;
661  for(G4int iez=0; iez<nbinvertexz ; iez++)
662  {
663  z+= dz ;
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 ;
669  }
670  G4cout << G4endl;
671  }
672  }
673 
674  G4cout.precision(prec);
675 
677  {
678  G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
679  }
680 
681  // save Rndm status
682 
683  if (saveRndm == 1)
684  {
686  CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
687  }
688 }
689 
691 
693 {
694  TotNbofEvents += 1. ;
695 }
696 
698 
700 {
701  nStepSumCharged += nstp;
702  nStepSum2Charged += nstp*nstp;
703 }
704 
706 
708 {
709  nStepSumNeutral += nstp;
710  nStepSum2Neutral += nstp*nstp;
711 }
712 
714 
716 {
717  EnergySumAbs += Eabs;
718  EnergySquareSumAbs += Eabs*Eabs;
719 }
720 
722 
724 {
725  tlSumAbs += tlabs;
726  tlsquareSumAbs += tlabs*tlabs ;
727 }
728 
730 
732 {
733  Transmitted += tr ;
734  Reflected += ref;
735 }
736 
738 
740 {
741 }
742 
744 
746 {
747  G4double bin ;
748  G4int ibin;
749 
750  entryEn += 1. ;
751  if(Enlow < Enhigh) {
752 
753  if(En < Enlow) underEn += 1. ;
754  else if( En >= Enhigh) overEn += 1. ;
755  else
756  {
757  bin = (En-Enlow)/dEn;
758  ibin= (G4int)bin;
759  if(ibin < 0) { ibin = 0; }
760  if(ibin > 199) { ibin = 199; }
761  distEn[ibin] += 1.;
762  }
763  }
764 }
765 
767 
769 {
770 }
771 
773 
775 {
776 }
777 
779 
781 {
782 }
783 
785 
787 {
788 }
789 
791 
793 {
794 }
795 
797 
799 {
800 }
801 
803 
805 {
806 }
807 
809 
811 {
812 }
813 
815 
817 {
818  histName = name ;
819  G4cout << " hist file = " << histName << G4endl;
820 }
821 
823 {
824  if(nbin> 0 && nbin<= 200) {
825  nbinStep = nbin;
826  G4cout << " Nb of bins in #step plot = " << nbinStep << G4endl ;
827  }
828 }
829 
831 {
832  if(low >= 0.0){
833  Steplow = low ;
834  G4cout << " low in the #step plot = " << Steplow << G4endl ;
835  }
836 }
838 {
839  if(high > 0.0) {
840  Stephigh = high;
841  G4cout << " high in the #step plot = " << Stephigh << G4endl ;
842  }
843 }
844 
846 
848 {
849  if(nbin > 0 && nbin <= 200) {
850  nbinEn = nbin;
851  G4cout << " Nb of bins in Edep plot = " << nbinEn << G4endl ;
852  }
853 }
854 
856 {
857  if(Elow >= 0.0) {
858  Enlow = Elow ;
859  G4cout << " Elow in the Edep plot = " << Enlow << G4endl ;
860  }
861 }
862 
864 {
865  if(Ehigh > 0.0) {
866  Enhigh = Ehigh ;
867  G4cout << " Ehigh in the Edep plot = " << Enhigh << G4endl ;
868  }
869 }
870 
872 
874 {
875  if(nbin > 0 && nbin <= 200) {
876  nbinGamma = nbin;
877  G4cout << " Nb of bins in gamma spectrum plot = " << nbinGamma << G4endl ;
878  }
879 }
880 
882 {
883  if(Elow >= 0.0) {
884  ElowGamma = Elow;
885  G4cout << " Elow in the gamma spectrum plot = " << ElowGamma << G4endl ;
886  }
887 }
888 
890 {
891  if(Ehigh > 0.0) {
892  EhighGamma = Ehigh;
893  G4cout << " Ehigh in the gamma spectrum plot = " << EhighGamma << G4endl ;
894  }
895 }
896 
898 {
899  if(nbin > 0 && nbin <= 200) {
900  nbinTt = nbin;
901  G4cout << " Nb of bins in Etransmisssion plot = " << nbinTt << G4endl ;
902  }
903 }
904 
906 {
907  if(Elow >= 0.0) {
908  Ttlow = Elow;
909  G4cout << " Elow in the Etransmission plot = " << Ttlow << G4endl ;
910  }
911 }
912 
914 {
915  if(Ehigh > 0.0) {
916  Tthigh = Ehigh;
917  G4cout << " Ehigh in the Etransmission plot = " << Tthigh << G4endl ;
918  }
919 }
920 
922 {
923  if(nbin > 0 && nbin <= 200) {
924  nbinTb = nbin;
925  G4cout << " Nb of bins in Ebackscattered plot = " << nbinTb << G4endl ;
926  }
927 }
928 
930 {
931 
932  Tblow = Elow ;
933  G4cout << " Elow in the Ebackscattered plot = " << Tblow << G4endl ;
934 }
935 
937 {
938  Tbhigh = Ehigh ;
939  G4cout << " Ehigh in the Ebackscattered plot = " << Tbhigh << G4endl ;
940 }
941 
943 {
944  if(nbin > 0 && nbin <= 200) {
945  nbinTsec = nbin;
946  G4cout << " Nb of bins in Tsecondary plot = " << nbinTsec << G4endl ;
947  }
948 }
949 
951 {
952  Tseclow = Elow ;
953  G4cout << " Elow in the Tsecondary plot = " << Tseclow << G4endl ;
954 }
955 
957 {
958  Tsechigh = Ehigh ;
959  G4cout << " Ehigh in the Tsecondary plot = " << Tsechigh << G4endl ;
960 }
961 
963 {
964  if(nbin > 0 && nbin <= 200) {
965  nbinR = nbin;
966  G4cout << " Nb of bins in R plot = " << nbinR << G4endl ;
967  }
968 }
969 
971 {
972  Rlow = rlow ;
973  G4cout << " Rlow in the R plot = " << Rlow << G4endl ;
974 }
975 
977 {
978  Rhigh = rhigh ;
979  G4cout << " Rhigh in the R plot = " << Rhigh << G4endl ;
980 }
981 
983 {
984  if(nbin > 0 && nbin <= 200) {
985  nbinvertexz = nbin;
986  G4cout << " Nb of bins in Z plot = " << nbinvertexz << G4endl ;
987  }
988 }
989 
991 {
992  zlow = z ;
993  G4cout << " zlow in the Z plot = " << zlow << G4endl ;
994 }
995 
997 {
998  zhigh = z ;
999  G4cout << " zhigh in the Z plot = " << zhigh << G4endl ;
1000 }
1001 
1003 {
1004  if(nbin > 0 && nbin <= 200) {
1005  nbinTh = nbin;
1006  G4cout << " Nb of bins in Theta plot = " << nbinTh << G4endl ;
1007  }
1008 }
1009 
1011 {
1012  Thlow = Tlow ;
1013  G4cout << " Tlow in the Theta plot = " << Thlow << G4endl ;
1014 }
1015 
1017 {
1018  Thhigh = Thigh ;
1019  G4cout << " Thigh in the Theta plot = " << Thhigh << G4endl ;
1020 }
1021 
1023 {
1024  if(nbin > 0 && nbin <= 200) {
1025  nbinThback = nbin;
1026  G4cout << " Nb of bins in Theta plot = " << nbinThback << G4endl ;
1027  }
1028 }
1029 
1031 {
1032  Thlowback = Tlow ;
1033  G4cout << " Tlow in the Theta plot = " << Thlowback << G4endl ;
1034 }
1035 
1037 {
1038  Thhighback = Thigh ;
1039  G4cout << " Thigh in the Theta plot = " << Thhighback << G4endl ;
1040 }
1041 
1043 {
1044  SumCharged += nch ;
1045  SumNeutral += nne ;
1046  Sum2Charged += nch*nch ;
1047  Sum2Neutral += nne*nne ;
1048 }
1049 
1051 {
1052  Selectron += nele;
1053  Spositron += npos;
1054 }
1055 
1056 //
1057 //