Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Run.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 // $Id: Run.cc 71376 2013-06-14 07:44:50Z maire $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "Run.hh"
35 
36 #include "G4UnitsTable.hh"
37 #include "G4SystemOfUnits.hh"
38 
39 #include <iomanip>
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44 : G4Run(),
45  f_n_gam_sync(0),
46  f_e_gam_sync(0.),
47  f_e_gam_sync2(0.),
48  f_e_gam_sync_max(0.),
49  f_lam_gam_sync(0.)
50 { }
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
54 Run::~Run()
55 { }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
59 void Run::Merge(const G4Run* run)
60 {
61  const Run* localRun = static_cast<const Run*>(run);
62 
63  // accumulate sums
64  //
65  f_n_gam_sync += localRun->f_n_gam_sync;
66  f_e_gam_sync += localRun->f_e_gam_sync;
67  f_e_gam_sync2 += localRun->f_e_gam_sync2;
69  f_lam_gam_sync += localRun->f_lam_gam_sync;
70 
71  G4Run::Merge(run);
72 }
73 
74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75 
76 void Run::EndOfRun()
77 {
78  if (f_n_gam_sync > 0)
79  {
81  G4double E_rms = std::sqrt(f_e_gam_sync2/f_n_gam_sync - Emean*Emean);
82  G4cout
83  << "Summary for synchrotron radiation :" << '\n' << std::setprecision(4)
84  << " Number of photons = " << f_n_gam_sync << '\n'
85  << " Emean = " << Emean/keV << " +/- "
86  << E_rms/(keV * std::sqrt((G4double) f_n_gam_sync)) << " keV" << '\n'
87  << " E_rms = " << G4BestUnit(E_rms,"Energy") << '\n'
88  << " Energy Max / Mean = " << f_e_gam_sync_max / Emean << '\n'
89  << " MeanFreePath = " << G4BestUnit(f_lam_gam_sync/f_n_gam_sync,
90  "Length")
91  << G4endl;
92  }
93 
94 }
95 
96 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void Merge(const G4Run *)
Definition: G4Run.cc:54
Run()
Definition: Run.cc:43
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4GLOB_DLL std::ostream G4cout
G4double f_e_gam_sync_max
Definition: Run.hh:57
G4double f_e_gam_sync2
Definition: Run.hh:56
Definition: G4Run.hh:46
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void EndOfRun()
Definition: Run.cc:147
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Definition: Run.hh:46
G4double f_e_gam_sync
Definition: Run.hh:56
static constexpr double keV
Definition: G4SIunits.hh:216
virtual void Merge(const G4Run *)
Definition: Run.cc:115
G4int f_n_gam_sync
Definition: Run.hh:55
~Run()
Definition: Run.cc:72
G4double f_lam_gam_sync
Definition: Run.hh:58