Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CopyRandomState.hh File Reference

Helper function for copying random state files in G4run. More...

#include "G4Exception.hh"
#include "G4Filesystem.hh"
#include "G4String.hh"
#include "G4Types.hh"

Go to the source code of this file.

Functions

G4bool G4CopyRandomState (const G4fs::path &source, const G4fs::path &dest, const G4String &callsite)
 

Detailed Description

Helper function for copying random state files in G4run.

Author
Ben Morgan
Date
2023-06-05

Definition in file G4CopyRandomState.hh.

Function Documentation

◆ G4CopyRandomState()

G4bool G4CopyRandomState ( const G4fs::path & source,
const G4fs::path & dest,
const G4String & callsite )
inline

Return true if file source is successfully copied to dest Convert any thrown exception to JustWarning G4Exception

Definition at line 41 of file G4CopyRandomState.hh.

43{
44 try {
45 G4fs::copy_file(source, dest);
46 }
47 catch (G4fs::filesystem_error const& ex) {
49 ed << "Failed to copy " << ex.path1() << " to " << ex.path2() << " , error:\n"
50 << " code : " << ex.code().value() << '\n'
51 << " message: " << ex.code().message() << '\n';
52 G4Exception(callsite, "UnableToCopyRndmStateFile", JustWarning, ed);
53 return false;
54 }
55 return true;
56}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription

Referenced by G4RunManager::rndmSaveThisEvent(), G4WorkerRunManager::rndmSaveThisEvent(), G4MTRunManager::rndmSaveThisRun(), G4RunManager::rndmSaveThisRun(), and G4WorkerRunManager::rndmSaveThisRun().