Commit 33d1f787 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Detector: add helper to check the role

parent b34ea57b
......@@ -83,6 +83,14 @@ Detector::Detector(const Configuration& config) {
}
}
bool Detector::isReference() {
return m_role == DetectorRole::REFERENCE;
}
bool Detector::isDUT() {
return m_role == DetectorRole::DUT;
}
// Functions to set and check channel masking
void Detector::setMaskFile(std::string file) {
m_maskfile = file;
......
......@@ -52,7 +52,11 @@ namespace corryvreckan {
// Functions to retrieve basic information
std::string type() { return m_detectorType; }
std::string name() { return m_detectorName; }
// Detector role and helper functions
DetectorRole role() { return m_role; }
bool isReference();
bool isDUT();
Configuration getConfiguration();
......
......@@ -35,8 +35,7 @@ Detector* Module::get_detector(std::string name) {
}
Detector* Module::get_reference() {
auto it = find_if(
m_detectors.begin(), m_detectors.end(), [](Detector* obj) { return obj->role() == DetectorRole::REFERENCE; });
auto it = find_if(m_detectors.begin(), m_detectors.end(), [](Detector* obj) { return obj->isReference(); });
return (*it);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment