Skip to content

Commit

Permalink
Re #7524. Add log message about discarded events.
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellTaylor committed Jul 26, 2013
1 parent 5138a88 commit 0f00daa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Expand Up @@ -127,6 +127,8 @@ namespace Mantid
double shortest_tof;
/// Count of all the "bad" tofs found. These are events with TOF > 2e8 microsec
size_t bad_tofs;
/// A count of events discarded because they came from a pixel that's not in the IDF
size_t discarded_events;

/// Do we pre-count the # of events in each pixel ID?
bool precount;
Expand Down
25 changes: 21 additions & 4 deletions Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp
Expand Up @@ -170,11 +170,11 @@ class ProcessBankData : public Task
void run()
{
//Local tof limits
double my_shortest_tof, my_longest_tof;
my_shortest_tof = static_cast<double>(std::numeric_limits<uint32_t>::max()) * 0.1;
my_longest_tof = 0.;
double my_shortest_tof = static_cast<double>(std::numeric_limits<uint32_t>::max()) * 0.1;
double my_longest_tof = 0.;
// A count of "bad" TOFs that were too high
size_t badTofs = 0;
size_t my_discarded_events(0);

prog->report(entry_name + ": precount");

Expand Down Expand Up @@ -295,6 +295,10 @@ class ProcessBankData : public Task
eventVector->push_back( WeightedEvent(tof, pulsetime, weight, errorSq) );
#endif
}
else
{
++my_discarded_events;
}
}
else
{
Expand All @@ -310,6 +314,10 @@ class ProcessBankData : public Task
eventVector->push_back( TofEvent(tof, pulsetime) );
#endif
}
else
{
++my_discarded_events;
}
}

//Local tof limits
Expand Down Expand Up @@ -364,6 +372,7 @@ class ProcessBankData : public Task
if (my_shortest_tof < alg->shortest_tof) { alg->shortest_tof = my_shortest_tof;}
if (my_longest_tof > alg->longest_tof ) { alg->longest_tof = my_longest_tof;}
alg->bad_tofs += badTofs;
alg->discarded_events += my_discarded_events;
}


Expand Down Expand Up @@ -938,7 +947,7 @@ class LoadBankFromDiskTask : public Task

/// Empty default constructor
LoadEventNexus::LoadEventNexus() : IFileLoader<Kernel::NexusDescriptor>(),
event_id_is_spec(false), m_allBanksPulseTimes(NULL)
discarded_events(0), event_id_is_spec(false), m_allBanksPulseTimes(NULL)
{
}

Expand Down Expand Up @@ -1170,6 +1179,14 @@ void LoadEventNexus::exec()
// Load the detector events
WS = createEmptyEventWorkspace(); // Algorithm currently relies on an object-level workspace ptr
loadEvents(&prog, false); // Do not load monitor blocks

if ( discarded_events > 0 )
{
g_log.information() << discarded_events
<< " events were encountered coming from pixels which are not in the Instrument Definition File."
"These events were discarded.\n";
}

//add filename
WS->mutableRun().addProperty("Filename",m_filename);
//Save output
Expand Down

0 comments on commit 0f00daa

Please sign in to comment.