Skip to content

Commit

Permalink
Uniquify ROOT file name when output is directed to stdout (#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcanal committed Dec 6, 2023
1 parent 1782ddb commit 3fa7c6e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/celer-g4/RootIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "GlobalSetup.hh"
#include "SensitiveHit.hh"

#ifdef _WIN32
# include <process.h>
#endif

namespace celeritas
{
namespace app
Expand All @@ -54,6 +58,11 @@ RootIO::RootIO()
file_name_ = "celer-g4.root";
}

if (file_name_ == "-")
{
file_name_ = "stdout-" + std::to_string(::getpid()) + ".root";
}

if (G4Threading::IsWorkerThread())
{
file_name_ += std::to_string(G4Threading::G4GetThreadId());
Expand Down

0 comments on commit 3fa7c6e

Please sign in to comment.