]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliClusters.cxx
Improved cuts for the reconstruction of V0s (M.Ivanov)
[u/mrichter/AliRoot.git] / TPC / AliClusters.cxx
index 9c3d830c7890184c0c8b05e13cf54dab14a346d1..bba208dc00255e5e2c687fe88d1666a9345849f2 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.1.4.2  2000/04/10 11:34:02  kowal2
-
-Clusters handling in a new data structure
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -33,9 +27,8 @@ Clusters handling in a new data structure
 #include "TError.h"
 #include "TClass.h"
 #include  <TROOT.h>
-#include "AliCluster.h"
+#include "AliComplexCluster.h"
 #include "AliClusters.h"
-#include "TClonesArray.h"
 #include "TMarker.h"
 
 
@@ -51,17 +44,30 @@ AliClusters::AliClusters()
 {  
   //
   //default constructor
+  //
   fNclusters=0;
   fClusters =0;
   fClass =0;
 }
 
+//________________________________________________________________________
+AliClusters::~AliClusters()
+{
+   //
+   //default destructor
+  //
+   if (fClusters !=0) fClusters->Clear();
+   delete fClusters;
+}
+
+//_________________________________________________________________________
+
 Bool_t AliClusters::SetClass(const Text_t *classname)
 {
   //
   //set class of stored object
   if ( fClass !=0 ) {
-    delete fClass;
+    //    delete fClass;
     fClass = 0;
   }
  
@@ -73,10 +79,10 @@ Bool_t AliClusters::SetClass(const Text_t *classname)
       Error("AliClusters", "%s is not a valid class name", classname);
       return kFALSE;
    }
-   if (!fClass->InheritsFrom(AliCluster::Class())) {
-      Error("AliClusters", "%s does not inherit from AliCluster", classname);
-      return kFALSE;
-   }  
+   if (!fClass->InheritsFrom(TObject::Class())) {
+      Error("AliClusters", "%s does not inherit from TObject", classname);
+      return kFALSE; 
+   } 
    return kTRUE;
 }
 
@@ -97,15 +103,13 @@ void AliClusters::SetArray(Int_t length)
 
 
 //_____________________________________________________________________________
-const  AliCluster* AliClusters::operator[](Int_t i)
+const  TObject* AliClusters::operator[](Int_t i)
 {
   //
   // return cluster at internal position i
   //
   if (fClusters==0) return 0;
-  void * cl = fClusters->UncheckedAt(i);
-  if (cl==0) return 0;
-  return  (AliCluster*)cl;
+  return fClusters->UncheckedAt(i);
 }
 //_____________________________________________________________________________
 void  AliClusters::Sort()
@@ -115,7 +119,7 @@ void  AliClusters::Sort()
 }
 
 //_____________________________________________________________________________
-AliCluster * AliClusters::InsertCluster( const AliCluster * c) 
+TObject * AliClusters::InsertCluster( const TObject * c) 
 { 
   //
   // Add a simulated cluster copy to the list
@@ -126,7 +130,7 @@ AliCluster * AliClusters::InsertCluster( const AliCluster * c)
   }
   if(!fClusters) fClusters=new TClonesArray(fClass->GetName(),1000);
   TClonesArray &lclusters = *fClusters;
-  return new(lclusters[fNclusters++]) AliCluster(*c);
+  return new(lclusters[fNclusters++]) AliComplexCluster(*((AliComplexCluster*)c));
 }
 
 //_____________________________________________________________________________
@@ -135,14 +139,14 @@ Int_t AliClusters::Find(Double_t y) const
   //
   // return index of cluster nearest to given y position
   //
-  AliCluster* cl;
-  cl=(AliCluster*)fClusters->UncheckedAt(0);
+  AliComplexCluster* cl;
+  cl=(AliComplexCluster*)fClusters->UncheckedAt(0);
   if (y <= cl->fY) return 0;  
-  cl=(AliCluster*)fClusters->UncheckedAt(fNclusters-1);
+  cl=(AliComplexCluster*)fClusters->UncheckedAt(fNclusters-1);
   if (y > cl->fY) return fNclusters; 
   Int_t b=0, e=fNclusters-1, m=(b+e)/2;
   for (; b<e; m=(b+e)/2) {
-    cl = (AliCluster*)fClusters->UncheckedAt(m);
+    cl = (AliComplexCluster*)fClusters->UncheckedAt(m);
     if (y > cl->fY) b=m+1;
     else e=m; 
   }
@@ -152,7 +156,7 @@ Int_t AliClusters::Find(Double_t y) const
 
 //_____________________________________________________________________________
 
-void AliClusters::Draw(Float_t shiftx, Float_t shifty, 
+void AliClusters::DrawClusters(Float_t shiftx, Float_t shifty, 
                                  Int_t color, Int_t size, Int_t style)
 {
 
@@ -160,7 +164,7 @@ void AliClusters::Draw(Float_t shiftx, Float_t shifty,
   //draw marker for each of cluster
   Int_t ncl=fClusters->GetEntriesFast();
   for (Int_t i=0;i<ncl;i++){
-    AliCluster *cl = (AliCluster*)fClusters->UncheckedAt(i);
+    AliComplexCluster *cl = (AliComplexCluster*)fClusters->UncheckedAt(i);
     TMarker * marker = new TMarker;
     marker->SetX(cl->fX+shiftx);
     marker->SetY(cl->fY+shifty);