Skip to content

Commit

Permalink
Re #4303 Add property to LoadEventNexus to specify the entry to load
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Feb 10, 2012
1 parent 2469d94 commit 997c09a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,10 @@ void LoadEventNexus::init()
setPropertyGroup("FilterByTimeStart", grp1);
setPropertyGroup("FilterByTimeStop", grp1);

declareProperty(
new PropertyWithValue<string>("NXentryName", "", Direction::Input),
"Optional: Name of the NXentry to load if it's not the default.");

declareProperty(
new PropertyWithValue<string>("BankName", "", Direction::Input),
"Optional: To only include events from one bank. Any bank whose name does not match the given string will have no events.");
Expand Down Expand Up @@ -953,12 +957,22 @@ void LoadEventNexus::init()
/// set the name of the top level NXentry m_top_entry_name
void LoadEventNexus::setTopEntryName()
{
std::string nxentryProperty = getProperty("NXentryName");
if (nxentryProperty.size()>0)
{
m_top_entry_name = nxentryProperty;
return;
}
typedef std::map<std::string,std::string> string_map_t;
try
{
string_map_t::const_iterator it;
::NeXus::File file = ::NeXus::File(m_filename);
string_map_t entries = file.getEntries();

// Choose the first entry as the default
m_top_entry_name = entries.begin()->first;

for (it = entries.begin(); it != entries.end(); ++it)
{
if ( ((it->first == "entry") || (it->first == "raw_data_1")) && (it->second == "NXentry") )
Expand Down

0 comments on commit 997c09a

Please sign in to comment.