Skip to content
Snippets Groups Projects
Commit 5a791c23 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

FlatDetector: set new trafos

parent a512c8bf
No related branches found
No related tags found
1 merge request!1900coord trafo at Frame level, with 1st application to AxesInDifferentUnits
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "Device/Detector/FlatDetector.h" #include "Device/Detector/FlatDetector.h"
#include "Base/Axis/Frame.h" #include "Base/Axis/Frame.h"
#include "Base/Axis/FrameTrafo.h"
#include "Base/Axis/MakeScale.h" #include "Base/Axis/MakeScale.h"
#include "Base/Axis/Scale.h" #include "Base/Axis/Scale.h"
#include "Base/Const/Units.h" #include "Base/Const/Units.h"
...@@ -106,7 +107,44 @@ FlatDetector::FlatDetector(size_t nxbins, size_t nybins, double width, double he ...@@ -106,7 +107,44 @@ FlatDetector::FlatDetector(size_t nxbins, size_t nybins, double width, double he
Scale* y = newEquiDivision("v (mm)", nybins, 0.0, height); Scale* y = newEquiDivision("v (mm)", nybins, 0.0, height);
x->setTrafos(x_trafos); x->setTrafos(x_trafos);
y->setTrafos(y_trafos); y->setTrafos(y_trafos);
setFrame(new Frame(x, y)); Frame* f = new Frame(x, y);
f->addTrafo(new FrameTrafo{"q (1/nm)",
{{"q_y (1/nm)"}, {"q_z (1/nm)"}},
{[=](double u) -> double {
const R3 p = pos_in_det(u, 0);
const R3 kf = k0 * p.unit_or_throw();
const R3 q = kf - ki;
return -q.y();
},
[=](double v) -> double {
const R3 p = pos_in_det(0, v);
const R3 kf = k0 * p.unit_or_throw();
const R3 q = kf - ki;
return q.z();
}},
true});
f->addTrafo(
new FrameTrafo{"u,v (mm)",
{{"u (mm)"}, {"v (mm)"}},
{[](double u) -> double { return u; }, [](double v) -> double { return v; }},
false});
f->addTrafo(new FrameTrafo{"nbins",
{{"nubins"}, {"nvbins"}},
{[=](double u) -> double { return nxbins / width * u; },
[=](double v) -> double { return nybins / height * v; }},
false});
f->addTrafo(new FrameTrafo{"angles (deg)",
{{"phi_f (deg)"}, {"alpha_f (deg)"}},
{[=](double u) -> double {
const R3 p = pos_in_det(u, 0);
return atan2(-p.y(), p.x()) * (180 / pi);
},
[=](double v) -> double {
const R3 p = pos_in_det(0, v);
return atan2(p.z(), p.x()) * (180 / pi);
}},
true});
setFrame(f);
} }
FlatDetector::FlatDetector(const FlatDetector& other) = default; FlatDetector::FlatDetector(const FlatDetector& other) = default;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment