Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Computing
cbmroot
Commits
90bd8f08
Commit
90bd8f08
authored
1 year ago
by
Felix Weiglhofer
Browse files
Options
Downloads
Patches
Plain Diff
algo::Archive: Implement %n wildcard in filenames to store TS id in filename.
parent
4bfcc332
No related branches found
No related tags found
1 merge request
!1192
cbmreco: Add support to store results to file
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
algo/global/Archive.cxx
+22
-1
22 additions, 1 deletion
algo/global/Archive.cxx
algo/global/Archive.h
+4
-2
4 additions, 2 deletions
algo/global/Archive.h
algo/global/Reco.h
+2
-2
2 additions, 2 deletions
algo/global/Reco.h
reco/app/cbmreco/main.cxx
+7
-6
7 additions, 6 deletions
reco/app/cbmreco/main.cxx
with
35 additions
and
11 deletions
algo/global/Archive.cxx
+
22
−
1
View file @
90bd8f08
...
@@ -5,11 +5,14 @@
...
@@ -5,11 +5,14 @@
#include
"CbmStsDigi.h"
#include
"CbmStsDigi.h"
#include
<boost/algorithm/string.hpp>
#include
<boost/archive/binary_iarchive.hpp>
#include
<boost/archive/binary_iarchive.hpp>
#include
<boost/archive/binary_oarchive.hpp>
#include
<boost/archive/binary_oarchive.hpp>
#include
<boost/serialization/vector.hpp>
#include
<boost/serialization/vector.hpp>
#include
<fstream>
#include
<fstream>
#include
<iomanip>
#include
<sstream>
#include
"log.hpp"
#include
"log.hpp"
...
@@ -25,10 +28,28 @@ Archive::Archive(fs::path file)
...
@@ -25,10 +28,28 @@ Archive::Archive(fs::path file)
ia
>>
*
this
;
ia
>>
*
this
;
}
}
void
Archive
::
Store
(
fs
::
path
file
)
const
void
Archive
::
Store
(
fs
::
path
file
,
std
::
optional
<
size_t
>
tsId
)
const
{
{
file
=
makeFileName
(
file
,
tsId
);
L_
(
info
)
<<
"Writing archive to "
<<
file
;
L_
(
info
)
<<
"Writing archive to "
<<
file
;
std
::
ofstream
ofs
(
file
.
string
(),
std
::
ios
::
binary
);
std
::
ofstream
ofs
(
file
.
string
(),
std
::
ios
::
binary
);
ba
::
binary_oarchive
oa
(
ofs
);
ba
::
binary_oarchive
oa
(
ofs
);
oa
<<
*
this
;
oa
<<
*
this
;
}
}
fs
::
path
Archive
::
makeFileName
(
fs
::
path
file
,
std
::
optional
<
size_t
>
tsId
)
const
{
if
(
!
tsId
)
return
file
;
// Shamelessly copied from fles::OutputArchiveSequence
if
(
file
.
string
().
find
(
"%n"
)
==
std
::
string
::
npos
)
{
L_
(
warning
)
<<
"Archive file name does not contain %n wildcard (timeslice number). Appending id to file name instead."
;
file
+=
"_%n"
;
}
std
::
ostringstream
number
;
number
<<
std
::
setw
(
4
)
<<
std
::
setfill
(
'0'
)
<<
*
tsId
;
return
boost
::
replace_all_copy
(
file
.
string
(),
"%n"
,
number
.
str
());
}
This diff is collapsed.
Click to expand it.
algo/global/Archive.h
+
4
−
2
View file @
90bd8f08
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include
<boost/serialization/access.hpp>
#include
<boost/serialization/access.hpp>
#include
<boost/serialization/version.hpp>
#include
<boost/serialization/version.hpp>
#include
<optional>
#include
<vector>
#include
<vector>
#include
"RecoIO.h"
#include
"RecoIO.h"
...
@@ -32,7 +33,7 @@ namespace cbm::algo
...
@@ -32,7 +33,7 @@ namespace cbm::algo
/**
/**
* @brief Store Archive object to file.
* @brief Store Archive object to file.
*/
*/
void
Store
(
fs
::
path
file
)
const
;
void
Store
(
fs
::
path
file
,
std
::
optional
<
size_t
>
tsId
=
{}
)
const
;
const
std
::
vector
<
fles
::
SubsystemIdentifier
>&
Detectors
()
const
{
return
fDetectors
;
}
const
std
::
vector
<
fles
::
SubsystemIdentifier
>&
Detectors
()
const
{
return
fDetectors
;
}
...
@@ -41,7 +42,6 @@ namespace cbm::algo
...
@@ -41,7 +42,6 @@ namespace cbm::algo
private
:
private
:
std
::
vector
<
fles
::
SubsystemIdentifier
>
fDetectors
;
std
::
vector
<
fles
::
SubsystemIdentifier
>
fDetectors
;
std
::
vector
<
RecoIO
>
fTimesliceResults
;
std
::
vector
<
RecoIO
>
fTimesliceResults
;
friend
class
boost
::
serialization
::
access
;
friend
class
boost
::
serialization
::
access
;
...
@@ -51,6 +51,8 @@ namespace cbm::algo
...
@@ -51,6 +51,8 @@ namespace cbm::algo
ar
&
fDetectors
;
ar
&
fDetectors
;
ar
&
fTimesliceResults
;
ar
&
fTimesliceResults
;
}
}
fs
::
path
makeFileName
(
fs
::
path
file
,
std
::
optional
<
size_t
>
tsId
)
const
;
};
};
}
// namespace cbm::algo
}
// namespace cbm::algo
...
...
This diff is collapsed.
Click to expand it.
algo/global/Reco.h
+
2
−
2
View file @
90bd8f08
...
@@ -25,10 +25,10 @@ namespace cbm::algo
...
@@ -25,10 +25,10 @@ namespace cbm::algo
Reco
();
Reco
();
~
Reco
();
~
Reco
();
Reco
(
const
Reco
&
)
=
delete
;
Reco
(
const
Reco
&
)
=
delete
;
Reco
&
operator
=
(
const
Reco
&
)
=
delete
;
Reco
&
operator
=
(
const
Reco
&
)
=
delete
;
Reco
(
Reco
&&
)
=
delete
;
Reco
(
Reco
&&
)
=
delete
;
Reco
&
operator
=
(
Reco
&&
)
=
delete
;
Reco
&
operator
=
(
Reco
&&
)
=
delete
;
void
Init
(
const
Options
&
);
void
Init
(
const
Options
&
);
RecoIO
Run
(
const
fles
::
Timeslice
&
);
RecoIO
Run
(
const
fles
::
Timeslice
&
);
...
...
This diff is collapsed.
Click to expand it.
reco/app/cbmreco/main.cxx
+
7
−
6
View file @
90bd8f08
...
@@ -58,19 +58,20 @@ int main(int argc, char** argv)
...
@@ -58,19 +58,20 @@ int main(int argc, char** argv)
}
}
auto
result
=
reco
.
Run
(
*
ts
);
auto
result
=
reco
.
Run
(
*
ts
);
if
(
opts
.
WritePerTimeslice
()
&&
!
opts
.
OutputFile
().
empty
())
{
if
(
opts
.
SplitOutputPerTS
()
&&
!
opts
.
OutputFile
().
empty
())
{
Archive
tsResults
({
fles
::
SubsystemIdentifier
::
STS
});
// TODO: use opts.Detector() once detector flag is merged
Archive
tsResults
({
fles
::
SubsystemIdentifier
::
STS
});
// TODO: use opts.Detector() once detector flag is merged
tsResults
.
TimesliceResults
().
push_back
(
result
);
tsResults
.
TimesliceResults
().
emplace_back
(
std
::
move
(
result
));
// TODO: handle file endings
tsResults
.
Store
(
opts
.
OutputFile
(),
ts
->
index
());
tsResults
.
Store
(
fmt
::
format
(
"{}_{}"
,
opts
.
OutputFile
().
string
(),
ts
->
index
()));
}
else
{
archive
.
TimesliceResults
().
emplace_back
(
std
::
move
(
result
));
}
}
archive
.
TimesliceResults
().
push_back
(
result
);
// TODO: result should be moved not copied
tsIdx
++
;
tsIdx
++
;
if
(
num_ts
>
0
&&
tsIdx
>=
num_ts
)
{
break
;
}
if
(
num_ts
>
0
&&
tsIdx
>=
num_ts
)
{
break
;
}
}
}
if
(
!
opts
.
WritePerTimeslice
()
&&
!
opts
.
OutputFile
().
empty
())
archive
.
Store
(
opts
.
OutputFile
());
if
(
!
opts
.
SplitOutputPerTS
()
&&
!
opts
.
OutputFile
().
empty
())
archive
.
Store
(
opts
.
OutputFile
());
reco
.
Finalize
();
reco
.
Finalize
();
return
0
;
return
0
;
...
...
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