Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
cbb751de
Commit
cbb751de
authored
Oct 20, 2020
by
Simon Spannagel
Browse files
EventLoaders: throw if input data is missing
parent
45a41171
Pipeline
#2027073
passed with stages
in 30 minutes and 13 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/modules/EventLoaderATLASpix/EventLoaderATLASpix.cpp
View file @
cbb751de
...
...
@@ -59,8 +59,7 @@ void EventLoaderATLASpix::initialize() {
// Open the root directory
DIR
*
directory
=
opendir
(
m_inputDirectory
.
c_str
());
if
(
directory
==
nullptr
)
{
LOG
(
ERROR
)
<<
"Directory "
<<
m_inputDirectory
<<
" does not exist"
;
return
;
throw
ModuleError
(
"Directory "
+
m_inputDirectory
+
" does not exist"
);
}
dirent
*
entry
;
...
...
@@ -75,10 +74,9 @@ void EventLoaderATLASpix::initialize() {
// If no data was loaded, give a warning
if
(
m_filename
.
length
()
==
0
)
{
LOG
(
WARNING
)
<<
"No data file was found for ATLASpix in "
<<
m_inputDirectory
;
}
else
{
LOG
(
STATUS
)
<<
"Opened data file for ATLASpix: (dbg)"
<<
m_filename
;
throw
ModuleError
(
"No data file was found for ATLASpix in "
+
m_inputDirectory
);
}
LOG
(
STATUS
)
<<
"Opened data file for ATLASpix: (dbg)"
<<
m_filename
;
// Open the binary data file for later
m_file
.
open
(
m_filename
.
c_str
(),
ios
::
in
|
ios
::
binary
);
...
...
src/modules/EventLoaderCLICpix/EventLoaderCLICpix.cpp
View file @
cbb751de
...
...
@@ -43,8 +43,9 @@ void EventLoaderCLICpix::initialize() {
}
// If no data was loaded, give a warning
if
(
m_filename
.
length
()
==
0
)
LOG
(
WARNING
)
<<
"No data file was found for CLICpix in "
<<
inputDirectory
;
if
(
m_filename
.
length
()
==
0
)
{
throw
ModuleError
(
"No data file was found for CLICpix in "
+
inputDirectory
);
}
// Open the data file for later
m_file
.
open
(
m_filename
.
c_str
());
...
...
src/modules/EventLoaderCLICpix2/EventLoaderCLICpix2.cpp
View file @
cbb751de
...
...
@@ -63,7 +63,7 @@ void EventLoaderCLICpix2::initialize() {
matrix_config
=
clicpix2_utils
::
readMatrix
(
m_matrix
);
// If no data was loaded, give a warning
if
(
m_filename
.
empty
())
{
LOG
(
WARNING
)
<<
"No data file was found for CLICpix2 in "
<<
inputDirectory
;
throw
ModuleError
(
"No data file was found for CLICpix2 in "
+
inputDirectory
)
;
}
// Open the data file for later
...
...
src/modules/EventLoaderTimepix1/EventLoaderTimepix1.cpp
View file @
cbb751de
...
...
@@ -52,8 +52,7 @@ void EventLoaderTimepix1::initialize() {
// Open the directory
DIR
*
directory
=
opendir
(
m_inputDirectory
.
c_str
());
if
(
directory
==
nullptr
)
{
LOG
(
ERROR
)
<<
"Directory "
<<
m_inputDirectory
<<
" does not exist"
;
return
;
throw
ModuleError
(
"Directory "
+
m_inputDirectory
+
" does not exist"
);
}
dirent
*
entry
;
...
...
@@ -72,6 +71,10 @@ void EventLoaderTimepix1::initialize() {
}
}
if
(
m_inputFilenames
.
empty
())
{
throw
ModuleError
(
"Could not find any data files in directory "
+
m_inputDirectory
);
}
// Now sort the list of filenames by time (included in the title) from
// earliest to latest
std
::
sort
(
m_inputFilenames
.
begin
(),
m_inputFilenames
.
end
(),
sortByTime
);
...
...
src/modules/EventLoaderTimepix3/EventLoaderTimepix3.cpp
View file @
cbb751de
...
...
@@ -96,9 +96,8 @@ void EventLoaderTimepix3::initialize() {
// Check that we have files for this detector and sort them correctly:
if
(
detector_files
.
empty
())
{
LOG
(
ERROR
)
<<
"No data file found for detector "
<<
m_detector
->
getName
()
<<
" in input directory "
<<
std
::
endl
<<
m_inputDirectory
;
return
;
throw
ModuleError
(
"No data file found for detector "
+
m_detector
->
getName
()
+
" in input directory "
+
m_inputDirectory
);
}
// Initialise null values for later
...
...
Simon Spannagel
@simonspa
mentioned in commit
7638c9ec
·
Oct 21, 2020
mentioned in commit
7638c9ec
mentioned in commit 7638c9ec9620e1b0ec11bd5fc4214ef1f086aaf1
Toggle commit list
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment