]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPreClusterFinder.cxx
Init() method added.
[u/mrichter/AliRoot.git] / MUON / AliMUONPreClusterFinder.cxx
index 9c196252d1d8bb58f96652ac6cccbfcbd68e8aad..7be9d5630695ac46aae2920be456c97c60b32f37 100644 (file)
@@ -26,7 +26,9 @@
 #include "AliMUONPad.h"
 #include "AliMUONVDigit.h"
 #include "AliMUONVDigitStore.h"
+//#include "AliCodeTimer.h"
 
+//-----------------------------------------------------------------------------
 /// \class AliMUONPreClusterFinder
 ///
 /// Implementation of AliMUONVClusterFinder
@@ -34,6 +36,7 @@
 /// This class simply find adjacent pads to form clusters
 ///
 /// \author Laurent Aphecetche
+//-----------------------------------------------------------------------------
 
 ClassImp(AliMUONPreClusterFinder)
 
@@ -127,7 +130,8 @@ AliMUONPreClusterFinder::Prepare(const AliMpVSegmentation* segmentations[2],
                     ix,iy,pad.Position().X(),pad.Position().Y(),
                     pad.Dimensions().X(),pad.Dimensions().Y(),
                     d->Charge());
-    if ( d->IsSaturated() ) mpad.SetSaturated(kTRUE); 
+    if ( d->IsSaturated() ) mpad.SetSaturated(kTRUE);
+    mpad.SetUniqueID(d->GetUniqueID());
     new (padArray[padArray.GetLast()+1]) AliMUONPad(mpad);      
   }
   if ( fPads[0]->GetLast() < 0 && fPads[1]->GetLast() < 0 )
@@ -135,7 +139,7 @@ AliMUONPreClusterFinder::Prepare(const AliMpVSegmentation* segmentations[2],
     // no pad at all, nothing to do...
     return kFALSE;
   }
-
+  
   return kTRUE;
 }
 
@@ -148,11 +152,20 @@ AliMUONPreClusterFinder::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
   
   Int_t cathode = pad->Cathode();
   TClonesArray& padArray = *fPads[cathode];
+  // WARNING: this Remove method uses the AliMUONPad::IsEqual if that method is
+  // present (otherwise just compares pointers) : so that one must be correct
+  // if implemented !
   padArray.Remove(pad);
-  padArray.Compress();
+ // TObject* o = padArray.Remove(pad); 
+//  if (!o)
+//  {
+//    AliFatal("Oups. Could not remove pad from pads to consider. Aborting as anyway "
+//             " we'll get an infinite loop. Please check the AliMUONPad::IsEqual method"
+//             " as the first suspect for failed remove");
+//  }  
   TIter next(&padArray);
   AliMUONPad* testPad;
-  
+
   while ( ( testPad = static_cast<AliMUONPad*>(next())))
   {
     if ( AliMUONPad::AreNeighbours(*testPad,*pad) )
@@ -191,18 +204,21 @@ AliMUONCluster*
 AliMUONPreClusterFinder::NextCluster()
 {
   /// Builds the next cluster, and returns it.
+//  AliCodeTimerAuto("pre-clustering")
   
   // Start a new cluster
   Int_t id = fClusters->GetLast()+1;
   AliMUONCluster* cluster = new ((*fClusters)[id]) AliMUONCluster;
   cluster->SetUniqueID(id);
   
-  AliMUONPad* pad = static_cast<AliMUONPad*>(fPads[0]->First());
+  TIter next(fPads[0]);
+  AliMUONPad* pad = static_cast<AliMUONPad*>(next());
   
   if (!pad) // protection against no pad in first cathode, which might happen
   {
     // try other cathode
-    pad = static_cast<AliMUONPad*>(fPads[1]->First());
+    TIter next(fPads[1]);
+    pad = static_cast<AliMUONPad*>(next());
     if (!pad) 
     {
       // we are done.