Skip to content
Snippets Groups Projects
Commit 440b6131 authored by Nick Draper's avatar Nick Draper
Browse files

fixes #3367

Change from using getPlottable to getDetectors
parent 05fc5b37
No related merge requests found
...@@ -70,21 +70,31 @@ void FindDetectorsInShape::initDocs() ...@@ -70,21 +70,31 @@ void FindDetectorsInShape::initDocs()
//get the instrument out of the workspace //get the instrument out of the workspace
IInstrument_sptr instrument_sptr = WS->getInstrument(); IInstrument_sptr instrument_sptr = WS->getInstrument();
IInstrument::plottables_const_sptr objCmptList = instrument_sptr->getPlottable();
//To get all the detector ID's
detid2det_map allDetectors;
instrument_sptr->getDetectors(allDetectors);
std::vector<int> foundDets; std::vector<int> foundDets;
//progress //progress
IInstrument::plottables::size_type objCmptCount = objCmptList->size(); detid2det_map::size_type objCmptCount = allDetectors.size();
int iprogress_step = static_cast<int>(objCmptCount / 100); int iprogress_step = static_cast<int>(objCmptCount / 100);
if (iprogress_step == 0) iprogress_step = 1; if (iprogress_step == 0) iprogress_step = 1;
int iprogress=0;
//Now go through all
detid2det_map::iterator it;
detid2det_map::const_iterator it_end = allDetectors.end();
for (it = allDetectors.begin(); it != it_end; it++)
{
detid_t detectorID = it->first;
Geometry::IDetector_sptr det = it->second;
//for every plottable item
for (IInstrument::plottables::const_iterator it = objCmptList->begin(); it!=objCmptList->end(); ++it)
{
//attempt to dynamic cast up to an IDetector //attempt to dynamic cast up to an IDetector
boost::shared_ptr<const Geometry::IDetector> detector_sptr = boost::shared_ptr<const Geometry::IDetector> detector_sptr =
boost::dynamic_pointer_cast<const Geometry::IDetector>((*it)); boost::dynamic_pointer_cast<const Geometry::IDetector>(it->second);
if (detector_sptr) if (detector_sptr)
{ {
...@@ -100,10 +110,10 @@ void FindDetectorsInShape::initDocs() ...@@ -100,10 +110,10 @@ void FindDetectorsInShape::initDocs()
} }
} }
int i = static_cast<int>(objCmptList->end()-it); iprogress++;
if (i % iprogress_step == 0) if (iprogress % iprogress_step == 0)
{ {
progress(static_cast<double>(i)/static_cast<double>(objCmptCount)); progress(static_cast<double>(iprogress)/static_cast<double>(objCmptCount));
interruption_point(); interruption_point();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment