![]() |
|
|||
File indexing completed on 2025-02-23 09:21:51
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // This example is provided by the Geant4-DNA collaboration 0027 // Any report or published results obtained using the Geant4-DNA software 0028 // shall cite the following Geant4-DNA collaboration publication: 0029 // Med. Phys. 37 (2010) 4692-4708 0030 // The Geant4-DNA web site is available at http://geant4-dna.org 0031 // 0032 // 0033 /// \file RunAction.cc 0034 /// \brief Implementation of the RunAction class 0035 0036 #include "RunAction.hh" 0037 0038 #include "RunActionMessenger.hh" 0039 #include "RunInitObserver.hh" 0040 0041 #include "G4AnalysisManager.hh" 0042 #include "G4Run.hh" 0043 #include "G4RunManager.hh" 0044 0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0046 0047 RunAction::RunAction() : G4UserRunAction() 0048 { 0049 fFileName = "clusters_output"; 0050 fpRunMessenger = new RunActionMessenger(this); 0051 CreateHistogram(); 0052 } 0053 0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0055 0056 RunAction::~RunAction() 0057 { 0058 delete fpRunMessenger; 0059 } 0060 0061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0062 0063 void RunAction::BeginOfRunAction(const G4Run*) 0064 { 0065 // 0066 RunInitManager::Instance()->Initialize(); 0067 0068 // Get analysis manager 0069 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0070 analysisManager->SetDefaultFileType("root"); 0071 0072 // Open an output file 0073 analysisManager->OpenFile(fFileName); 0074 G4cout << "\n----> Histogram file is opened in " << fFileName << "." 0075 << analysisManager->GetFileType() << G4endl; 0076 } 0077 0078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0079 0080 void RunAction::EndOfRunAction(const G4Run*) 0081 { 0082 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0083 analysisManager->Write(); 0084 analysisManager->CloseFile(); 0085 } 0086 0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0088 0089 void RunAction::CreateHistogram() 0090 { 0091 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0092 analysisManager->SetFirstHistoId(1); 0093 analysisManager->CreateH1("1", "simpleSSB", 75, 0., 75); 0094 analysisManager->CreateH1("2", "complexSSB", 75, 0., 75); 0095 analysisManager->CreateH1("3", "DSB", 75, 0., 75); 0096 analysisManager->CreateH1("4", "cluster size", 20, 1, 20); 0097 analysisManager->CreateH1("5", "edep", 1, 0., 1E6); 0098 } 0099 0100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0101 0102 void RunAction::WriteHistogram() 0103 { 0104 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0105 analysisManager->Write(); 0106 analysisManager->CloseFile(); 0107 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |