* Enhancements for XFEL
* Enhancements for EIGER * Writer is more flexible and capable of handling DECTRIS data
This commit is contained in:
+17
-12
@@ -4,8 +4,8 @@
|
||||
#include "JFJochException.h"
|
||||
#include "Definitions.h"
|
||||
|
||||
DetectorGeometry::DetectorGeometry(const std::vector<DetectorModuleGeometry> &in_modules)
|
||||
: modules(in_modules) {
|
||||
DetectorGeometry::DetectorGeometry(const std::vector<DetectorModuleGeometry> &in_modules, bool vertical_flip)
|
||||
: modules(in_modules) {
|
||||
if (modules.empty())
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Module number must be positive");
|
||||
|
||||
@@ -16,6 +16,11 @@ DetectorGeometry::DetectorGeometry(const std::vector<DetectorModuleGeometry> &in
|
||||
width = std::max<int64_t>(width, m.GetMaxX()+1);
|
||||
height = std::max<int64_t>(height, m.GetMaxY()+1);
|
||||
}
|
||||
|
||||
if (vertical_flip) {
|
||||
for (auto &m: modules) m.VerticalFlip(height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DetectorGeometry::DetectorGeometry(int32_t nmodules, int32_t horizontal_stacking, int32_t gap_x,
|
||||
@@ -35,22 +40,22 @@ DetectorGeometry::DetectorGeometry(int32_t nmodules, int32_t horizontal_stacking
|
||||
int64_t conv_lines = nmodules / horizontal_stacking + (nmodules % horizontal_stacking > 0 ? 1 : 0);
|
||||
height = conv_lines * CONVERTED_MODULE_LINES + (conv_lines - 1) * gap_y;
|
||||
|
||||
for (int module = 0; module < nmodules; module++) {
|
||||
int64_t module_x = module % horizontal_stacking;
|
||||
int64_t module_y = module / horizontal_stacking;
|
||||
for (int m = 0; m < nmodules; m++) {
|
||||
int64_t module_x = m % horizontal_stacking;
|
||||
int64_t module_y = m / horizontal_stacking;
|
||||
|
||||
int64_t x0 = module_x * (CONVERTED_MODULE_COLS + gap_x);
|
||||
int64_t y0 = module_y * (CONVERTED_MODULE_LINES + gap_y);
|
||||
|
||||
DetectorModuleGeometry::Direction fast = DetectorModuleGeometry::Direction::Xpos;
|
||||
DetectorModuleGeometry::Direction slow;
|
||||
if (mirror_y) {
|
||||
y0 = height - y0 - 1;
|
||||
slow = DetectorModuleGeometry::Direction::Yneg;
|
||||
} else
|
||||
slow = DetectorModuleGeometry::Direction::Ypos;
|
||||
DetectorModuleGeometry::Direction slow = DetectorModuleGeometry::Direction::Ypos;
|
||||
|
||||
modules.emplace_back(x0, y0, fast, slow);
|
||||
DetectorModuleGeometry mgeom(x0,y0,fast, slow);
|
||||
|
||||
if (mirror_y)
|
||||
mgeom.VerticalFlip(height);
|
||||
|
||||
modules.emplace_back(mgeom);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user