10#include "MantidDataHandling/DllConfig.h"
13#include <Poco/DOM/Document.h>
25namespace DataHandling {
39 const std::string
name()
const override {
return "LoadDetectorsGroupingFile"; };
41 const std::string
summary()
const override {
42 return "Load an XML or Map file, which contains definition of detectors "
43 "grouping, to a GroupingWorkspace.";
47 int version()
const override {
return 1; };
48 const std::vector<std::string>
seeAlso()
const override {
return {
"SaveDetectorsGrouping",
"GroupDetectors"}; }
50 const std::string
category()
const override {
return "DataHandling\\Grouping;Transforms\\Grouping"; }
62 void intializeGroupingWorkspace();
64 void setByComponents();
66 void setByDetectors();
68 void setBySpectrumNos();
76 void parseRangeText(std::string inputstr, std::vector<int32_t> &singles, std::vector<int32_t> &pairs);
78 void generateNoInstrumentGroupWorkspace();
87 Poco::XML::Document *m_pDoc{
nullptr};
89 Poco::XML::Element *m_pRootElem{
nullptr};
101 void loadXMLFile(
const std::string &xmlfilename);
137 Poco::AutoPtr<Poco::XML::Document>
m_pDoc;
148 void initializeXMLParser(
const std::string &filename);
152 static std::string getAttributeValueByName(Poco::XML::Node *pNode,
const std::string &attributename,
bool &found);
180 bool nextDataLine(std::string &line);
Base class from which all concrete algorithm classes should be derived.
LoadDetectorsGroupingFile.
void parseXML()
Parse XML.
std::map< int, std::vector< int > > m_groupSpectraMap
DataObjects::GroupingWorkspace_sptr m_groupWS
Grouping Workspace.
const std::string name() const override
function to return a name of the algorithm, must be overridden in all algorithms
std::map< int, std::vector< std::string > > m_groupComponentsMap
Data structures to store XML to Group/Detector conversion map.
std::map< int, std::vector< detid_t > > m_groupDetectorsMap
const std::string category() const override
Algorithm's category for identification.
void initializeXMLParser(const std::string &filename)
Initialize XML parser.
void parseRangeText(std::string inputstr, std::vector< int32_t > &singles, std::vector< int32_t > &pairs)
Split and convert string.
const std::vector< std::string > seeAlso() const override
Function to return all of the seeAlso (these are not validated) algorithms related to this algorithm....
int version() const override
Algorithm's version for identification.
const std::string summary() const override
Summary of algorithms purpose.
Geometry::Instrument_const_sptr m_instrument
Instrument to use if given by user.
static std::string getAttributeValueByName(Poco::XML::Node *pNode, std::string attributename, bool &found)
Get attribute value from an XML node.
void parseDetectorIDs(std::string inputstring, std::vector< detid_t > &detids)
Convert detector ID combination string to vector of detectors.
void parseSpectrumNos(std::string inputstring, std::vector< int > &specids)
Convert spectrum Nos combination string to vector of spectrum Nos.
Class used to load a grouping information from .map file.
Kernel::Logger & m_log
Logger used.
std::map< int, std::vector< int > > m_groupSpectraMap
group_id -> [list of spectra]
const std::string m_fileName
The name of the file being parsed.
int m_lastLineRead
Number of the last line parsed.
std::ifstream m_file
The file being parsed.
std::map< int, std::vector< int > > getGroupSpectraMap()
Return the map parsed from file.
std::map< int, std::vector< std::string > > getGroupComponentsMap()
Data structures to store XML to Group/Detector conversion map.
std::string m_description
Grouping description. Empty if not specified.
std::map< int, std::vector< detid_t > > getGroupDetectorsMap()
void setDefaultStartingGroupID(int startgroupid)
std::string m_date
Date in ISO 8601 for which this grouping is relevant.
std::string getDescription()
std::map< int, std::vector< std::string > > m_groupComponentsMap
Data structures to store XML to Group/Detector conversion map.
bool isGivenInstrumentName()
std::string getInstrumentName()
bool m_userGiveDescription
Whether description is given by user.
Poco::AutoPtr< Poco::XML::Document > m_pDoc
XML document loaded.
bool m_userGiveDate
Whether date is given by user.
std::map< int, std::string > getGroupNamesMap()
bool m_userGiveInstrument
User-define instrument name.
std::map< int, std::vector< int > > getGroupSpectraMap()
std::string m_instrumentName
Instrument name.
std::map< int, std::vector< detid_t > > m_groupDetectorsMap
bool isGivenDescription()
std::map< int, std::string > m_groupNamesMap
Map of group names.
std::map< int, std::vector< int > > m_groupSpectraMap
The Logger class is in charge of the publishing messages from the framework through various channels.
std::shared_ptr< GroupingWorkspace > GroupingWorkspace_sptr
shared pointer to the GroupingWorkspace class
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
Helper class which provides the Collimation Length for SANS instruments.