Newer
Older
#ifndef MANTID_ALGORITHMS_CREATECALFILEBYNAMES_H_
#define MANTID_ALGORITHMS_CREATECALFILEBYNAMES_H_
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
// To be compatible with MSVC++ Express Edition that does not have TR1 headers
#include <map>
namespace Mantid {
namespace Algorithms {
/** Create a calibration file for diffraction focussing (*.cal old Ariel format)
* based on list of names of the instrument tree.
* The offsets are all sets to zero and all detectors are selected. Detectors
not assigned
* to any group will appear as group 0, i.e. not included when using
AlignDetector or
* The group number is assigned based on a descent in the instrument tree
assembly.
* If two assemblies are parented, say Bank1 and module1, and both assembly
names
* are given in the GroupNames, they will get assigned different grouping
numbers.
* This allows to isolate a particular sub-assembly of a particular leaf of the
tree
<LI> InstrumentName - The name of the instrument. Needs to be present in
the store</LI>
<LI> GroupingFilename - The name of the output file (*.cal extension) .</LI>
<LI> GroupNames - Name of assemblies to consider (names separated by
"/" or "," or "*"</LI>
</UL>
@author Laurent Chapon, ISIS Facility, Rutherford Appleton Laboratory
@date 01/03/2009
Copyright © 2009 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 CreateCalFileByNames : public API::Algorithm {
public:
/// (Empty) Constructor
CreateCalFileByNames();
/// Virtual destructor
virtual ~CreateCalFileByNames() {}
/// Algorithm's name
virtual const std::string name() const { return "CreateCalFileByNames"; }
/// Summary of algorithms purpose
virtual const std::string summary() const {
return "Create a calibration file (extension .cal) for diffraction "
"focusing based on the names of the components in the instrument "
"tree.";
}
Janik Zikovsky
committed
virtual int version() const { return (1); }
virtual const std::string category() const { return "Diffraction\\DataHandling\\CalFiles"; }
/// Calibration entries map
typedef std::map<int, std::pair<int, int>> instrcalmap;
/// The name and path of the input file
std::string m_filename;
Janik Zikovsky
committed
/// @param filename :: GroupingFilename (extension .cal)
/// @return true if the grouping file exists
bool groupingFileDoesExist(const std::string &filename) const;
void saveGroupingFile(const std::string &, bool overwrite) const;
static void writeCalEntry(std::ostream &os, int number, int udet,
double offset, int select, int group);
void writeHeaders(std::ostream &os, const std::string &filename,
bool overwrite) const;
/// The names of the groups
/// Calibration map used if the *.cal file exist. All entries in the *.cal
/// file are registered with the udet number as the key and the
/// <Number,Offset,Select,Group> as the tuple value.