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

merge local fct into SpecularSimulation::runComputation

parent 4a1777a6
No related branches found
No related tags found
No related merge requests found
...@@ -29,33 +29,6 @@ ...@@ -29,33 +29,6 @@
#include "Sim/Computation/SpecularComputation.h" #include "Sim/Computation/SpecularComputation.h"
#include "Sim/Scan/AlphaScan.h" #include "Sim/Scan/AlphaScan.h"
namespace {
//! Performs the actual simulation, and sets intensity, for given range of SpecularElement%s.
double reflectedIntensity(const ReSample& re_sample, SpecularElement& ele)
{
if (!ele.isCalculated())
return 0;
const SliceStack& slices = re_sample.averageSlices();
std::vector<complex_t> kz_stack = ele.produceKz(slices);
if (re_sample.polarizing()) {
const SpinMatrix R = Compute::polarizedReflectivity(slices, kz_stack, true);
const SpinMatrix& polMatrix = ele.polarizer();
const SpinMatrix& anaMatrix = ele.analyzer();
return Compute::magneticR(R, polMatrix, anaMatrix);
} else {
const complex_t R = Compute::scalarReflectivity(slices, kz_stack);
return Compute::scalarR(R);
}
}
} // namespace
SpecularSimulation::SpecularSimulation(const IBeamScan& scan, const MultiLayer& sample) SpecularSimulation::SpecularSimulation(const IBeamScan& scan, const MultiLayer& sample)
: ISimulation(sample) : ISimulation(sample)
, m_scan(scan.clone()) , m_scan(scan.clone())
...@@ -82,7 +55,26 @@ void SpecularSimulation::initElementVector() ...@@ -82,7 +55,26 @@ void SpecularSimulation::initElementVector()
void SpecularSimulation::runComputation(const ReSample& re_sample, size_t iElement, double weight) void SpecularSimulation::runComputation(const ReSample& re_sample, size_t iElement, double weight)
{ {
SpecularElement& ele = *(m_eles.begin() + static_cast<long>(iElement)); SpecularElement& ele = *(m_eles.begin() + static_cast<long>(iElement));
double refl = reflectedIntensity(re_sample, ele);
double refl = 0;
if (ele.isCalculated()) {
const SliceStack& slices = re_sample.averageSlices();
std::vector<complex_t> kz_stack = ele.produceKz(slices);
if (re_sample.polarizing()) {
const SpinMatrix R = Compute::polarizedReflectivity(slices, kz_stack, true);
const SpinMatrix& polMatrix = ele.polarizer();
const SpinMatrix& anaMatrix = ele.analyzer();
refl = Compute::magneticR(R, polMatrix, anaMatrix);
} else {
const complex_t R = Compute::scalarReflectivity(slices, kz_stack);
refl = Compute::scalarR(R);
}
}
double intensity = refl * ele.footprint(); double intensity = refl * ele.footprint();
if (background()) if (background())
......
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