]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliRecPoint.cxx
Removing AliESDCaloTrack now obsolete
[u/mrichter/AliRoot.git] / STEER / AliRecPoint.cxx
index ccf0ce43efa1874529c6c6cb48bb5103904df6c7..5b6963618d5131b76a234a3413cb34780dc5665f 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.1  1999/12/17 09:01:14  fca
-Y.Schutz new classes for reconstruction
-
-*/
+/* $Id$ */
 
 //-*-C++-*-
 //_________________________________________________________________________
-// Base Class of Cluster (empty cxx needed by Root)
+// Base Class for reconstructed space points 
+// usually coming from the clusterisation algorithms
+// run on the digits
+//
 //*-- Author : Yves Schutz  SUBATECH 
 //////////////////////////////////////////////////////////////////////////////
 
-// --- ROOT system ---
 
-#include "TObjArray.h"
+// --- ROOT system ---
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 
 #include "AliRecPoint.h"
+#include "AliGeometry.h"
+#include "AliDigitNew.h"
 
 ClassImp(AliRecPoint)
 
 
-//____________________________________________________________________________
-AliRecPoint::AliRecPoint()
+//_______________________________________________________________________
+AliRecPoint::AliRecPoint():
+  fAmp(0),
+  fGeom(0),
+  fIndexInList(-1), // to be set when the point is already stored
+  fLocPos(0,0,0),
+  fLocPosM(0),
+  fMaxDigit(100),
+  fMulDigit(0),
+  fMaxTrack(5),
+  fMulTrack(0),
+  fDigitsList(0),
+  fTracksList(0)
 {
-  // ctor  
-  fAmp = 0.0 ; 
-  
-  fLocPos.SetXYZ(0., 0., 0.) ;
-  fLocPosM = new TMatrix(3,3) ;
-  fMaxDigit = 100 ; 
-  fMulDigit = 0 ; 
-  fDigitsList = new int[fMaxDigit]; ; 
-  fMaxTrack = 5 ; 
-  fMulTrack = 0 ; 
-  fTracksList = new int[fMaxTrack]; ; 
+  //
+  // default ctor  
+  //
 }
 
-//____________________________________________________________________________
+//_______________________________________________________________________
+AliRecPoint::AliRecPoint(const char * ):
+  fAmp(0),
+  fGeom(0),
+  fIndexInList(-1), // to be set when the point is already stored
+  fLocPos(0,0,0),
+  fLocPosM(new TMatrix(3,3)),
+  fMaxDigit(100),
+  fMulDigit(0),
+  fMaxTrack(5),
+  fMulTrack(0),
+  fDigitsList(new int[fMaxDigit]),
+  fTracksList(new int[fMaxTrack])
+{
+  //
+  // Standard ctor  
+  //
+}
+
+//_______________________________________________________________________
+AliRecPoint::AliRecPoint(const AliRecPoint& recp):
+  TObject(recp),
+  fAmp(0),
+  fGeom(0),
+  fIndexInList(-1), // to be set when the point is already stored
+  fLocPos(0,0,0),
+  fLocPosM(0),
+  fMaxDigit(100),
+  fMulDigit(0),
+  fMaxTrack(5),
+  fMulTrack(0),
+  fDigitsList(0),
+  fTracksList(0)
+{
+  //
+  // Copy constructor
+  //
+  recp.Copy(*this);
+}
+
+//_______________________________________________________________________
 AliRecPoint::~AliRecPoint()
 {
   // dtor
   
   delete fLocPosM ; 
-  if ( fDigitsList )    
-    delete fDigitsList ; 
-  if ( fTracksList )    
-    delete fTracksList ;  
+  delete [] fDigitsList ; 
+  delete [] fTracksList ;  
   
 }
   
-//____________________________________________________________________________
+//_______________________________________________________________________
 void AliRecPoint::AddDigit(AliDigitNew & digit)
 {
   // adds a digit to the digits list
@@ -76,7 +116,7 @@ void AliRecPoint::AddDigit(AliDigitNew & digit)
   
   
   if ( fMulDigit >= fMaxDigit ) { // increase the size of the list 
-    int * tempo = new ( int[fMaxDigit*=2] ) 
+    int * tempo = new int[fMaxDigit*2]
     
     Int_t index ; 
     
@@ -87,11 +127,12 @@ void AliRecPoint::AddDigit(AliDigitNew & digit)
     fDigitsList = tempo ; 
   }
   
-  fDigitsList[fMulDigit++]=  (int) &digit  ; 
+  fDigitsList[fMulDigit] = digit.GetIndexInList()  ; 
+  fMulDigit++ ; 
   fAmp += digit.GetAmp() ; 
 }
 
