Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
scdaq
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
scouting-demonstrator
scdaq
Commits
1d1b815e
Commit
1d1b815e
authored
8 months ago
by
Giovanna Lazzari Miotto
Browse files
Options
Downloads
Patches
Plain Diff
tidy: output: Clean up
parent
50185b4b
No related branches found
Branches containing commit
No related tags found
1 merge request
!109
Introduce pipeline synchronization, output template and parallel sink
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/OutputFile.h
+11
-16
11 additions, 16 deletions
src/OutputFile.h
src/OutputFileHandler.h
+1
-1
1 addition, 1 deletion
src/OutputFileHandler.h
with
12 additions
and
17 deletions
src/OutputFile.h
+
11
−
16
View file @
1d1b815e
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
class
OutputFile
{
class
OutputFile
{
public:
public:
using
HeaderType
=
FRDFileHeader_v2
;
using
HeaderType
=
FRDFileHeader_v2
;
struct
Metadata
{
struct
Metadata
{
uint32_t
run_number
;
uint32_t
run_number
;
uint32_t
lumisection
;
uint32_t
lumisection
;
...
@@ -35,14 +36,13 @@ class OutputFile {
...
@@ -35,14 +36,13 @@ class OutputFile {
size_t
file_size
{};
size_t
file_size
{};
uint32_t
num_orbits
{};
uint32_t
num_orbits
{};
uint32_t
num_files
{};
uint32_t
num_files
{};
uint32_t
max_index
;
uint32_t
max_index
;
LumisectionMetadata
(
uint32_t
max_index_per_ls
)
:
max_index
(
max_index_per_ls
)
{}
LumisectionMetadata
(
uint32_t
max_index_per_ls
)
:
max_index
(
max_index_per_ls
)
{}
void
Reset
()
{
file_size
=
num_orbits
=
num_files
=
0
;
}
void
Reset
()
{
file_size
=
num_orbits
=
num_files
=
0
;
}
void
AddFileMetadata
(
Metadata
&&
fmd
)
{
void
AddFileMetadata
(
Metadata
&&
fmd
)
{
file_size
+=
fmd
.
size
;
file_size
+=
fmd
.
size
;
num_orbits
+=
fmd
.
num_orbits
;
num_orbits
+=
fmd
.
num_orbits
;
num_files
++
;
num_files
++
;
...
@@ -64,9 +64,6 @@ class OutputFile {
...
@@ -64,9 +64,6 @@ class OutputFile {
OutputFile
()
=
default
;
OutputFile
()
=
default
;
std
::
string
GetFilename
()
{
return
filename_
;
}
std
::
string
GetRunDir
()
{
return
run_dir_
;
}
void
ReserveHeaderSize
()
{
void
ReserveHeaderSize
()
{
assert
(
md_
.
size
==
0
);
assert
(
md_
.
size
==
0
);
md_
.
size
=
sizeof
(
HeaderType
);
md_
.
size
=
sizeof
(
HeaderType
);
...
@@ -101,27 +98,25 @@ class OutputFile {
...
@@ -101,27 +98,25 @@ class OutputFile {
auto
IsOpen
()
->
bool
{
return
(
file_ptr_
!=
NULL
);
}
auto
IsOpen
()
->
bool
{
return
(
file_ptr_
!=
NULL
);
}
auto
HasPayload
()
->
bool
{
return
md_
.
size
>
sizeof
(
HeaderType
);
}
void
SetFileHeader
(
uint16_t
source_id
)
{
void
SetFileHeader
(
uint16_t
source_id
)
{
header_
=
HeaderType
(
source_id
,
md_
.
num_orbits
,
md_
.
run_number
,
md_
.
lumisection
,
md_
.
size
);
header_
=
HeaderType
(
source_id
,
md_
.
num_orbits
,
md_
.
run_number
,
md_
.
lumisection
,
md_
.
size
);
}
}
void
SetLumisectionFooter
(
LumisectionMetadata
&
md
)
{
void
SetLumisectionFooter
(
LumisectionMetadata
&
md
)
{
// The last file in a lumisection carries a LS footer
// The last file in a lumisection carries a
n
LS
metadata
footer
ls_footer_
.
emplace
(
md
);
ls_footer_
.
emplace
(
md
);
}
}
uint32_t
GetLumisection
()
{
return
md_
.
lumisection
;
}
uint32_t
GetIndex
()
{
return
md_
.
index
;
}
Metadata
GetMetadata
()
{
return
md_
;
}
auto
GetLumisectionFooter
()
->
LumisectionMetadata
{
return
ls_footer_
.
value
();
}
auto
HasLumisectionFooter
()
->
bool
{
return
ls_footer_
.
has_value
();
}
auto
GetSize
()
->
size_t
{
return
md_
.
size
;
}
auto
GetSize
()
->
size_t
{
return
md_
.
size
;
}
auto
GetNumberOfOrbits
()
->
uint32_t
{
return
md_
.
num_orbits
;
}
auto
GetNumberOfOrbits
()
->
uint32_t
{
return
md_
.
num_orbits
;
}
auto
GetFilename
()
->
std
::
string
{
return
filename_
;
}
auto
GetRunDir
()
->
std
::
string
{
return
run_dir_
;
}
auto
GetLumisection
()
->
uint32_t
{
return
md_
.
lumisection
;
}
auto
GetIndex
()
->
uint32_t
{
return
md_
.
index
;
}
auto
GetMetadata
()
->
Metadata
{
return
md_
;
}
auto
GetLumisectionFooter
()
->
LumisectionMetadata
{
return
ls_footer_
.
value
();
}
auto
HasLumisectionFooter
()
->
bool
{
return
ls_footer_
.
has_value
();
}
auto
HasPayload
()
->
bool
{
return
md_
.
size
>
sizeof
(
HeaderType
);
}
private
:
private
:
FILE
*
file_ptr_
{};
FILE
*
file_ptr_
{};
...
...
This diff is collapsed.
Click to expand it.
src/OutputFileHandler.h
+
1
−
1
View file @
1d1b815e
...
@@ -20,7 +20,7 @@ struct FileLocator {
...
@@ -20,7 +20,7 @@ struct FileLocator {
const
std
::
string
filename_suffix
;
const
std
::
string
filename_suffix
;
const
static
std
::
string
working_dirname
;
const
static
std
::
string
working_dirname
;
FileLocator
(
std
::
string
base
,
std
::
string
pref
,
std
::
string
suf
)
FileLocator
(
std
::
string
&&
base
,
std
::
string
&&
pref
,
std
::
string
&&
suf
)
:
base_path
(
std
::
move
(
base
)),
:
base_path
(
std
::
move
(
base
)),
filename_prefix
(
std
::
move
(
pref
)),
filename_prefix
(
std
::
move
(
pref
)),
filename_suffix
(
std
::
move
(
suf
))
{}
filename_suffix
(
std
::
move
(
suf
))
{}
...
...
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