Mantid
Loading...
Searching...
No Matches
ProcessBankCompressed.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2024 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
11#include "MantidDataHandling/DllConfig.h"
13#include "MantidKernel/Task.h"
14
15#include <vector>
16
17namespace Mantid {
18namespace API {
19class Progress; // forward declare
20}
21namespace DataHandling {
22class DefaultEventLoader; // forward declare
23class CompressEventAccumulatorFactory;
24
27class MANTID_DATAHANDLING_DLL ProcessBankCompressed : public Mantid::Kernel::Task {
28public:
29 ProcessBankCompressed(DefaultEventLoader &m_loader, const std::string &entry_name, Mantid::API::Progress *prog,
30 std::shared_ptr<std::vector<uint32_t>> event_detid,
31 std::shared_ptr<std::vector<float>> event_tof, size_t startAt,
32 std::shared_ptr<std::vector<uint64_t>> event_index,
33 std::shared_ptr<BankPulseTimes> bankPulseTimes, detid_t min_detid, detid_t max_detid,
34 std::shared_ptr<std::vector<double>> histogram_bin_edges, const double divisor);
35
36 void run() override;
37
38 void addEvent(const size_t period_index, const size_t event_index);
39
40 void createWeightedEvents(const size_t period_index, const detid_t detid,
41 std::vector<Mantid::DataObjects::WeightedEventNoTime> *raw_events);
42
44 double totalWeight() const;
45
46private:
47 void createAccumulators(const bool precount);
48 void collectEvents();
49 void addToEventLists();
50
51 // disable default constructor
55 const std::string m_entry_name;
58
60 std::unique_ptr<CompressEventAccumulatorFactory> m_factory;
61
63 std::shared_ptr<std::vector<uint32_t>> m_event_detid;
65 std::shared_ptr<std::vector<float>> m_event_tof;
67 const size_t m_firstEventIndex;
69 std::shared_ptr<std::vector<uint64_t>> m_event_index;
71 std::shared_ptr<BankPulseTimes> m_bankPulseTimes;
72
76 std::vector<std::vector<std::unique_ptr<DataHandling::CompressEventAccumulator>>> m_spectra_accum;
77
78 /*
79 * After events are added, this will contain the sorting information to set out the output event lists
80 */
81 std::vector<DataObjects::EventSortType> m_sorting;
82
83 // inclusive
85 // inclusive
87 // inclusive
88 const float m_tof_min;
89 // exclusive
90 const float m_tof_max;
91};
92
93} // namespace DataHandling
94} // namespace Mantid
Helper class for reporting progress from algorithms.
Definition Progress.h:25
Helper class for LoadEventNexus that is specific to the current default loading code for NXevent_data...
ProcessBankCompressed : TODO: DESCRIPTION.
std::vector< DataObjects::EventSortType > m_sorting
std::shared_ptr< BankPulseTimes > m_bankPulseTimes
Pulse times for this bank.
std::unique_ptr< CompressEventAccumulatorFactory > m_factory
factory for creating accumulators
std::shared_ptr< std::vector< uint64_t > > m_event_index
vector of event index (length of # of pulses)
DefaultEventLoader & m_loader
Algorithm being run.
const size_t m_firstEventIndex
index of the first event from event_index
std::shared_ptr< std::vector< uint32_t > > m_event_detid
event pixel ID array
API::Progress * m_prog
Progress reporting.
std::shared_ptr< std::vector< float > > m_event_tof
event TOF array
std::vector< std::vector< std::unique_ptr< DataHandling::CompressEventAccumulator > > > m_spectra_accum
Objects holding individual spectra.
A Task is a unit of work to be scheduled and run by a ThreadPool.
Definition Task.h:29
Helper class which provides the Collimation Length for SANS instruments.
int32_t detid_t
Typedef for a detector ID.