DiffractionExperiment: solid angle correction

This commit is contained in:
2023-05-09 14:03:59 +02:00
parent 5d63bac30f
commit a867b1c596
10 changed files with 163 additions and 117 deletions

View File

@@ -48,6 +48,7 @@ DiffractionExperiment::DiffractionExperiment(const DetectorSetup& det_setup) {
dataset.set_images_per_trigger(1);
dataset.set_summation(1);
dataset.set_space_group_number(0); // not set
dataset.set_rad_int_solid_angle_corr(false);
dataset.set_compression(JFJochProtoBuf::BSHUF_LZ4);
@@ -766,6 +767,17 @@ float DiffractionExperiment::ResToPxl(float resolution) const {
return tan_2theta * GetDetectorDistance_mm() / GetPixelSize_mm();
}
float DiffractionExperiment::CalcRadIntSolidAngleCorr(float q) const {
if (!GetSolidAngleCorrection())
return 1.0f;
float sin_theta = q * GetWavelength_A() / (4 * static_cast<float>(M_PI));
float theta = asinf(sin_theta);
float cos_two_theta = cosf(2 * theta);
float cos_two_theta_3 = cos_two_theta * cos_two_theta * cos_two_theta;
return cos_two_theta_3;
}
Coord DiffractionExperiment::LabCoord(float detector_x, float detector_y) const {
// Assumes planar detector, 90 deg towards beam
return {(detector_x - GetBeamX_pxl()) * GetPixelSize_mm() ,
@@ -1173,4 +1185,14 @@ void DiffractionExperiment::GetDetectorModuleHostname(std::vector<std::string> &
std::string DiffractionExperiment::GetDetectorDescription() const {
return internal.detector().description();
}
}
bool DiffractionExperiment::GetSolidAngleCorrection() const {
return dataset.rad_int_solid_angle_corr();
}
DiffractionExperiment &DiffractionExperiment::RadIntSolidAngleCorr(bool input) {
dataset.set_rad_int_solid_angle_corr(input);
return *this;
}