Commit 7200b707 authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Refs #14764. Reviewed files.

parent 146c0c77
...@@ -343,9 +343,9 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) { ...@@ -343,9 +343,9 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) {
// and append to the list // and append to the list
this->weightedEvents.reserve(this->weightedEvents.size() + this->weightedEvents.reserve(this->weightedEvents.size() +
more_events.size()); more_events.size());
for (auto it = more_events.begin(); for (const auto &event : more_events) {
it != more_events.end(); ++it) this->weightedEvents.emplace_back(event);
this->weightedEvents.push_back(WeightedEvent(*it)); }
break; break;
case WEIGHTED_NOTIME: case WEIGHTED_NOTIME:
...@@ -355,7 +355,7 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) { ...@@ -355,7 +355,7 @@ EventList &EventList::operator+=(const std::vector<TofEvent> &more_events) {
more_events.size()); more_events.size());
for (auto it = more_events.begin(); for (auto it = more_events.begin();
it != more_events.end(); ++it) it != more_events.end(); ++it)
this->weightedEventsNoTime.push_back(WeightedEventNoTime(*it)); this->weightedEventsNoTime.emplace_back(*it);
break; break;
} }
...@@ -405,9 +405,9 @@ operator+=(const std::vector<WeightedEvent> &more_events) { ...@@ -405,9 +405,9 @@ operator+=(const std::vector<WeightedEvent> &more_events) {
// and append to the list // and append to the list
this->weightedEventsNoTime.reserve(this->weightedEventsNoTime.size() + this->weightedEventsNoTime.reserve(this->weightedEventsNoTime.size() +
more_events.size()); more_events.size());
for (auto it = more_events.begin(); for (const auto &event : more_events) {
it != more_events.end(); ++it) this->weightedEventsNoTime.emplace_back(event);
this->weightedEventsNoTime.push_back(WeightedEventNoTime(*it)); }
break; break;
} }
...@@ -501,14 +501,14 @@ void EventList::minusHelper(std::vector<T1> &events, ...@@ -501,14 +501,14 @@ void EventList::minusHelper(std::vector<T1> &events,
* Using it caused a segault, Ticket #2306. * Using it caused a segault, Ticket #2306.
* So we cache the end (this speeds up too). * So we cache the end (this speeds up too).
*/ */
auto more_begin = more_events.begin(); auto more_begin = more_events.cbegin();
auto more_end = more_events.end(); auto more_end = more_events.cend();
for (itev = more_begin; itev != more_end; itev++) { for (itev = more_begin; itev != more_end; itev++) {
// We call the constructor for T1. In the case of WeightedEventNoTime, the // We call the constructor for T1. In the case of WeightedEventNoTime, the
// pulse time will just be ignored. // pulse time will just be ignored.
events.push_back(T1(itev->tof(), itev->pulseTime(), itev->weight() * (-1.0), events.emplace_back(itev->tof(), itev->pulseTime(), itev->weight() * (-1.0),
itev->errorSquared())); itev->errorSquared());
} }
} }
...@@ -1628,10 +1628,7 @@ EventList::compressEventsHelper(const std::vector<T> &events, ...@@ -1628,10 +1628,7 @@ EventList::compressEventsHelper(const std::vector<T> &events,
double weight = 0; double weight = 0;
double errorSquared = 0; double errorSquared = 0;
typename std::vector<T>::const_iterator it; for (auto it = events.cbegin(); it != events.cend(); it++) {
auto it_end =
events.end(); // cache for speed
for (it = events.begin(); it != it_end; it++) {
if ((it->m_tof - lastTof) <= tolerance) { if ((it->m_tof - lastTof) <= tolerance) {
// Carry the error and weight // Carry the error and weight
weight += it->weight(); weight += it->weight();
...@@ -1847,9 +1844,8 @@ void EventList::compressEvents(double tolerance, EventList *destination, ...@@ -1847,9 +1844,8 @@ void EventList::compressEvents(double tolerance, EventList *destination,
template <class T> template <class T>
typename std::vector<T>::const_iterator typename std::vector<T>::const_iterator
EventList::findFirstEvent(const std::vector<T> &events, const double seek_tof) { EventList::findFirstEvent(const std::vector<T> &events, const double seek_tof) {
auto itev = events.begin(); auto itev = events.cbegin();
auto itev_end = auto itev_end = events.cend(); // cache for speed
events.end(); // cache for speed
// if tof < X[0], that means that you need to skip some events // if tof < X[0], that means that you need to skip some events
while ((itev != itev_end) && (itev->tof() < seek_tof)) while ((itev != itev_end) && (itev->tof() < seek_tof))
...@@ -1903,9 +1899,8 @@ template <class T> ...@@ -1903,9 +1899,8 @@ template <class T>
typename std::vector<T>::const_iterator EventList::findFirstTimeAtSampleEvent( typename std::vector<T>::const_iterator EventList::findFirstTimeAtSampleEvent(
const std::vector<T> &events, const double seek_time, const std::vector<T> &events, const double seek_time,
const double &tofFactor, const double &tofOffset) const { const double &tofFactor, const double &tofOffset) const {
auto itev = events.begin(); auto itev = events.cbegin();
auto itev_end = auto itev_end = events.cend(); // cache for speed
events.end(); // cache for speed
// if tof < X[0], that means that you need to skip some events // if tof < X[0], that means that you need to skip some events
while ((itev != itev_end) && while ((itev != itev_end) &&
...@@ -1987,7 +1982,7 @@ void EventList::histogramForWeightsHelper(const std::vector<T> &events, ...@@ -1987,7 +1982,7 @@ void EventList::histogramForWeightsHelper(const std::vector<T> &events,
if (events.size() > 0) { if (events.size() > 0) {
// Iterate through all events (sorted by tof) // Iterate through all events (sorted by tof)
auto itev = findFirstEvent(events, X[0]); auto itev = findFirstEvent(events, X[0]);
auto itev_end = events.end(); auto itev_end = events.cend();
// The above can still take you to end() if no events above X[0], so check // The above can still take you to end() if no events above X[0], so check
// again. // again.
if (itev == itev_end) if (itev == itev_end)
...@@ -2182,8 +2177,7 @@ void EventList::generateCountsHistogramPulseTime(const MantidVec &X, ...@@ -2182,8 +2177,7 @@ void EventList::generateCountsHistogramPulseTime(const MantidVec &X,
// Iterate through all events (sorted by pulse time) // Iterate through all events (sorted by pulse time)
auto itev = auto itev =
findFirstPulseEvent(this->events, X[0]); findFirstPulseEvent(this->events, X[0]);
std::vector<TofEvent>::const_iterator itev_end = auto itev_end = events.cend(); // cache for speed
events.end(); // cache for speed
// The above can still take you to end() if no events above X[0], so check // The above can still take you to end() if no events above X[0], so check
// again. // again.
if (itev == itev_end) if (itev == itev_end)
...@@ -2607,10 +2601,9 @@ template <class T> ...@@ -2607,10 +2601,9 @@ template <class T>
void EventList::convertTofHelper(std::vector<T> &events, const double factor, void EventList::convertTofHelper(std::vector<T> &events, const double factor,
const double offset) { const double offset) {
// iterate through all events // iterate through all events
typename std::vector<T>::iterator itev; for (auto &event : events) {
auto itev_end = events.end(); // cache for speed event.m_tof = event.m_tof * factor + offset;
for (itev = events.begin(); itev != itev_end; itev++) }
itev->m_tof = itev->m_tof * factor + offset;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -2639,10 +2632,9 @@ template <class T> ...@@ -2639,10 +2632,9 @@ template <class T>
void EventList::addPulsetimeHelper(std::vector<T> &events, void EventList::addPulsetimeHelper(std::vector<T> &events,
const double seconds) { const double seconds) {
// iterate through all events // iterate through all events
typename std::vector<T>::iterator itev; for (auto &event : events) {
auto itev_end = events.end(); // cache for speed event.m_pulsetime += seconds;
for (itev = events.begin(); itev != itev_end; itev++) }
itev->m_pulsetime += seconds;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
...@@ -2761,11 +2753,8 @@ void EventList::maskTof(const double tofMin, const double tofMax) { ...@@ -2761,11 +2753,8 @@ void EventList::maskTof(const double tofMin, const double tofMax) {
template <class T> template <class T>
void EventList::getTofsHelper(const std::vector<T> &events, void EventList::getTofsHelper(const std::vector<T> &events,
std::vector<double> &tofs) { std::vector<double> &tofs) {
typename std::vector<T>::const_iterator itev;
auto itev_end =
events.end(); // cache for speed
tofs.clear(); tofs.clear();
for (itev = events.begin(); itev != itev_end; itev++) for (auto itev = events.cbegin(); itev != events.cend(); ++itev)
tofs.push_back(itev->m_tof); tofs.push_back(itev->m_tof);
} }
...@@ -2809,12 +2798,10 @@ std::vector<double> EventList::getTofs() const { ...@@ -2809,12 +2798,10 @@ std::vector<double> EventList::getTofs() const {
template <class T> template <class T>
void EventList::getWeightsHelper(const std::vector<T> &events, void EventList::getWeightsHelper(const std::vector<T> &events,
std::vector<double> &weights) { std::vector<double> &weights) {
typename std::vector<T>::const_iterator itev;
auto itev_end =
events.end(); // cache for speed
weights.clear(); weights.clear();
for (itev = events.begin(); itev != itev_end; itev++) for (const auto &event : events) {
weights.push_back(itev->weight()); weights.push_back(event.weight());
}
} }
/** Fill a vector with the list of Weights /** Fill a vector with the list of Weights
...@@ -2858,12 +2845,10 @@ std::vector<double> EventList::getWeights() const { ...@@ -2858,12 +2845,10 @@ std::vector<double> EventList::getWeights() const {
template <class T> template <class T>
void EventList::getWeightErrorsHelper(const std::vector<T> &events, void EventList::getWeightErrorsHelper(const std::vector<T> &events,
std::vector<double> &weightErrors) { std::vector<double> &weightErrors) {
typename std::vector<T>::const_iterator itev;
auto itev_end =
events.end(); // cache for speed
weightErrors.clear(); weightErrors.clear();
for (itev = events.begin(); itev != itev_end; itev++) for (const auto &event : events) {
weightErrors.push_back(itev->error()); weightErrors.push_back(event.error());
}
} }
/** Fill a vector with the list of Weight Errors /** Fill a vector with the list of Weight Errors
...@@ -2908,12 +2893,10 @@ template <class T> ...@@ -2908,12 +2893,10 @@ template <class T>
void EventList::getPulseTimesHelper( void EventList::getPulseTimesHelper(
const std::vector<T> &events, const std::vector<T> &events,
std::vector<Mantid::Kernel::DateAndTime> &times) { std::vector<Mantid::Kernel::DateAndTime> &times) {
typename std::vector<T>::const_iterator itev;
auto itev_end =
events.end(); // cache for speed
times.clear(); times.clear();
for (itev = events.begin(); itev != itev_end; itev++) for (const auto &event : events) {
times.push_back(itev->pulseTime()); times.push_back(event.pulseTime());
}
} }
/** Get the pulse times of each event in this EventList. /** Get the pulse times of each event in this EventList.
...@@ -3290,19 +3273,18 @@ void EventList::multiplyHelper(std::vector<T> &events, const double value, ...@@ -3290,19 +3273,18 @@ void EventList::multiplyHelper(std::vector<T> &events, const double value,
double errorSquared = error * error; double errorSquared = error * error;
double valueSquared = value * value; double valueSquared = value * value;
typename std::vector<T>::iterator itev;
auto itev_end = events.end(); auto itev_end = events.end();
if (error == 0) { if (error == 0) {
// Error-less calculation // Error-less calculation
for (itev = events.begin(); itev != itev_end; itev++) { for (auto itev = events.begin(); itev != itev_end; itev++) {
itev->m_errorSquared = itev->m_errorSquared =
static_cast<float>(itev->m_errorSquared * valueSquared); static_cast<float>(itev->m_errorSquared * valueSquared);
itev->m_weight *= static_cast<float>(value); itev->m_weight *= static_cast<float>(value);
} }
} else { } else {
// Carry the scalar error // Carry the scalar error
for (itev = events.begin(); itev != itev_end; itev++) { for (auto itev = events.begin(); itev != itev_end; itev++) {
itev->m_errorSquared = itev->m_errorSquared =
static_cast<float>(itev->m_errorSquared * valueSquared + static_cast<float>(itev->m_errorSquared * valueSquared +
errorSquared * itev->m_weight * itev->m_weight); errorSquared * itev->m_weight * itev->m_weight);
...@@ -4548,11 +4530,9 @@ template <class T> ...@@ -4548,11 +4530,9 @@ template <class T>
void EventList::convertUnitsQuicklyHelper(typename std::vector<T> &events, void EventList::convertUnitsQuicklyHelper(typename std::vector<T> &events,
const double &factor, const double &factor,
const double &power) { const double &power) {
auto itev = events.begin(); for (auto &event : events) {
auto itev_end = events.end();
for (; itev != itev_end; itev++) {
// Output unit = factor * (input) ^ power // Output unit = factor * (input) ^ power
itev->m_tof = factor * std::pow(itev->m_tof, power); event.m_tof = factor * std::pow(event.m_tof, power);
} }
} }
......
...@@ -43,17 +43,15 @@ bool getIntersectionRegion(MatrixWorkspace_const_sptr outputWS, ...@@ -43,17 +43,15 @@ bool getIntersectionRegion(MatrixWorkspace_const_sptr outputWS,
yn_hi < verticalAxis.front() || yn_lo > verticalAxis.back()) yn_hi < verticalAxis.front() || yn_lo > verticalAxis.back())
return false; return false;
auto start_it = auto start_it = std::upper_bound(xAxis.cbegin(), xAxis.cend(), xn_lo);
std::upper_bound(xAxis.begin(), xAxis.end(), xn_lo); auto end_it = std::upper_bound(xAxis.cbegin(), xAxis.cend(), xn_hi);
auto end_it =
std::upper_bound(xAxis.begin(), xAxis.end(), xn_hi);
x_start = 0; x_start = 0;
x_end = xAxis.size() - 1; x_end = xAxis.size() - 1;
if (start_it != xAxis.begin()) { if (start_it != xAxis.cbegin()) {
x_start = (start_it - xAxis.begin() - 1); x_start = (start_it - xAxis.cbegin() - 1);
} }
if (end_it != xAxis.end()) { if (end_it != xAxis.cend()) {
x_end = end_it - xAxis.begin(); x_end = end_it - xAxis.cbegin();
} }
// Q region // Q region
......
...@@ -409,8 +409,7 @@ void MDBoxFlatTree::loadExperimentInfos( ...@@ -409,8 +409,7 @@ void MDBoxFlatTree::loadExperimentInfos(
std::map<std::string, std::string> entries; std::map<std::string, std::string> entries;
file->getEntries(entries); file->getEntries(entries);
std::list<uint16_t> ExperimentBlockNum; std::list<uint16_t> ExperimentBlockNum;
auto it = entries.begin(); for (auto it = entries.begin(); it != entries.end(); ++it) {
for (; it != entries.end(); ++it) {
std::string name = it->first; std::string name = it->first;
if (boost::starts_with(name, "experiment")) { if (boost::starts_with(name, "experiment")) {
try { try {
......
...@@ -197,8 +197,7 @@ bool MaskWorkspace::isMasked(const std::set<detid_t> &detectorIDs) const { ...@@ -197,8 +197,7 @@ bool MaskWorkspace::isMasked(const std::set<detid_t> &detectorIDs) const {
} }
bool masked(true); bool masked(true);
for (auto it = detectorIDs.begin(); for (auto it = detectorIDs.cbegin(); it != detectorIDs.cend(); ++it) {
it != detectorIDs.end(); ++it) {
if (!this->isMasked(*it)) { if (!this->isMasked(*it)) {
masked = false; masked = false;
break; // allows space for a debug print statement break; // allows space for a debug print statement
......
...@@ -82,10 +82,8 @@ std::vector<Kernel::V3D> PeakShapeEllipsoid::getDirectionInSpecificFrame( ...@@ -82,10 +82,8 @@ std::vector<Kernel::V3D> PeakShapeEllipsoid::getDirectionInSpecificFrame(
"compatible with the direction vector"); "compatible with the direction vector");
} }
for (auto it = m_directions.begin(); for (auto it = m_directions.cbegin(); it != m_directions.cend(); ++it) {
it != m_directions.end(); ++it) {
directionsInFrame.push_back(invertedGoniometerMatrix * (*it)); directionsInFrame.push_back(invertedGoniometerMatrix * (*it));
Mantid::Kernel::V3D d = invertedGoniometerMatrix * (*it);
} }
return directionsInFrame; return directionsInFrame;
......
...@@ -34,10 +34,10 @@ TableWorkspace::TableWorkspace(const TableWorkspace &other) ...@@ -34,10 +34,10 @@ TableWorkspace::TableWorkspace(const TableWorkspace &other)
: ITableWorkspace(other), m_rowCount(0), m_LogManager(new API::LogManager) { : ITableWorkspace(other), m_rowCount(0), m_LogManager(new API::LogManager) {
setRowCount(other.m_rowCount); setRowCount(other.m_rowCount);
auto it = other.m_columns.begin(); auto it = other.m_columns.cbegin();
while (it != other.m_columns.end()) { while (it != other.m_columns.cend()) {
addColumn(boost::shared_ptr<API::Column>((*it)->clone())); addColumn(boost::shared_ptr<API::Column>((*it)->clone()));
it++; ++it;
} }
// copy logs/properties. // copy logs/properties.
m_LogManager = boost::make_shared<API::LogManager>(*(other.m_LogManager)); m_LogManager = boost::make_shared<API::LogManager>(*(other.m_LogManager));
...@@ -48,7 +48,7 @@ TableWorkspace::~TableWorkspace() {} ...@@ -48,7 +48,7 @@ TableWorkspace::~TableWorkspace() {}
size_t TableWorkspace::getMemorySize() const { size_t TableWorkspace::getMemorySize() const {
size_t data_size = 0; size_t data_size = 0;
for (auto c = m_columns.begin(); c != m_columns.end(); c++) { for (auto c = m_columns.cbegin(); c != m_columns.cend(); ++c) {
data_size += (*c)->sizeOfData(); data_size += (*c)->sizeOfData();
} }
data_size += m_LogManager->getMemorySize(); data_size += m_LogManager->getMemorySize();
...@@ -118,9 +118,7 @@ API::Column_sptr TableWorkspace::getColumn(const std::string &name) { ...@@ -118,9 +118,7 @@ API::Column_sptr TableWorkspace::getColumn(const std::string &name) {
/// Gets the shared pointer to a column. /// Gets the shared pointer to a column.
API::Column_const_sptr API::Column_const_sptr
TableWorkspace::getColumn(const std::string &name) const { TableWorkspace::getColumn(const std::string &name) const {
auto c_it = m_columns.begin(); for (auto c_it = m_columns.cbegin(); c_it != m_columns.cend(); ++c_it) {
auto c_end = m_columns.end();
for (; c_it != c_end; c_it++) {
if (c_it->get()->name() == name) { if (c_it->get()->name() == name) {
return *c_it; return *c_it;
} }
......
...@@ -182,8 +182,7 @@ void Instrument::getDetectors(detid2det_map &out_map) const { ...@@ -182,8 +182,7 @@ void Instrument::getDetectors(detid2det_map &out_map) const {
const detid2det_map &in_dets = const detid2det_map &in_dets =
static_cast<const Instrument *>(m_base)->m_detectorCache; static_cast<const Instrument *>(m_base)->m_detectorCache;
// And turn them into parametrized versions // And turn them into parametrized versions
for (auto it = in_dets.begin(); for (auto it = in_dets.cbegin(); it != in_dets.cend(); ++it) {
it != in_dets.end(); ++it) {
out_map.insert(std::pair<detid_t, IDetector_sptr>( out_map.insert(std::pair<detid_t, IDetector_sptr>(
it->first, it->first,
ParComponentFactory::createDetector(it->second.get(), m_map))); ParComponentFactory::createDetector(it->second.get(), m_map)));
...@@ -201,14 +200,12 @@ std::vector<detid_t> Instrument::getDetectorIDs(bool skipMonitors) const { ...@@ -201,14 +200,12 @@ std::vector<detid_t> Instrument::getDetectorIDs(bool skipMonitors) const {
if (m_map) { if (m_map) {
const detid2det_map &in_dets = const detid2det_map &in_dets =
static_cast<const Instrument *>(m_base)->m_detectorCache; static_cast<const Instrument *>(m_base)->m_detectorCache;
for (auto it = in_dets.begin(); for (auto it = in_dets.cbegin(); it != in_dets.cend(); ++it)
it != in_dets.end(); ++it)
if (!skipMonitors || !it->second->isMonitor()) if (!skipMonitors || !it->second->isMonitor())
out.push_back(it->first); out.push_back(it->first);
} else { } else {
const detid2det_map &in_dets = m_detectorCache; const detid2det_map &in_dets = m_detectorCache;
for (auto it = in_dets.begin(); for (auto it = in_dets.cbegin(); it != in_dets.cend(); ++it)
it != in_dets.end(); ++it)
if (!skipMonitors || !it->second->isMonitor()) if (!skipMonitors || !it->second->isMonitor())
out.push_back(it->first); out.push_back(it->first);
} }
...@@ -231,8 +228,7 @@ std::size_t Instrument::getNumberDetectors(bool skipMonitors) const { ...@@ -231,8 +228,7 @@ std::size_t Instrument::getNumberDetectors(bool skipMonitors) const {
if (m_map) { if (m_map) {
const detid2det_map &in_dets = const detid2det_map &in_dets =
static_cast<const Instrument *>(m_base)->m_detectorCache; static_cast<const Instrument *>(m_base)->m_detectorCache;
for (auto it = in_dets.begin(); for (auto it = in_dets.cbegin(); it != in_dets.cend(); ++it)
it != in_dets.end(); ++it)
if (it->second->isMonitor()) if (it->second->isMonitor())
monitors += 1; monitors += 1;
} else { } else {
...@@ -509,8 +505,7 @@ bool Instrument::isMonitor(const std::set<detid_t> &detector_ids) const { ...@@ -509,8 +505,7 @@ bool Instrument::isMonitor(const std::set<detid_t> &detector_ids) const {
if (detector_ids.empty()) if (detector_ids.empty())
return false; return false;
for (auto it = detector_ids.begin(); for (auto it = detector_ids.cbegin(); it != detector_ids.cend(); ++it) {
it != detector_ids.end(); ++it) {
if (this->isMonitor(*it)) if (this->isMonitor(*it))
return true; return true;
} }
...@@ -557,8 +552,7 @@ bool Instrument::isDetectorMasked(const std::set<detid_t> &detector_ids) const { ...@@ -557,8 +552,7 @@ bool Instrument::isDetectorMasked(const std::set<detid_t> &detector_ids) const {
if (detector_ids.empty()) if (detector_ids.empty())
return false; return false;
for (auto it = detector_ids.begin(); for (auto it = detector_ids.cbegin(); it != detector_ids.cend(); ++it) {
it != detector_ids.end(); ++it) {
if (!this->isDetectorMasked(*it)) if (!this->isDetectorMasked(*it))
return false; return false;
} }
...@@ -832,8 +826,7 @@ void Instrument::getBoundingBox(BoundingBox &assemblyBox) const { ...@@ -832,8 +826,7 @@ void Instrument::getBoundingBox(BoundingBox &assemblyBox) const {
m_cachedBoundingBox = new BoundingBox(); m_cachedBoundingBox = new BoundingBox();
ComponentID sourceID = getSource()->getComponentID(); ComponentID sourceID = getSource()->getComponentID();
// Loop over the children and define a box large enough for all of them // Loop over the children and define a box large enough for all of them
for (auto it = m_children.begin(); it != m_children.end(); for (auto it = m_children.cbegin(); it != m_children.cend(); ++it) {
++it) {
BoundingBox compBox; BoundingBox compBox;
IComponent *component = *it; IComponent *component = *it;
if (component && component->getComponentID() != sourceID) { if (component && component->getComponentID() != sourceID) {
...@@ -958,10 +951,9 @@ double Instrument::calcConversion( ...@@ -958,10 +951,9 @@ double Instrument::calcConversion(
const std::map<detid_t, double> &offsets) { const std::map<detid_t, double> &offsets) {
double factor = 0.; double factor = 0.;
double offset; double offset;
for (auto iter = detectors.begin(); for (auto iter = detectors.cbegin(); iter != detectors.cend(); ++iter) {
iter != detectors.end(); ++iter) {
auto off_iter = offsets.find(*iter); auto off_iter = offsets.find(*iter);
if (off_iter != offsets.end()) { if (off_iter != offsets.cend()) {
offset = offsets.find(*iter)->second; offset = offsets.find(*iter)->second;
} else { } else {
offset = 0.; offset = 0.;
......
...@@ -372,8 +372,7 @@ void CompAssembly::getBoundingBox(BoundingBox &assemblyBox) const { ...@@ -372,8 +372,7 @@ void CompAssembly::getBoundingBox(BoundingBox &assemblyBox) const {
if (!m_cachedBoundingBox) { if (!m_cachedBoundingBox) {
m_cachedBoundingBox = new BoundingBox(); m_cachedBoundingBox = new BoundingBox();
// Loop over the children and define a box large enough for all of them // Loop over the children and define a box large enough for all of them
for (auto it = m_children.begin(); it != m_children.end(); for (auto it = m_children.cbegin(); it != m_children.cend(); ++it) {
++it) {
BoundingBox compBox; BoundingBox compBox;
if (*it) { if (*it) {
(*it)->getBoundingBox(compBox); (*it)->getBoundingBox(compBox);
......