Skip to content

Commit

Permalink
Save pulse charge in the sample logs
Browse files Browse the repository at this point in the history
Refs #6871
  • Loading branch information
rgmiller committed Apr 17, 2013
1 parent 3bcc6a5 commit 5462b9d
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ using namespace Mantid::API;
// Names for a couple of time series properties
#define PAUSE_PROPERTY "pause"
#define SCAN_PROPERTY "scan_index"
#define PROTON_CHARGE_PROPERTY "proton_charge"


// Helper function to get a DateAndTime value from an ADARA packet header
Expand Down Expand Up @@ -394,8 +395,6 @@ namespace DataHandling
return false;
}

// TODO: Create a log with the pulse time and charge!! (TimeSeriesProperties)

// Append the events
g_log.debug() << "----- Pulse ID: " << pkt.pulseId() << " -----" << std::endl;
{
Expand All @@ -404,6 +403,11 @@ namespace DataHandling
// Timestamp for the events
Mantid::Kernel::DateAndTime eventTime = timeFromPacket( pkt);

// Save the pulse charge in the logs (*10 because we want the units to be
// picoCulombs, and ADARA sends them out in units of 10pC)
m_eventBuffer->mutableRun().getTimeSeriesProperty<double>( PROTON_CHARGE_PROPERTY)
->addValue( timeFromPacket( pkt), pkt.pulseCharge()*10);

// Iterate through each event
const ADARA::Event *event = pkt.firstEvent();
unsigned lastBankID = pkt.curBankId();
Expand Down Expand Up @@ -1008,14 +1012,15 @@ namespace DataHandling
// The numbers in the create() function don't matter - they'll get overwritten
// down in initWorkspacePart2() when we load the instrument definition.

// We also know we'll need 2 time series properties on the workspace. Create them
// now (because we may end up adding values to them before we can call
// initWorkspacePart2().
// We also know we'll need 3 time series properties on the workspace. Create them
// now. (We may end up adding values to the pause and scan properties before we
// can call initWorkspacePart2().)
Property *prop = new TimeSeriesProperty<int>(PAUSE_PROPERTY);
m_eventBuffer->mutableRun().addLogData(prop);
prop = new TimeSeriesProperty<int>(SCAN_PROPERTY);
m_eventBuffer->mutableRun().addLogData(prop);

prop = new TimeSeriesProperty<double>(PROTON_CHARGE_PROPERTY);
m_eventBuffer->mutableRun().addLogData(prop);
}

/// Second part of the workspace initialization
Expand Down

0 comments on commit 5462b9d

Please sign in to comment.