本文整理汇总了C++中Peak::findDetector方法的典型用法代码示例。如果您正苦于以下问题:C++ Peak::findDetector方法的具体用法?C++ Peak::findDetector怎么用?C++ Peak::findDetector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Peak
的用法示例。
在下文中一共展示了Peak::findDetector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findPeaks
//.........这里部分代码省略.........
// Distance between this box and a box we already put in.
coord_t distSquared = 0.0;
for (size_t d=0; d<nd; d++)
{
coord_t dist = otherCenter[d] - boxCenter[d];
distSquared += (dist * dist);
}
// Reject this box if it is too close to another previously found box.
if (distSquared < peakRadiusSquared)
{
badBox = true;
break;
}
}
// The box was not rejected for another reason.
if (!badBox)
{
if (numBoxesFound++ >= MaxPeaks)
{
g_log.notice() << "Number of peaks found exceeded the limit of " << MaxPeaks << ". Stopping peak finding." << std::endl;
break;
}
peakBoxes.push_back(box);
g_log.information() << "Found box at ";
for (size_t d=0; d<nd; d++)
g_log.information() << (d>0?",":"") << boxCenter[d];
g_log.information() << "; Density = " << density << std::endl;
// Report progres for each box found.
prog->report("Finding Peaks");
}
}
prog->resetNumSteps(numBoxesFound, 0.95, 1.0);
// Copy the instrument, sample, run to the peaks workspace.
peakWS->copyExperimentInfoFrom(ei.get());
// --- Convert the "boxes" to peaks ----
for (typename std::vector<boxPtr>::iterator it3=peakBoxes.begin(); it3 != peakBoxes.end(); it3++)
{
// The center of the box = Q in the lab frame
boxPtr box = *it3;
#ifndef MDBOX_TRACK_CENTROID
coord_t boxCenter[nd];
box->calculateCentroid(boxCenter);
#else
const coord_t * boxCenter = box->getCentroid();
#endif
V3D Q(boxCenter[0], boxCenter[1], boxCenter[2]);
// Create a peak and add it
// Empty starting peak.
Peak p;
try
{
if (dimType == QLAB)
{
// Build using the Q-lab-frame constructor
p = Peak(inst, Q);
// Save gonio matrix for later
p.setGoniometerMatrix(goniometer);
}
else if (dimType == QSAMPLE)
{
// Build using the Q-sample-frame constructor
p = Peak(inst, Q, goniometer);
}
}
catch (std::exception &e)
{
g_log.notice() << "Error creating peak at " << Q << " because of '" << e.what() << "'. Peak will be skipped." << std::endl;
continue;
}
try
{ // Look for a detector
p.findDetector();
}
catch (...)
{ /* Ignore errors in ray-tracer TODO: Handle for WISH data later */ }
// The "bin count" used will be the box density.
p.setBinCount( box->getSignalNormalized() * densityScalingFactor);
// Save the run number found before.
p.setRunNumber(runNumber);
peakWS->addPeak(p);
// Report progres for each box found.
prog->report("Adding Peaks");
} // for each box found
}