-//____________________________________________________________________________
+//_______________________________________________________________________
 // void AliRecPoint::AddTrack(AliTrack & track)
 // {
 //   // adds a digit to the digits list
@@ -110,8 +151,35 @@ void AliRecPoint::AddDigit(AliDigitNew & digit)
 //   fTracksList[fMulTrack++]=  (int) &Track  ; 
 // }
 
-//____________________________________________________________________________
-void AliRecPoint::GetCovarianceMatrix(TMatrix & mat)
+//_______________________________________________________________________
+void AliRecPoint::Copy(TObject& recp) const
+{
+  //
+  // Copy *this onto pts
+  //
+  // Copy all first
+  if((TObject*)this != &recp) {
+    ((TObject*) this)->Copy(recp);
+    (dynamic_cast<AliRecPoint&>(recp)).fAmp = fAmp;
+    (dynamic_cast<AliRecPoint&>(recp)).fGeom = fGeom;
+    (dynamic_cast<AliRecPoint&>(recp)).fIndexInList = fIndexInList;
+    (dynamic_cast<AliRecPoint&>(recp)).fLocPos = fLocPos;
+    (dynamic_cast<AliRecPoint&>(recp)).fLocPosM = new TMatrix(*fLocPosM);
+    (dynamic_cast<AliRecPoint&>(recp)).fMaxDigit = fMaxDigit;
+    (dynamic_cast<AliRecPoint&>(recp)).fMulDigit = fMulDigit;
+    (dynamic_cast<AliRecPoint&>(recp)).fMaxTrack = fMaxTrack;
+    (dynamic_cast<AliRecPoint&>(recp)).fMulTrack = fMulTrack;
+    
+    // Duplicate pointed objects
+    (dynamic_cast<AliRecPoint&>(recp)).fDigitsList = new Int_t[fMulDigit];
+    memcpy((dynamic_cast<AliRecPoint&>(recp)).fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
+    (dynamic_cast<AliRecPoint&>(recp)).fTracksList = new Int_t[fMulTrack];
+    memcpy((dynamic_cast<AliRecPoint&>(recp)).fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
+  }
+}
+
+//_______________________________________________________________________
+void AliRecPoint::GetCovarianceMatrix(TMatrix & mat) const
 {
   // returns the covariant matrix for the local position
   
@@ -120,7 +188,7 @@ void AliRecPoint::GetCovarianceMatrix(TMatrix & mat)
 }
 
 //____________________________________________________________________________
-void AliRecPoint::GetLocalPosition(TVector3 & pos)
+void AliRecPoint::GetLocalPosition(TVector3 & pos) const
 {
   // returns the position of the cluster in the local reference system of the sub-detector
 
@@ -130,7 +198,7 @@ void AliRecPoint::GetLocalPosition(TVector3 & pos)
 }
 
 //____________________________________________________________________________
-void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat)
+void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const
 {
   // returns the position of the cluster in the global reference system of ALICE
   // and the uncertainty on this position
@@ -140,34 +208,4 @@ void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat)
  
 }
 
-//______________________________________________________________________________
-void AliRecPoint::Streamer(TBuffer &R__b)
-{
-   // Stream an object of class AliRecPoint.
-
-   if (R__b.IsReading()) {
-      Version_t R__v = R__b.ReadVersion(); if (R__v) { }
-      TObject::Streamer(R__b);
-      R__b >> fAmp;
-      R__b >> fMulDigit;
-      fDigitsList = new Int_t[fMulDigit] ; 
-      R__b.ReadFastArray(fDigitsList, fMulDigit);
-      R__b >> fGeom;
-      fLocPos.Streamer(R__b);
-      R__b >> fLocPosM;
-      R__b >> fMulTrack;
-      fTracksList = new Int_t[fMulTrack] ; 
-      R__b.ReadFastArray(fTracksList, fMulTrack);
-   } else {
-      R__b.WriteVersion(AliRecPoint::IsA());
-      TObject::Streamer(R__b);
-      R__b << fAmp;
-      R__b << fMulDigit;
-      R__b.WriteFastArray(fDigitsList, fMulDigit);
-      R__b << fGeom;
-      fLocPos.Streamer(R__b);
-      R__b << fLocPosM;
-      R__b << fMulTrack;
-      R__b.WriteFastArray(fTracksList, fMulTrack);
-   }
-}
+