Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/amsEcal/src/Run.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/amsEcal/src/Run.cc (Version 11.3.0) and /examples/advanced/amsEcal/src/Run.cc (Version 10.7.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 /// \file electromagnetic/TestEm11/src/Run.cc      26 /// \file electromagnetic/TestEm11/src/Run.cc
 27 /// \brief Implementation of the Run class         27 /// \brief Implementation of the Run class
 28 //                                                 28 //
 29 //                                                 29 // 
 30 //....oooOO0OOooo........oooOO0OOooo........oo     30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    32 
 33 #include "Run.hh"                                  33 #include "Run.hh"
 34 #include "DetectorConstruction.hh"                 34 #include "DetectorConstruction.hh"
 35 #include "HistoManager.hh"                         35 #include "HistoManager.hh"
 36                                                    36 
 37 #include "G4ParticleDefinition.hh"                 37 #include "G4ParticleDefinition.hh"
 38 #include "G4SystemOfUnits.hh"                      38 #include "G4SystemOfUnits.hh"
 39 #include "G4UnitsTable.hh"                         39 #include "G4UnitsTable.hh"
 40                                                    40 
 41 #include <iomanip>                                 41 #include <iomanip>
 42                                                    42 
 43 //....oooOO0OOooo........oooOO0OOooo........oo     43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 44                                                    44 
 45 Run::Run(DetectorConstruction* det)                45 Run::Run(DetectorConstruction* det)
 46 : G4Run(),                                         46 : G4Run(),
 47   fDetector(det),                                  47   fDetector(det), 
 48   fParticle(0), fEkin(0.),                         48   fParticle(0), fEkin(0.),
 49   nbOfModules(0), nbOfLayers(0), kLayerMax(0),     49   nbOfModules(0), nbOfLayers(0), kLayerMax(0),
 50   EtotCalor(0.), Etot2Calor(0.), EvisCalor(0.)     50   EtotCalor(0.), Etot2Calor(0.), EvisCalor(0.), Evis2Calor(0.),
 51   Eleak(0.), Eleak2(0.)                            51   Eleak(0.), Eleak2(0.)
 52 {                                                  52 {
 53   nbOfModules = fDetector->GetNbModules();         53   nbOfModules = fDetector->GetNbModules();    
 54   nbOfLayers  = fDetector->GetNbLayers();          54   nbOfLayers  = fDetector->GetNbLayers();
 55   kLayerMax = nbOfModules*nbOfLayers + 1;          55   kLayerMax = nbOfModules*nbOfLayers + 1;
 56                                                    56   
 57   //initialize vectors                             57   //initialize vectors
 58   //                                               58   //
 59   EtotLayer.resize(kLayerMax); Etot2Layer.resi     59   EtotLayer.resize(kLayerMax); Etot2Layer.resize(kLayerMax);
 60   EvisLayer.resize(kLayerMax); Evis2Layer.resi     60   EvisLayer.resize(kLayerMax); Evis2Layer.resize(kLayerMax);      
 61   for (G4int k=0; k<kLayerMax; k++) {              61   for (G4int k=0; k<kLayerMax; k++) {
 62     EtotLayer[k] = Etot2Layer[k] = EvisLayer[k     62     EtotLayer[k] = Etot2Layer[k] = EvisLayer[k] = Evis2Layer[k] = 0.0;
 63   }                                                63   }
 64                                                    64   
 65   EtotCalor = Etot2Calor = EvisCalor = Evis2Ca     65   EtotCalor = Etot2Calor = EvisCalor = Evis2Calor = Eleak = Eleak2 = 0.;
 66   EdLeak[0] = EdLeak[1] = EdLeak[2] = 0.;          66   EdLeak[0] = EdLeak[1] = EdLeak[2] = 0.;
 67 }                                                  67 }
 68                                                    68 
 69 //....oooOO0OOooo........oooOO0OOooo........oo     69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 70                                                    70 
 71 Run::~Run()                                        71 Run::~Run()
 72 { }                                                72 { }
 73                                                    73 
 74 //....oooOO0OOooo........oooOO0OOooo........oo     74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 75                                                    75 
 76 void Run::SetPrimary(G4ParticleDefinition* par     76 void Run::SetPrimary(G4ParticleDefinition* particle, G4double energy)
 77 {                                                  77 { 
 78   fParticle = particle;                            78   fParticle = particle;
 79   fEkin = energy;                                  79   fEkin = energy;
 80 }                                                  80 }
 81                                                    81 
 82 //....oooOO0OOooo........oooOO0OOooo........oo     82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 83                                                    83 
 84 void Run::SumEvents_1(G4int layer, G4double Et     84 void Run::SumEvents_1(G4int layer, G4double Etot, G4double Evis)
 85 {                                                  85 {
 86   //accumulate statistic per layer                 86   //accumulate statistic per layer
 87   //                                               87   //
 88   EtotLayer[layer] += Etot;  Etot2Layer[layer]     88   EtotLayer[layer] += Etot;  Etot2Layer[layer] += Etot*Etot;
 89   EvisLayer[layer] += Evis;  Evis2Layer[layer]     89   EvisLayer[layer] += Evis;  Evis2Layer[layer] += Evis*Evis;
 90 }                                                  90 }
 91                                                    91 
 92 //....oooOO0OOooo........oooOO0OOooo........oo     92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 93                                                    93 
 94 void Run::SumEvents_2(G4double etot, G4double      94 void Run::SumEvents_2(G4double etot, G4double evis, G4double eleak)
 95 {                                                  95 {
 96   //accumulate statistic for full calorimeter      96   //accumulate statistic for full calorimeter
 97   //                                               97   //
 98   EtotCalor += etot;  Etot2Calor += etot*etot;     98   EtotCalor += etot;  Etot2Calor += etot*etot;  
 99   EvisCalor += evis;  Evis2Calor += evis*evis;     99   EvisCalor += evis;  Evis2Calor += evis*evis; 
100   Eleak += eleak;  Eleak2 += eleak*eleak;         100   Eleak += eleak;  Eleak2 += eleak*eleak;
101 }                                                 101 }
102                                                   102 
103 //....oooOO0OOooo........oooOO0OOooo........oo    103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104                                                   104 
105 void Run::DetailedLeakage(G4int icase, G4doubl    105 void Run::DetailedLeakage(G4int icase, G4double energy)
106 {                                                 106 {
107   //forward, backward, lateral leakage            107   //forward, backward, lateral leakage
108   //                                              108   //
109   EdLeak[icase] += energy;                        109   EdLeak[icase] += energy;
110 }                                                 110 }
111                                                   111 
112 //....oooOO0OOooo........oooOO0OOooo........oo    112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113                                                   113 
114 void Run::Merge(const G4Run* run)                 114 void Run::Merge(const G4Run* run)
115 {                                                 115 {
116   const Run* localRun = static_cast<const Run*    116   const Run* localRun = static_cast<const Run*>(run);
117                                                   117 
118   // pass information about primary particle      118   // pass information about primary particle
119   fParticle = localRun->fParticle;                119   fParticle = localRun->fParticle;
120   fEkin     = localRun->fEkin;                    120   fEkin     = localRun->fEkin;
121                                                   121 
122   // accumulate sums                              122   // accumulate sums
123   //                                              123   //
124   for (G4int k=0; k<kLayerMax; k++) {             124   for (G4int k=0; k<kLayerMax; k++) {
125     EtotLayer[k]  += localRun->EtotLayer[k];      125     EtotLayer[k]  += localRun->EtotLayer[k];
126     Etot2Layer[k] += localRun->Etot2Layer[k];     126     Etot2Layer[k] += localRun->Etot2Layer[k];  
127     EvisLayer[k]  += localRun->EvisLayer[k];      127     EvisLayer[k]  += localRun->EvisLayer[k];
128     Evis2Layer[k] += localRun->Evis2Layer[k];     128     Evis2Layer[k] += localRun->Evis2Layer[k];  
129   }                                               129   }
130                                                   130   
131   EtotCalor  += localRun->EtotCalor;              131   EtotCalor  += localRun->EtotCalor;  
132   Etot2Calor += localRun->Etot2Calor;             132   Etot2Calor += localRun->Etot2Calor;  
133   EvisCalor  += localRun->EvisCalor;              133   EvisCalor  += localRun->EvisCalor;
134   Evis2Calor += localRun->Evis2Calor;             134   Evis2Calor += localRun->Evis2Calor;   
135   Eleak      += localRun->Eleak;                  135   Eleak      += localRun->Eleak;  
136   Eleak2     += localRun->Eleak2;                 136   Eleak2     += localRun->Eleak2;
137   EdLeak[0]  += localRun->EdLeak[0];              137   EdLeak[0]  += localRun->EdLeak[0];
138   EdLeak[1]  += localRun->EdLeak[1];              138   EdLeak[1]  += localRun->EdLeak[1];
139   EdLeak[2]  += localRun->EdLeak[2];              139   EdLeak[2]  += localRun->EdLeak[2];
140                                                   140   
141   G4Run::Merge(run);                              141   G4Run::Merge(run); 
142 }                                                 142 } 
143                                                   143 
144 //....oooOO0OOooo........oooOO0OOooo........oo    144 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
145                                                   145 
146 void Run::EndOfRun()                              146 void Run::EndOfRun()
147 {                                                 147 {
148   //calorimeter                                   148   //calorimeter
149   //                                              149   //
150   fDetector->PrintCalorParameters();              150   fDetector->PrintCalorParameters();
151                                                   151  
152   //run conditions                                152   //run conditions
153   //                                              153   //   
154   G4String partName = fParticle->GetParticleNa    154   G4String partName = fParticle->GetParticleName();
155   G4int nbEvents = numberOfEvent;                 155   G4int nbEvents = numberOfEvent;
156                                                   156 
157   G4int prec = G4cout.precision(3);               157   G4int prec = G4cout.precision(3);
158                                                   158 
159   G4cout << " The run was " << nbEvents << " "    159   G4cout << " The run was " << nbEvents << " " << partName << " of "
160          << G4BestUnit(fEkin,"Energy") << " th    160          << G4BestUnit(fEkin,"Energy") << " through the calorimeter" << G4endl;
161                                                   161  
162   G4cout << "---------------------------------    162   G4cout << "------------------------------------------------------------"
163          << G4endl;                               163          << G4endl;
164                                                   164    
165   //if no events, return                          165   //if no events, return
166   //                                              166   //
167   if (nbEvents == 0) return;                      167   if (nbEvents == 0) return;
168                                                   168 
169   //compute and print statistic                   169   //compute and print statistic
170   //                                              170   //
171   std::ios::fmtflags mode = G4cout.flags();       171   std::ios::fmtflags mode = G4cout.flags(); 
172                                                   172    
173   // energy in layers                             173   // energy in layers
174   //                                              174   //
175   G4cout.precision(prec);                         175   G4cout.precision(prec);  
176   G4cout << "\n             "                     176   G4cout << "\n             " 
177          << "total Energy          (rms/mean)     177          << "total Energy          (rms/mean)      "
178          << "visible Energy        (rms/mean)"    178          << "visible Energy        (rms/mean)" << G4endl;
179                                                   179   
180   G4AnalysisManager* analysisManager = G4Analy    180   G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
181                                                   181   
182   G4double meanEtot,meanEtot2,varianceEtot,rms    182   G4double meanEtot,meanEtot2,varianceEtot,rmsEtot,resEtot;  
183   G4double meanEvis,meanEvis2,varianceEvis,rms    183   G4double meanEvis,meanEvis2,varianceEvis,rmsEvis,resEvis;
184                                                   184   
185   for (G4int i1=1; i1<kLayerMax; i1++) {          185   for (G4int i1=1; i1<kLayerMax; i1++) {
186     //total energy                                186     //total energy
187     meanEtot  = EtotLayer[i1] /nbEvents;          187     meanEtot  = EtotLayer[i1] /nbEvents;
188     meanEtot2 = Etot2Layer[i1]/nbEvents;          188     meanEtot2 = Etot2Layer[i1]/nbEvents;    
189     varianceEtot = meanEtot2 - meanEtot*meanEt    189     varianceEtot = meanEtot2 - meanEtot*meanEtot;
190     resEtot = rmsEtot = 0.;                       190     resEtot = rmsEtot = 0.;
191     if (varianceEtot > 0.) rmsEtot = std::sqrt    191     if (varianceEtot > 0.) rmsEtot = std::sqrt(varianceEtot);
192     if (meanEtot > 0.) resEtot = 100*rmsEtot/m    192     if (meanEtot > 0.) resEtot = 100*rmsEtot/meanEtot;
193     analysisManager->FillH1(3, i1+0.5, meanEto    193     analysisManager->FillH1(3, i1+0.5, meanEtot);
194                                                   194       
195     //visible energy                              195     //visible energy
196     meanEvis  = EvisLayer[i1] /nbEvents;          196     meanEvis  = EvisLayer[i1] /nbEvents;
197     meanEvis2 = Evis2Layer[i1]/nbEvents;          197     meanEvis2 = Evis2Layer[i1]/nbEvents;    
198     varianceEvis = meanEvis2 - meanEvis*meanEv    198     varianceEvis = meanEvis2 - meanEvis*meanEvis;
199     resEvis = rmsEvis = 0.;                       199     resEvis = rmsEvis = 0.;
200     if (varianceEvis > 0.) rmsEvis = std::sqrt    200     if (varianceEvis > 0.) rmsEvis = std::sqrt(varianceEvis);
201     if (meanEvis > 0.) resEvis = 100*rmsEvis/m    201     if (meanEvis > 0.) resEvis = 100*rmsEvis/meanEvis;
202     analysisManager->FillH1(4, i1+0.5, meanEvi    202     analysisManager->FillH1(4, i1+0.5, meanEvis);
203                                                   203 
204     //print                                       204     //print
205     //                                            205     //
206     G4cout                                        206     G4cout
207       << "\n   layer " << i1 << ": "              207       << "\n   layer " << i1 << ": "
208       << std::setprecision(5)                     208       << std::setprecision(5)
209       << std::setw(6) << G4BestUnit(meanEtot,"    209       << std::setw(6) << G4BestUnit(meanEtot,"Energy") << " +- "
210       << std::setprecision(4)                     210       << std::setprecision(4)
211       << std::setw(5) << G4BestUnit( rmsEtot,"    211       << std::setw(5) << G4BestUnit( rmsEtot,"Energy") << "  ("
212       << std::setprecision(2)                     212       << std::setprecision(2) 
213       << std::setw(3) << resEtot  << " %)"        213       << std::setw(3) << resEtot  << " %)" 
214       << "     "                                  214       << "     "
215       << std::setprecision(5)                     215       << std::setprecision(5)
216       << std::setw(6) << G4BestUnit(meanEvis,"    216       << std::setw(6) << G4BestUnit(meanEvis,"Energy") << " +- "
217       << std::setprecision(4)                     217       << std::setprecision(4)
218       << std::setw(5) << G4BestUnit( rmsEvis,"    218       << std::setw(5) << G4BestUnit( rmsEvis,"Energy") << "  ("
219       << std::setprecision(2)                     219       << std::setprecision(2) 
220       << std::setw(3) << resEvis  << " %)";       220       << std::setw(3) << resEvis  << " %)"; 
221   }                                               221   }
222   G4cout << G4endl;                               222   G4cout << G4endl;
223                                                   223 
224   //calorimeter: total energy                     224   //calorimeter: total energy
225   meanEtot  = EtotCalor /nbEvents;                225   meanEtot  = EtotCalor /nbEvents;
226   meanEtot2 = Etot2Calor/nbEvents;                226   meanEtot2 = Etot2Calor/nbEvents;
227   varianceEtot = meanEtot2 - meanEtot*meanEtot    227   varianceEtot = meanEtot2 - meanEtot*meanEtot;
228   resEtot = rmsEtot = 0.;                         228   resEtot = rmsEtot = 0.;
229   if (varianceEtot > 0.) rmsEtot = std::sqrt(v    229   if (varianceEtot > 0.) rmsEtot = std::sqrt(varianceEtot);
230   if (meanEtot > 0.) resEtot = 100*rmsEtot/mea    230   if (meanEtot > 0.) resEtot = 100*rmsEtot/meanEtot;
231                                                   231 
232   //calorimeter: visible energy                   232   //calorimeter: visible energy
233   meanEvis  = EvisCalor /nbEvents;                233   meanEvis  = EvisCalor /nbEvents;
234   meanEvis2 = Evis2Calor/nbEvents;                234   meanEvis2 = Evis2Calor/nbEvents;
235   varianceEvis = meanEvis2 - meanEvis*meanEvis    235   varianceEvis = meanEvis2 - meanEvis*meanEvis;
236   resEvis = rmsEvis = 0.;                         236   resEvis = rmsEvis = 0.;
237   if (varianceEvis > 0.) rmsEvis = std::sqrt(v    237   if (varianceEvis > 0.) rmsEvis = std::sqrt(varianceEvis);
238   if (meanEvis > 0.) resEvis = 100*rmsEvis/mea    238   if (meanEvis > 0.) resEvis = 100*rmsEvis/meanEvis;
239                                                   239       
240   //print                                         240   //print
241   //                                              241   //
242   G4cout                                          242   G4cout
243     << "\n   total calor : "                      243     << "\n   total calor : "
244     << std::setprecision(5)                       244     << std::setprecision(5)
245     << std::setw(6) << G4BestUnit(meanEtot,"En    245     << std::setw(6) << G4BestUnit(meanEtot,"Energy") << " +- "
246     << std::setprecision(4)                       246     << std::setprecision(4)
247     << std::setw(5) << G4BestUnit( rmsEtot,"En    247     << std::setw(5) << G4BestUnit( rmsEtot,"Energy") << "  ("
248     << std::setprecision(2)                       248     << std::setprecision(2) 
249     << std::setw(3) << resEtot  << " %)"          249     << std::setw(3) << resEtot  << " %)" 
250     << "     "                                    250     << "     "
251     << std::setprecision(5)                       251     << std::setprecision(5)
252     << std::setw(6) << G4BestUnit(meanEvis,"En    252     << std::setw(6) << G4BestUnit(meanEvis,"Energy") << " +- "
253     << std::setprecision(4)                       253     << std::setprecision(4)
254     << std::setw(5) << G4BestUnit( rmsEvis,"En    254     << std::setw(5) << G4BestUnit( rmsEvis,"Energy") << "  ("
255     << std::setprecision(2)                       255     << std::setprecision(2) 
256     << std::setw(3) << resEvis  << " %)";         256     << std::setw(3) << resEvis  << " %)";
257                                                   257                      
258   G4cout << "\n-------------------------------    258   G4cout << "\n------------------------------------------------------------"
259          << G4endl;                               259          << G4endl;
260                                                   260 
261   //leakage                                       261   //leakage
262   G4double meanEleak,meanEleak2,varianceEleak,    262   G4double meanEleak,meanEleak2,varianceEleak,rmsEleak,ratio;
263   meanEleak  = Eleak /nbEvents;                   263   meanEleak  = Eleak /nbEvents;
264   meanEleak2 = Eleak2/nbEvents;                   264   meanEleak2 = Eleak2/nbEvents;
265   varianceEleak = meanEleak2 - meanEleak*meanE    265   varianceEleak = meanEleak2 - meanEleak*meanEleak;
266   rmsEleak = 0.;                                  266   rmsEleak = 0.;
267   if (varianceEleak > 0.) rmsEleak = std::sqrt    267   if (varianceEleak > 0.) rmsEleak = std::sqrt(varianceEleak);
268   ratio = 100*meanEleak/fEkin;                    268   ratio = 100*meanEleak/fEkin;
269                                                   269 
270   G4double forward = 100*EdLeak[0]/(nbEvents*f    270   G4double forward = 100*EdLeak[0]/(nbEvents*fEkin);
271   G4double bakward = 100*EdLeak[1]/(nbEvents*f    271   G4double bakward = 100*EdLeak[1]/(nbEvents*fEkin);
272   G4double lateral = 100*EdLeak[2]/(nbEvents*f    272   G4double lateral = 100*EdLeak[2]/(nbEvents*fEkin);
273                                                   273       
274   //print                                         274   //print
275   //                                              275   //
276   G4cout                                          276   G4cout
277     << "\n   Leakage : "                          277     << "\n   Leakage : "
278     << std::setprecision(5)                       278     << std::setprecision(5)
279     << std::setw(6) << G4BestUnit(meanEleak,"E    279     << std::setw(6) << G4BestUnit(meanEleak,"Energy") << " +- "
280     << std::setprecision(4)                       280     << std::setprecision(4)
281     << std::setw(5) << G4BestUnit( rmsEleak,"E    281     << std::setw(5) << G4BestUnit( rmsEleak,"Energy") 
282     << "\n   Eleak/Ebeam ="                       282     << "\n   Eleak/Ebeam ="
283     << std::setprecision(3)                       283     << std::setprecision(3) 
284     << std::setw(4) << ratio  << " %  ( forwar    284     << std::setw(4) << ratio  << " %  ( forward ="
285     << std::setw(4) << forward  << " %;   back    285     << std::setw(4) << forward  << " %;   backward ="
286     << std::setw(4) << bakward  << " %;   late    286     << std::setw(4) << bakward  << " %;   lateral ="
287     << std::setw(4) << lateral  << " %)"          287     << std::setw(4) << lateral  << " %)"             
288     << G4endl;                                    288     << G4endl;
289                                                   289   
290   G4cout.setf(mode,std::ios::floatfield);         290   G4cout.setf(mode,std::ios::floatfield);
291   G4cout.precision(prec);                         291   G4cout.precision(prec);
292                                                   292   
293   //normalize histograms                          293   //normalize histograms
294   G4double factor = 1./nbEvents;                  294   G4double factor = 1./nbEvents;
295   analysisManager->ScaleH1(5,factor);             295   analysisManager->ScaleH1(5,factor);
296 }                                                 296 }
297                                                   297 
298 //....oooOO0OOooo........oooOO0OOooo........oo    298 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
299                                                   299