]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDcluster.cxx
Added a commented out version with new digitizers.
[u/mrichter/AliRoot.git] / TRD / AliTRDcluster.cxx
index 2b0191652a560347f768ee854a06541ebe8ae58e..5f7620bcb846e2a2f9b6335a23fe2e7775949772 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.4  2001/05/07 08:08:05  cblume
-Update of TRD code
+/* $Id$ */
 
-Revision 1.3  2000/12/08 16:07:02  cblume
-Update of the tracking by Sergei
-
-Revision 1.2  2000/10/06 16:49:46  cblume
-Made Getters const
-
-Revision 1.1.2.1  2000/09/22 14:47:52  cblume
-Add the tracking code
-
-*/
  
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -39,29 +26,22 @@ Add the tracking code
 #include "AliTRDrecPoint.h"
 
 ClassImp(AliTRDcluster)
-//_____________________________________________________________________________
-AliTRDcluster::AliTRDcluster() 
-{
-  //
-  // Default constructor
-  //
 
-  fDetector  = 0;
-  fTimeBin   = 0;
-  fTracks[0] = 0;
-  fTracks[1] = 0;
-  fTracks[2] = 0; 
-  fY         = 0;
-  fZ         = 0;
-  fQ         = 0;
-  fSigmaY2   = 0;
-  fSigmaZ2   = 0;
 
-}
+  //___________________________________________________________________________
 
+  AliTRDcluster::AliTRDcluster() : AliCluster() { 
+  //
+  // default constructor
+  //
+  fQ=0; 
+  fTimeBin=0; 
+  fDetector=0; 
+  fNPads=0; 
+  for (Int_t i = 0;i<7; i++) fSignals[i]=0;
+}
 //_____________________________________________________________________________
-AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p)
+  AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p):AliCluster()
 {
   //
   // Constructor from AliTRDrecPoint
@@ -83,65 +63,35 @@ AliTRDcluster::AliTRDcluster(const AliTRDrecPoint &p)
 
   fSigmaY2    = 0.2;
   fSigmaZ2    = 5.;  
-
+  fNPads      =0;
+  fCenter     = 0;
 }
 
 //_____________________________________________________________________________
-AliTRDcluster::AliTRDcluster(const AliTRDcluster &c)
+AliTRDcluster::AliTRDcluster(const AliTRDcluster &c):AliCluster()
 {
   //
   // Copy constructor 
   //
 
-  ((AliTRDcluster &) c).Copy(*this);
-
-}
-
-//_____________________________________________________________________________
-AliTRDcluster::~AliTRDcluster()
-{
-  //
-  // AliTRDcluster destructor
-  //
-
+  fTracks[0]  = c.GetLabel(0);
+  fTracks[1]  = c.GetLabel(1);
+  fTracks[2]  = c.GetLabel(2);
+
+  fX          = c.GetX();
+  fY          = c.GetY();
+  fZ          = c.GetZ();
+  fSigmaY2    = c.GetSigmaY2();
+  fSigmaZ2    = c.GetSigmaZ2();  
+
+  fDetector   = c.GetDetector();
+  fTimeBin    = c.GetLocalTimeBin();
+  fQ          = c.GetQ();
+  fNPads      = c.fNPads;
+  fCenter     = c.fCenter;
+  for (Int_t i=0;i<7;i++) fSignals[i] = c.fSignals[i];
 }
 
-//_____________________________________________________________________________
-AliTRDcluster &AliTRDcluster::operator=(const AliTRDcluster &c)
-{
-  //
-  // Assignment operator
-  //
-
-  if (this != &c) ((AliTRDcluster &) c).Copy(*this);
-  return *this;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDcluster::Copy(TObject &c)
-{
-  //
-  // Copy function
-  //
-
-  ((AliTRDcluster &) c).fDetector   = fDetector;
-  ((AliTRDcluster &) c).fTimeBin    = fTimeBin;
-
-  ((AliTRDcluster &) c).fTracks[0]  = fTracks[0];
-  ((AliTRDcluster &) c).fTracks[1]  = fTracks[1];
-  ((AliTRDcluster &) c).fTracks[2]  = fTracks[2];
-
-  ((AliTRDcluster &) c).fQ          = fQ;
-
-  ((AliTRDcluster &) c).fY          = fY;
-  ((AliTRDcluster &) c).fZ          = fZ;
-  ((AliTRDcluster &) c).fSigmaY2    = fSigmaY2;
-  ((AliTRDcluster &) c).fSigmaZ2    = fSigmaZ2;  
-
-}
-
-
 //_____________________________________________________________________________
 void AliTRDcluster::AddTrackIndex(Int_t *track)
 {
@@ -163,7 +113,7 @@ void AliTRDcluster::AddTrackIndex(Int_t *track)
   for (i=0; i<kSize; i++) {
     entries[i][0]=-1;
     entries[i][1]=0;
-  }
+  }                                 
 
   for (Int_t k=0; k<kSize; k++) {
     index=track[k];
@@ -179,7 +129,7 @@ void AliTRDcluster::AddTrackIndex(Int_t *track)
         j++;
       }
     }
-  }
+  }             
 
   // sort by number of appearances and index value
   Int_t swap=1, tmp0, tmp1;
@@ -200,14 +150,43 @@ void AliTRDcluster::AddTrackIndex(Int_t *track)
         }
       }
     }
-  }
+  }               
 
   // set track indexes
-  for(i=0; i<3; i++) {
-    fTracks[i] = entries[i][0];
-  }
+  for(i=0; i<3; i++) SetLabel(entries[i][0],i);
 
   return;
 
+}          
+
+void AliTRDcluster::SetSignals(Short_t*signals){
+  //
+  // write signals in the cluster
+  //
+  for (Int_t i = 0;i<7;i++) fSignals[i]=signals[i];
+}
+
+Float_t AliTRDcluster::GetSumS() const
+{
+  //
+  // return total charge in non unfolded cluster
+  //
+  Float_t sum=0;
+  for (Int_t i = 0;i<7;i++) sum+=fSignals[i];
+  return sum;
 }
+Float_t AliTRDcluster::GetCenterS() const
+{
+  //
+  //
+  //
+  Float_t sum=0;
+  Float_t sum2=0;
+  for (Int_t i = 0;i<7;i++) {    
+    sum+=fSignals[i];
+    sum2+=i*fSignals[i];
+  }
+  if (sum>0) return sum2/sum-2;
+  return 0;
 
+}