43#if BOOST_VERSION < 107100
44#include <boost/timer.hpp>
46#include <boost/timer/timer.hpp>
56using namespace Kernel;
58using namespace Geometry;
59using namespace DataObjects;
61using DataObjects::EventList;
62using DataObjects::EventWorkspace;
65using std::runtime_error;
67using std::stringstream;
69using Types::Core::DateAndTime;
70using Types::Event::TofEvent;
92static const uint64_t
VETOFLAG(72057594037927935);
94static const string EVENT_EXTS[] = {
"_neutron_event.dat",
"_neutron0_event.dat",
"_neutron1_event.dat",
95 "_neutron2_event.dat",
"_neutron3_event.dat",
"_neutron4_event.dat",
96 "_live_neutron_event.dat"};
97static const string PULSE_EXTS[] = {
"_pulseid.dat",
"_pulseid0.dat",
"_pulseid1.dat",
"_pulseid2.dat",
98 "_pulseid3.dat",
"_pulseid4.dat",
"_live_pulseid.dat"};
110 string runnumber(Poco::Path(filename).getBaseName());
112 if (runnumber.find(
"neutron") >= string::npos)
115 std::size_t
left = runnumber.find(
'_');
116 std::size_t
right = runnumber.find(
'_',
left + 1);
127 std::reverse(eventExts.begin(), eventExts.end());
129 std::reverse(pulseExts.begin(), pulseExts.end());
132 for (std::size_t i = 0; i < eventExts.size(); ++i) {
133 size_t start = eventfile.find(eventExts[i]);
134 if (start != string::npos)
135 return eventfile.replace(start, eventExts[i].size(), pulseExts[i]);
147 std::vector<string> temp = wksp->getInstrument()->getStringParameter(
"TS_mapping_file");
150 string mapping = temp[0];
152 Poco::File localmap(mapping);
153 if (localmap.exists())
158 if (!dataversion.empty())
162 string instrument = wksp->getInstrument()->getName();
163 Poco::File base(
"/SNS/" + instrument +
"/");
165 if (!base.exists()) {
167 base = Poco::File(
"/SNS/" + instrument +
"/");
175 const string CAL(
"_CAL");
176 const size_t CAL_LEN = CAL.length();
177 vector<string> files;
178 for (
auto &dir : dirs) {
179 if ((dir.length() > CAL_LEN) && (dir.compare(dir.length() - CAL.length(), CAL.length(), CAL) == 0)) {
180 std::string path = std::string(base.path()).append(
"/").append(dir).append(
"/calibrations/").append(mapping);
181 if (Poco::File(path).
exists())
182 files.emplace_back(path);
188 else if (files.size() == 1)
192 return *(files.rbegin());
203 if (descriptor.
extension().rfind(
"dat") == std::string::npos)
212 const size_t objSize =
sizeof(
DasEvent);
213 auto &handle = descriptor.
data();
216 handle.seekg(0, std::ios::end);
217 const auto filesize =
static_cast<size_t>(handle.tellg());
218 handle.seekg(0, std::ios::beg);
220 if (filesize % objSize == 0)
231 proton_charge(), proton_charge_tot(0), pixel_to_wkspindex(), pixelmap(), detid_max(), eventfile(nullptr),
232 num_events(0), num_pulses(0), numpixel(0), num_good_events(0), num_error_events(0), num_bad_events(0),
233 num_wrongdetid_events(0), num_ignored_events(0), first_event(0), max_events(0), using_mapping_file(false),
234 loadOnlySomeSpectra(false), spectraLoadMap(), longest_tof(0), shortest_tof(0), parallelProcessing(false),
235 pulsetimesincreasing(false), m_dbOutput(false), m_dbOpBlockNumber(0), m_dbOpNumEvents(0), m_dbOpNumPulses(0) {}
244 "The name of the neutron event file to read, including its full or "
245 "relative path. In most cases, the file typically ends in "
246 "neutron_event.dat (N.B. case sensitive if running on Linux).");
249 "File containing the accelerator pulse information; the "
250 "filename will be found automatically if not specified.");
252 "File containing the pixel mapping (DAS pixels to pixel IDs) file "
253 "(typically INSTRUMENT_TS_YYYY_MM_DD.dat). The filename will be found "
254 "automatically if not specified.");
258 "A list of individual spectra (pixel IDs) to read, specified "
259 "as e.g. 10:20. Only used if set.");
261 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
262 mustBePositive->setLower(1);
264 "If loading the file by sections ('chunks'), this is the "
265 "section number of this execution of the algorithm.");
267 "If loading the file by sections ('chunks'), this is the "
268 "total number of sections.");
274 std::vector<std::string> propOptions{
"Auto",
"Serial",
"Parallel"};
275 declareProperty(
"UseParallelProcessing",
"Auto", std::make_shared<StringListValidator>(propOptions),
276 "Use multiple cores for loading the data?\n"
277 " Auto: Use serial loading for small data sets, parallel "
278 "for large data sets.\n"
279 " Serial: Use a single core.\n"
280 " Parallel: Use all available cores.");
284 "The name of the workspace that will be created, filled "
286 "data and stored in the [[Analysis Data Service]].");
290 "Workspace with number of events per pulse");
293 auto mustBeNonNegative = std::make_shared<BoundedValidator<int>>();
294 mustBeNonNegative->setLower(0);
296 "Index of the loading block for debugging output. ");
299 "Number of output events for debugging purpose. Must be "
300 "defined with DBOutputBlockNumber.");
303 "Number of output pulses for debugging purpose. ");
305 std::string dbgrp =
"Investigation Use";
327 throw std::out_of_range(
"ChunkNumber cannot be larger than TotalChunks");
330 prog = std::make_unique<Progress>(
this, 0.0, 1.0, 100);
338 bool throwError =
true;
339 if (pulseid_filename.empty()) {
341 if (!pulseid_filename.empty()) {
342 if (Poco::File(pulseid_filename).
exists()) {
343 this->
g_log.
information() <<
"Found pulseid file " << pulseid_filename <<
'\n';
346 pulseid_filename =
"";
354 prog->report(
"Loading Pulse ID file");
356 prog->report(
"Loading Event File");
364 if (!diswsname.empty()) {
370 prog->report(
"Creating output workspace");
416 prog->report(
"Loading Instrument");
420 prog->report(
"Loading Mapping File");
422 if (mapping_filename.empty()) {
424 if (!mapping_filename.empty())
425 this->
g_log.
information() <<
"Found mapping file \"" << mapping_filename <<
"\"\n";
431 size_t nSpec =
localWorkspace->getInstrument()->getDetectorIDs(
true).size();
434 auto tmp = createWorkspace<EventWorkspace>(nSpec, 2, 1);
446 for (
int i = 0; i < static_cast<int>(
event_indices.size()); ++i) {
450 if (eventindex >
static_cast<uint64_t
>(
max_events)) {
452 uint64_t realeventindex = eventindex &
VETOFLAG;
458 if (eventindexcheck >
static_cast<uint64_t
>(
max_events)) {
459 g_log.
information() <<
"Check: Pulse " << i <<
": unphysical event index = " << eventindexcheck <<
"\n";
476 size_t sizey = sizex;
481 <<
"Number of pulses = " <<
pulsetimes.size() <<
"\n";
484 for (
size_t i = 0; i < 2; ++i) {
485 auto &dataX = disws->mutableX(i);
487 for (
size_t j = 0; j < sizex; ++j) {
489 dataX[j] =
static_cast<double>(time) * 1.0E-9;
494 auto &dataY0 = disws->mutableY(0);
495 auto &dataY1 = disws->mutableY(1);
500 for (
size_t i = 1; i < sizey; ++i) {
515 size_t mindex = mit->second;
517 g_log.
error() <<
"Wrong Index " << mindex <<
" for Pixel " << pid <<
'\n';
518 throw std::invalid_argument(
"Wrong array index for pixel from map");
524 std::stringstream ssname;
525 ssname <<
"Pixel" << pid;
526 std::string logname = ssname.str();
531 g_log.
notice() <<
"Processed imbedded log " << logname <<
"\n";
549 for (
size_t k = 0; k < nbins; k++) {
552 int64_t abstime_ns = pulsetime.totalNanoseconds() +
static_cast<int64_t
>(tof * 1000);
553 DateAndTime abstime(abstime_ns);
554 property->addValue(abstime, tof);
560 g_log.
information() <<
"Size of Property " <<
property->name() <<
" = " <<
property->size()
561 <<
" vs Original Log Size = " << nbins <<
"\n";
573 string instrument = Poco::Path(eventfilename).getFileName();
577 std::reverse(eventExts.begin(), eventExts.end());
579 for (
const auto &ending : eventExts) {
580 size_t pos = instrument.find(ending);
581 if (pos != string::npos) {
582 instrument = instrument.substr(0, pos);
588 size_t pos = instrument.rfind(
'_');
589 instrument = instrument.substr(0, pos);
595 loadInst->setPropertyValue(
"InstrumentName", instrument);
598 loadInst->executeAsChildAlg();
617 period = (pixel - unmapped_pid) / this->
numpixel;
618 pixel = this->
pixelmap[unmapped_pid];
640 size_t numBlocks = (
max_events + loadBlockSize - 1) / loadBlockSize;
643 const auto &detectorInfo =
workspace->detectorInfo();
644 const auto &detIDs = detectorInfo.detectorIDs();
647 std::string procMode =
getProperty(
"UseParallelProcessing");
648 if (procMode ==
"Serial")
650 else if (procMode ==
"Parallel")
659 double setUpTime = double(detectorInfo.size()) * 10e-6;
665 const auto it = std::max_element(detIDs.cbegin(), detIDs.cend());
666 detid_max = it == detIDs.cend() ? 0 : *it;
676 prog->report(
"Padding Pixels");
680 size_t workspaceIndex = 0;
682 for (
size_t i = 0; i < detectorInfo.size(); ++i) {
683 if (!detectorInfo.isMonitor(i)) {
703 std::vector<EventWorkspace_sptr> partWorkspaces;
704 std::vector<DasEvent *> buffers;
707 using EventVector_pt = std::vector<TofEvent> *;
709 EventVector_pt **eventVectors;
712 size_t numThreads = 1;
716 partWorkspaces.resize(numThreads);
717 buffers.resize(numThreads);
718 eventVectors =
new EventVector_pt *[numThreads];
721 for (
int i = 0; i < int(numThreads); i++) {
725 prog->report(
"Creating Partial Workspace");
730 partWorkspaces[i] = partWS;
735 buffers[i] =
new DasEvent[loadBlockSize];
739 eventVectors[i] =
new EventVector_pt[
detid_max + 1];
740 EventVector_pt *theseEventVectors = eventVectors[i];
744 if (wi !=
static_cast<size_t>(-1))
745 theseEventVectors[j] = &partWS->getSpectrum(wi).getEvents();
747 theseEventVectors[j] =
nullptr;
752 <<
" workspaces (same as number of threads) for parallel loading " << numBlocks <<
" blocks. "
755 prog->resetNumSteps(numBlocks, 0.1, 0.8);
762 for (
int blockNum = 0; blockNum < int(numBlocks); blockNum++) {
767 size_t threadNum = 0;
770 ws = partWorkspaces[threadNum];
775 DasEvent *event_buffer = buffers[threadNum];
778 EventVector_pt *theseEventVectors = eventVectors[threadNum];
781 size_t fileOffset =
first_event + (loadBlockSize * blockNum);
783 size_t current_event_buffer_size =
784 (blockNum == int(numBlocks - 1)) ? (
max_events - (numBlocks - 1) * loadBlockSize) : loadBlockSize;
788 current_event_buffer_size =
eventfile->loadBlockAt(event_buffer, fileOffset, current_event_buffer_size);
793 procEventsLinear(ws, theseEventVectors, event_buffer, current_event_buffer_size, fileOffset, dbprint);
796 prog->report(
"Load Event PreNeXus");
802 g_log.
debug() << tim <<
" to load the data.\n";
809 prog->resetNumSteps(
workspace->getNumberHistograms(), 0.8, 0.95);
813 for (
int iwi = 0; iwi < int(
workspace->getNumberHistograms()); iwi++) {
814 auto wi = size_t(iwi);
822 for (
size_t i = 0; i < numThreads; i++)
823 numEvents += partWorkspaces[i]->getSpectrum(wi).getNumberEvents();
828 for (
size_t i = 0; i < numThreads; i++) {
829 EventList &partEl = partWorkspaces[i]->getSpectrum(wi);
834 prog->report(
"Merging Workspaces");
836 g_log.
debug() << tim <<
" to merge workspaces together.\n";
846 for (
size_t i = 0; i < numThreads; i++) {
848 delete[] eventVectors[i];
850 delete[] eventVectors;
853 prog->resetNumSteps(3, 0.94, 1.00);
858 prog->report(
"Setting proton charge");
860 g_log.
debug() << tim <<
" to set the proton charge log."
886 <<
"Number of Wrong Detector IDs = " << this->
wrongdetids.size() <<
"\n";
888 for (
auto wit = this->
wrongdetids.begin(); wit != this->wrongdetids.end(); ++wit) {
889 g_log.
notice() <<
"Wrong Detector ID : " << *wit <<
'\n';
891 for (
auto git = this->
wrongdetidmap.begin(); git != this->wrongdetidmap.end(); ++git) {
893 size_t vindex = git->second;
912 std::vector<TofEvent> **arrayOfVectors,
DasEvent *event_buffer,
913 size_t current_event_buffer_size,
size_t fileOffset,
bool dbprint) {
915 DateAndTime pulsetime;
917 auto numPulses =
static_cast<int64_t
>(
num_pulses);
919 g_log.
warning() <<
"Event_indices vector is smaller than the pulsetimes array.\n";
924 size_t local_num_error_events = 0;
925 size_t local_num_bad_events = 0;
926 size_t local_num_wrongdetid_events = 0;
927 size_t local_num_ignored_events = 0;
928 size_t local_num_good_events = 0;
930 double local_longest_tof = 0.;
933 std::map<PixelType, size_t> local_pidindexmap;
934 std::vector<std::vector<Types::Core::DateAndTime>> local_pulsetimes;
935 std::vector<std::vector<double>> local_tofs;
936 std::set<PixelType> local_wrongdetids;
939 std::stringstream dbss;
941 for (
size_t i = 0; i < current_event_buffer_size; i++) {
942 DasEvent &temp = *(event_buffer + i);
944 bool iswrongdetid =
false;
947 dbss << i <<
" \t" << temp.
tof <<
" \t" << temp.
pid <<
"\n";
951 local_num_error_events++;
952 local_num_bad_events++;
958 if (pid == 1073741843)
969 local_num_error_events++;
970 local_num_wrongdetid_events++;
971 local_wrongdetids.insert(pid);
976 std::map<int64_t, bool>::iterator it;
980 local_num_ignored_events++;
988 if (pulse_i < numPulses - 1) {
990 size_t total_i = i + fileOffset;
996 if (pulse_i >= (numPulses - 1))
1007 if (!iswrongdetid) {
1010 if (tof < local_shortest_tof)
1011 local_shortest_tof = tof;
1012 if (tof > local_longest_tof)
1013 local_longest_tof = tof;
1018 arrayOfVectors[pid]->emplace_back(tof, pulsetime);
1019 ++local_num_good_events;
1023 std::map<PixelType, size_t>::iterator it;
1024 it = local_pidindexmap.find(pid);
1025 size_t theindex = 0;
1026 if (it == local_pidindexmap.end()) {
1028 size_t newindex = local_pulsetimes.size();
1029 local_pidindexmap[pid] = newindex;
1031 std::vector<Types::Core::DateAndTime> tempvectime;
1032 std::vector<double> temptofs;
1033 local_pulsetimes.emplace_back(tempvectime);
1034 local_tofs.emplace_back(temptofs);
1036 theindex = newindex;
1040 g_log.
debug() <<
"Find New Wrong Pixel ID = " << pid <<
"\n";
1043 theindex = it->second;
1048 local_pulsetimes[theindex].emplace_back(pulsetime);
1049 local_tofs[theindex].emplace_back(tof);
1067 std::set<PixelType>::iterator it;
1068 for (it = local_wrongdetids.begin(); it != local_wrongdetids.end(); ++it) {
1080 std::vector<Types::Core::DateAndTime> temppulsetimes;
1081 std::vector<double> temptofs;
1087 mindex = git->second;
1091 auto lit = local_pidindexmap.find(tmpid);
1092 size_t localindex = lit->second;
1094 for (
size_t iv = 0; iv < local_pulsetimes[localindex].size(); iv++) {
1096 this->
wrongdetid_tofs[mindex].emplace_back(local_tofs[localindex][iv]);
1142 g_log.
information() <<
"Total proton charge of " << integ <<
" microAmp*hours found by integrating.\n";
1153 if (filename.empty()) {
1159 this->
g_log.
debug(
"Using mapping file \"" + filename +
"\"");
1168 using std::placeholders::_1;
1169 if (std::find_if(
pixelmap.begin(),
pixelmap.end(), std::bind(std::greater<PixelType>(), _1, max_pid)) !=
1171 this->
g_log.
warning(
"Pixel id in mapping file was out of bounds. Loading "
1172 "without mapping file");
1192 eventfile = std::make_unique<BinaryFile<DasEvent>>(filename);
1204 const int totalChunks =
getProperty(
"TotalChunks");
1208 if (chunk == totalChunks)
1226 if (filename.empty()) {
1231 std::vector<Pulse> pulses;
1244 }
catch (runtime_error &e) {
1248 this->
g_log.
information() <<
"Encountered error in pulseidfile (ignoring file): " << e.what() <<
"\n";
1254 DateAndTime lastPulseDateTime(0, 0);
1256 for (
const auto &pulse : pulses) {
1257 DateAndTime pulseDateTime(
static_cast<int64_t
>(pulse.seconds),
static_cast<int64_t
>(pulse.nanoseconds));
1258 this->
pulsetimes.emplace_back(pulseDateTime);
1261 if (pulseDateTime < lastPulseDateTime)
1264 lastPulseDateTime = pulseDateTime;
1266 double temp = pulse.pCurrent;
1269 this->
g_log.
warning(
"Individual proton charge < 0 being ignored");
1278 std::stringstream dbss;
1296 int numdbevents =
getProperty(
"DBNumberOutputEvents");
1300 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.
@ 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 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.
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
static const string BLOCK_SIZE_PARAM("LoadingBlockSize")
bool vzintermediatePixelIDComp(IntermediateEvent x, IntermediateEvent y)
Comparator for sorting dasevent lists.
static const double CURRENT_CONVERSION
Conversion factor between picoColumbs and microAmp*hours.
bool exists(::NeXus::File &file, const std::string &name)
Based on the current group in the file, does the named sub-entry exist?
static const string PULSEID_PARAM("PulseidFilename")
static string getRunnumber(const string &filename)
Get run number.
static string generatePulseidName(string eventfile)
Generate pulse ID.
int PixelType
DetermineChunking : Workflow algorithm to determine chunking.
static const string PID_PARAM("SpectrumList")
static const uint64_t VETOFLAG(72057594037927935)
Veto mask as 0xFF000000000.
static const string OUT_PARAM("OutputWorkspace")
std::size_t numEvents(::NeXus::File &file, bool &hasTotalCounts, bool &oldNeXusFileNames, const std::string &prefix, const NexusHDF5Descriptor &descriptor)
Get the number of events in the currently opened group.
static const string PARALLEL_PARAM("UseParallelProcessing")
static string generateMappingfileName(EventWorkspace_sptr &wksp)
Generate mapping file name.
static const string MAP_PARAM("MappingFilename")
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.
static const 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.