20 using InterferenceFunctionUtils::PrecomputePolarizedFormFactors;
21 using InterferenceFunctionUtils::PrecomputeScalarFormFactors;
23 SSCApproximationStrategy::SSCApproximationStrategy(
SimulationOptions sim_params,
double kappa,
29 void SSCApproximationStrategy::strategy_specific_post_init()
31 m_helper.init(m_formfactor_wrappers);
37 double SSCApproximationStrategy::scalarCalculation(
const SimulationElement& sim_element)
const
39 double qp = sim_element.getMeanQ().
magxy();
40 double diffuse_intensity = 0.0;
41 auto precomputed_ff = PrecomputeScalarFormFactors(sim_element, m_formfactor_wrappers);
42 for (
size_t i = 0; i < m_formfactor_wrappers.size(); ++i) {
43 complex_t ff = precomputed_ff[i];
44 double fraction = m_formfactor_wrappers[i].relativeAbundance();
45 diffuse_intensity += fraction * std::norm(ff);
47 complex_t mean_ff_norm =
48 m_helper.getMeanFormfactorNorm(qp, precomputed_ff, m_formfactor_wrappers);
49 complex_t p2kappa = m_helper.getCharacteristicSizeCoupling(qp, m_formfactor_wrappers);
50 complex_t omega = m_helper.getCharacteristicDistribution(qp, mP_iff.get());
51 double iff = 2.0 * (mean_ff_norm * omega / (1.0 - p2kappa * omega)).real();
52 double dw_factor = mP_iff->DWfactor(sim_element.getMeanQ());
53 return diffuse_intensity + dw_factor * iff;
57 double SSCApproximationStrategy::polarizedCalculation(
const SimulationElement& sim_element)
const
59 double qp = sim_element.getMeanQ().
magxy();
60 Eigen::Matrix2cd diffuse_matrix = Eigen::Matrix2cd::Zero();
61 auto precomputed_ff = PrecomputePolarizedFormFactors(sim_element, m_formfactor_wrappers);
63 for (
size_t i = 0; i < m_formfactor_wrappers.size(); ++i) {
64 Eigen::Matrix2cd ff = precomputed_ff[i];
65 double fraction = m_formfactor_wrappers[i].relativeAbundance();
66 diffuse_matrix += fraction * (ff * polarization_handler.getPolarization() * ff.adjoint());
68 Eigen::Matrix2cd mff_orig, mff_conj;
69 m_helper.getMeanFormfactors(qp, mff_orig, mff_conj, precomputed_ff, m_formfactor_wrappers);
70 complex_t p2kappa = m_helper.getCharacteristicSizeCoupling(qp, m_formfactor_wrappers);
71 complex_t omega = m_helper.getCharacteristicDistribution(qp, mP_iff.get());
72 Eigen::Matrix2cd interference_matrix = (2.0 * omega / (1.0 - p2kappa * omega))
73 * polarization_handler.getAnalyzerOperator() * mff_orig
74 * polarization_handler.getPolarization() * mff_conj;
75 Eigen::Matrix2cd diffuse_matrix2 = polarization_handler.getAnalyzerOperator() * diffuse_matrix;
76 double interference_trace = std::abs(interference_matrix.trace());
77 double diffuse_trace = std::abs(diffuse_matrix2.trace());
78 double dw_factor = mP_iff->DWfactor(sim_element.getMeanQ());
79 return diffuse_trace + dw_factor * interference_trace;
Defines and implements the interface class IInterferenceFunction.
Defines class SSCApproximationStrategy.
Defines class SimulationElement.
double magxy() const
Returns distance from z axis.
Base class of all interference function strategy classes.
Data stucture containing both input and output of a single detector cell.
const PolarizationHandler & polarizationHandler() const
Returns assigned PolarizationHandler.
Collect the different options for simulation.