diff --git a/Calorimeter/CaloEvent/CaloEvent/CaloCluster.h b/Calorimeter/CaloEvent/CaloEvent/CaloCluster.h index ea622f909774ddde1d0bbca483fe033f2838d7e9..aafea74c82f3eaaaf26a3255fba7ce50e96b8fd0 100644 --- a/Calorimeter/CaloEvent/CaloEvent/CaloCluster.h +++ b/Calorimeter/CaloEvent/CaloEvent/CaloCluster.h @@ -155,61 +155,40 @@ class CaloCluster : public CaloCompositeKineBase, public: /*! \brief Default constructor builds unusable iterator */ - MomentStoreIter() : m_iter(), m_firstStore(0), m_secndStore(0) { }; + MomentStoreIter(); /*! \brief Standard constructor for a useable iterator */ MomentStoreIter(moment_iterator_i iter, const moment_store* firstStore, - const moment_store* secndStore=0) - : m_iter(iter), m_firstStore(firstStore), m_secndStore(secndStore) - { }; + const moment_store* secndStore=0) ; /*! Destructor */ - ~MomentStoreIter() { }; + ~MomentStoreIter(); /*! \brief Advance iterator */ - MomentStoreIter next() - { - m_iter++; - if ( m_iter == m_firstStore->end() && - ( m_secndStore != 0 && m_secndStore->size() > 0 ) ) - { - m_iter = m_secndStore->begin(); - } - return *this; - } + MomentStoreIter next(); /*! Step back iterator */ - MomentStoreIter prev() - { - if ( m_secndStore != 0 && m_iter == m_secndStore->begin() ) - { - m_iter = m_firstStore->end(); - } - m_iter--; - return *this; - } + MomentStoreIter prev() ; /*! \brief Post-advance operator */ - MomentStoreIter operator++() { return this->next(); } + MomentStoreIter operator++(); /*! \brief Pre-advance operator */ - MomentStoreIter operator++(int) { return this->next(); } + MomentStoreIter operator++(int); /*! \brief Post-step back operator */ - MomentStoreIter operator--() { return this->prev(); } + MomentStoreIter operator--(); /*! \brief Pre-step back operator */ - MomentStoreIter operator--(int) { return this->prev(); } + MomentStoreIter operator--(int); /*! \brief Equality comparator */ - bool operator==(const MomentStoreIter& anOther) - { return m_iter == anOther.m_iter; } + bool operator==(const MomentStoreIter& anOther); /*! \brief Inequality comparator */ - bool operator!=(const MomentStoreIter& anOther) - { return m_iter != anOther.m_iter; } + bool operator!=(const MomentStoreIter& anOther); /*! \brief Operator access to \a CaloClusterMoment */ - const CaloClusterMoment& operator*() const { return *m_iter; } + const CaloClusterMoment& operator*() const; /*! \brief Function access to \a CaloClusterMoment */ - const CaloClusterMoment& getMoment() const { return *m_iter; } + const CaloClusterMoment& getMoment() const; /*! \brief Function access to moment type */ - moment_type getMomentType() const { return m_iter.getMomentType(); } + moment_type getMomentType() const; private: diff --git a/Calorimeter/CaloEvent/src/CaloCluster.cxx b/Calorimeter/CaloEvent/src/CaloCluster.cxx index ae0507f8fdfa5d8d5a6fa2f2435aa8d6ca44917a..4824fb5a91b35e65f230cd3929d229cc6e733294 100644 --- a/Calorimeter/CaloEvent/src/CaloCluster.cxx +++ b/Calorimeter/CaloEvent/src/CaloCluster.cxx @@ -1551,3 +1551,65 @@ unsigned int CaloCluster::samplingPattern() const { return m_samplingPattern; } + + +// MomentStoreIter methods moved out-of-line to avoid a cling problem. +// Symptom was that iteration over the moments would enter an infinte +// loop in the ESD_18.0.0 test of CaloAthenaPool. + +/*! \brief Default constructor builds unusable iterator */ +CaloCluster::MomentStoreIter::MomentStoreIter() : m_iter(), m_firstStore(0), m_secndStore(0) { } +/*! \brief Standard constructor for a useable iterator */ +CaloCluster::MomentStoreIter::MomentStoreIter(moment_iterator_i iter, + const moment_store* firstStore, + const moment_store* secndStore/*=0*/) + : m_iter(iter), m_firstStore(firstStore), m_secndStore(secndStore) +{ } +/*! Destructor */ +CaloCluster::MomentStoreIter::~MomentStoreIter() { } + +/*! \brief Advance iterator */ +CaloCluster::MomentStoreIter CaloCluster::MomentStoreIter::next() +{ + m_iter++; + if ( m_iter == m_firstStore->end() && + ( m_secndStore != 0 && m_secndStore->size() > 0 ) ) + { + m_iter = m_secndStore->begin(); + } + return *this; +} + +/*! Step back iterator */ +CaloCluster::MomentStoreIter CaloCluster::MomentStoreIter::prev() +{ + if ( m_secndStore != 0 && m_iter == m_secndStore->begin() ) + { + m_iter = m_firstStore->end(); + } + m_iter--; + return *this; +} + +/*! \brief Post-advance operator */ +CaloCluster::MomentStoreIter CaloCluster::MomentStoreIter::operator++() { return this->next(); } +/*! \brief Pre-advance operator */ +CaloCluster::MomentStoreIter CaloCluster::MomentStoreIter::operator++(int) { return this->next(); } +/*! \brief Post-step back operator */ +CaloCluster::MomentStoreIter CaloCluster::MomentStoreIter::operator--() { return this->prev(); } +/*! \brief Pre-step back operator */ +CaloCluster::MomentStoreIter CaloCluster::MomentStoreIter::operator--(int) { return this->prev(); } + +/*! \brief Equality comparator */ +bool CaloCluster::MomentStoreIter::operator==(const MomentStoreIter& anOther) +{ return m_iter == anOther.m_iter; } +/*! \brief Inequality comparator */ +bool CaloCluster::MomentStoreIter::operator!=(const MomentStoreIter& anOther) +{ return m_iter != anOther.m_iter; } + +/*! \brief Operator access to \a CaloClusterMoment */ +const CaloClusterMoment& CaloCluster::MomentStoreIter::operator*() const { return *m_iter; } +/*! \brief Function access to \a CaloClusterMoment */ +const CaloClusterMoment& CaloCluster::MomentStoreIter::getMoment() const { return *m_iter; } +/*! \brief Function access to moment type */ +CaloCluster::moment_type CaloCluster::MomentStoreIter::getMomentType() const { return m_iter.getMomentType(); }