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#include "MantidKernel/System.h"
11
12namespace Mantid {
13namespace DataObjects {
14
28template <typename MDEW_SPTR> class DLLExport MDEventInserter {
29private:
31 template <int I> struct IntToType {
32 enum { value = I };
33 };
34
35public:
37 using MDEventType = typename MDEW_SPTR::element_type::MDEventType;
38
43 MDEventInserter(MDEW_SPTR &ws) : m_ws(ws) {}
44
56 void insertMDEvent(float signal, float errorSQ, uint16_t expInfoIndex, uint16_t goniometerIndex, int32_t detectno,
57 Mantid::coord_t *coords) {
58 // compile-time overload selection based on nested type information on the
59 // MDEventType.
60 insertMDEvent(signal, errorSQ, expInfoIndex, goniometerIndex, detectno, coords,
62 }
63
64private:
66 MDEW_SPTR m_ws;
67
74 void insertMDEvent(float signal, float errorSQ, uint16_t, uint16_t, int32_t, Mantid::coord_t *coords,
76 m_ws->addEvent(MDEventType(signal, errorSQ, coords));
77 }
78
89 void insertMDEvent(float signal, float errorSQ, uint16_t expInfoIndex, uint16_t goniometerIndex, int32_t detectno,
91 m_ws->addEvent(MDEventType(signal, errorSQ, expInfoIndex, goniometerIndex, detectno, coords));
92 }
93};
94
95} // namespace DataObjects
96} // namespace Mantid
double value
The value of the point.
Definition: FitMW.cpp:51
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition: System.h:53
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.