Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
ea7156ad
Commit
ea7156ad
authored
1 year ago
by
Markus Frank
Committed by
MarkusFrankATcernch
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Make Geant4Output2ROOT more robust.
parent
8a42ec73
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DDG4/src/Geant4Output2ROOT.cpp
+8
-0
8 additions, 0 deletions
DDG4/src/Geant4Output2ROOT.cpp
with
8 additions
and
0 deletions
DDG4/src/Geant4Output2ROOT.cpp
+
8
−
0
View file @
ea7156ad
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
#include
<TFile.h>
#include
<TFile.h>
#include
<TTree.h>
#include
<TTree.h>
#include
<TBranch.h>
#include
<TBranch.h>
#include
<TSystem.h>
using
namespace
dd4hep
::
sim
;
using
namespace
dd4hep
::
sim
;
using
namespace
dd4hep
;
using
namespace
dd4hep
;
...
@@ -94,7 +96,13 @@ void Geant4Output2ROOT::beginRun(const G4Run* run) {
...
@@ -94,7 +96,13 @@ void Geant4Output2ROOT::beginRun(const G4Run* run) {
}
}
if
(
!
m_file
&&
!
fname
.
empty
()
)
{
if
(
!
m_file
&&
!
fname
.
empty
()
)
{
TDirectory
::
TContext
ctxt
(
TDirectory
::
CurrentDirectory
());
TDirectory
::
TContext
ctxt
(
TDirectory
::
CurrentDirectory
());
if
(
!
gSystem
->
AccessPathName
(
fname
.
c_str
())
)
{
gSystem
->
Unlink
(
fname
.
c_str
());
}
std
::
unique_ptr
<
TFile
>
file
(
TFile
::
Open
(
fname
.
c_str
(),
"RECREATE"
,
"dd4hep Simulation data"
));
std
::
unique_ptr
<
TFile
>
file
(
TFile
::
Open
(
fname
.
c_str
(),
"RECREATE"
,
"dd4hep Simulation data"
));
if
(
!
file
)
{
file
.
reset
(
TFile
::
Open
((
fname
+
".1"
).
c_str
(),
"RECREATE"
,
"dd4hep Simulation data"
));
}
if
(
!
file
)
{
if
(
!
file
)
{
except
(
"Failed to create ROOT output file:'%s'"
,
fname
.
c_str
());
except
(
"Failed to create ROOT output file:'%s'"
,
fname
.
c_str
());
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment