diff --git a/Code/Mantid/Framework/API/inc/MantidAPI/IPeak.h b/Code/Mantid/Framework/API/inc/MantidAPI/IPeak.h index 4168f93c7428a9f58b0b9fdf69b2a6a6de9af5c8..b783f3be255260466c4de75e054b13dc2e00b178 100644 --- a/Code/Mantid/Framework/API/inc/MantidAPI/IPeak.h +++ b/Code/Mantid/Framework/API/inc/MantidAPI/IPeak.h @@ -33,6 +33,9 @@ namespace API virtual int getRunNumber() const = 0; virtual void setRunNumber(int m_RunNumber) = 0; + virtual double getMonitorCount() const = 0; + virtual void setMonitorCount(double m_MonitorCount) = 0; + virtual double getH() const = 0; virtual double getK() const = 0; virtual double getL() const = 0; diff --git a/Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp b/Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp index f755a29642322242eb5abbf3ea040a08b82bba0c..10ecae8f373914e62e8f2246d93e6e9e5bab68d3 100644 --- a/Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp +++ b/Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp @@ -499,6 +499,7 @@ namespace Crystal peak.setGoniometerMatrix(gonMat); peak.setRunNumber(run); + peak.setMonitorCount( monCount ); double tof = peak.getTOF()+T0; Kernel::Units::Wavelength wl; diff --git a/Code/Mantid/Framework/Crystal/src/SaveIsawPeaks.cpp b/Code/Mantid/Framework/Crystal/src/SaveIsawPeaks.cpp index 16cbb78e2230d4533f8e7c79e8ae82085a86cd40..4f196acac208945683ea971438d8c93bc1e7482a 100644 --- a/Code/Mantid/Framework/Crystal/src/SaveIsawPeaks.cpp +++ b/Code/Mantid/Framework/Crystal/src/SaveIsawPeaks.cpp @@ -256,7 +256,12 @@ namespace Crystal out << std::setw( 7 ) << std::fixed << std::setprecision( 2 ) << chi << " "; out << std::setw( 7 ) << std::fixed << std::setprecision( 2 ) << phi << " "; out << std::setw( 7 ) << std::fixed << std::setprecision( 2 ) << omega << " "; - out << std::setw( 7 ) << (int)( 1 ) << std::endl; + + // Get the monitor count from the first peak (should all be the same for one run) + size_t first_peak_index = ids[0]; + Peak & first_peak = peaks[ first_peak_index ]; + double monct = first_peak.getMonitorCount(); + out << std::setw( 7 ) << (int)( monct ) << std::endl; out << header << std::endl; diff --git a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/Peak.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/Peak.h index fc7808506de1692a4e6f080149a08142403a6713..924b90be463dd604bd757f9afe6b028f47fe2307 100644 --- a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/Peak.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/Peak.h @@ -50,6 +50,9 @@ namespace DataObjects int getRunNumber() const; void setRunNumber(int m_RunNumber); + double getMonitorCount() const; + void setMonitorCount( double m_MonitorCount ); + double getH() const; double getK() const; double getL() const; @@ -147,6 +150,9 @@ namespace DataObjects /// Originating run number for this peak int m_RunNumber; + /// Integrated monitor count over TOF range for this run + double m_MonitorCount; + /// Cached row in the detector int m_Row; diff --git a/Code/Mantid/Framework/DataObjects/src/Peak.cpp b/Code/Mantid/Framework/DataObjects/src/Peak.cpp index 6de74ba854af7006e98fcef830ae8d4313ca6ece..cd235035bac505f3f51d8ab33b7d48da4c2111e5 100644 --- a/Code/Mantid/Framework/DataObjects/src/Peak.cpp +++ b/Code/Mantid/Framework/DataObjects/src/Peak.cpp @@ -23,7 +23,7 @@ namespace DataObjects m_Intensity(0), m_SigmaIntensity(0), m_BinCount(0), m_GoniometerMatrix(3,3,true), m_InverseGoniometerMatrix(3,3,true), - m_RunNumber(0),orig_H(0),orig_K(0),orig_L(0) + m_RunNumber(0),m_MonitorCount(0),orig_H(0),orig_K(0),orig_L(0) { } @@ -41,7 +41,7 @@ namespace DataObjects m_Intensity(0), m_SigmaIntensity(0), m_BinCount(0), m_GoniometerMatrix(3,3,true), m_InverseGoniometerMatrix(3,3,true), - m_RunNumber(0),orig_H(0),orig_K(0),orig_L(0) + m_RunNumber(0),m_MonitorCount(0),orig_H(0),orig_K(0),orig_L(0) { this->setInstrument(m_inst); this->setQLabFrame(QLabFrame, detectorDistance); @@ -65,7 +65,7 @@ namespace DataObjects m_Intensity(0), m_SigmaIntensity(0), m_BinCount(0), m_GoniometerMatrix(goniometer), m_InverseGoniometerMatrix(goniometer), - m_RunNumber(0),orig_H(0),orig_K(0),orig_L(0) + m_RunNumber(0),m_MonitorCount(0),orig_H(0),orig_K(0),orig_L(0) { if(fabs(m_InverseGoniometerMatrix.Invert())<1e-8) throw std::invalid_argument("Peak::ctor(): Goniometer matrix must non-singular."); this->setInstrument(m_inst); @@ -87,7 +87,7 @@ namespace DataObjects m_Intensity(0), m_SigmaIntensity(0), m_BinCount(0), m_GoniometerMatrix(3,3,true), m_InverseGoniometerMatrix(3,3,true), - m_RunNumber(0),orig_H(0),orig_K(0),orig_L(0) + m_RunNumber(0),m_MonitorCount(0),orig_H(0),orig_K(0),orig_L(0) { this->setInstrument(m_inst); this->setDetectorID(m_DetectorID); @@ -109,7 +109,7 @@ namespace DataObjects m_Intensity(0), m_SigmaIntensity(0), m_BinCount(0), m_GoniometerMatrix(3,3,true), m_InverseGoniometerMatrix(3,3,true), - m_RunNumber(0),orig_H(0),orig_K(0),orig_L(0) + m_RunNumber(0),m_MonitorCount(0),orig_H(0),orig_K(0),orig_L(0) { this->setInstrument(m_inst); this->setDetectorID(m_DetectorID); @@ -131,7 +131,7 @@ namespace DataObjects m_Intensity(0), m_SigmaIntensity(0), m_BinCount(0), m_GoniometerMatrix(goniometer), m_InverseGoniometerMatrix(goniometer), - m_RunNumber(0),orig_H(0),orig_K(0),orig_L(0) + m_RunNumber(0),m_MonitorCount(0),orig_H(0),orig_K(0),orig_L(0) { if(fabs(m_InverseGoniometerMatrix.Invert())<1e-8) throw std::invalid_argument("Peak::ctor(): Goniometer matrix must non-singular."); this->setInstrument(m_inst); @@ -151,7 +151,7 @@ namespace DataObjects m_Intensity(0), m_SigmaIntensity(0), m_BinCount(0), m_GoniometerMatrix(3,3,true), m_InverseGoniometerMatrix(3,3,true), - m_RunNumber(0),orig_H(0),orig_K(0),orig_L(0) + m_RunNumber(0),m_MonitorCount(0),orig_H(0),orig_K(0),orig_L(0) { this->setInstrument(m_inst); this->setWavelength(m_Wavelength); @@ -182,6 +182,7 @@ namespace DataObjects m_GoniometerMatrix(peak.m_GoniometerMatrix), m_InverseGoniometerMatrix(peak.m_InverseGoniometerMatrix), m_RunNumber(peak.m_RunNumber), + m_MonitorCount(peak.m_MonitorCount), m_Row(peak.m_Row), m_Col(peak.m_Col), sourcePos(peak.sourcePos), @@ -210,7 +211,8 @@ namespace DataObjects m_FinalEnergy(ipeak.getFinalEnergy()), m_GoniometerMatrix(ipeak.getGoniometerMatrix()), m_InverseGoniometerMatrix(ipeak.getGoniometerMatrix()), - m_RunNumber(ipeak.getRunNumber()) + m_RunNumber(ipeak.getRunNumber()), + m_MonitorCount(ipeak.getMonitorCount()) { if(fabs(m_InverseGoniometerMatrix.Invert())<1e-8) throw std::invalid_argument("Peak::ctor(): Goniometer matrix must non-singular."); setInstrument(ipeak.getInstrument()); @@ -549,6 +551,16 @@ namespace DataObjects void Peak::setRunNumber(int m_RunNumber) { this->m_RunNumber = m_RunNumber; } + //---------------------------------------------------------------------------------------------- + /** Return the monitor count stored in this peak. */ + double Peak::getMonitorCount() const + { return m_MonitorCount; } + + /** Set the monitor count for this peak + * @param m_MonitorCount :: the monitor count */ + void Peak::setMonitorCount(double m_MonitorCount) + { this->m_MonitorCount = m_MonitorCount; } + //---------------------------------------------------------------------------------------------- /** Get the ID of the detector at the center of the peak */ int Peak::getDetectorID() const diff --git a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp index f601fafc32a3a830e057ca5dd62b91649227d1e4..c6075247fd80e601a06791032e3510fb626aa343 100644 --- a/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp +++ b/Code/Mantid/Framework/PythonInterface/mantid/api/src/Exports/IPeak.cpp @@ -14,6 +14,8 @@ void export_IPeak() .def("setDetectorID", &IPeak::setDetectorID, "Set the detector ID and look up and cache values related to it.") .def("getRunNumber", &IPeak::getRunNumber, "Return the run number this peak was measured at") .def("setRunNumber", &IPeak::setRunNumber, "Set the run number that measured this peak") + .def("getMonitorCount", &IPeak::getMonitorCount, "Get the monitor count set for this peak") + .def("setMonitorCount", &IPeak::setMonitorCount, "Set the monitor count for this peak") .def("getH", &IPeak::getH, "Get the H index of the peak") .def("getK", &IPeak::getK, "Get the K index of the peak") .def("getL", &IPeak::getL, "Get the L index of the peak")