Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GeoModelDev
GeoModel
Commits
25d3a9a8
Commit
25d3a9a8
authored
2 years ago
by
Joseph Boudreau
Browse files
Options
Downloads
Plain Diff
Merge branch 'The-track-file-name-update' into 'master'
The tracks output file name update See merge request
!165
parents
129e775c
75431293
Branches
Branches containing commit
Tags
v95r2p5g1
Tags containing commit
1 merge request
!165
The tracks output file name update
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
FullSimLight/Plugins/TracksPlugin/src/TrksRunAction.cc
+38
-1
38 additions, 1 deletion
FullSimLight/Plugins/TracksPlugin/src/TrksRunAction.cc
with
38 additions
and
1 deletion
FullSimLight/Plugins/TracksPlugin/src/TrksRunAction.cc
+
38
−
1
View file @
25d3a9a8
#include
"TrksRunAction.h"
#include
"TrksHDF5Factory.h"
#include
<string>
#include
<filesystem>
#include
<set>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std
::
map
<
G4int
,
G4int
>
TrksRunAction
::
fgTrkNums
;
...
...
@@ -26,8 +30,37 @@ void TrksRunAction::BeginOfRunAction(const G4Run* /*aRun*/)
{
if
(
IsMaster
())
{
using
namespace
std
;
namespace
fs
=
std
::
filesystem
;
set
<
string
>
fileNames
;
string
outputFileName
;
fs
::
path
pwdPath
=
fs
::
current_path
();
for
(
const
auto
&
entry
:
fs
::
directory_iterator
(
pwdPath
))
{
fileNames
.
insert
(
entry
.
path
());
}
for
(
int
i
=
0
;
true
;
++
i
)
{
outputFileName
=
"Tracks_data"
;
outputFileName
+=
i
==
0
?
""
:
string
(
"_"
)
+
to_string
(
i
);
outputFileName
+=
".h5"
;
if
(
fileNames
.
find
(
string
(
pwdPath
)
+
"/"
+
outputFileName
)
==
fileNames
.
end
())
{
break
;
}
cout
<<
"A file "
<<
outputFileName
<<
" already exists in the working directory. "
<<
"Looking for another file name.
\n
"
;
}
TrksHDF5Factory
*
hdf5Factory
=
TrksHDF5Factory
::
GetInstance
();
hdf5Factory
->
OpenFile
(
"Tracks_data.h5"
);
hdf5Factory
->
OpenFile
(
outputFileName
.
c_str
()
);
}
}
...
...
@@ -60,7 +93,11 @@ void TrksRunAction::EndOfRunAction(const G4Run* /*aRun*/)
delete
dataSet
;
G4String
outputFileName
=
file
->
getFileName
();
file
->
close
();
G4cout
<<
"The file "
<<
outputFileName
<<
" has been created."
<<
G4endl
;
}
}
...
...
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