]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliClusters.cxx
Possibility to vary the cos(PA) cut
[u/mrichter/AliRoot.git] / TPC / AliClusters.cxx
index 60f6ed146fbb28e3c211a6085f55d60a57612fd3..fa30eb6ac5c5771b45e4800d691bb6c5240a8922 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.2.4.2  2000/06/14 16:45:13  kowal2
-Improved algorithms. Compiler warnings removed.
-
-Revision 1.2.4.1  2000/06/09 07:09:29  kowal2
-
-Clustering and tracking classes are splitted from the simulation ones
-
-Revision 1.2  2000/04/17 09:37:33  kowal2
-removed obsolete AliTPCDigitsDisplay.C
-
-Revision 1.1.4.2  2000/04/10 11:34:02  kowal2
-
-Clusters handling in a new data structure
-
-*/
+/* $Id$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -43,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"
 
 
@@ -57,23 +40,67 @@ ClassImp(AliClusters)
 //*****************************************************************************
 //
 //_____________________________________________________________________________
-AliClusters::AliClusters() 
+AliClusters::AliClusters()
+            :AliSegmentID(), 
+            fClusters(0),
+             fNclusters(0),
+             fClass(0)
 {  
   //
   //default constructor
   //
-  fNclusters=0;
-  fClusters =0;
-  fClass =0;
+
+}
+//________________________________________________________________________
+AliClusters::AliClusters(const AliClusters &param)
+            :AliSegmentID(), 
+            fClusters(0),
+             fNclusters(0),
+             fClass(0)
+{
+  //
+  //  copy constructor - dummy
+  //
+  fNclusters = param.fNclusters;
+}
+
+//________________________________________________________________________
+AliClusters::AliClusters(const char *classname)
+            :AliSegmentID(),
+             fClusters(0),
+             fNclusters(0),
+             fClass(0)
+{
+//
+// Special constructor
+//          
+  fClass = gROOT->GetClass(classname);
+  
+  if (!fClass)
+        Error("AliClusters", "%s is not a valid class name", classname);
+  if (!fClass->InheritsFrom(TObject::Class())) 
+       Error("AliClusters", "%s does not inherit from TObject", classname);
+                                                 
+  fClusters = new TClonesArray(fClass->GetName(),100);
 }
 
+//______________________________________________________________________                                                          
+AliClusters & AliClusters::operator =(const AliClusters & param)
+{
+  //
+  // assignment operator - dummy
+  //
+  if (this == &param) return (*this);
+  fNclusters=param.fNclusters;
+  return (*this);
+}
 //________________________________________________________________________
 AliClusters::~AliClusters()
 {
    //
    //default destructor
   //
-   if (fClusters !=0) fClusters->Clear();
+   if (fClusters !=0) fClusters->Delete();
    delete fClusters;
 }
 
@@ -84,7 +111,7 @@ Bool_t AliClusters::SetClass(const Text_t *classname)
   //
   //set class of stored object
   if ( fClass !=0 ) {
-    delete fClass;
+    //    delete fClass;
     fClass = 0;
   }
  
@@ -145,9 +172,9 @@ TObject * AliClusters::InsertCluster( const TObject * c)
     Error("AliClusters", "class type not specified");
     return 0; 
   }
-  if(!fClusters) fClusters=new TClonesArray(fClass->GetName(),1000);
+  if(!fClusters) fClusters=new TClonesArray(fClass->GetName(),100);
   TClonesArray &lclusters = *fClusters;
-  return new(lclusters[fNclusters++]) AliCluster(*((AliCluster*)c));
+  return new(lclusters[fNclusters++]) AliComplexCluster(*((AliComplexCluster*)c));
 }
 
 //_____________________________________________________________________________
@@ -156,15 +183,15 @@ Int_t AliClusters::Find(Double_t y) const
   //
   // return index of cluster nearest to given y position
   //
-  AliCluster* cl;
-  cl=(AliCluster*)fClusters->UncheckedAt(0);
-  if (y <= cl->fY) return 0;  
-  cl=(AliCluster*)fClusters->UncheckedAt(fNclusters-1);
-  if (y > cl->fY) return fNclusters; 
+  AliComplexCluster* cl;
+  cl=(AliComplexCluster*)fClusters->UncheckedAt(0);
+  if (y <= cl->GetY()) return 0;  
+  cl=(AliComplexCluster*)fClusters->UncheckedAt(fNclusters-1);
+  if (y > cl->GetY()) 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);
-    if (y > cl->fY) b=m+1;
+    cl = (AliComplexCluster*)fClusters->UncheckedAt(m);
+    if (y > cl->GetY()) b=m+1;
     else e=m; 
   }
   return m;
@@ -181,10 +208,10 @@ void AliClusters::DrawClusters(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);
+    marker->SetX(cl->GetX()+shiftx);
+    marker->SetY(cl->GetY()+shifty);
     marker->SetMarkerSize(size);
     marker->SetMarkerStyle(style);
     marker->SetMarkerColor(color);