]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPreClusterFinderV3.cxx
Adding code to patch St1 HV mapping
[u/mrichter/AliRoot.git] / MUON / AliMUONPreClusterFinderV3.cxx
index 036ef66de63878aaa83114036f2a51007a9bd913..83f3cefc0c25859327fe17308d6fd8cca0faf49b 100644 (file)
@@ -20,7 +20,7 @@
 #include "AliLog.h"
 #include "AliMUONCluster.h"
 #include "AliMpVSegmentation.h"
-#include "TClonesArray.h"
+#include "TObjArray.h"
 #include "AliMpArea.h"
 #include "TVector2.h"
 #include "AliMUONPad.h"
 /// \author Laurent Aphecetche
 //-----------------------------------------------------------------------------
 
+using std::endl;
+using std::cout;
 ClassImp(AliMUONPreClusterFinderV3)
 
-namespace
-{
-  //___________________________________________________________________________
-  Bool_t
-  AreOverlapping(const AliMUONPad& pad, const AliMUONCluster& cluster)
-  {
-    /// Whether the pad overlaps with the cluster
-    
-    static Double_t precision = 1E-4; // cm
-    static TVector2 precisionAdjustment(precision,precision);//-precision,-precision);
-      for ( Int_t i = 0; i < cluster.Multiplicity(); ++i )
-      {
-        AliMUONPad* testPad = cluster.Pad(i);
-        // Note: we use negative precision numbers, meaning
-        // the area of the pads will be *increased* by these small numbers
-        // prior to check the overlap by the AreOverlapping method,
-        // so pads touching only by the corners will be considered as
-        // overlapping.    
-        if ( AliMUONPad::AreOverlapping(*testPad,pad,precisionAdjustment) )
-        {
-          return kTRUE;
-        }
-      }
-      return kFALSE;
-  }
-}
-
 //_____________________________________________________________________________
 AliMUONPreClusterFinderV3::AliMUONPreClusterFinderV3()
 : AliMUONVClusterFinder(),
   fClusters(new TClonesArray("AliMUONCluster",10)),
-  fSegmentations(0x0),
+  fkSegmentations(0x0),
   fPads(0x0),
   fDetElemId(0),
   fIterator(0x0)
 {
     /// ctor
-    AliInfo("")
+  AliInfo("");
   for ( Int_t i = 0; i < 2; ++i )
   {
     fPreClusters[i] = new TClonesArray("AliMUONCluster",10);
@@ -116,15 +91,16 @@ AliMUONPreClusterFinderV3::UsePad(const AliMUONPad& pad)
     return kFALSE;
   }
   
-  AliMUONPad* p = new ((*fPads[pad.Cathode()])[fPads[pad.Cathode()]->GetLast()+1]) AliMUONPad(pad); 
+  AliMUONPad* p = new AliMUONPad(pad); 
   p->SetClusterId(-1);
+  fPads[pad.Cathode()]->Add(p); 
   return kTRUE;
 }
 
 //_____________________________________________________________________________
 Bool_t
 AliMUONPreClusterFinderV3::Prepare(Int_t detElemId,
-                                   TClonesArray* pads[2],
+                                   TObjArray* pads[2],
                                    const AliMpArea& area,
                                    const AliMpVSegmentation* seg[2])
 {
@@ -135,7 +111,7 @@ AliMUONPreClusterFinderV3::Prepare(Int_t detElemId,
     AliError("Handling of area not yet implemented for this class. Please check.");
   }
   
-  fSegmentations = seg;
+  fkSegmentations = seg;
   fPads = pads;
   
   fClusters->Clear("C");
@@ -191,12 +167,19 @@ AliMUONPreClusterFinderV3::AddPreCluster(AliMUONCluster& cluster, AliMUONCluster
   AliMUONCluster a(*preCluster);
 
   Int_t cathode = preCluster->Cathode();
+  if ( cathode < 0 ) {
+    AliError(Form("Cathod undefined: %d",cathode));
+    AliFatal("");
+    return;
+  }
+  
   if ( cathode <=1 && !fPreClusters[cathode]->Remove(preCluster) ) 
   {
     AliError(Form("Could not remove %s from preclusters[%d]",
                   preCluster->AsString().Data(),cathode));
     StdoutToAliDebug(1,DumpPreClusters());
     AliFatal("");
+    return;
   }
              
   cluster.AddCluster(a);
@@ -223,8 +206,9 @@ AliMUONPreClusterFinderV3::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
   AliMUONPad* addedPad = cluster.AddPad(*pad);
   
   Int_t cathode = pad->Cathode();
-  TClonesArray& padArray = *fPads[cathode];
-  padArray.Remove(pad);
+  TObjArray& padArray = *fPads[cathode];
+  delete padArray.Remove(pad);
+  
   TIter next(&padArray);
   AliMUONPad* testPad;
   
@@ -252,7 +236,7 @@ AliMUONPreClusterFinderV3::MakeClusters()
 {
   /// Associate (proto)preclusters to form (pre)clusters
   
-//  AliCodeTimerAuto("")
+//  AliCodeTimerAuto("",0)
   
   for ( Int_t cathode = 0; cathode < 2; ++cathode ) 
   {
@@ -277,7 +261,7 @@ AliMUONPreClusterFinderV3::MakeCathodePreClusters(Int_t cathode)
 {
   /// Build (proto)preclusters from digits on a given cathode
   
-//  AliCodeTimerAuto(Form("Cathode %d",cathode))
+//  AliCodeTimerAuto(Form("Cathode %d",cathode),0)
   
   while ( fPads[cathode]->GetLast() > 0  )
   {