Newer
Older
Peterson, Peter
committed
#ifndef MANTID_ALGORITHMS_MASKDETECTORSIF_H_
#define MANTID_ALGORITHMS_MASKDETECTORSIF_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
Peterson, Peter
committed
#include <boost/function.hpp>
// To be compatible with VSC Express edition that does not have tr1
#include <unordered_map>
namespace Mantid {
namespace Algorithms {
Peterson, Peter
committed
/**
*
This algorithm is used to select/deselect detectors in a *.cal file.
@author Laurent Chapon, Pascal Manuel ISIS Facility, Rutherford Appleton
Laboratory
Peterson, Peter
committed
@date 06/07/2009
Copyright © 2009 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
Peterson, Peter
committed
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>
Peterson, Peter
committed
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport MaskDetectorsIf : public API::Algorithm {
Peterson, Peter
committed
public:
/// Default constructor
MaskDetectorsIf();
/// Destructor
virtual ~MaskDetectorsIf();
/// Algorithm's name for identification overriding a virtual method
virtual const std::string name() const { return "MaskDetectorsIf"; }
/// Summary of algorithms purpose
virtual const std::string summary() const {
return "Adjusts the selected field for a CalFile depending on the values "
"in the input workspace.";
}
Peterson, Peter
committed
/// Algorithm's version for identification overriding a virtual method
Gigg, Martyn Anthony
committed
virtual int version() const { return 1; }
Peterson, Peter
committed
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const {
return "Diffraction\\Masking;Transforms\\Masking";
Peterson, Peter
committed
private:
/// Returns an allowed values statement to insert into decumentation
std::string allowedValuesStatement(std::vector<std::string> vals);
Peterson, Peter
committed
// Typedef for det to value map
typedef std::unordered_map<detid_t, bool> udet2valuem;
/// A map of detector numbers to mask boolean
udet2valuem umap;
/// Get the properties
void retrieveProperties();
/// Create a new cal file
void createNewCalFile(const std::string &oldfile, const std::string &newfile);
/// The input workspace
API::MatrixWorkspace_const_sptr inputW;
/// The Value parameter
double value;
/// A comparator function
boost::function<bool(double, double)> compar_f;
/// Whether select is on or off
bool select_on;
/// Overidden init
void init();
/// Overidden exec
void exec();
Peterson, Peter
committed
};
} // namespace Algorithm
} // namespace Mantid
#endif /*MANTID_ALGORITHM_MASKDETECTORSIF_H_*/