diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/PhaseQuadMuon.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/PhaseQuadMuon.h index ddd716bd9206f1e78e178f1fdd798b7f38b848cc..588f7f1a5d77d91f905dda48283acd3bce414489 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/PhaseQuadMuon.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/PhaseQuadMuon.h @@ -39,7 +39,9 @@ public: /// Default constructor PhaseQuadMuon() : API::Algorithm(), m_muLife(2.19703), m_bigNumber(1e10), m_tPulseOver(0), - m_pulseTail(182), m_poissonLim(30), m_pulseTwo(0.325){}; + m_pulseTail(182), m_poissonLim(30), m_pulseTwo(0.325), m_nHist(0), + m_nData(0), m_res(0.0), m_meanLag(0.0), m_tValid(0), m_isDouble(false), + m_tMin(0.0){}; /// Destructor virtual ~PhaseQuadMuon(){}; /// Algorithm's name for identification overriding a virtual method diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/AppendGeometryToSNSNexus.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/AppendGeometryToSNSNexus.h index a02abe22617634cd39193239804391523a72ae83..82d4978d6b021e440694cf523f18c3400b8a0800 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/AppendGeometryToSNSNexus.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/AppendGeometryToSNSNexus.h @@ -76,17 +76,14 @@ private: /// Are we going to make a copy of the NeXus file to operate on ? bool m_makeNexusCopy; - /// Algorithm progress keeper - API::Progress *progress; - /// The workspace to load instrument and logs API::MatrixWorkspace_sptr ws; /// Was the instrument loaded? - bool instrument_loaded_correctly; + bool m_instrumentLoadedCorrectly; /// Were the logs loaded? - bool logs_loaded_correctly; + bool m_logsLoadedCorrectly; }; } // namespace DataHandling diff --git a/Code/Mantid/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp b/Code/Mantid/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp index 87765f23b5cd677a68cbb3c9da79610ba950f6ec..a4f22442efce17b553a40dd701d4968dbbab8ceb 100644 --- a/Code/Mantid/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp @@ -23,7 +23,9 @@ DECLARE_ALGORITHM(AppendGeometryToSNSNexus) //---------------------------------------------------------------------------------------------- /** Constructor */ -AppendGeometryToSNSNexus::AppendGeometryToSNSNexus() {} +AppendGeometryToSNSNexus::AppendGeometryToSNSNexus() + : m_makeNexusCopy(false), m_instrumentLoadedCorrectly(false), + m_logsLoadedCorrectly(false) {} //---------------------------------------------------------------------------------------------- /** Destructor @@ -144,23 +146,23 @@ void AppendGeometryToSNSNexus::exec() { if (m_instrument == "HYSPEC" || m_instrument == "HYSPECA" || m_instrument == "SNAP") { g_log.debug() << "Run LoadNexusLogs Child Algorithm." << std::endl; - logs_loaded_correctly = runLoadNexusLogs(m_filename, ws, this); + m_logsLoadedCorrectly = runLoadNexusLogs(m_filename, ws, this); - if (!logs_loaded_correctly) + if (!m_logsLoadedCorrectly) throw std::runtime_error("Failed to run LoadNexusLogs Child Algorithm."); } g_log.debug() << "Run LoadInstrument Child Algorithm." << std::endl; - instrument_loaded_correctly = runLoadInstrument(m_idf_filename, ws, this); + m_instrumentLoadedCorrectly = runLoadInstrument(m_idf_filename, ws, this); - if (!instrument_loaded_correctly) + if (!m_instrumentLoadedCorrectly) throw std::runtime_error("Failed to run LoadInstrument Child Algorithm."); // Get the number of detectors (just for progress reporting) // Get the number of histograms/detectors const size_t numDetectors = ws->getInstrument()->getDetectorIDs().size(); - this->progress = new API::Progress(this, 0.0, 1.0, numDetectors); + API::Progress progress(this, 0.0, 1.0, numDetectors); // Get the instrument Geometry::Instrument_const_sptr instrument = ws->getInstrument(); @@ -250,7 +252,7 @@ void AppendGeometryToSNSNexus::exec() { nxfile.closeGroup(); // close NXdetector - this->progress->report(dets.size()); + progress.report(dets.size()); } else { throw std::runtime_error( "Could not find any detectors for the bank named " + diff --git a/Code/Mantid/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp b/Code/Mantid/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp index 5cc06ebf6e86a781b91f52a8d8ad9840a1affc7b..7a1cdbedc406bad20d23cd982068f19e4bbf93cb 100644 --- a/Code/Mantid/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp @@ -202,8 +202,15 @@ static string generateMappingfileName(EventWorkspace_sptr &wksp) { /** Constructor */ FilterEventsByLogValuePreNexus::FilterEventsByLogValuePreNexus() - : Mantid::API::IFileLoader<Kernel::FileDescriptor>(), eventfile(NULL), - m_maxNumEvents(0) {} + : Mantid::API::IFileLoader<Kernel::FileDescriptor>(), proton_charge_tot(0), + detid_max(0), eventfile(NULL), num_events(0), num_pulses(0), numpixel(0), + num_good_events(0), num_error_events(0), num_bad_events(0), + num_wrongdetid_events(0), num_ignored_events(0), first_event(0), + m_maxNumEvents(0), using_mapping_file(false), loadOnlySomeSpectra(false), + longest_tof(0.0), shortest_tof(0.0), parallelProcessing(false), + pulsetimesincreasing(false), m_throwError(true), m_examEventLog(false), + m_pixelid2exam(0), m_numevents2write(0), m_freqHz(0), istep(0), + m_dbPixelID(0), m_useDBOutput(false), m_corretctTOF(false) {} //---------------------------------------------------------------------------------------------- /** Desctructor @@ -740,13 +747,22 @@ void FilterEventsByLogValuePreNexus::doStatToEventLog(size_t mindex) { max_dt = temp_dt; } - double avg_dt = static_cast<double>(sum_dt) / static_cast<double>(nbins - 1); + if ( nbins - 1 ) { + double avg_dt = static_cast<double>(sum_dt) / static_cast<double>(nbins - 1); + g_log.information() << "Event log of map index " << mindex + << ": Avg(dt) = " << avg_dt * 1.0E-9 + << ", Min(dt) = " << static_cast<double>(min_dt) * 1.0E-9 + << ", Max(dt) = " << static_cast<double>(max_dt) * 1.0E-9 + << "\n"; + } else { + g_log.information() << "Event log of map index " << mindex + << ": Avg(dt) = " << static_cast<double>(sum_dt) * 1.0E-9 + << ", Min(dt) = " << static_cast<double>(min_dt) * 1.0E-9 + << ", Max(dt) = " << static_cast<double>(max_dt) * 1.0E-9 + << "\n"; + + } - g_log.information() << "Event log of map index " << mindex - << ": Avg(dt) = " << avg_dt * 1.0E-9 - << ", Min(dt) = " << static_cast<double>(min_dt) * 1.0E-9 - << ", Max(dt) = " << static_cast<double>(max_dt) * 1.0E-9 - << "\n"; g_log.information() << "Number of zero-interval eveng log = " << numzeros << "\n"; diff --git a/Code/Mantid/Framework/DataHandling/src/SaveISISNexus.cpp b/Code/Mantid/Framework/DataHandling/src/SaveISISNexus.cpp index ade4e26476fde8bd4e6abdb9cbf629614bfd6739..9313b64044e0758ba5cb268c6ed74b878b9953f1 100644 --- a/Code/Mantid/Framework/DataHandling/src/SaveISISNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SaveISISNexus.cpp @@ -37,7 +37,10 @@ using namespace Kernel; using namespace API; /// Empty default constructor -SaveISISNexus::SaveISISNexus() : Algorithm() {} +SaveISISNexus::SaveISISNexus() + : Algorithm(), m_isisRaw(), handle(), rawFile(), nper(0), nsp(0), ntc(0), + nmon(0), ndet(0), counts_link(), period_index_link(), + spectrum_index_link(), time_of_flight_link(), time_of_flight_raw_link() {} /** Initialisation method. * diff --git a/Code/Mantid/Framework/DataHandling/src/SaveNexusProcessed.cpp b/Code/Mantid/Framework/DataHandling/src/SaveNexusProcessed.cpp index 7f0833ecbf64939ceacdca1f557b728e71a76248..c6778b15c89d26ddd5777b780f86d93942d5e3b0 100644 --- a/Code/Mantid/Framework/DataHandling/src/SaveNexusProcessed.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SaveNexusProcessed.cpp @@ -36,7 +36,7 @@ typedef NeXus::NexusFileIO::optional_size_t optional_size_t; DECLARE_ALGORITHM(SaveNexusProcessed) /// Empty default constructor -SaveNexusProcessed::SaveNexusProcessed() : Algorithm() {} +SaveNexusProcessed::SaveNexusProcessed() : Algorithm(), m_timeProgInit(0.0), prog() {} //----------------------------------------------------------------------------------------------- /** Initialisation method. diff --git a/Code/Mantid/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp b/Code/Mantid/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp index 5199815d7124e54304aeb297e5518368933aa5ae..2db400089273d08c819a10da4b8de63da8b4dc06 100644 --- a/Code/Mantid/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/SaveToSNSHistogramNexus.cpp @@ -39,7 +39,7 @@ using namespace DataObjects; using namespace Geometry; /// Empty default constructor -SaveToSNSHistogramNexus::SaveToSNSHistogramNexus() : Algorithm() {} +SaveToSNSHistogramNexus::SaveToSNSHistogramNexus() : Algorithm(), prog(), m_compress(false), links_count(0), inId(), outId() {} /** Initialisation method. * diff --git a/Code/Mantid/Framework/Kernel/src/NexusDescriptor.cpp b/Code/Mantid/Framework/Kernel/src/NexusDescriptor.cpp index 39755715bc32b9ab8a774b25a8bd76494e12d44e..f05232f4cb511d9c0480bd7ef033a8fc040fc90f 100644 --- a/Code/Mantid/Framework/Kernel/src/NexusDescriptor.cpp +++ b/Code/Mantid/Framework/Kernel/src/NexusDescriptor.cpp @@ -50,8 +50,12 @@ bool isHDFHandle(FILE *fileHandle, NexusDescriptor::Version version) { // HDF4 check requires 4 bytes, HDF5 check requires 8 bytes // Use same buffer and waste a few bytes if only checking HDF4 unsigned char buffer[8] = {'0', '0', '0', '0', '0', '0', '0', '0'}; - std::fread(static_cast<void *>(&buffer), sizeof(unsigned char), - NexusDescriptor::HDF5SignatureSize, fileHandle); + if (NexusDescriptor::HDF5SignatureSize != + std::fread(static_cast<void *>(&buffer), sizeof(unsigned char), + NexusDescriptor::HDF5SignatureSize, fileHandle)) { + throw std::runtime_error("Error while reading file"); + } + // Number of bytes read doesn't matter as if it is not enough then the memory // simply won't match // as the buffer has been "zeroed" diff --git a/Code/Mantid/Framework/Nexus/src/MuonNexusReader.cpp b/Code/Mantid/Framework/Nexus/src/MuonNexusReader.cpp index bdcda4d395f4254cf185c09b3fc8d919f8f72797..594dc6d35b4d754ce18b5e55e0353563a411072f 100644 --- a/Code/Mantid/Framework/Nexus/src/MuonNexusReader.cpp +++ b/Code/Mantid/Framework/Nexus/src/MuonNexusReader.cpp @@ -25,8 +25,10 @@ using namespace Mantid; /// Default constructor MuonNexusReader::MuonNexusReader() - : nexus_instrument_name(), corrected_times(NULL), counts(NULL), - detectorGroupings(NULL) {} + : nexus_instrument_name(), nexus_samplename(), nexusLogCount(0), + startTime_time_t(), t_nsp1(0), t_ntc1(0), t_nper(0), + corrected_times(NULL), counts(NULL), detectorGroupings(NULL), + numDetectors(0) {} /// Destructor deletes temp storage MuonNexusReader::~MuonNexusReader() { diff --git a/Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp b/Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp index 0984355bcd319cfefa9c8fa190b44751c277b85b..9427b662c74f4a5a06f34f748334a713dd7845c8 100644 --- a/Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp +++ b/Code/Mantid/Framework/Nexus/src/NexusFileIO.cpp @@ -629,7 +629,7 @@ void NexusFileIO::writeNexusVectorColumn( int NexusFileIO::writeNexusTableWorkspace( const API::ITableWorkspace_const_sptr &itableworkspace, const char *group_name) const { - NXstatus status = 0; + NXstatus status = NX_ERROR; boost::shared_ptr<const TableWorkspace> tableworkspace = boost::dynamic_pointer_cast<const TableWorkspace>(itableworkspace); @@ -637,7 +637,7 @@ int NexusFileIO::writeNexusTableWorkspace( boost::dynamic_pointer_cast<const PeaksWorkspace>(itableworkspace); if (!tableworkspace && !peakworkspace) - return ((status == NX_ERROR) ? 3 : 0); + return 3; // write data entry status = NXmakegroup(fileID, group_name, "NXdata");