Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re #11619. Added ExtractSpectra algorithm.
- Loading branch information
1 parent
101f2a2
commit 197abe3
Showing
5 changed files
with
688 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/ExtractSpectra.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#ifndef MANTID_ALGORITHMS_EXTRACTSPECTRA_H_ | ||
#define MANTID_ALGORITHMS_EXTRACTSPECTRA_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
#include "MantidAPI/Algorithm.h" | ||
#include "MantidDataObjects/EventWorkspace.h" | ||
|
||
namespace Mantid { | ||
namespace Algorithms { | ||
|
||
/** Extracts specified spectra from a workspace and places them in a new | ||
workspace. | ||
Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge | ||
National Laboratory & European Spallation Source | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport ExtractSpectra : public API::Algorithm { | ||
public: | ||
ExtractSpectra(); | ||
virtual ~ExtractSpectra(); | ||
|
||
virtual const std::string name() const; | ||
virtual int version() const; | ||
virtual const std::string category() const; | ||
virtual const std::string summary() const; | ||
|
||
private: | ||
void init(); | ||
void exec(); | ||
void execEvent(); | ||
|
||
void checkProperties(); | ||
std::size_t getXMin(const int wsIndex = 0); | ||
std::size_t getXMax(const int wsIndex = 0); | ||
void cropRagged(API::MatrixWorkspace_sptr outputWorkspace, int inIndex, | ||
int outIndex); | ||
|
||
/// The input workspace | ||
API::MatrixWorkspace_sptr m_inputWorkspace; | ||
DataObjects::EventWorkspace_sptr eventW; | ||
/// The bin index to start the cropped workspace from | ||
std::size_t m_minX; | ||
/// The bin index to end the cropped workspace at | ||
std::size_t m_maxX; | ||
/// The spectrum index to start the cropped workspace from | ||
specid_t m_minSpec; | ||
/// The spectrum index to end the cropped workspace at | ||
specid_t m_maxSpec; | ||
/// Flag indicating whether the input workspace has common boundaries | ||
bool m_commonBoundaries; | ||
/// Flag indicating whether we're dealing with histogram data | ||
bool m_histogram; | ||
/// Flag indicating whether XMin and/or XMax has been set | ||
bool m_croppingInX; | ||
}; | ||
|
||
} // namespace Algorithms | ||
} // namespace Mantid | ||
|
||
#endif /* MANTID_ALGORITHMS_EXTRACTSPECTRA_H_ */ |
Oops, something went wrong.