From 00d2f42abc3a36c10b90f1c9b2fd4b3cbc748364 Mon Sep 17 00:00:00 2001 From: "Doucet, Mathieu" Date: Tue, 16 Dec 2014 11:38:22 -0500 Subject: [PATCH] Re #10805 Modify solid angle correction for tubes --- .../src/SANSSolidAngleCorrection.cpp | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp index ad8991225bf5..ee3eec176fba 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/SANSSolidAngleCorrection.cpp @@ -139,15 +139,17 @@ void SANSSolidAngleCorrection::exec() // Compute solid angle correction factor const bool is_tube = getProperty("DetectorTubes"); - double tanTheta; + const double tanTheta = tan( inputWS->detectorTwoTheta(det) ); + const double theta_term = sqrt(tanTheta*tanTheta + 1.0); + double corr; if (is_tube) { - tanTheta = tan( getYTubeAngle(det, inputWS) ); + const double tanAlpha = tan( getYTubeAngle(det, inputWS) ); + const double alpha_term = sqrt(tanAlpha*tanAlpha + 1.0); + corr = alpha_term*theta_term*theta_term; } else { - tanTheta = tan( inputWS->detectorTwoTheta(det) ); + corr = theta_term*theta_term*theta_term; } - const double term = sqrt(tanTheta*tanTheta + 1.0); - const double corr = term*term*term; // Correct data for all X bins for (int j = 0; j < xLength; j++) @@ -211,9 +213,18 @@ void SANSSolidAngleCorrection::execEvent() if ( det->isMonitor() || det->isMasked() ) continue; // Compute solid angle correction factor + const bool is_tube = getProperty("DetectorTubes"); const double tanTheta = tan( inputEventWS->detectorTwoTheta(det) ); - const double term = sqrt(tanTheta*tanTheta + 1.0); - const double corr = term*term*term; + const double theta_term = sqrt(tanTheta*tanTheta + 1.0); + double corr; + if (is_tube) + { + const double tanAlpha = tan( getYTubeAngle(det, inputWS) ); + const double alpha_term = sqrt(tanAlpha*tanAlpha + 1.0); + corr = alpha_term*theta_term*theta_term; + } else { + corr = theta_term*theta_term*theta_term; + } EventList& el = outputEventWS->getEventList(i); el*=corr; progress.report("Solid Angle Correction");