|
||||
File indexing completed on 2025-01-31 09:22:02
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 // 0027 /// \file PhysRunAction.cc 0028 /// \brief Implementation of the PhysRunAction class 0029 0030 #include "PhysRunAction.hh" 0031 #include "G4Run.hh" 0032 #include "PhysAnalysis.hh" 0033 #include "InformationKeeper.hh" 0034 #include "G4DNAChemistryManager.hh" 0035 #ifdef USE_MPI 0036 #include "G4MPImanager.hh" 0037 #endif 0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0039 0040 PhysRunAction::PhysRunAction() : G4UserRunAction() 0041 { 0042 CreateNtuple(); 0043 } 0044 0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0046 0047 void PhysRunAction::BeginOfRunAction(const G4Run*) 0048 { 0049 PhysAnalysis* myana = PhysAnalysis::GetAnalysis(); 0050 std::ostringstream fname; 0051 G4String slash = ""; 0052 #if defined(_WIN32) || defined(WIN32) 0053 slash= "\\"; 0054 #else 0055 G4String slashu = "/"; 0056 slash = slashu; 0057 #endif 0058 0059 #ifdef USE_MPI 0060 G4int rank = G4MPImanager::GetManager()->GetRank(); 0061 fname<<InformationKeeper::Instance()->GetPhysOutFolderName()<<slash<<"phys_output"<<"_rank"<<rank; 0062 #else 0063 fname<<InformationKeeper::Instance()->GetPhysOutFolderName()<<slash<<"phys_output"; 0064 #endif 0065 myana->OpenFile(fname.str()); 0066 } 0067 0068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0069 0070 void PhysRunAction::EndOfRunAction(const G4Run*) 0071 { 0072 WriteNtuple(); 0073 } 0074 0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0076 0077 void PhysRunAction::CreateNtuple() 0078 { 0079 auto myana = PhysAnalysis::GetAnalysis(); 0080 myana->Book(); 0081 } 0082 0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0084 0085 void PhysRunAction::WriteNtuple() 0086 { 0087 PhysAnalysis* myana = PhysAnalysis::GetAnalysis(); 0088 myana-> Save(); 0089 myana-> Close(); 0090 } 0091 0092 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0093 0094 0095 0096 0097 0098
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |