Skip to content

Fix reverse logic bug introduced in !252

Gerhard Raven requested to merge fix-bug-in-mr-252 into master

The change introduced in ec8f1fd6 was:

 void MuonCombRec::clear() {

-  if( !m_hitsDone ) m_trackhits.clear() ; // clear the array of pointers to MuonHit's
+  m_trackhits = nullptr ; // clear the array of pointers to MuonHit's
   if( !m_sortDone ) for( auto& hitVector : m_sortedHits ) hitVector.clear();
   m_tracks.clear() ;      // clear the array of pointers to MuonTrack's

but the logic is that the bool m_hitsDone was replaced with the statement m_trackhits!=nullptr, where m_trackhits changed from container to a pointer to a container (to avoid a copy). So the above statement should have become

   if ( ! ( m_trackhits!=nullptr ) ) m_trackhits = nullptr

as an 'empty' container was flagged by 'not pointing' at the container kept elsewhere. Simplifying this, one gets

   if ( m_trackhits == nullptr) m_trackshits = nullptr

i.e. the logic in the above commit is 'the wrong way around', and the statement can (and should) just be dropped altogether.

Merge request reports