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 10.0.p4)


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