From 0a37c5cdaacf6cd6683573c7598ff75ccfe0490e Mon Sep 17 00:00:00 2001 From: Vickie Lynch <lynchve@ornl.gov> Date: Thu, 3 Sep 2015 12:26:50 -0400 Subject: [PATCH] Refs #12867 changes suggested by Owen --- .../MantidMDAlgorithms/IntegrateEllipsoids.h | 2 +- .../MDAlgorithms/src/IntegrateEllipsoids.cpp | 46 +------------------ .../algorithms/IntegrateEllipsoids-v1.rst | 37 +++++++++++++++ 3 files changed, 40 insertions(+), 45 deletions(-) diff --git a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegrateEllipsoids.h b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegrateEllipsoids.h index a2b2811b6a2..6dedaa0affe 100644 --- a/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegrateEllipsoids.h +++ b/Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/IntegrateEllipsoids.h @@ -40,7 +40,7 @@ private: /// Calculate if this Q is on a detector void calculateE1(Geometry::Instrument_const_sptr inst) ; - bool detectorQ(Mantid::Kernel::V3D QLabFrame, std::vector<double>& PeakRadius); + void runMaskDetectors(Mantid::DataObjects::PeaksWorkspace_sptr peakWS, std::string property, std::string values); diff --git a/Code/Mantid/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp b/Code/Mantid/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp index 2b5652bac19..1ae713b3f76 100644 --- a/Code/Mantid/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp +++ b/Code/Mantid/Framework/MDAlgorithms/src/IntegrateEllipsoids.cpp @@ -279,8 +279,8 @@ void IntegrateEllipsoids::init() { declareProperty( "IntegrateIfOnEdge", true, - "Only warning if all of peak outer radius is not on detector (default).\n" - "If false, do not integrate if the outer radius is not on a detector."); + "Set to false to not integrate if peak radius is off edge of detector." + "Background will be scaled if background radius is off edge."); } //--------------------------------------------------------------------- @@ -425,17 +425,6 @@ void IntegrateEllipsoids::exec() { integrator.ellipseIntegrateEvents(E1Vec, peak_q, specify_size, peak_radius, back_inner_radius, back_outer_radius, axes_radii, inti, sigi); - // Do not integrate if sphere is off edge of detector - - /*if (!detectorQ(peak_q, axes_radii)) { - g_log.warning() << "Warning: sphere/cylinder for integration is off edge " - "of detector for peak " << i << std::endl; - if (!integrateEdge) { - peaks[i].setIntensity(0.0); - peaks[i].setSigmaIntensity(0.0); - continue; - } - }*/ peaks[i].setIntensity(inti); peaks[i].setSigmaIntensity(sigi); peaks[i].setPeakShape(shape); @@ -511,17 +500,6 @@ void IntegrateEllipsoids::exec() { integrator.ellipseIntegrateEvents(E1Vec, peak_q, specify_size, peak_radius, back_inner_radius, back_outer_radius, axes_radii, inti, sigi); - // Do not integrate if sphere is off edge of detector - - /*if (!detectorQ(peak_q, axes_radii)) { - g_log.warning() << "Warning: sphere/cylinder for integration is off edge " - "of detector for peak " << i << std::endl; - if (!integrateEdge) { - peaks[i].setIntensity(0.0); - peaks[i].setSigmaIntensity(0.0); - continue; - } - }*/ peaks[i].setIntensity(inti); peaks[i].setSigmaIntensity(sigi); if (axes_radii.size() == 3) { @@ -629,26 +607,6 @@ void IntegrateEllipsoids::calculateE1(Geometry::Instrument_const_sptr inst) { } } - /** Calculate if this Q is on a detector - * The distance from C to OE is given by dv=C-E*(C.scalar_prod(E)) - * If dv.norm<integration_radius, one of the detector trajectories on the edge - *is too close to the peak - * This method is applied to all masked pixels. If there are masked pixels - *trajectories inside an integration volume, the peak must be rejected. - * - * @param QLabFrame: The Peak center. - * @param r: Peak radius. - */ - bool IntegrateEllipsoids::detectorQ(Mantid::Kernel::V3D QLabFrame, std::vector<double>& r) { - - for (auto E1 = E1Vec.begin(); E1 != E1Vec.end(); ++E1) { - V3D distv = QLabFrame - *E1 * (QLabFrame.scalar_prod(*E1)); // distance to the trajectory as a vector - if (distv.norm() < *( std::min_element(r.begin(), r.end()))) { - return false; - } - } - return true; -} void IntegrateEllipsoids::runMaskDetectors( Mantid::DataObjects::PeaksWorkspace_sptr peakWS, std::string property, std::string values) { diff --git a/Code/Mantid/docs/source/algorithms/IntegrateEllipsoids-v1.rst b/Code/Mantid/docs/source/algorithms/IntegrateEllipsoids-v1.rst index 6c9b414ca46..3befdb87212 100644 --- a/Code/Mantid/docs/source/algorithms/IntegrateEllipsoids-v1.rst +++ b/Code/Mantid/docs/source/algorithms/IntegrateEllipsoids-v1.rst @@ -165,6 +165,43 @@ surface. This algorithm uses principle component analysis to determine the principle axis for each peak. For the event list (QLab) associated with each peak, the algorithm determines a covariance matrix, and uses that to establish eigenvectors corresponding to the principle axis (all orthogonal). The sizes of each principle axis are used define the region of which events will be counted/integrated from those already associated with each peak. +IntegrateIfOnEdge=False option +################################### + +Edges for each bank or pack of tubes of the instrument are defined by masking the edges in the PeaksWorkspace instrument. +e.g. For CORELLI, tubes 1 and 16, and pixels 0 and 255. +Q in the lab frame for every peak is calculated, call it C +For every point on the edge, the trajectory in reciprocal space is a straight line, going through: + +:math:`\vec{O}=(0,0,0)` + +Calculate a point at a fixed momentum, say k=1. +Q in the lab frame: + +:math:`\vec{E}=(-k*sin(\theta)*cos(\phi),-k*sin(\theta)*sin(\phi),k-k*cos(\phi))` + +Normalize E to 1: + +:math:`\vec{E}=\vec{E}*(1./\left|\vec{E}\right|)` + +The distance from C to OE is given by: + +:math:`dv=\vec{C}-\vec{E}*(\vec{C} \cdot \vec{E})` + +If: + +:math:`\left|dv\right|<PeakRadius` + +for the integration, one of the detector trajectories on the edge is too close to the peak +This method is also applied to all masked pixels. If there are masked pixels trajectories inside an integration volume, the peak must be rejected. +If there are masked pixel trajectories inside the background volume, the background events are scaled by estimating the volume of the ellipsoid +on the detector. + +Sigma from the background +################################### +The sigma from the background could be too small because the background contains events from other peaks. In an effort to reduce this, all the +background events are sorted and the top 1% are removed. + Usage ------ -- GitLab