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
77d76a61
Commit
77d76a61
authored
Nov 14, 2017
by
Simon Spannagel
Browse files
Corry: allow multiple "detectors" files to be read in. Still only one is written out
parent
8d67d6d0
Pipeline
#238296
failed with stages
in 1 minute and 44 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/algorithms/Timepix3EventLoader/Timepix3EventLoader.cpp
View file @
77d76a61
...
...
@@ -145,12 +145,13 @@ void Timepix3EventLoader::initialise() {
LOG
(
DEBUG
)
<<
"Opened data file for "
<<
detectorID
<<
": "
<<
filename
;
// The header is repeated in every new data file, thus skip it for all.
uint32_t
headerID
;
uint32_t
headerID
;
if
(
!
new_file
->
read
(
reinterpret_cast
<
char
*>
(
&
headerID
),
sizeof
headerID
))
{
throw
AlgorithmError
(
"Cannot read header ID for "
+
detectorID
+
" in file "
+
filename
);
}
if
(
headerID
!=
1380208723
)
{
throw
AlgorithmError
(
"Incorrect header ID for "
+
detectorID
+
" in file "
+
filename
+
": "
+
std
::
to_string
(
headerID
));
throw
AlgorithmError
(
"Incorrect header ID for "
+
detectorID
+
" in file "
+
filename
+
": "
+
std
::
to_string
(
headerID
));
}
LOG
(
TRACE
)
<<
"Header ID:
\"
"
<<
headerID
<<
"
\"
"
;
...
...
src/core/Analysis.cpp
View file @
77d76a61
...
...
@@ -96,17 +96,31 @@ void Analysis::load() {
}
void
Analysis
::
load_detectors
()
{
std
::
string
detectors_file
=
global_config
.
getPath
(
"detectors_file"
);
std
::
fstream
file
(
detectors_file
);
ConfigReader
reader
(
file
,
detectors_file
);
for
(
auto
&
detector
:
reader
.
getConfigurations
())
{
LOG
(
INFO
)
<<
"Detector: "
<<
detector
.
getName
();
Detector
*
det_parm
=
new
Detector
(
detector
);
std
::
vector
<
std
::
string
>
detectors_files
=
global_config
.
getPathArray
(
"detectors_file"
);
// Add the new detector to the global list:
detectors
.
push_back
(
det_parm
);
for
(
auto
&
detectors_file
:
detectors_files
)
{
std
::
fstream
file
(
detectors_file
);
ConfigReader
reader
(
file
,
detectors_file
);
for
(
auto
&
detector
:
reader
.
getConfigurations
())
{
std
::
string
name
=
detector
.
getName
();
// Check if we have a duplicate:
if
(
std
::
find_if
(
detectors
.
begin
(),
detectors
.
end
(),
[
&
name
](
Detector
*
obj
)
{
return
obj
->
name
()
==
name
;
})
!=
detectors
.
end
())
{
throw
InvalidValueError
(
global_config
,
"detectors_file"
,
"Detector "
+
detector
.
getName
()
+
" defined twice"
);
}
LOG
(
INFO
)
<<
"Detector: "
<<
name
;
Detector
*
det_parm
=
new
Detector
(
detector
);
// Add the new detector to the global list:
detectors
.
push_back
(
det_parm
);
}
}
LOG
(
STATUS
)
<<
"Loaded "
<<
detectors
.
size
()
<<
" detectors"
;
// Finally, sort the list of detectors by z position (from lowest to highest)
...
...
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