]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPreClusterFinderV2.cxx
Updates to AddTask macro from Chris
[u/mrichter/AliRoot.git] / MUON / AliMUONPreClusterFinderV2.cxx
index 143373c46b15f46c44b528b949b16b7a720f5500..e3d42f48bd974bf7dee0498f998f3bb7435dd780 100644 (file)
@@ -21,7 +21,7 @@
 #include "AliMUONCluster.h"
 #include "AliMpVSegmentation.h"
 #include "AliMpPad.h"
-#include "TClonesArray.h"
+#include "TObjArray.h"
 #include "TVector2.h"
 #include "AliMUONPad.h"
 #include "AliMUONVDigit.h"
@@ -69,7 +69,7 @@ AliMUONPreClusterFinderV2::UsePad(const AliMUONPad& pad)
     return kFALSE;
   }
   
-  new ((*fPads[pad.Cathode()])[fPads[pad.Cathode()]->GetLast()+1]) AliMUONPad(pad); 
+  fPads[pad.Cathode()]->Add(new AliMUONPad(pad)); 
   // FIXME: should set the ClusterId of that new pad to be -1
   return kTRUE;
 }
@@ -77,7 +77,7 @@ AliMUONPreClusterFinderV2::UsePad(const AliMUONPad& pad)
 //_____________________________________________________________________________
 Bool_t
 AliMUONPreClusterFinderV2::Prepare(Int_t detElemId,
-                                   TClonesArray* pads[2],
+                                   TObjArray* pads[2],
                                    const AliMpArea& area,
                                    const AliMpVSegmentation* seg[2])
 {
@@ -111,18 +111,16 @@ AliMUONPreClusterFinderV2::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
 {
   /// Add a pad to a cluster
   
-  cluster.AddPad(*pad);
-  pad->SetClusterId(cluster.GetUniqueID());
+  AliMUONPad* addedPad = cluster.AddPad(*pad);
   
   Int_t cathode = pad->Cathode();
-  TClonesArray& padArray = *fPads[cathode];
-  padArray.Remove(pad);
-  TIter next(&padArray);
+  TObjArray& padArray = *fPads[cathode];
+  delete padArray.Remove(pad);
   
   // Check neighbours
   TObjArray neighbours;
-  AliMpPad p = fkSegmentations[pad->Cathode()]->PadByIndices(pad->Ix(),pad->Iy(),kTRUE);
-  Int_t nn = fkSegmentations[pad->Cathode()]->GetNeighbours(p,neighbours);
+  AliMpPad p = fkSegmentations[cathode]->PadByIndices(addedPad->Ix(),addedPad->Iy(),kTRUE);
+  Int_t nn = fkSegmentations[cathode]->GetNeighbours(p,neighbours);
   for (Int_t in = 0; in < nn; ++in) 
   {
     AliMpPad* p1 = static_cast<AliMpPad*>(neighbours.At(in));
@@ -134,7 +132,7 @@ AliMUONPreClusterFinderV2::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
     {
         if ( !p2->IsUsed() && p2->Ix()==p1->GetIx() 
              && p2->Iy() == p1->GetIy() &&
-             p2->Cathode() == pad->Cathode() )
+             p2->Cathode() == cathode )
         {
           AddPad(cluster,p2);
         }