-
Notifications
You must be signed in to change notification settings - Fork 122
/
PoldiCalculateSpectrum2D.h
97 lines (70 loc) · 3.64 KB
/
PoldiCalculateSpectrum2D.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef MANTID_SINQ_POLDICALCULATESPECTRUM2D_H_
#define MANTID_SINQ_POLDICALCULATESPECTRUM2D_H_
#include "MantidKernel/System.h"
#include "MantidSINQ/DllConfig.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/IFunction.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidSINQ/PoldiUtilities/PoldiPeakCollection.h"
#include "MantidSINQ/PoldiUtilities/PoldiTimeTransformer.h"
#include "MantidSINQ/PoldiUtilities/Poldi2DFunction.h"
namespace Mantid
{
namespace Poldi
{
/** PoldiCalculateSpectrum2D
An Algorithm to calculate a POLDI 2D-spectrum from a given table containing POLDI
peak data. A MatrixWorkspace containing a proper POLDI instrument definition is required
to determine output workspace dimensions etc.
@author Michael Wedel, Paul Scherrer Institut - SINQ
@date 16/05/2014
Copyright © 2014 PSI-MSS
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 MANTID_SINQ_DLL PoldiCalculateSpectrum2D : public API::Algorithm
{
public:
PoldiCalculateSpectrum2D();
virtual ~PoldiCalculateSpectrum2D();
virtual const std::string name() const;
virtual int version() const;
virtual const std::string category() const;
virtual const std::string summary() const;
protected:
PoldiPeakCollection_sptr getPeakCollection(const DataObjects::TableWorkspace_sptr &peakTable) const;
PoldiPeakCollection_sptr getIntegratedPeakCollection(const PoldiPeakCollection_sptr &rawPeakCollection) const;
PoldiPeakCollection_sptr getNormalizedPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const;
PoldiPeakCollection_sptr getCountPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const;
PoldiPeakCollection_sptr getPeakCollectionFromFunction(const API::IFunction_sptr &fitFunction) const;
boost::shared_ptr<Poldi2DFunction> getFunctionFromPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const;
void addBackgroundTerms(boost::shared_ptr<Poldi2DFunction> poldi2DFunction) const;
API::IAlgorithm_sptr calculateSpectrum(const PoldiPeakCollection_sptr &peakCollection, const API::MatrixWorkspace_sptr &matrixWorkspace);
API::MatrixWorkspace_sptr getWorkspace(const API::IAlgorithm_sptr &fitAlgorithm) const;
API::IFunction_sptr getFunction(const API::IAlgorithm_sptr &fitAlgorithm) const;
void setTimeTransformerFromInstrument(const PoldiInstrumentAdapter_sptr &poldiInstrument);
void setTimeTransformer(const PoldiTimeTransformer_sptr &poldiTimeTransformer);
void setDeltaTFromWorkspace(const API::MatrixWorkspace_sptr &matrixWorkspace);
void setDeltaT(double newDeltaT);
bool isValidDeltaT(double deltaT) const;
void throwOnInsufficientState();
PoldiTimeTransformer_sptr m_timeTransformer;
double m_deltaT;
private:
void init();
void exec();
};
} // namespace Poldi
} // namespace Mantid
#endif /* MANTID_SINQ_POLDICALCULATESPECTRUM2D_H_ */