Commit 9ec34ae0 authored by Ruth Mikkelson's avatar Ruth Mikkelson
Browse files

Refs #7224 Fixed a problems and more catches

It is possible( very unlikely) for a peak to be deleted from another thread
parent 159e060a
......@@ -105,7 +105,7 @@ namespace DataObjects
Peak & getPeak(int peakNum);
const Peak & getPeak(int peakNum) const;
API::IPeak* createPeak(Kernel::V3D QLabFrame, double detectorDistance=1.0) const;
std::vector<std::pair<std::string,std::string> > PeakInfo(Kernel::V3D QLabFrame , bool lab_coords) const;
std::vector<std::pair<std::string,std::string> > PeakInfo(Kernel::V3D QFrame , bool lab_coords) const;
std::vector<Peak> & getPeaks();
const std::vector<Peak> & getPeaks() const;
virtual bool hasIntegratedPeaks() const;
......
......@@ -265,31 +265,37 @@ namespace Mantid
bool hasOneRunNumber = true;
int runNum = -1;
double minDist = 10000000;
for (int i = 0; i < getNumberPeaks(); i++)
int NPeaks = getNumberPeaks();
try
{
Peak pk = getPeak(i);
V3D Q = pk.getQLabFrame();
if (!lab_coords)
Q = pk.getQSampleFrame();
double D = QFrame.distance(Q);
if (D < minDist)
for (int i = 0; i < NPeaks; i++)
{
minDist = D;
seqNum = i + 1;
}
Peak pk = getPeak(i);
V3D Q = pk.getQLabFrame();
if (!lab_coords)
Q = pk.getQSampleFrame();
double D = QFrame.distance(Q);
if (D < minDist)
{
minDist = D;
seqNum = i;
}
int run = pk.getRunNumber();
if (runNum < 0)
runNum = run;
else if (runNum != run)
hasOneRunNumber = false;
int run = pk.getRunNumber();
if (runNum < 0)
runNum = run;
else if (runNum != run)
hasOneRunNumber = false;
}
}catch(...)
{
seqNum = -1;//peak could have been removed
}
V3D Qlab = QFrame;
V3D Qsamp;
Kernel::Matrix<double> Gon(3, 3, true);
if (seqNum >= 0)
if (seqNum >= 0 && NPeaks == getNumberPeaks())
Gon = getPeak(seqNum).getGoniometerMatrix();
if (lab_coords)
{
......@@ -356,8 +362,8 @@ namespace Mantid
boost::lexical_cast<std::string>(PhiChiOmega));
Result.push_back(GRead);
std::pair<std::string, std::string> SeqNum("Sequence Num"," "+
boost::lexical_cast<std::string>(seqNum));
std::pair<std::string, std::string> SeqNum("Seq Num,1st=1"," "+
boost::lexical_cast<std::string>(seqNum + 1));
Result.push_back(SeqNum);
oss<<std::setw(12)<<std::fixed<<std::setprecision(3)<<(peak->getWavelength());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment