Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/medical/fanoCavity2/src/RunAction.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/extended/medical/fanoCavity2/src/RunAction.cc (Version 11.3.0) and /examples/extended/medical/fanoCavity2/src/RunAction.cc (Version 9.6.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 medical/fanoCavity2/src/RunAction.cc     26 /// \file medical/fanoCavity2/src/RunAction.cc
 27 /// \brief Implementation of the RunAction cla     27 /// \brief Implementation of the RunAction class
 28 //                                                 28 //
 29 //                                             <<  29 // $Id$
                                                   >>  30 // 
 30 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    33 
 33 #include "RunAction.hh"                            34 #include "RunAction.hh"
 34                                                << 
 35 #include "DetectorConstruction.hh"                 35 #include "DetectorConstruction.hh"
 36 #include "HistoManager.hh"                     << 
 37 #include "PrimaryGeneratorAction.hh"               36 #include "PrimaryGeneratorAction.hh"
 38 #include "Run.hh"                              <<  37 #include "HistoManager.hh"
 39                                                    38 
 40 #include "G4Electron.hh"                       << 
 41 #include "G4EmCalculator.hh"                   << 
 42 #include "G4Run.hh"                                39 #include "G4Run.hh"
 43 #include "G4RunManager.hh"                         40 #include "G4RunManager.hh"
 44 #include "G4SystemOfUnits.hh"                  << 
 45 #include "G4UnitsTable.hh"                         41 #include "G4UnitsTable.hh"
 46 #include "Randomize.hh"                        <<  42 #include "G4EmCalculator.hh"
                                                   >>  43 #include "G4Electron.hh"
 47                                                    44 
                                                   >>  45 #include "G4SystemOfUnits.hh"
                                                   >>  46 #include "Randomize.hh"
 48 #include <iomanip>                                 47 #include <iomanip>
 49                                                    48 
 50 //....oooOO0OOooo........oooOO0OOooo........oo     49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 51                                                    50 
 52 RunAction::RunAction(DetectorConstruction* det <<  51 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin, 
 53   : fDetector(det), fKinematic(kin), fRun(0),  <<  52                      HistoManager* histo)
 54 {                                              <<  53 :fDetector(det),fKinematic(kin),fProcCounter(0),fHistoManager(histo)
 55   fHistoManager = new HistoManager();          <<  54 { }
 56 }                                              << 
 57                                                    55 
 58 //....oooOO0OOooo........oooOO0OOooo........oo     56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 59                                                    57 
 60 RunAction::~RunAction()                            58 RunAction::~RunAction()
 61 {                                              <<  59 { }
 62   delete fHistoManager;                        << 
 63 }                                              << 
 64                                                    60 
 65 //....oooOO0OOooo........oooOO0OOooo........oo     61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 66 G4Run* RunAction::GenerateRun()                <<  62 
 67 {                                              <<  63 void RunAction::BeginOfRunAction(const G4Run* aRun)
 68   fRun = new Run(fDetector, fKinematic, isMast <<  64 {    
 69   return fRun;                                 <<  65   // do not save Rndm status
                                                   >>  66   G4RunManager::GetRunManager()->SetRandomNumberStore(false);
                                                   >>  67   CLHEP::HepRandom::showEngineStatus();
                                                   >>  68   
                                                   >>  69   G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
                                                   >>  70     
                                                   >>  71   G4int NbofEvents = aRun->GetNumberOfEventToBeProcessed();
                                                   >>  72   if (NbofEvents == 0) return;
                                                   >>  73   
                                                   >>  74   //run conditions
                                                   >>  75   //     
                                                   >>  76   G4ParticleDefinition* particleGun 
                                                   >>  77                     = fKinematic->GetParticleGun()->GetParticleDefinition();
                                                   >>  78   G4String partName = particleGun->GetParticleName();                             
                                                   >>  79   fEnergyGun = fKinematic->GetParticleGun()->GetParticleEnergy();
                                                   >>  80   
                                                   >>  81   //geometry : effective wall volume
                                                   >>  82   //  
                                                   >>  83   G4double cavityThickness = fDetector->GetCavityThickness();             
                                                   >>  84   G4Material* mateCavity   = fDetector->GetCavityMaterial();
                                                   >>  85   G4double densityCavity   = mateCavity->GetDensity();
                                                   >>  86   fMassCavity = cavityThickness*densityCavity;
                                                   >>  87       
                                                   >>  88   G4double wallThickness = fDetector->GetWallThickness();
                                                   >>  89   G4Material* mateWall   = fDetector->GetWallMaterial();
                                                   >>  90   G4double densityWall   = mateWall->GetDensity();
                                                   >>  91   
                                                   >>  92   G4EmCalculator emCal;
                                                   >>  93   G4double RangeWall = emCal.GetCSDARange(fEnergyGun,particleGun,mateWall);
                                                   >>  94   G4double factor = 1.2;
                                                   >>  95   G4double effWallThick = factor*RangeWall;
                                                   >>  96   if ((effWallThick > wallThickness)||(effWallThick <= 0.))
                                                   >>  97     effWallThick = wallThickness;
                                                   >>  98   fMassWall = 2*effWallThick*densityWall;  
                                                   >>  99   
                                                   >> 100   G4double massTotal     = fMassWall + fMassCavity;
                                                   >> 101   G4double fMassWallRatio = fMassWall/massTotal;  
                                                   >> 102   fKinematic->RunInitialisation(effWallThick, fMassWallRatio ); 
                                                   >> 103      
                                                   >> 104   G4double massRatio = fMassCavity/fMassWall;
                                                   >> 105   
                                                   >> 106   //check radius
                                                   >> 107   //
                                                   >> 108   G4double worldRadius = fDetector->GetWorldRadius();
                                                   >> 109   G4double RangeCavity = emCal.GetCSDARange(fEnergyGun,particleGun,mateCavity);
                                                   >> 110     
                                                   >> 111   std::ios::fmtflags mode = G4cout.flags();
                                                   >> 112   G4cout.setf(std::ios::fixed,std::ios::floatfield);
                                                   >> 113   G4int prec = G4cout.precision(3);
                                                   >> 114   
                                                   >> 115   G4cout << "\n ======================== run conditions =====================\n";
                                                   >> 116   
                                                   >> 117   G4cout << "\n The run will be " << NbofEvents << " "<< partName << " of "
                                                   >> 118          << G4BestUnit(fEnergyGun,"Energy") << " through 2*" 
                                                   >> 119          << G4BestUnit(effWallThick,"Length") << " of "
                                                   >> 120          << mateWall->GetName() << " (density: " 
                                                   >> 121          << G4BestUnit(densityWall,"Volumic Mass") << "); Mass/cm2 = "
                                                   >> 122          << G4BestUnit(fMassWall*cm2,"Mass") 
                                                   >> 123          << "\n csdaRange: " << G4BestUnit(RangeWall,"Length") << G4endl;
                                                   >> 124          
                                                   >> 125   G4cout << "\n the cavity is "
                                                   >> 126          << G4BestUnit(cavityThickness,"Length") << " of "
                                                   >> 127          << mateCavity->GetName() << " (density: " 
                                                   >> 128          << G4BestUnit(densityCavity,"Volumic Mass") << "); Mass/cm2 = " 
                                                   >> 129          << G4BestUnit(fMassCavity*cm2,"Mass") 
                                                   >> 130          << " --> massRatio = " << std::setprecision(6) << massRatio << G4endl;
                                                   >> 131           
                                                   >> 132   G4cout.precision(3);         
                                                   >> 133   G4cout << " World radius: " << G4BestUnit(worldRadius,"Length")
                                                   >> 134          << "; range in cavity: " << G4BestUnit(RangeCavity,"Length")
                                                   >> 135          << G4endl;         
                                                   >> 136                   
                                                   >> 137   G4cout << "\n ============================================================\n";
                                                   >> 138                
                                                   >> 139   //stopping power from EmCalculator
                                                   >> 140   //
                                                   >> 141   G4double dedxWall = 
                                                   >> 142       emCal.GetDEDX(fEnergyGun,G4Electron::Electron(),mateWall);
                                                   >> 143   dedxWall /= densityWall;
                                                   >> 144   G4double dedxCavity = 
                                                   >> 145       emCal.GetDEDX(fEnergyGun,G4Electron::Electron(),mateCavity);
                                                   >> 146   dedxCavity /= densityCavity;
                                                   >> 147   
                                                   >> 148   G4cout << std::setprecision(4)
                                                   >> 149          << "\n StoppingPower in wall   = " 
                                                   >> 150          << G4BestUnit(dedxWall,"Energy*Surface/Mass")
                                                   >> 151          << "\n               in cavity = " 
                                                   >> 152          << G4BestUnit(dedxCavity,"Energy*Surface/Mass")
                                                   >> 153          << G4endl;
                                                   >> 154                   
                                                   >> 155   //process counter
                                                   >> 156   //
                                                   >> 157   fProcCounter = new ProcessesCount;
                                                   >> 158   
                                                   >> 159   //charged particles and energy flow in cavity
                                                   >> 160   //
                                                   >> 161   fPartFlowCavity[0] = fPartFlowCavity[1] = 0;
                                                   >> 162   fEnerFlowCavity[0] = fEnerFlowCavity[1] = 0.;
                                                   >> 163        
                                                   >> 164   //total energy deposit and charged track segment in cavity
                                                   >> 165   //
                                                   >> 166   fEdepCavity = fEdepCavity2 = fTrkSegmCavity = 0.;
                                                   >> 167   fNbEventCavity = 0;
                                                   >> 168       
                                                   >> 169   //stepLenth of charged particles
                                                   >> 170   //
                                                   >> 171   fStepWall = fStepWall2 = fStepCavity = fStepCavity2 =0.;
                                                   >> 172   fNbStepWall = fNbStepCavity = 0;
                                                   >> 173     
                                                   >> 174   //histograms
                                                   >> 175   //
                                                   >> 176   fHistoManager->book();
                                                   >> 177   
                                                   >> 178   // reset default formats
                                                   >> 179   G4cout.setf(mode,std::ios::floatfield);
                                                   >> 180   G4cout.precision(prec);      
 70 }                                                 181 }
 71                                                   182 
 72 //....oooOO0OOooo........oooOO0OOooo........oo    183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 73                                                   184 
 74 void RunAction::BeginOfRunAction(const G4Run*  << 185 void RunAction::CountProcesses(G4String procName)
 75 {                                                 186 {
 76   // do not save Rndm status                   << 187    //does the process  already encounted ?
 77   G4RunManager::GetRunManager()->SetRandomNumb << 188    size_t nbProc = fProcCounter->size();
 78   if (isMaster) {                              << 189    size_t i = 0;
 79     CLHEP::HepRandom::showEngineStatus();      << 190    while ((i<nbProc)&&((*fProcCounter)[i]->GetName()!=procName)) i++;
 80     G4cout << "### Run " << aRun->GetRunID() < << 191    if (i == nbProc) fProcCounter->push_back( new OneProcessCount(procName));
 81   }                                            << 
 82                                                   192 
 83   // G4int NbofEvents = aRun->GetNumberOfEvent << 193    (*fProcCounter)[i]->Count();
 84   // if (NbofEvents == 0) return;              << 194 }
 85                                                   195 
 86   // run conditions                            << 196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 87   //                                           << 
 88   G4ParticleDefinition* particleGun = fKinemat << 
 89   G4String partName = particleGun->GetParticle << 
 90   // G4double energyGun = fKinematic->GetParti << 
 91                                                   197 
 92   // histograms                                << 198 void RunAction::SurveyConvergence(G4int NbofEvents)
                                                   >> 199 {  
                                                   >> 200   if (NbofEvents == 0) return;
                                                   >> 201     
                                                   >> 202                   
                                                   >> 203   //beam fluence
 93   //                                              204   //
 94   /*                                           << 205   G4int Nwall   = fKinematic->GetWallCount();
 95                                                << 206   G4int Ncavity = fKinematic->GetCavityCount();
 96     G4AnalysisManager* analysisManager = G4Ana << 207   G4double Iwall   = Nwall/fMassWall;    
 97     if ( analysisManager->IsActive() ) {       << 208   G4double Icavity = Ncavity/fMassCavity;
 98       analysisManager->OpenFile();             << 209   G4double Iratio  = Icavity/Iwall;
 99     }                                          << 210   G4double Itot    = NbofEvents/(fMassWall+fMassCavity);
100   */                                           << 211   G4double energyFluence = fEnergyGun*Itot;
                                                   >> 212            
                                                   >> 213   //total dose in cavity
                                                   >> 214   //                   
                                                   >> 215   G4double doseCavity = fEdepCavity/fMassCavity;
                                                   >> 216   G4double ratio = doseCavity/energyFluence;
                                                   >> 217   G4double err = 100*(ratio-1.);
                                                   >> 218 
                                                   >> 219   std::ios::fmtflags mode = G4cout.flags();
                                                   >> 220   G4cout.setf(std::ios::fixed,std::ios::floatfield);
                                                   >> 221   G4int prec = G4cout.precision(5);
                                                   >> 222   
                                                   >> 223   G4cout << "\n--->evntNb= " << NbofEvents 
                                                   >> 224          << " Nwall= " << Nwall
                                                   >> 225          << " Ncav= "  << Ncavity
                                                   >> 226          << " Ic/Iw= " << Iratio        
                                                   >> 227          << " Ne-_cav= " << fPartFlowCavity[0]
                                                   >> 228          << " doseCavity/Ebeam= " << ratio 
                                                   >> 229          << "  (100*(ratio-1) = " << err << " %)"
                                                   >> 230          << G4endl;
                                                   >> 231          
                                                   >> 232   // reset default formats
                                                   >> 233   G4cout.setf(mode,std::ios::floatfield);
                                                   >> 234   G4cout.precision(prec);  
101 }                                                 235 }
102                                                   236 
103 //....oooOO0OOooo........oooOO0OOooo........oo    237 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104                                                   238 
105 void RunAction::EndOfRunAction(const G4Run*)   << 239 void RunAction::EndOfRunAction(const G4Run* aRun)
106 {                                                 240 {
107   // compute and print statistic               << 241   std::ios::fmtflags mode = G4cout.flags();
108   if (isMaster) fRun->EndOfRun();              << 242   G4cout.setf(std::ios::fixed,std::ios::floatfield);
                                                   >> 243   G4int prec = G4cout.precision(3);
                                                   >> 244   
                                                   >> 245   G4int NbofEvents = aRun->GetNumberOfEvent();
                                                   >> 246   if (NbofEvents == 0) return;
109                                                   247 
110   // save histograms                           << 248   //frequency of processes
111   G4AnalysisManager* analysisManager = G4Analy << 249   //
112   if (analysisManager->IsActive()) {           << 250   G4cout << "\n Process calls frequency --->";
113     analysisManager->Write();                  << 251   for (size_t i=0; i< fProcCounter->size();i++) {
114     analysisManager->CloseFile();              << 252      G4String procName = (*fProcCounter)[i]->GetName();
                                                   >> 253      G4int    count    = (*fProcCounter)[i]->GetCounter(); 
                                                   >> 254      G4cout << "  " << procName << "= " << count;
115   }                                               255   }
116                                                << 256   G4cout << G4endl;
                                                   >> 257           
                                                   >> 258   //charged particle flow in cavity
                                                   >> 259   //
                                                   >> 260   G4cout 
                                                   >> 261     << "\n Charged particle flow in cavity :"
                                                   >> 262     << "\n      Enter --> nbParticles = " << fPartFlowCavity[0]
                                                   >> 263     << "\t Energy = " << G4BestUnit (fEnerFlowCavity[0], "Energy")
                                                   >> 264     << "\n      Exit  --> nbParticles = " << fPartFlowCavity[1]
                                                   >> 265     << "\t Energy = " << G4BestUnit (fEnerFlowCavity[1], "Energy")
                                                   >> 266     << G4endl;
                                                   >> 267              
                                                   >> 268   if (fPartFlowCavity[0] == 0) return;
                                                   >> 269                   
                                                   >> 270   //beam fluence
                                                   >> 271   //
                                                   >> 272   G4int Nwall   = fKinematic->GetWallCount();
                                                   >> 273   G4int Ncavity = fKinematic->GetCavityCount();  
                                                   >> 274   G4double Iwall   = Nwall/fMassWall;
                                                   >> 275   G4double Icavity = Ncavity/fMassCavity;
                                                   >> 276   G4double Iratio  = Icavity/Iwall;
                                                   >> 277   G4double Itot    = NbofEvents/(fMassWall+fMassCavity);
                                                   >> 278   G4double energyFluence = fEnergyGun*Itot;  
                                                   >> 279   
                                                   >> 280   G4cout.precision(5);       
                                                   >> 281   G4cout 
                                                   >> 282     << "\n beamFluence in wall = " << Nwall
                                                   >> 283     << "\t in cavity = " << Ncavity
                                                   >> 284     << "\t Icav/Iwall = " << Iratio        
                                                   >> 285     << "\t energyFluence = " << energyFluence/(MeV*cm2/mg) << " MeV*cm2/mg"
                                                   >> 286     << G4endl;
                                                   >> 287   
                                                   >> 288   //error on Edep in cavity
                                                   >> 289   //
                                                   >> 290   if (fNbEventCavity == 0) return;
                                                   >> 291   G4double meanEdep  = fEdepCavity/fNbEventCavity;
                                                   >> 292   G4double meanEdep2 = fEdepCavity2/fNbEventCavity;
                                                   >> 293   G4double varianceEdep = meanEdep2 - meanEdep*meanEdep;
                                                   >> 294   G4double dEoverE = 0.;
                                                   >> 295   if(varianceEdep>0.) dEoverE = std::sqrt(varianceEdep/fNbEventCavity)/meanEdep;
                                                   >> 296                
                                                   >> 297   //total dose in cavity
                                                   >> 298   //                   
                                                   >> 299   G4double doseCavity = fEdepCavity/fMassCavity;
                                                   >> 300   G4double ratio = doseCavity/energyFluence, error = ratio*dEoverE;
                                                   >> 301                     
                                                   >> 302   G4cout 
                                                   >> 303     << "\n Total edep in cavity = "      << G4BestUnit(fEdepCavity,"Energy")
                                                   >> 304     << " +- " << 100*dEoverE << " %"        
                                                   >> 305     << "\n Total dose in cavity = " << doseCavity/(MeV*cm2/mg) << " MeV*cm2/mg"
                                                   >> 306     << " +- " << 100*dEoverE << " %"          
                                                   >> 307     << "\n\n DoseCavity/EnergyFluence = " << ratio 
                                                   >> 308     << " +- " << error << G4endl;
                                                   >> 309     
                                                   >> 310 
                                                   >> 311   //track length in cavity
                                                   >> 312   G4double meantrack = fTrkSegmCavity/fPartFlowCavity[0];
                                                   >> 313   
                                                   >> 314   G4cout.precision(4); 
                                                   >> 315   G4cout  
                                                   >> 316     << "\n Total charged trackLength in cavity = " 
                                                   >> 317     << G4BestUnit(fTrkSegmCavity,"Length")
                                                   >> 318     << "   (mean value = " << G4BestUnit(meantrack,"Length") << ")"       
                                                   >> 319     << G4endl;
                                                   >> 320                   
                                                   >> 321   //compute mean step size of charged particles
                                                   >> 322   //
                                                   >> 323   fStepWall /= fNbStepWall; fStepWall2 /= fNbStepWall;
                                                   >> 324   G4double rms = fStepWall2 - fStepWall*fStepWall;        
                                                   >> 325   if (rms>0.) rms = std::sqrt(rms); else rms = 0.;
                                                   >> 326   G4double nbTrackWall = fKinematic->GetWallCount();
                                                   >> 327 
                                                   >> 328   G4cout 
                                                   >> 329     << "\n StepSize of ch. tracks in wall   = " 
                                                   >> 330     << G4BestUnit(fStepWall,"Length") << " +- " << G4BestUnit( rms,"Length")
                                                   >> 331     << "\t (nbSteps/track = " << double(fNbStepWall)/nbTrackWall << ")";
                                                   >> 332     
                                                   >> 333   fStepCavity /= fNbStepCavity; fStepCavity2 /= fNbStepCavity;
                                                   >> 334   rms = fStepCavity2 - fStepCavity*fStepCavity;        
                                                   >> 335   if (rms>0.) rms = std::sqrt(rms); else rms = 0.;
                                                   >> 336 
                                                   >> 337   G4cout 
                                                   >> 338     << "\n StepSize of ch. tracks in cavity = " 
                                                   >> 339     << G4BestUnit(fStepCavity,"Length") << " +- " << G4BestUnit( rms,"Length")
                                                   >> 340     << "\t (nbSteps/track = " << double(fNbStepCavity)/fPartFlowCavity[0] << ")";
                                                   >> 341         
                                                   >> 342   G4cout << G4endl;
                                                   >> 343   
                                                   >> 344    // reset default formats
                                                   >> 345   G4cout.setf(mode,std::ios::floatfield);
                                                   >> 346   G4cout.precision(prec);
                                                   >> 347   
                                                   >> 348   // delete and remove all contents in fProcCounter 
                                                   >> 349   while (fProcCounter->size()>0){
                                                   >> 350     OneProcessCount* aProcCount=fProcCounter->back();
                                                   >> 351     fProcCounter->pop_back();
                                                   >> 352     delete aProcCount;
                                                   >> 353   }
                                                   >> 354   delete fProcCounter;
                                                   >> 355   
                                                   >> 356   // save histograms
                                                   >> 357   fHistoManager->save();
                                                   >> 358  
117   // show Rndm status                             359   // show Rndm status
118   if (isMaster) CLHEP::HepRandom::showEngineSt << 360   CLHEP::HepRandom::showEngineStatus();
119 }                                                 361 }
120                                                   362 
121 //....oooOO0OOooo........oooOO0OOooo........oo    363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122                                                   364