Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yue Hang Leung
cbmroot
Commits
33bbde0d
Commit
33bbde0d
authored
1 year ago
by
Felix Weiglhofer
Browse files
Options
Downloads
Patches
Plain Diff
algo: Raise error if only one of output-file and output-type is specified.
parent
0b299d72
Branches
Branches containing commit
Tags
dev_2023_44
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
algo/base/Exceptions.h
+8
-6
8 additions, 6 deletions
algo/base/Exceptions.h
algo/base/Options.cxx
+1
-1
1 addition, 1 deletion
algo/base/Options.cxx
algo/global/Reco.cxx
+13
-6
13 additions, 6 deletions
algo/global/Reco.cxx
with
22 additions
and
13 deletions
algo/base/Exceptions.h
+
8
−
6
View file @
33bbde0d
...
...
@@ -5,18 +5,20 @@
#define CBM_ALGO_BASE_EXCEPTIONS_H
#include
<exception>
#include
<string_view>
#include
<fmt/format.h>
namespace
cbm
::
algo
{
/**
* @brief Base class for exceptions
* @brief Base class for exceptions.
*
* @note Should not be thrown directly. Use one of the derived classes instead.
*/
class
Exception
:
public
std
::
runtime_error
{
public:
struct
Exception
:
std
::
runtime_error
{
template
<
typename
...
Args
>
Exception
(
const
char
*
fmt
,
Args
&&
...
args
)
:
std
::
runtime_error
(
fmt
::
format
(
fmt
,
std
::
forward
<
Args
>
(
args
)...))
Exception
(
std
::
string_view
fmt
,
Args
&&
...
args
)
:
std
::
runtime_error
(
fmt
::
format
(
fmt
,
std
::
forward
<
Args
>
(
args
)...))
{
}
};
...
...
@@ -24,7 +26,7 @@ namespace cbm::algo
/**
* @brief Indicates an unrecoverable error. Should tear down the process.
*/
class
FatalError
:
public
Exception
{
struct
FatalError
:
Exception
{
using
Exception
::
Exception
;
};
...
...
@@ -32,7 +34,7 @@ namespace cbm::algo
* Indicates an error during timeslice processing. Timeslice will be discarded.
* Processing can continue with new timeslice.
*/
class
ProcessingError
:
public
Exception
{
struct
ProcessingError
:
Exception
{
using
Exception
::
Exception
;
};
...
...
This diff is collapsed.
Click to expand it.
algo/base/Options.cxx
+
1
−
1
View file @
33bbde0d
...
...
@@ -72,7 +72,7 @@ Options::Options(int argc, char** argv)
(
"histogram"
,
po
::
value
(
&
fHistogramUri
)
->
value_name
(
"<uri>"
),
"URI to specify histogram server"
)
(
"log-file,L"
,
po
::
value
(
&
fLogFile
)
->
value_name
(
"<file>"
),
"write log messages to file"
)
(
"output-types,O"
,
po
::
value
(
&
fOutputTypes
)
->
multitoken
()
->
default_value
({
RecoData
::
Hit
})
->
value_name
(
"<types>"
),
(
"output-types,O"
,
po
::
value
(
&
fOutputTypes
)
->
multitoken
()
->
value_name
(
"<types>"
),
"comma seperated list of reconstruction output types (hit, digi, ...)"
)
(
"steps"
,
po
::
value
(
&
fRecoSteps
)
->
multitoken
()
->
default_value
({
Step
::
Unpack
,
Step
::
DigiTrigger
,
Step
::
LocalReco
,
Step
::
Tracking
})
->
value_name
(
"<steps>"
),
"comma seperated list of reconstruction steps (upack, digitrigger, localreco, ...)"
)
...
...
This diff is collapsed.
Click to expand it.
algo/global/Reco.cxx
+
13
−
6
View file @
33bbde0d
...
...
@@ -10,6 +10,7 @@
#include
<xpu/host.h>
#include
"Exceptions.h"
#include
"compat/OpenMP.h"
#include
"config/Yaml.h"
#include
"evbuild/Config.h"
...
...
@@ -24,14 +25,20 @@ Reco::~Reco() {}
void
Reco
::
Validate
(
const
Options
&
opts
)
{
if
(
!
fs
::
exists
(
opts
.
ParamsDir
()))
{
throw
std
::
runtime_error
(
"ParamsDir does not exist: "
+
opts
.
ParamsDir
().
string
());
}
if
(
!
fs
::
exists
(
opts
.
ParamsDir
()))
throw
FatalError
(
"ParamsDir does not exist: {}"
,
opts
.
ParamsDir
().
string
());
if
(
opts
.
HasOutput
(
RecoData
::
Digi
))
throw
FatalError
(
"Storing raw digis via 'Digi' option not supported"
);
if
(
opts
.
HasOutput
(
RecoData
::
Cluster
))
throw
FatalError
(
"Storing clusters via 'Cluster' option not supported"
);
if
(
opts
.
HasOutput
(
RecoData
::
Digi
))
{
throw
std
::
runtime_error
(
"Storing raw digis via 'Digi' option not supported"
);
}
bool
hasOutputFile
=
!
opts
.
OutputFile
().
empty
();
bool
hasOutputType
=
!
opts
.
OutputTypes
().
empty
();
if
(
!
hasOutputFile
&&
hasOutputType
)
{
throw
FatalError
(
"Output types specified, but no output file given: -o <file> missing"
);
}
if
(
opts
.
H
asOutput
(
RecoData
::
Cluster
)
)
{
throw
std
::
runtime_error
(
"Storing clusters via 'Cluster' option not supported
"
);
if
(
h
asOutput
File
&&
!
hasOutputType
)
{
throw
FatalError
(
"Output file specified, but no output types given: -O <types> missing
"
);
}
}
...
...
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