diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 3f0fcedca732db002004b8137332ec9bca31c527..8cd56bc94a2ae1c7b81a4c376df9fd3cdb48e4b7 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -509,7 +509,7 @@ void THcShower::Clear(Option_t* opt) fTREpl_neg_cor[ip] = -0.; } - fClusterList->clear(); + fClusterList->purge(); } diff --git a/src/THcShowerCluster.h b/src/THcShowerCluster.h index 59404365e0c74a6f4a3699112da5c311c3014428..cc716b5f8175d352c458e92fad3cedd180b72a75 100644 --- a/src/THcShowerCluster.h +++ b/src/THcShowerCluster.h @@ -162,16 +162,17 @@ class THcShowerClusterList : private THcShClusterList { } ~THcShowerClusterList() { + purge(); + } + + // Purge cluster list + // + void purge() { for (THcShClusterIt i = THcShClusterList::begin(); - i != THcShClusterList::end(); ++i) { + i != THcShClusterList::end(); ++i) { delete *i; *i = 0; } - } - - // Clear cluster list - // - void clear() { THcShClusterList::clear(); } @@ -193,50 +194,50 @@ class THcShowerClusterList : private THcShClusterList { return THcShClusterList::size(); } -//_____________________________________________________________________________ + //____________________________________________________________________________ -void ClusterHits(THcShowerHitList HitList) { + void ClusterHits(THcShowerHitList HitList) { -// Collect hits from the HitList into the clusters. The resultant clusters -// of hits are saved in the ClusterList. + // Collect hits from the HitList into the clusters. The resultant clusters + // of hits are saved in the ClusterList. - while (HitList.size() != 0) { + while (HitList.size() != 0) { - THcShowerCluster* cluster = new THcShowerCluster; + THcShowerCluster* cluster = new THcShowerCluster; - (*cluster).grow(*(HitList.end()-1)); //Move the last hit from the hit list - HitList.erase(HitList.end()-1); //into the 1st cluster - bool clustered = true; + (*cluster).grow(*(HitList.end()-1)); //Move the last hit from the hit list + HitList.erase(HitList.end()-1); //into the 1st cluster + bool clustered = true; - while (clustered) { //Proceed while a hit is clustered + while (clustered) { //Proceed while a hit is clustered - clustered = false; + clustered = false; - for (THcShowerHitIt i=HitList.begin(); i!=HitList.end(); ++i) { + for (THcShowerHitIt i=HitList.begin(); i!=HitList.end(); ++i) { - for (UInt_t k=0; k!=(*cluster).clSize(); k++) { + for (UInt_t k=0; k!=(*cluster).clSize(); k++) { - if ((**i).isNeighbour((*cluster).ClusteredHit(k))) { + if ((**i).isNeighbour((*cluster).ClusteredHit(k))) { - (*cluster).grow(*i); //If the hit #i is neighbouring a hit - HitList.erase(i); //in the cluster, then move it + (*cluster).grow(*i); //If the hit #i is neighbouring a hit + HitList.erase(i); //in the cluster, then move it //into the cluster. - clustered = true; - } + clustered = true; + } - if (clustered) break; - } //k + if (clustered) break; + } //k - if (clustered) break; - } //i + if (clustered) break; + } //i - } //while clustered + } //while clustered - grow(cluster); //Put the cluster in the cluster list + grow(cluster); //Put the cluster in the cluster list - } //While hit_list not exhausted + } //While hit_list not exhausted -} + } }; diff --git a/src/THcShowerHit.h b/src/THcShowerHit.h index 5874bdb2255f8f024f58c7ee0352b128b946ab3a..e3569d27e54d3ffebf665e8448c1b00e05f4b4b2 100644 --- a/src/THcShowerHit.h +++ b/src/THcShowerHit.h @@ -97,6 +97,4 @@ public: typedef vector<THcShowerHit*> THcShowerHitList; typedef THcShowerHitList::iterator THcShowerHitIt; -//typedef vector< std::auto_ptr<THcShowerHit> > THcShowerHitList; - #endif