]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliRecPoint.cxx
Removal of useless dependecies via forward declarations
[u/mrichter/AliRoot.git] / STEER / AliRecPoint.cxx
index 6197a0ad0d0cba9671faef8492dc8c73c64ce9c8..e03649a69c2f0f5260f18bb94950b112fe8df3ee 100644 (file)
 
 /*
 $Log$
+Revision 1.5  2000/07/11 18:24:59  fca
+Coding convention corrections + few minor bug fixes
+
+Revision 1.4  2000/05/16 08:30:02  fca
+Using automatic streamer for c arrays
+
+Revision 1.3  2000/03/20 14:22:25  fca
+New version to support new PHOS code
+
+Revision 1.2  2000/02/15 09:43:54  fca
+Corrections
+- a bug in the streamer (wrong size of the arrays)
+- replace Read/WriteArray by Read/WriteFastArray (suggestion R.Brun)
+
+Revision 1.1  1999/12/17 09:01:14  fca
+Y.Schutz new classes for reconstruction
+
 */
 
 //-*-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 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -32,6 +52,8 @@ $Log$
 // --- AliRoot header files ---
 
 #include "AliRecPoint.h"
+#include "AliGeometry.h"
+#include "AliDigitNew.h"
 
 ClassImp(AliRecPoint)
 
@@ -43,13 +65,23 @@ AliRecPoint::AliRecPoint()
   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]; ; 
+  fLocPosM     = new TMatrix(3,3) ;
+  fMaxDigit    = 100 ; 
+  fMulDigit    = 0 ; 
+  fDigitsList  = new int[fMaxDigit]; ; 
+  fMaxTrack    = 5 ; 
+  fMulTrack    = 0 ; 
+  fTracksList  = new int[fMaxTrack]; ; 
+  fIndexInList = -1 ; // to be set when the point is already stored
+}
+
+//____________________________________________________________________________
+AliRecPoint::AliRecPoint(const AliRecPoint& recp)
+{
+  //
+  // Copy constructor
+  //
+  recp.Copy(*this);
 }
 
 //____________________________________________________________________________
@@ -58,8 +90,10 @@ AliRecPoint::~AliRecPoint()
   // dtor
   
   delete fLocPosM ; 
-  if ( fDigitsList )     delete fDigitsList ; 
-  if ( fTracksList )     delete fTracksList ;  
+  if ( fDigitsList )    
+    delete fDigitsList ; 
+  if ( fTracksList )    
+    delete fTracksList ;  
   
 }
   
@@ -82,7 +116,8 @@ void AliRecPoint::AddDigit(AliDigitNew & digit)
     fDigitsList = tempo ; 
   }
   
-  fDigitsList[fMulDigit++]=  (int) &digit  ; 
+  fDigitsList[fMulDigit] = digit.GetIndexInList()  ; 
+  fMulDigit++ ; 
   fAmp += digit.GetAmp() ; 
 }
 
@@ -105,6 +140,33 @@ void AliRecPoint::AddDigit(AliDigitNew & digit)
 //   fTracksList[fMulTrack++]=  (int) &Track  ; 
 // }
 
+//____________________________________________________________________________
+void AliRecPoint::Copy(AliRecPoint& recp) const
+{
+  //
+  // Copy *this onto pts
+  //
+  // Copy all first
+  if(this != &recp) {
+    ((TObject*) this)->Copy((TObject&)recp);
+    recp.fAmp = fAmp;
+    recp.fGeom = fGeom;
+    recp.fIndexInList = fIndexInList;
+    recp.fLocPos = fLocPos;
+    recp.fLocPosM = new TMatrix(*fLocPosM);
+    recp.fMaxDigit = fMaxDigit;
+    recp.fMulDigit = fMulDigit;
+    recp.fMaxTrack = fMaxTrack;
+    recp.fMulTrack = fMulTrack;
+    
+    // Duplicate pointed objects
+    recp.fDigitsList = new Int_t[fMulDigit];
+    memcpy(recp.fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
+    recp.fTracksList = new Int_t[fMulTrack];
+    memcpy(recp.fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
+  }
+}
+
 //____________________________________________________________________________
 void AliRecPoint::GetCovarianceMatrix(TMatrix & mat)
 {
@@ -115,7 +177,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
 
@@ -125,7 +187,15 @@ void AliRecPoint::GetLocalPosition(TVector3 & pos)
 }
 
 //____________________________________________________________________________
-void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat)
+AliRecPoint & AliRecPoint::operator= (const AliRecPoint &recp)
+{
+  recp.Copy(*this);
+  return (*this);
+}
+
+
+//____________________________________________________________________________
+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
@@ -135,32 +205,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.ReadArray(fDigitsList);
-      R__b >> fGeom;
-      fLocPos.Streamer(R__b);
-      R__b >> fLocPosM;
-      R__b >> fMulDigit;
-      R__b >> fMulTrack;
-      R__b.ReadArray(fTracksList);
-   } else {
-      R__b.WriteVersion(AliRecPoint::IsA());
-      TObject::Streamer(R__b);
-      R__b << fAmp;
-      R__b.WriteArray(fDigitsList, fMaxDigit);
-      R__b << fGeom;
-      fLocPos.Streamer(R__b);
-      R__b << fLocPosM;
-      R__b << fMulDigit;
-      R__b << fMulTrack;
-      R__b.WriteArray(fTracksList, fMaxTrack);
-   }
-}
+