Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 /// \file electromagnetic/TestEm16/src/Run.cc 27 /// \brief Implementation of the Run class 28 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 #include "Run.hh" 34 35 #include "G4SystemOfUnits.hh" 36 #include "G4UnitsTable.hh" 37 38 #include <iomanip> 39 40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 41 42 Run::Run() : G4Run() {} 43 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 46 void Run::Merge(const G4Run* run) 47 { 48 const Run* localRun = static_cast<const Run*>(run); 49 50 // accumulate sums 51 // 52 f_n_gam_sync += localRun->f_n_gam_sync; 53 f_e_gam_sync += localRun->f_e_gam_sync; 54 f_e_gam_sync2 += localRun->f_e_gam_sync2; 55 f_e_gam_sync_max = std::max(f_e_gam_sync_max, localRun->f_e_gam_sync_max); 56 f_lam_gam_sync += localRun->f_lam_gam_sync; 57 f_n_Xray_Refl += localRun->f_n_Xray_Refl; 58 59 G4Run::Merge(run); 60 } 61 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 64 void Run::EndOfRun() 65 { 66 if (f_n_gam_sync > 0) { 67 G4double Emean = f_e_gam_sync / f_n_gam_sync; 68 G4double E_rms = std::sqrt(f_e_gam_sync2 / f_n_gam_sync - Emean * Emean); 69 G4cout << "Summary for synchrotron radiation :" << '\n' 70 << std::setprecision(4) << " Number of photons = " << f_n_gam_sync << '\n' 71 << " Emean = " << Emean / keV << " +/- " 72 << E_rms / (keV * std::sqrt((G4double)f_n_gam_sync)) << " keV" << '\n' 73 << " E_rms = " << G4BestUnit(E_rms, "Energy") << '\n' 74 << " Energy Max / Mean = " << f_e_gam_sync_max / Emean << '\n' 75 << " MeanFreePath = " << G4BestUnit(f_lam_gam_sync / f_n_gam_sync, "Length") 76 << G4endl; 77 } 78 79 if (f_n_Xray_Refl > 0) { 80 G4cout << "Summary for XrayReflection f_n_Xray_Refl=" << f_n_Xray_Refl 81 << " reflection probability = " << f_n_Xray_Refl / GetNumberOfEventToBeProcessed() 82 << G4endl; 83 } 84 } 85 86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 87