DiffractionExperiment: Move internal variables to a C++ structure
This commit is contained in:
@@ -54,19 +54,6 @@ DetectorGeometry::DetectorGeometry(int32_t nmodules, int32_t horizontal_stacking
|
||||
}
|
||||
}
|
||||
|
||||
DetectorGeometry::operator JFJochProtoBuf::DetectorGeometry() const {
|
||||
JFJochProtoBuf::DetectorGeometry ret;
|
||||
ret.set_height_pxl(height);
|
||||
ret.set_width_pxl(width);
|
||||
for (auto &m: modules) {
|
||||
auto mpbf = ret.add_module_geometry();
|
||||
mpbf->set_pixel0(m.GetPixel0_X() + width * m.GetPixel0_Y());
|
||||
mpbf->set_fast_direction_step(GetDirectionStep(m.GetFastAxis()));
|
||||
mpbf->set_slow_direction_step(GetDirectionStep(m.GetSlowAxis()));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t DetectorGeometry::GetDirectionStep(DetectorModuleGeometry::Direction direction) const {
|
||||
switch (direction) {
|
||||
case DetectorModuleGeometry::Direction::Xneg:
|
||||
@@ -84,4 +71,30 @@ int64_t DetectorGeometry::GetDirectionStep(DetectorModuleGeometry::Direction dir
|
||||
|
||||
int64_t DetectorGeometry::GetModulesNum() const {
|
||||
return modules.size();
|
||||
}
|
||||
}
|
||||
|
||||
int64_t DetectorGeometry::GetWidth() const {
|
||||
return width;
|
||||
}
|
||||
|
||||
int64_t DetectorGeometry::GetHeight() const {
|
||||
return height;
|
||||
}
|
||||
|
||||
int64_t DetectorGeometry::GetPixel0(int64_t m) const {
|
||||
if ((m < 0) || (m >= modules.size()))
|
||||
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Wrong module number");
|
||||
return modules[m].GetPixel0_X() + width * modules[m].GetPixel0_Y();
|
||||
}
|
||||
|
||||
int64_t DetectorGeometry::GetFastDirectionStep(int64_t m) const {
|
||||
if ((m < 0) || (m >= modules.size()))
|
||||
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Wrong module number");
|
||||
return GetDirectionStep(modules[m].GetFastAxis());
|
||||
}
|
||||
|
||||
int64_t DetectorGeometry::GetSlowDirectionStep(int64_t m) const {
|
||||
if ((m < 0) || (m >= modules.size()))
|
||||
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Wrong module number");
|
||||
return GetDirectionStep(modules[m].GetSlowAxis());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user