@@ -13,15 +13,19 @@ The following information will be useful to you if you want to write an
...
@@ -13,15 +13,19 @@ The following information will be useful to you if you want to write an
Individual Neutron Event Data (TofEvent)
Individual Neutron Event Data (TofEvent)
########################################
########################################
The TofEvent class holds information for each neutron detection event
The `TofEvent <https://github.com/mantidproject/mantid/blob/master/Framework/Types/inc/MantidTypes/Event/TofEvent.h>`_ class holds information for each neutron detection event
data:
data:
- PulseTime: An absolute time of the pulse that generated this neutron.
- PulseTime: An absolute time of the pulse that generated this neutron.
This is saved as an INT64 of the number of nanoseconds since Jan 1,
This is saved as an INT64 of the number of nanoseconds since Jan 1,
1990; this can be converted to other date and time formats as needed.
1990; this can be converted to other date and time formats as needed.
Internall the PulseTime is represented as a Kernel::DateAndTime type.
- tof: Time-of-flight of the neutron, in microseconds, as a double.
- tof: Time-of-flight of the neutron, in microseconds, as a double.
Note that this field can be converted to other units, e.g. d-spacing.
Note that this field can be converted to other units, e.g. d-spacing.
.. tip::
There are in fact several variants of the Event type within Mantid. The common by far is the RAW TOF described above, but there are also ``Weighted`` events that offer better compression.
Lists of Events (EventList)
Lists of Events (EventList)
###########################
###########################
...
@@ -29,12 +33,10 @@ Lists of Events (EventList)
...
@@ -29,12 +33,10 @@ Lists of Events (EventList)
this list is not significant, since various algorithms will resort by
this list is not significant, since various algorithms will resort by
time of flight or pulse time, as needed.
time of flight or pulse time, as needed.
- Also contained in the EventList is a std::set of detector ID's. This
- Also contained in the EventList is a std::set of detector ID's. This tracks which detector(s) were hit by the events in the list. ``EventList`` is a subtype of ``ISpectrum``, which provides the interface to many of the spectrum level access methods.
tracks which detector(s) were hit by the events in
the list.
- The histogram bins (X axis) are also stored in EventList. The Y and E
- The histogram bins (X axis) are also stored in EventList. The Y and E
histogram data are not, however, as they are calculated by the MRU
histogram data are not, however, as they are calculated on demand by the MRU
(below).
(below).
The += operator can be used to append two EventList's together. The
The += operator can be used to append two EventList's together. The
...
@@ -56,7 +58,7 @@ A note about workspace index / spectrum number / detector ID
...
@@ -56,7 +58,7 @@ A note about workspace index / spectrum number / detector ID
For event workspaces there is no benefit, and only a drawback to grouping detectors in hardware, therefore most of the loading algorithms for event data **match** the workspace index and spectrum number
For event workspaces there is no benefit, and only a drawback to grouping detectors in hardware, therefore most of the loading algorithms for event data **match** the workspace index and spectrum number
in the Event Workspace. Therefore, in an Event Workspace, the two numbers
in the Event Workspace. Therefore, in an Event Workspace, the two numbers
will be the same, and your workspace's Axis[1] is a simple 1:1 map. As
will often be the same, and your workspace's Axis[1] is a simple 1:1 map. As
mentioned above, the detectorID is saved in EventList, but the
mentioned above, the detectorID is saved in EventList, but the
makeSpectraMap() method generates the usual SpectraDetectorMap object.
makeSpectraMap() method generates the usual SpectraDetectorMap object.
...
@@ -68,8 +70,7 @@ like a :ref:`MatrixWorkspace <MatrixWorkspace>`. By default, if an algorithm
...
@@ -68,8 +70,7 @@ like a :ref:`MatrixWorkspace <MatrixWorkspace>`. By default, if an algorithm
performs an operation and outputs a new workspace, the
performs an operation and outputs a new workspace, the
WorkspaceFactory will create a :ref:`Workspace2D` *copy*
WorkspaceFactory will create a :ref:`Workspace2D` *copy*
of your Event Workspace's histogram representation. If you attempt to
of your Event Workspace's histogram representation. If you attempt to
change an Event Workspace's Y or E data in place, you will get an error
change an Event Workspace's Y or E data in place, you will get an ``NotImplementedError`` raised, since that is not possible.
message, since that is not possible.
A Note about Thread Safety
A Note about Thread Safety
##########################
##########################
...
@@ -81,13 +82,12 @@ problems. This is because the histogramming code will try to sort the
...
@@ -81,13 +82,12 @@ problems. This is because the histogramming code will try to sort the
event list. If two threads try to sort the same event list, you can get
event list. If two threads try to sort the same event list, you can get
segfaults.
segfaults.
Remember that the PARALLEL\_FOR1(), PARALLEL\_FOR2() etc. macros will
Remember that the ``PARALLEL\_FOR1()``, ``PARALLEL\_FOR2()`` etc. macros will
perform the check Workspace->threadSafe() on the input Event Workspace.
perform the check Workspace->threadSafe() on the input Event Workspace.
This function will return *false* (thereby disabling parallelization) if
This function will return *false* (thereby disabling parallelization) if
any of the event lists are unsorted.
any of the event lists are unsorted.
You can go around this by forcing the parallel loop with a plain
You can go around this by forcing the parallel loop with a plain
PARALLEL\_FOR() macro. **Make sure you do not read from the same
``PARALLEL\_FOR()`` macro. **Make sure you do not read from the same