Mantid
Loading...
Searching...
No Matches
MDEventInserter.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10
11#include <cstdint>
12
13namespace Mantid {
14namespace DataObjects {
15
29template <typename MDEW_SPTR> class MDEventInserter {
30private:
32 template <int I> struct IntToType {
33 enum { value = I };
34 };
35
36public:
38 using MDEventType = typename MDEW_SPTR::element_type::MDEventType;
39
44 MDEventInserter(MDEW_SPTR &ws) : m_ws(ws) {}
45
57 void insertMDEvent(float signal, float errorSQ, uint16_t expInfoIndex, uint16_t goniometerIndex, int32_t detectno,
58 Mantid::coord_t *coords) {
59 // compile-time overload selection based on nested type information on the
60 // MDEventType.
61 insertMDEvent(signal, errorSQ, expInfoIndex, goniometerIndex, detectno, coords,
63 }
64
65private:
67 MDEW_SPTR m_ws;
68
75 void insertMDEvent(float signal, float errorSQ, uint16_t, uint16_t, int32_t, Mantid::coord_t *coords,
77 m_ws->addEvent(MDEventType(signal, errorSQ, coords));
78 }
79
90 void insertMDEvent(float signal, float errorSQ, uint16_t expInfoIndex, uint16_t goniometerIndex, int32_t detectno,
92 m_ws->addEvent(MDEventType(signal, errorSQ, expInfoIndex, goniometerIndex, detectno, coords));
93 }
94};
95
96} // namespace DataObjects
97} // namespace Mantid
MDEventInserter : Helper class that provides a generic interface for adding events to an MDWorkspace ...
typename MDEW_SPTR::element_type::MDEventType MDEventType
Type of MDEvent used by the MDEventWorkspace.
MDEW_SPTR m_ws
shared pointer to MDEW to add to.
void insertMDEvent(float signal, float errorSQ, uint16_t expInfoIndex, uint16_t goniometerIndex, int32_t detectno, Mantid::coord_t *coords, IntToType< true >)
Creates a FULL MDEvent and adds it to the MDEW.
void insertMDEvent(float signal, float errorSQ, uint16_t, uint16_t, int32_t, Mantid::coord_t *coords, IntToType< false >)
Creates a LEAN MDEvent and adds it to the MDEW.
void insertMDEvent(float signal, float errorSQ, uint16_t expInfoIndex, uint16_t goniometerIndex, int32_t detectno, Mantid::coord_t *coords)
Creates an mdevent and adds it to the MDEW.
MDEventInserter(MDEW_SPTR &ws)
Constructor.
Helper class which provides the Collimation Length for SANS instruments.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition MDTypes.h:27
Loki IntToType, used for template overload deduction.