[807] | 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 | // $Id: RunAction.cc,v 1.8 2007/01/18 10:24:35 vnivanch Exp $ |
---|
[1337] | 27 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[807] | 28 | // |
---|
| 29 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 30 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 31 | |
---|
| 32 | #include "RunAction.hh" |
---|
| 33 | |
---|
| 34 | #include "G4Run.hh" |
---|
| 35 | #include "G4RunManager.hh" |
---|
| 36 | #include "G4UnitsTable.hh" |
---|
| 37 | |
---|
| 38 | #include "Randomize.hh" |
---|
| 39 | #include "HistoManager.hh" |
---|
| 40 | |
---|
| 41 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 42 | |
---|
| 43 | RunAction::RunAction(HistoManager* histo) |
---|
| 44 | :histoManager(histo) |
---|
| 45 | { |
---|
| 46 | n_gam_sync = 0; |
---|
| 47 | e_gam_sync = 0; |
---|
| 48 | e_gam_sync2 = 0; |
---|
| 49 | e_gam_sync_max =0; |
---|
| 50 | lam_gam_sync = 0; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 54 | |
---|
| 55 | RunAction::~RunAction() |
---|
| 56 | { } |
---|
| 57 | |
---|
| 58 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 59 | |
---|
| 60 | void RunAction::BeginOfRunAction(const G4Run* aRun) |
---|
| 61 | { |
---|
| 62 | G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl; |
---|
| 63 | |
---|
| 64 | // save Rndm status |
---|
| 65 | G4RunManager::GetRunManager()->SetRandomNumberStore(true); |
---|
| 66 | CLHEP::HepRandom::showEngineStatus(); |
---|
| 67 | |
---|
| 68 | //book histograms |
---|
| 69 | histoManager->book(); |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 73 | |
---|
| 74 | void RunAction::EndOfRunAction(const G4Run*) |
---|
| 75 | { |
---|
| 76 | if(n_gam_sync>0) |
---|
| 77 | { |
---|
| 78 | G4double Emean = e_gam_sync/n_gam_sync; |
---|
| 79 | G4double E_rms = std::sqrt(e_gam_sync2/n_gam_sync - Emean*Emean); |
---|
| 80 | G4cout |
---|
| 81 | << "Summary for synchrotron radiation :" << '\n' << std::setprecision(4) |
---|
| 82 | << " Number of photons = " << n_gam_sync << '\n' |
---|
| 83 | << " Emean = " << Emean/keV << " +/- " |
---|
| 84 | << E_rms/(keV * std::sqrt((G4double) n_gam_sync)) << " keV" << '\n' |
---|
| 85 | << " E_rms = " << G4BestUnit(E_rms,"Energy") << '\n' |
---|
| 86 | << " Energy Max / Mean = " << e_gam_sync_max / Emean << '\n' |
---|
| 87 | << " MeanFreePath = " << G4BestUnit(lam_gam_sync/n_gam_sync,"Length") |
---|
| 88 | << G4endl; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | // show Rndm status |
---|
| 92 | CLHEP::HepRandom::showEngineStatus(); |
---|
| 93 | |
---|
| 94 | //save histograms |
---|
| 95 | histoManager->save(); |
---|
| 96 | |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|