42#if BOOST_VERSION < 107100
43#include <boost/timer.hpp>
45#include <boost/timer/timer.hpp>
53using namespace Kernel;
55using namespace Geometry;
56using namespace DataObjects;
58using DataObjects::EventList;
59using DataObjects::EventWorkspace;
62using std::runtime_error;
64using std::stringstream;
66using Types::Core::DateAndTime;
67using Types::Event::TofEvent;
87static const uint64_t
VETOFLAG(72057594037927935);
89static const string EVENT_EXTS[] = {
"_neutron_event.dat",
"_neutron0_event.dat",
"_neutron1_event.dat",
90 "_neutron2_event.dat",
"_neutron3_event.dat",
"_neutron4_event.dat",
91 "_live_neutron_event.dat"};
92static const string PULSE_EXTS[] = {
"_pulseid.dat",
"_pulseid0.dat",
"_pulseid1.dat",
"_pulseid2.dat",
93 "_pulseid3.dat",
"_pulseid4.dat",
"_live_pulseid.dat"};
105 string runnumber(std::filesystem::path(filename).stem().
string());
107 if (runnumber.find(
"neutron") >= string::npos)
110 std::size_t
left = runnumber.find(
'_');
111 std::size_t
right = runnumber.find(
'_',
left + 1);
122 std::reverse(eventExts.begin(), eventExts.end());
124 std::reverse(pulseExts.begin(), pulseExts.end());
127 for (std::size_t i = 0; i < eventExts.size(); ++i) {
128 size_t start = eventfile.find(eventExts[i]);
129 if (start != string::npos)
130 return eventfile.replace(start, eventExts[i].size(), pulseExts[i]);
142 std::vector<string> temp = wksp->getInstrument()->getStringParameter(
"TS_mapping_file");
145 string mapping = temp[0];
147 std::filesystem::path localmap(mapping);
148 if (std::filesystem::exists(localmap))
152 string dataversion = Mantid::API::FileFinder::Instance().getFullPath(mapping);
153 if (!dataversion.empty())
157 string instrument = wksp->getInstrument()->getName();
158 std::filesystem::path base(
"/SNS/" + instrument +
"/");
160 if (!std::filesystem::exists(base)) {
161 instrument = Kernel::ConfigService::Instance().getInstrument(instrument).shortName();
162 base = std::filesystem::path(
"/SNS/" + instrument +
"/");
163 if (!std::filesystem::exists(base))
167 for (
const auto &entry : std::filesystem::directory_iterator(base)) {
168 if (entry.is_directory()) {
169 dirs.push_back(entry.path().filename().string());
174 const string CAL(
"_CAL");
175 const size_t CAL_LEN = CAL.length();
176 vector<string> files;
177 for (
const auto &dir : dirs) {
178 if ((dir.length() > CAL_LEN) && (dir.compare(dir.length() - CAL.length(), CAL.length(), CAL) == 0)) {
179 std::filesystem::path path = base / dir /
"calibrations" / mapping;
180 if (std::filesystem::exists(path))
181 files.emplace_back(path.string());
187 else if (files.size() == 1)
191 return *(files.rbegin());
202 if (descriptor.
extension().rfind(
"dat") == std::string::npos)
211 const size_t objSize =
sizeof(
DasEvent);
212 auto &handle = descriptor.
data();
215 handle.seekg(0, std::ios::end);
216 const auto filesize =
static_cast<size_t>(handle.tellg());
217 handle.seekg(0, std::ios::beg);
219 if (filesize % objSize == 0)
230 proton_charge(), proton_charge_tot(0), pixel_to_wkspindex(), pixelmap(), detid_max(), eventfile(nullptr),
231 num_events(0), num_pulses(0), numpixel(0), num_good_events(0), num_error_events(0), num_bad_events(0),
232 num_wrongdetid_events(0), num_ignored_events(0), first_event(0), max_events(0), using_mapping_file(false),
233 loadOnlySomeSpectra(false), spectraLoadMap(), longest_tof(0), shortest_tof(0), parallelProcessing(false),
234 pulsetimesincreasing(false), m_dbOutput(false), m_dbOpBlockNumber(0), m_dbOpNumEvents(0), m_dbOpNumPulses(0) {
245 "The name of the neutron event file to read, including its full or "
246 "relative path. In most cases, the file typically ends in "
247 "neutron_event.dat (N.B. case sensitive if running on Linux).");
250 "File containing the accelerator pulse information; the "
251 "filename will be found automatically if not specified.");
253 "File containing the pixel mapping (DAS pixels to pixel IDs) file "
254 "(typically INSTRUMENT_TS_YYYY_MM_DD.dat). The filename will be found "
255 "automatically if not specified.");
259 "A list of individual spectra (pixel IDs) to read, specified "
260 "as e.g. 10:20. Only used if set.");
262 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
263 mustBePositive->setLower(1);
265 "If loading the file by sections ('chunks'), this is the "
266 "section number of this execution of the algorithm.");
268 "If loading the file by sections ('chunks'), this is the "
269 "total number of sections.");
275 std::vector<std::string> propOptions{
"Auto",
"Serial",
"Parallel"};
276 declareProperty(
"UseParallelProcessing",
"Auto", std::make_shared<StringListValidator>(propOptions),
277 "Use multiple cores for loading the data?\n"
278 " Auto: Use serial loading for small data sets, parallel "
279 "for large data sets.\n"
280 " Serial: Use a single core.\n"
281 " Parallel: Use all available cores.");
285 "The name of the workspace that will be created, filled "
287 "data and stored in the [[Analysis Data Service]].");
291 "Workspace with number of events per pulse");
294 auto mustBeNonNegative = std::make_shared<BoundedValidator<int>>();
295 mustBeNonNegative->setLower(0);
297 "Index of the loading block for debugging output. ");
300 "Number of output events for debugging purpose. Must be "
301 "defined with DBOutputBlockNumber.");
304 "Number of output pulses for debugging purpose. ");
306 std::string dbgrp =
"Investigation Use";
328 throw std::out_of_range(
"ChunkNumber cannot be larger than TotalChunks");
331 prog = std::make_unique<Progress>(
this, 0.0, 1.0, 100);
339 bool throwError =
true;
340 if (pulseid_filename.empty()) {
342 if (!pulseid_filename.empty()) {
343 if (std::filesystem::exists(pulseid_filename)) {
344 this->
g_log.
information() <<
"Found pulseid file " << pulseid_filename <<
'\n';
347 pulseid_filename =
"";
355 prog->report(
"Loading Pulse ID file");
357 prog->report(
"Loading Event File");
365 if (!diswsname.empty()) {
371 prog->report(
"Creating output workspace");
398 localWorkspace->getAxis(0)->unit() = UnitFactory::Instance().create(
"TOF");
417 prog->report(
"Loading Instrument");
421 prog->report(
"Loading Mapping File");
423 if (mapping_filename.empty()) {
425 if (!mapping_filename.empty())
426 this->
g_log.
information() <<
"Found mapping file \"" << mapping_filename <<
"\"\n";
432 size_t nSpec =
localWorkspace->getInstrument()->getDetectorIDs(
true).size();
435 auto tmp = createWorkspace<EventWorkspace>(nSpec, 2, 1);
447 for (
int i = 0; i < static_cast<int>(
event_indices.size()); ++i) {
451 if (eventindex >
static_cast<uint64_t
>(
max_events)) {
453 uint64_t realeventindex = eventindex &
VETOFLAG;
459 if (eventindexcheck >
static_cast<uint64_t
>(
max_events)) {
460 g_log.
information() <<
"Check: Pulse " << i <<
": unphysical event index = " << eventindexcheck <<
"\n";
477 size_t sizey = sizex;
482 <<
"Number of pulses = " <<
pulsetimes.size() <<
"\n";
485 for (
size_t i = 0; i < 2; ++i) {
486 auto &dataX = disws->mutableX(i);
488 for (
size_t j = 0; j < sizex; ++j) {
490 dataX[j] =
static_cast<double>(time) * 1.0E-9;
495 auto &dataY0 = disws->mutableY(0);
496 auto &dataY1 = disws->mutableY(1);
501 for (
size_t i = 1; i < sizey; ++i) {
516 size_t mindex = mit->second;
518 g_log.
error() <<
"Wrong Index " << mindex <<
" for Pixel " << pid <<
'\n';
519 throw std::invalid_argument(
"Wrong array index for pixel from map");
525 std::stringstream ssname;
526 ssname <<
"Pixel" << pid;
527 std::string logname = ssname.str();
532 g_log.
notice() <<
"Processed imbedded log " << logname <<
"\n";
550 for (
size_t k = 0; k < nbins; k++) {
553 int64_t abstime_ns = pulsetime.totalNanoseconds() +
static_cast<int64_t
>(tof * 1000);
554 DateAndTime abstime(abstime_ns);
555 property->addValue(abstime, tof);
558 g_log.
information() <<
"Size of Property " <<
property->name() <<
" = " <<
property->size()
559 <<
" vs Original Log Size = " << nbins <<
"\n";
562 localWorkspace->mutableRun().addProperty(std::move(property),
false);
574 string instrument = std::filesystem::path(eventfilename).filename().string();
578 std::reverse(eventExts.begin(), eventExts.end());
580 for (
const auto &ending : eventExts) {
581 size_t pos = instrument.find(ending);
582 if (pos != string::npos) {
583 instrument.resize(pos);
589 size_t pos = instrument.rfind(
'_');
590 instrument.resize(pos);
596 loadInst->setPropertyValue(
"InstrumentName", instrument);
599 loadInst->executeAsChildAlg();
618 period = (pixel - unmapped_pid) / this->
numpixel;
619 pixel = this->
pixelmap[unmapped_pid];
641 size_t numBlocks = (
max_events + loadBlockSize - 1) / loadBlockSize;
644 const auto &detectorInfo =
workspace->detectorInfo();
645 const auto &detIDs = detectorInfo.detectorIDs();
648 std::string procMode =
getProperty(
"UseParallelProcessing");
649 if (procMode ==
"Serial")
651 else if (procMode ==
"Parallel")
660 double setUpTime = double(detectorInfo.size()) * 10e-6;
666 const auto it = std::max_element(detIDs.cbegin(), detIDs.cend());
667 detid_max = it == detIDs.cend() ? 0 : *it;
677 prog->report(
"Padding Pixels");
681 size_t workspaceIndex = 0;
683 for (
size_t i = 0; i < detectorInfo.size(); ++i) {
684 if (!detectorInfo.isMonitor(i)) {
704 std::vector<EventWorkspace_sptr> partWorkspaces;
705 std::vector<DasEvent *> buffers;
713 size_t numThreads = 1;
717 partWorkspaces.resize(numThreads);
718 buffers.resize(numThreads);
722 for (
int i = 0; i < int(numThreads); i++) {
726 prog->report(
"Creating Partial Workspace");
731 partWorkspaces[i] = partWS;
736 buffers[i] =
new DasEvent[loadBlockSize];
745 if (wi !=
static_cast<size_t>(-1))
746 theseEventVectors[j] = &partWS->getSpectrum(wi).getEvents();
748 theseEventVectors[j] =
nullptr;
753 <<
" workspaces (same as number of threads) for parallel loading " << numBlocks <<
" blocks. "
756 prog->resetNumSteps(numBlocks, 0.1, 0.8);
763 for (
int blockNum = 0; blockNum < int(numBlocks); blockNum++) {
768 size_t threadNum = 0;
771 ws = partWorkspaces[threadNum];
776 DasEvent *event_buffer = buffers[threadNum];
782 size_t fileOffset =
first_event + (loadBlockSize * blockNum);
784 size_t current_event_buffer_size =
785 (blockNum == int(numBlocks - 1)) ? (
max_events - (numBlocks - 1) * loadBlockSize) : loadBlockSize;
789 current_event_buffer_size =
eventfile->loadBlockAt(event_buffer, fileOffset, current_event_buffer_size);
794 procEventsLinear(ws, theseEventVectors, event_buffer, current_event_buffer_size, fileOffset, dbprint);
797 prog->report(
"Load Event PreNeXus");
803 g_log.
debug() << tim <<
" to load the data.\n";
810 prog->resetNumSteps(
workspace->getNumberHistograms(), 0.8, 0.95);
814 for (
int iwi = 0; iwi < int(
workspace->getNumberHistograms()); iwi++) {
815 auto wi = size_t(iwi);
823 for (
size_t i = 0; i < numThreads; i++)
824 numEvents += partWorkspaces[i]->getSpectrum(wi).getNumberEvents();
829 for (
size_t i = 0; i < numThreads; i++) {
830 EventList &partEl = partWorkspaces[i]->getSpectrum(wi);
835 prog->report(
"Merging Workspaces");
837 g_log.
debug() << tim <<
" to merge workspaces together.\n";
847 for (
size_t i = 0; i < numThreads; i++) {
849 delete[] eventVectors[i];
851 delete[] eventVectors;
854 prog->resetNumSteps(3, 0.94, 1.00);
859 prog->report(
"Setting proton charge");
861 g_log.
debug() << tim <<
" to set the proton charge log."
887 <<
"Number of Wrong Detector IDs = " << this->
wrongdetids.size() <<
"\n";
890 g_log.
notice() <<
"Wrong Detector ID : " << *wit <<
'\n';
894 size_t vindex = git->second;
913 std::vector<TofEvent> **arrayOfVectors,
DasEvent *event_buffer,
914 size_t current_event_buffer_size,
size_t fileOffset,
bool dbprint) {
916 DateAndTime pulsetime;
918 auto numPulses =
static_cast<int64_t
>(
num_pulses);
920 g_log.
warning() <<
"Event_indices vector is smaller than the pulsetimes array.\n";
925 size_t local_num_error_events = 0;
926 size_t local_num_bad_events = 0;
927 size_t local_num_wrongdetid_events = 0;
928 size_t local_num_ignored_events = 0;
929 size_t local_num_good_events = 0;
931 double local_longest_tof = 0.;
934 std::map<PixelType, size_t> local_pidindexmap;
935 std::vector<std::vector<Types::Core::DateAndTime>> local_pulsetimes;
936 std::vector<std::vector<double>> local_tofs;
937 std::set<PixelType> local_wrongdetids;
940 std::stringstream dbss;
942 for (
size_t i = 0; i < current_event_buffer_size; i++) {
943 const DasEvent &temp = *(event_buffer + i);
945 bool iswrongdetid =
false;
948 dbss << i <<
" \t" << temp.
tof <<
" \t" << temp.
pid <<
"\n";
952 local_num_error_events++;
953 local_num_bad_events++;
959 if (pid == 1073741843)
970 local_num_error_events++;
971 local_num_wrongdetid_events++;
972 local_wrongdetids.insert(pid);
977 std::map<int64_t, bool>::iterator it;
981 local_num_ignored_events++;
989 if (pulse_i < numPulses - 1) {
991 size_t total_i = i + fileOffset;
997 if (pulse_i >= (numPulses - 1))
1008 if (!iswrongdetid) {
1011 if (tof < local_shortest_tof)
1012 local_shortest_tof = tof;
1013 if (tof > local_longest_tof)
1014 local_longest_tof = tof;
1019 arrayOfVectors[pid]->emplace_back(tof, pulsetime);
1020 ++local_num_good_events;
1024 std::map<PixelType, size_t>::iterator it;
1025 it = local_pidindexmap.find(pid);
1026 size_t theindex = 0;
1027 if (it == local_pidindexmap.end()) {
1029 size_t newindex = local_pulsetimes.size();
1030 local_pidindexmap[pid] = newindex;
1032 std::vector<Types::Core::DateAndTime> tempvectime;
1033 std::vector<double> temptofs;
1034 local_pulsetimes.emplace_back(tempvectime);
1035 local_tofs.emplace_back(temptofs);
1037 theindex = newindex;
1041 g_log.
debug() <<
"Find New Wrong Pixel ID = " << pid <<
"\n";
1044 theindex = it->second;
1049 local_pulsetimes[theindex].emplace_back(pulsetime);
1050 local_tofs[theindex].emplace_back(tof);
1068 std::set<PixelType>::iterator it;
1069 for (it = local_wrongdetids.begin(); it != local_wrongdetids.end(); ++it) {
1081 std::vector<Types::Core::DateAndTime> temppulsetimes;
1082 std::vector<double> temptofs;
1088 mindex = git->second;
1092 auto lit = local_pidindexmap.find(tmpid);
1093 size_t localindex = lit->second;
1095 for (
size_t iv = 0; iv < local_pulsetimes[localindex].size(); iv++) {
1097 this->
wrongdetid_tofs[mindex].emplace_back(local_tofs[localindex][iv]);
1139 g_log.
information() <<
"Total proton charge of " << integ <<
" microAmp*hours found by integrating.\n";
1150 if (filename.empty()) {
1156 this->
g_log.
debug(
"Using mapping file \"" + filename +
"\"");
1165 using std::placeholders::_1;
1166 if (std::find_if(
pixelmap.begin(),
pixelmap.end(), std::bind(std::greater<PixelType>(), _1, max_pid)) !=
1168 this->
g_log.
warning(
"Pixel id in mapping file was out of bounds. Loading "
1169 "without mapping file");
1189 eventfile = std::make_unique<BinaryFile<DasEvent>>(filename);
1201 const int totalChunks =
getProperty(
"TotalChunks");
1205 if (chunk == totalChunks)
1223 if (filename.empty()) {
1228 std::vector<Pulse> pulses;
1241 }
catch (runtime_error &e) {
1245 this->
g_log.
information() <<
"Encountered error in pulseidfile (ignoring file): " << e.what() <<
"\n";
1251 DateAndTime lastPulseDateTime(0, 0);
1253 for (
const auto &pulse : pulses) {
1254 DateAndTime pulseDateTime(
static_cast<int64_t
>(pulse.seconds),
static_cast<int64_t
>(pulse.nanoseconds));
1255 this->
pulsetimes.emplace_back(pulseDateTime);
1258 if (pulseDateTime < lastPulseDateTime)
1261 lastPulseDateTime = pulseDateTime;
1263 double temp = pulse.pCurrent;
1266 this->
g_log.
warning(
"Individual proton charge < 0 being ignored");
1275 std::stringstream dbss;
1293 int numdbevents =
getProperty(
"DBNumberOutputEvents");
1297 int dbnumpulses =
getProperty(
"DBNumberOutputPulses");
IPeaksWorkspace_sptr workspace
#define PARALLEL_THREAD_NUMBER
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_FOR_NO_WSP_CHECK()
#define PARALLEL_CRITICAL(name)
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PRAGMA_OMP(expression)
#define PARALLEL_GET_MAX_THREADS
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
#define DECLARE_FILELOADER_ALGORITHM(classname)
DECLARE_FILELOADER_ALGORITHM should be used in place of the standard DECLARE_ALGORITHM macro when wri...
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
static bool isEmpty(const NumT toCheck)
checks that the value was not set by users, uses the value in empty double/int.
void deprecatedDate(const std::string &)
The date the algorithm was deprecated on.
@ OptionalLoad
to specify a file to read but the file doesn't have to exist
@ Load
allowed here which will be passed to the algorithm
Defines an interface to an algorithm that loads a file so that it can take part in the automatic sele...
void setDetectorID(const detid_t detID)
Clear the list of detector IDs, then add one.
void setSpectrumNo(specnum_t num)
Sets the spectrum number of this spectrum.
void addLogData(Kernel::Property *p)
Add a log entry.
This class stores information regarding an experimental run as a series of log entries.
void integrateProtonCharge(const std::string &logname="proton_charge") const
Integrate the proton charge over the whole run time - default log proton_charge.
double getProtonCharge() const
Get the proton charge.
A property class for workspaces.
Mantid::detid_t detid_max
The maximum detector ID possible.
std::vector< double > proton_charge
The proton charge on a pulse by pulse basis.
std::size_t num_good_events
The number of good events loaded.
std::map< int64_t, bool > spectraLoadMap
Handle to the loaded spectra map.
std::unique_ptr< Mantid::API::Progress > prog
void procEvents(DataObjects::EventWorkspace_sptr &workspace)
Process the event file properly in parallel.
std::vector< int64_t > spectra_list
the list of Spectra
void processImbedLogs()
Process imbed logs (marked by bad pixel IDs)
void procEventsLinear(DataObjects::EventWorkspace_sptr &workspace, std::vector< Types::Event::TofEvent > **arrayOfVectors, DasEvent *event_buffer, size_t current_event_buffer_size, size_t fileOffset, bool dbprint)
Linear-version of the procedure to process the event file properly.
bool loadOnlySomeSpectra
For loading only some spectra.
std::vector< Types::Core::DateAndTime > pulsetimes
The times for each pulse.
bool using_mapping_file
Set to true if a valid Mapping file was provided.
double longest_tof
Longest TOF limit.
double shortest_tof
Shortest TOF limit.
std::size_t num_error_events
The number of error events encountered.
uint32_t numpixel
the number of pixels
void init() override
Initialisation code.
std::vector< PixelType > pixelmap
Map between the DAS pixel IDs and our pixel IDs, used while loading.
std::vector< std::vector< Types::Core::DateAndTime > > wrongdetid_pulsetimes
double proton_charge_tot
The total proton charge for the run.
void runLoadInstrument(const std::string &eventfilename, const API::MatrixWorkspace_sptr &localWorkspace)
Load the instrument geometry File.
LoadEventPreNexus2()
Constructor.
void unmaskVetoEventIndex()
Some Pulse ID and event indexes might be wrong.
bool pulsetimesincreasing
Whether or not the pulse times are sorted in increasing order.
std::size_t num_events
The number of events in the file.
std::vector< std::vector< double > > wrongdetid_tofs
void processInvestigationInputs()
Processing the input properties for purpose of investigation.
void createOutputWorkspace(const std::string &event_filename)
Create and set up output Event Workspace.
void openEventFile(const std::string &filename)
Open an event file.
bool m_dbOutput
Investigation properties.
std::set< PixelType > wrongdetids
detector IDs. Part of error events.
std::size_t num_bad_events
The number of bad events.
void loadPixelMap(const std::string &filename)
Load a pixel mapping file.
std::vector< uint64_t > event_indices
The index of the first event in each pulse.
void fixPixelId(PixelType &pixel, uint32_t &period) const
Turn a pixel id into a "corrected" pixelid and period.
std::size_t first_event
The first event to load (count from zero)
std::size_t num_pulses
the number of pulses
API::MatrixWorkspace_sptr generateEventDistribtionWorkspace()
Generate a workspace with distribution of events with pulse Workspace has 2 spectrum.
void readPulseidFile(const std::string &filename, const bool throwError)
Read a pulse ID file.
std::size_t num_wrongdetid_events
The number of events with wrong.
std::map< PixelType, size_t > wrongdetidmap
void setProtonCharge(DataObjects::EventWorkspace_sptr &workspace)
Add a sample environment log for the proton chage (charge of the pulse in picoCoulombs) and set the s...
void exec() override
Execution code.
std::size_t num_ignored_events
the number of events that were ignored (not loaded) because, e.g.
void addToWorkspaceLog(const std::string &logtitle, size_t mindex)
Add absolute time series to log.
std::unique_ptr< Mantid::Kernel::BinaryFile< DasEvent > > eventfile
Handles loading from the event file.
bool parallelProcessing
Flag to allow for parallel loading.
DataObjects::EventWorkspace_sptr localWorkspace
std::vector< std::size_t > pixel_to_wkspindex
The value of the vector is the workspace index.
int confidence(Kernel::FileDescriptor &descriptor) const override
Returns a confidence value that this algorithm can load a file.
std::size_t max_events
Number of events to load.
std::vector< Types::Event::TofEvent > & getEvents()
Return the list of TofEvents contained.
void reserve(size_t num) override
Reserve a certain number of entries in event list of the specified eventType.
void clear(const bool removeDetIDs=true) override
Clear the list of events and any associated detector ID's.
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
Support for a property that holds an array of values.
The BinaryFile template is a helper function for loading simple binary files.
size_t getNumElements() const
Returns the # of elements in the file (cached result of getFileSize)
std::vector< T > loadAll()
Loads the entire contents of the file into a pointer to a std::vector.
std::vector< T > loadAllIntoVector()
Loads the entire contents of the file into a std::vector.
CPUTimer : Timer that uses the CPU time, rather than wall-clock time to measure execution time.
Defines a wrapper around an open file.
static bool isAscii(const std::string &filename, const size_t nbytes=256)
Returns true if the file is considered ascii.
std::istream & data()
Access the open file stream.
const std::string & extension() const
Access the file extension.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void setPropertySettings(const std::string &name, std::unique_ptr< IPropertySettings > settings)
void setPropertyGroup(const std::string &name, const std::string &group)
Set the group for a given property.
void debug(const std::string &msg)
Logs at debug level.
void notice(const std::string &msg)
Logs at notice level.
void error(const std::string &msg)
Logs at error level.
void warning(const std::string &msg)
Logs at warning level.
void information(const std::string &msg)
Logs at information level.
OptionalBool : Tri-state bool.
virtual void setUnits(const std::string &unit)
Sets the units of the property, as a string.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
A specialised Property class for holding a series of time-value pairs.
void addValues(const std::vector< Types::Core::DateAndTime > ×, const std::vector< TYPE > &values)
Adds vectors of values to the map.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::vector< Types::Event::TofEvent > * EventVector_pt
pointer to the vector of events
static const double CURRENT_CONVERSION
Conversion factor between picoColumbs and microAmp*hours.
static const string PULSEID_PARAM("PulseidFilename")
static string getRunnumber(const string &filename)
Parse preNexus file name to get run number.
static string generatePulseidName(string eventfile)
Generate Pulse ID file name from preNexus event file's name.
int PixelType
DetermineChunking : Workflow algorithm to determine chunking.
static const string PID_PARAM("SpectrumList")
static const uint64_t VETOFLAG(72057594037927935)
Veto flag: 0xFF00000000000.
static const string OUT_PARAM("OutputWorkspace")
static string generateMappingfileName(EventWorkspace_sptr &wksp)
Generate mapping file name from Event workspace's instrument.
static const string MAP_PARAM("MappingFilename")
std::size_t numEvents(Nexus::File &file, bool &hasTotalCounts, bool &oldNeXusFileNames, const std::string &prefix, const Nexus::NexusDescriptor &descriptor)
Get the number of events in the currently opened group.
static const double TOF_CONVERSION
Conversion factor between 100 nanoseconds and 1 microsecond.
static const string EVENT_PARAM("EventFilename")
static const PixelType ERROR_PID
All pixel ids with matching this mask are errors.
static const uint32_t MAX_TOF_UINT32
The maximum possible tof as native type.
static const string EVENT_EXTS[]
static const string PULSE_EXTS[]
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
std::unique_ptr< T > create(const P &parent, const IndexArg &indexArg, const HistArg &histArg)
This is the create() method that all the other create() methods call.
constexpr size_t DEFAULT_BLOCK_SIZE
Default number of items to read in from any of the files.
Helper class which provides the Collimation Length for SANS instruments.
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
int32_t detid_t
Typedef for a detector ID.
int32_t specnum_t
Typedef for a spectrum Number.
Structure that matches the form in the binary event list.
DasTofType tof
Time of flight.
PixelType pid
Pixel identifier as published by the DAS/DAE/DAQ.
@ Output
An output workspace.