Mantid
Loading...
Searching...
No Matches
DetectorDiagnostic.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 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
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
12#include "MantidAPI/Algorithm.h"
13#include "MantidAlgorithms/DllConfig.h"
16
17#include <set>
18
19namespace Mantid {
20namespace Algorithms {
30class MANTID_ALGORITHMS_DLL DetectorDiagnostic : public API::Algorithm {
31public:
35 virtual ~DetectorDiagnostic() = default;
37 const std::string category() const override;
39 const std::string name() const override;
41 const std::string summary() const override {
42 return "Identifies histograms and their detectors that have total numbers "
43 "of counts over a user defined maximum or less than the user define "
44 "minimum.";
45 }
46
48 int version() const override;
49 const std::vector<std::string> seeAlso() const override {
50 return {"FindDetectorsOutsideLimits", "FindDeadDetectors", "MedianDetectorTest", "DetectorEfficiencyVariation"};
51 }
52
53private:
54 // Overridden Algorithm methods
55 void init() override;
56 void exec() override;
58 void applyMask(const API::MatrixWorkspace_sptr &inputWS, const API::MatrixWorkspace_sptr &maskWS);
60 API::MatrixWorkspace_sptr doDetVanTest(const API::MatrixWorkspace_sptr &inputWS, int &nFails);
61
62protected:
64 API::MatrixWorkspace_sptr integrateSpectra(const API::MatrixWorkspace_sptr &inputWS, const int indexMin,
65 const int indexMax, const double lower, const double upper,
66 const bool outputWorkspace2D = false);
67
69
73 std::vector<double> calculateMedian(const API::MatrixWorkspace &input, bool excludeZeroes,
74 const std::vector<std::vector<size_t>> &indexmap);
79 std::vector<std::vector<size_t>> makeMap(const API::MatrixWorkspace_sptr &countsWS);
81 std::vector<std::vector<size_t>> makeInstrumentMap(const API::MatrixWorkspace &countsWS);
82
87 enum RunTime {
89 RTGetSolidAngle = 15000,
91 RTGetTotalCounts = 5000,
93 RTGetRate = 100,
95 RTMarkDetects = 200,
97 RTWriteFile = 200,
99 RTTotal = RTGetSolidAngle + RTGetTotalCounts + RTGetRate + RTMarkDetects + RTWriteFile
100 };
101
105 double advanceProgress(double toAdd);
108 void failProgress(RunTime aborted);
109
116
130};
131
132} // namespace Algorithms
133} // namespace Mantid
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
double lower
lower and upper bounds on the multiplier, if known
double upper
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:85
Base MatrixWorkspace Abstract Class.
A base class for a detector diagnostic algorithm.
double m_rangeUpper
Ending x-axis value for integrations.
int m_TotalTime
An estimate total number of additions or equilivent required to compute a spectrum.
double m_fracDone
An estimate of the percentage of the algorithm runtimes that has been completed.
RunTime
For the progress bar, estimates of how many additions, or equivalent, member functions will do for ea...
int m_maxIndex
Ending workspace index to run tests on.
double m_progStepWidth
The number of tests to be run.
virtual ~DetectorDiagnostic()=default
Default destructor.
const std::string summary() const override
Summary of algorithms purpose.
double m_rangeLower
Starting x-axis value for integrations.
int m_minIndex
Starting workspace index to run tests on.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso algorithms related to this algorithm.
int m_parents
number of parents up, 0 go to instrument
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
std::shared_ptr< MaskWorkspace > MaskWorkspace_sptr
shared pointer to the MaskWorkspace class
Definition: MaskWorkspace.h:64
Helper class which provides the Collimation Length for SANS instruments.