Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/dna/dsbandrepair/src/RunAction.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 RunAction.cc
0028 /// \brief Implementation of the RunAction class
0029 
0030 #include "RunAction.hh"
0031 #include "G4Run.hh"
0032 #include "Analysis.hh"
0033 #include "DetectorConstruction.hh"
0034 #include "G4DNAChemistryManager.hh"
0035 #include "G4Filesystem.hh"
0036 #ifdef USE_MPI
0037 #include "G4MPImanager.hh"
0038 #endif
0039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0040 
0041 RunAction::RunAction() : G4UserRunAction()
0042 {
0043     auto myana = Analysis::GetAnalysis();
0044     myana->Book();
0045 }
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0048 
0049 void RunAction::BeginOfRunAction(const G4Run*)
0050 {
0051     Analysis* myana = Analysis::GetAnalysis();
0052     if (gRunMode == RunningMode::Phys) {
0053         std::ostringstream fname;
0054         G4String slash = "";
0055 #if defined(_WIN32) || defined(WIN32)
0056         slash= "\\";
0057 #else
0058         G4String slashu = "/";
0059         slash = slashu;
0060 #endif
0061 
0062 #ifdef USE_MPI
0063         G4int rank = G4MPImanager::GetManager()->GetRank();
0064         fname<<myana->GetPhysOutFolderName()<<slash<<"phys_output"<<"_rank"<<rank;
0065 #else
0066         fname<<myana->GetPhysOutFolderName()<<slash<<"phys_output";
0067 #endif
0068         myana->SetFileName(fname.str());
0069         myana->OpenFile();
0070     }
0071 
0072     if (gRunMode == RunningMode::Chem) {
0073         myana->OpenFile(myana->GetChemOutFolderName());
0074     }
0075 }
0076 
0077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0078 
0079 void RunAction::EndOfRunAction(const G4Run*)
0080 {   
0081     WriteNtuple();
0082 }
0083 
0084 
0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0086 
0087 void RunAction::WriteNtuple()
0088 {
0089     Analysis* myana = Analysis::GetAnalysis();
0090     myana-> Save();
0091     myana-> Close();
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0095