-
Notifications
You must be signed in to change notification settings - Fork 122
/
CreateSampleWorkspace.h
69 lines (61 loc) · 3.59 KB
/
CreateSampleWorkspace.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2014 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/MatrixWorkspace_fwd.h"
#include "MantidAlgorithms/DllConfig.h"
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Objects/CSGObject.h"
#include "MantidKernel/PseudoRandomNumberGenerator.h"
namespace Mantid {
namespace Algorithms {
/** CreateSampleWorkspace : This algorithm is intended for the creation of
sample workspaces for usage examples and other situations
*/
class MANTID_ALGORITHMS_DLL CreateSampleWorkspace : public API::Algorithm {
public:
CreateSampleWorkspace();
const std::string name() const override;
int version() const override;
const std::vector<std::string> seeAlso() const override { return {"CreateWorkspace"}; }
const std::string category() const override;
/// Algorithm's summary
const std::string summary() const override {
return "Creates sample workspaces for usage examples and other situations.";
}
private:
void init() override;
void exec() override;
DataObjects::EventWorkspace_sptr createEventWorkspace(int numPixels, int numBins, int numMonitors, int numEvents,
double x0, double binDelta,
const Geometry::Instrument_sptr &inst,
const std::string &functionString, bool isRandom);
API::MatrixWorkspace_sptr createHistogramWorkspace(int numPixels, int numBins, int numMonitors, double x0,
double binDelta, const Geometry::Instrument_sptr &inst,
const std::string &functionString, bool isRandom);
API::MatrixWorkspace_sptr createScanningWorkspace(int numBins, double x0, double binDelta,
const Geometry::Instrument_sptr &inst,
const std::string &functionString, bool isRandom,
int numScanPoints);
Geometry::Instrument_sptr createTestInstrumentRectangular(API::Progress &progress, int numBanks, int numMonitors,
int pixels, double pixelSpacing,
const double bankDistanceFromSample,
const double sourceSampleDistance);
Geometry::IObject_sptr createCappedCylinder(double radius, double height, const Kernel::V3D &baseCentre,
const Kernel::V3D &axis, const std::string &id);
Geometry::IObject_sptr createSphere(double radius, const Kernel::V3D ¢re, const std::string &id);
std::vector<double> evalFunction(const std::string &functionString, const std::vector<double> &xVal,
double noiseScale);
void replaceAll(std::string &str, const std::string &from, const std::string &to);
void addChopperParameters(API::MatrixWorkspace_sptr &ws);
/// A pointer to the random number generator
std::unique_ptr<Kernel::PseudoRandomNumberGenerator> m_randGen;
std::map<std::string, std::string> m_preDefinedFunctionmap;
};
} // namespace Algorithms
} // namespace Mantid