Mantid
Loading...
Searching...
No Matches
Stitch1D.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2014 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
11#include "MantidAlgorithms/DllConfig.h"
12
13#include <boost/tuple/tuple.hpp>
14
15namespace Mantid {
16namespace Algorithms {
17
20class MANTID_ALGORITHMS_DLL Stitch1D final : public API::Algorithm {
21public:
23 const std::string name() const override { return "Stitch1D"; }
25 int version() const override { return 3; }
27 const std::string category() const override { return "Reflectometry"; }
29 const std::string summary() const override { return "Stitches single histogram matrix workspaces together"; }
30 const std::vector<std::string> seeAlso() const override { return {"Rebin", "Stitch1DMany"}; }
32 bool hasNonzeroErrors(Mantid::API::MatrixWorkspace_sptr &ws);
34 std::map<std::string, std::string> validateInputs() override;
35
36private:
39 using SpecialTypeIndexes = std::vector<std::vector<size_t>>;
41 void init() override;
43 void exec() override;
45 double getStartOverlap(const double intesectionMin, const double intesectionMax) const;
47 double getEndOverlap(const double intesectionMin, const double intesectionMax) const;
48
50 std::vector<double> getRebinParams(Mantid::API::MatrixWorkspace_const_sptr &lhsWS,
51 Mantid::API::MatrixWorkspace_const_sptr &rhsWS, const bool scaleRHS) const;
53 Mantid::API::MatrixWorkspace_sptr rebin(Mantid::API::MatrixWorkspace_sptr &input, const std::vector<double> &params);
55 Mantid::API::MatrixWorkspace_sptr integration(Mantid::API::MatrixWorkspace_sptr &input, const double start,
56 const double stop);
65 boost::tuple<int, int> findStartEndIndexes(double startOverlap, double endOverlap,
70 void maskInPlace(int a1, int a2, Mantid::API::MatrixWorkspace_sptr &source);
72 void reinsertSpecialValues(const Mantid::API::MatrixWorkspace_sptr &ws);
74 static const double range_tolerance;
79 void scaleWorkspace(API::MatrixWorkspace_sptr &ws, API::MatrixWorkspace_sptr &scaleFactorWS,
89};
90
91} // namespace Algorithms
92} // namespace Mantid
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Stitch1D : Stitches two Matrix Workspaces together into a single output.
Definition: Stitch1D.h:20
SpecialTypeIndexes m_infEIndexes
Index per workspace spectra of Infs.
Definition: Stitch1D.h:86
const std::string summary() const override
Summary of algorithm's purpose.
Definition: Stitch1D.h:29
SpecialTypeIndexes m_nanYIndexes
Definition: Stitch1D.h:83
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
Definition: Stitch1D.h:30
std::vector< std::vector< size_t > > SpecialTypeIndexes
Helper typedef.
Definition: Stitch1D.h:39
const std::string name() const override
Algorithm's name for identification.
Definition: Stitch1D.h:23
Mantid::API::MatrixWorkspace_sptr singleValueWS(const double val)
const std::string category() const override
Algorithm's category for identification.
Definition: Stitch1D.h:27
int version() const override
Algorithm's version for identification.
Definition: Stitch1D.h:25
SpecialTypeIndexes m_nanEIndexes
Index per workspace spectra of Nans.
Definition: Stitch1D.h:82
SpecialTypeIndexes m_infYIndexes
Definition: Stitch1D.h:87
SpecialTypeIndexes m_nanDxIndexes
Definition: Stitch1D.h:84
double m_scaleFactor
Scaling factors.
Definition: Stitch1D.h:76
static const double range_tolerance
Range tolerance.
Definition: Stitch1D.h:74
SpecialTypeIndexes m_infDxIndexes
Definition: Stitch1D.h:88
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
void MANTID_KERNEL_DLL rebin(const std::vector< double > &xold, const std::vector< double > &yold, const std::vector< double > &eold, const std::vector< double > &xnew, std::vector< double > &ynew, std::vector< double > &enew, bool distribution, bool addition=false)
Rebins data according to a new output X array.
Helper class which provides the Collimation Length for SANS instruments.