]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONRawCluster.cxx
Fixes for #86059: Install data when ALICE_ROOT does not point to source (Christian)
[u/mrichter/AliRoot.git] / MUON / AliMUONRawCluster.cxx
index 612f7e4ffa31552b708e5665e7836904b8ff027c..3068ec59f6b86470cbc3eeaa6cb0762e88dd05b8 100644 (file)
 
 /* $Id$ */
 
+//-----------------------------------------------------------------------------
+// Class AliMUONRawCluster
+// -------------------------
 // Class for the MUON RecPoint
 // It contains the properties of the physics cluters found in the tracking chambers
 // RawCluster contains also the information from the both cathode of the chambers.
-//
-//
+//-----------------------------------------------------------------------------
+
+
+#include "Riostream.h"
 
 #include <TArrayF.h>
+#include <TString.h>
 
 #include "AliMUONRawCluster.h"
 
-ClassImp(AliMUONRawCluster);
+/// \cond CLASSIMP
+ClassImp(AliMUONRawCluster)
+/// \endcond
 
 
+//____________________________________________________
 AliMUONRawCluster::AliMUONRawCluster() 
-  : TObject()
+  : AliMUONVCluster(),
+    fClusterType(0),
+    fGhost(0),
+    fDetElemId(0)   
 {
-// Constructor
+/// Constructor
     fTracks[0]=fTracks[1]=fTracks[2]=-1; 
     for (int j=0;j<2;j++) {
        fQ[j]=0;
        fX[j]=0;
        fY[j]=0;
+      fZ[j]=0;
        fMultiplicity[j]=0;
        fPeakSignal[j]=-1;
        fChi2[j]=-1;
@@ -49,11 +62,36 @@ AliMUONRawCluster::AliMUONRawCluster()
        }
     }
     fNcluster[0]=fNcluster[1]=-1;
-    fGhost=0;
+    fErrXY[0] = FLT_MAX;
+    fErrXY[1] = FLT_MAX;
+}
+
+//____________________________________________________
+AliMUONRawCluster::~AliMUONRawCluster() 
+{
+/// Destructor
+}
+
+//____________________________________________________
+void AliMUONRawCluster::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
+{
+  /// Set the array of digit Id
+  /// if digitsId is not given the array is filled with id=0
+  
+  fMultiplicity[0] = (nDigits < 50) ? nDigits : 50;
+  
+  if (fMultiplicity[0] == 0) return;
+  if (digitsId == 0)
+    for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = 0;
+  else
+    for (Int_t i=0; i<fMultiplicity[0]; i++) fIndexMap[i][0] = (Int_t) digitsId[i];
 }
+
 //____________________________________________________
 Int_t AliMUONRawCluster::Compare(const TObject *obj) const
 {
+/// Compare
+
   /*
          AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
         Float_t r=GetRadius();
@@ -62,19 +100,32 @@ Int_t AliMUONRawCluster::Compare(const TObject *obj) const
          else if (r<ro) return -1;
          else return 0;
   */
+  /*
          AliMUONRawCluster *raw=(AliMUONRawCluster *)obj;
         Float_t y=fY[0];
          Float_t yo=raw->fY[0];
          if (y>yo) return 1;
          else if (y<yo) return -1;
          else return 0;
-
+   */
+  
+  const AliMUONRawCluster* raw = static_cast<const AliMUONRawCluster*>(obj);
+  if ( GetCharge() > raw->GetCharge() ) 
+  {
+    return 1;
+  }
+  else if ( GetCharge() < raw->GetCharge() ) 
+  {
+    return -1;
+  }
+  return 0;
 }
+
 //____________________________________________________
 Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
 {
-   // Find object using a binary search. Array must first have been sorted.
-   // Search can be limited by setting upto to desired index.
+/// Find object using a binary search. Array must first have been sorted.
+/// Search can be limited by setting upto to desired index.
 
    Int_t low=from, high=upto-1, half;
    while(high-low>1) {
@@ -87,10 +138,8 @@ Int_t AliMUONRawCluster::BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_
 //____________________________________________________
 void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
 {
-  //
-  // Get the 3 closest points(cog) one can find on the second cathode 
-  // starting from a given cog on first cathode
-  //
+/// Get the 3 closest points(cog) one can find on the second cathode 
+/// starting from a given cog on first cathode
   
   //
   //  Loop over deltax, only 3 times
@@ -148,7 +197,7 @@ void AliMUONRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Floa
 //____________________________________________________
 Int_t AliMUONRawCluster::PhysicsContribution() const
 {
-// Evaluate physics contribution to cluster
+/// Evaluate physics contribution to cluster
   Int_t iPhys=0;
   Int_t iBg=0;
   Int_t iMixed=0;
@@ -165,10 +214,35 @@ Int_t AliMUONRawCluster::PhysicsContribution() const
     return 0;
   }
 }
+
+//____________________________________________________
+void AliMUONRawCluster::Print(Option_t* opt) const
+{
+  ///
+  /// Printing Raw Cluster (Rec Point) information 
+  /// "full" option for printing all the information about the raw cluster
+  ///
+  TString sopt(opt);
+  sopt.ToUpper();
+  cout << Form("<AliMUONRawCluster>: DetEle=%4d (x,y,z)=(%7.4f,%7.4f,%7.4f) cm"
+               " Chi2=%7.2f Q=%7.2f",
+               GetDetElemId(),GetX(),GetY(),GetZ(),GetChi2(),
+               GetCharge());
+               
+  if ( sopt.Contains("FULL") )
+  {
+    cout << ", Hit=" << setw(4)  << GetTrack(0) <<
+    ", Track1=" <<  setw(4)  << GetTrack(1) <<
+    ", Track2=" <<  setw(4)  << GetTrack(2);
+  }
+  cout << endl;
+}
+
 //____________________________________________________
 void AliMUONRawCluster::DumpIndex(void)
 {
-  // Dumping IdexMap of the cluster
+/// Dumping IdexMap of the cluster
     printf ("-----\n");
     for (Int_t icat=0;icat<2;icat++) {
        printf ("Mult %d\n",fMultiplicity[icat]);
@@ -179,9 +253,9 @@ void AliMUONRawCluster::DumpIndex(void)
     }
 }
 //____________________________________________________
-Int_t AliMUONRawCluster::AddCharge(Int_t i, Int_t Q)
+Int_t AliMUONRawCluster::AddCharge(Int_t i, Float_t Q)
 {
-  // Adding Q to the fQ value
+/// Adding Q to the fQ value
   if (i==0 || i==1) {
     fQ[i]+=Q;
     return 1;
@@ -191,7 +265,7 @@ Int_t AliMUONRawCluster::AddCharge(Int_t i, Int_t Q)
 //____________________________________________________
 Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
 {
-  // Adding X to the fX value
+/// Adding X to the fX value
   if (i==0 || i==1) {
     fX[i]+=X;
     return 1;
@@ -201,7 +275,7 @@ Int_t AliMUONRawCluster::AddX(Int_t i, Float_t X)
 //____________________________________________________
 Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
 {
-  // Adding Y to the fY value 
+/// Adding Y to the fY value 
   if (i==0 || i==1) {
     fY[i]+=Y;
     return 1;
@@ -211,7 +285,7 @@ Int_t AliMUONRawCluster::AddY(Int_t i, Float_t Y)
 //____________________________________________________
 Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
 {
-  // Adding Z to the fZ value
+/// Adding Z to the fZ value
   if (i==0 || i==1) {
     fZ[i]+=Z;
     return 1;
@@ -219,84 +293,84 @@ Int_t AliMUONRawCluster::AddZ(Int_t i, Float_t Z)
   else return 0;
 }
 //____________________________________________________
-Int_t AliMUONRawCluster::GetCharge(Int_t i) const
+Float_t AliMUONRawCluster::GetCharge(Int_t i) const
 {
-  // Getting the charge of the cluster
+/// Getting the charge of the cluster
   if (i==0 || i==1) return fQ[i];
   else  return 99999;
 }
 //____________________________________________________
 Float_t AliMUONRawCluster::GetX(Int_t i)  const
 {
-  // Getting X value of the cluster
+/// Getting X value of the cluster
   if (i==0 || i==1) return fX[i];
   else  return 99999.;
 }
 //____________________________________________________
 Float_t AliMUONRawCluster::GetY(Int_t i) const 
 {
-  // Getting Y value of the cluster
+/// Getting Y value of the cluster
   if (i==0 || i==1) return fY[i];
   else  return 99999.;
 }
 //____________________________________________________
 Float_t AliMUONRawCluster::GetZ(Int_t i) const 
 {
-  // Getting Z value of the cluster
+/// Getting Z value of the cluster
   if (i==0 || i==1) return fZ[i];
   else  return 99999.;
 }
 //____________________________________________________
 Int_t AliMUONRawCluster::GetTrack(Int_t i) const 
 {
-  // Getting track i contributing to the cluster
+/// Getting track i contributing to the cluster
   if (i==0 || i==1 || i==2) return fTracks[i];
   else  return 99999;
 }
 //____________________________________________________
-Int_t AliMUONRawCluster::GetPeakSignal(Int_t i) const 
+Float_t AliMUONRawCluster::GetPeakSignal(Int_t i) const 
 {
-  // Getting cluster peaksignal
+/// Getting cluster peaksignal
   if (i==0 || i==1 ) return fPeakSignal[i];
   else  return 99999;
 }
 //____________________________________________________
 Int_t AliMUONRawCluster::GetMultiplicity(Int_t i) const 
 {
-  // Getting cluster multiplicity
+/// Getting cluster multiplicity
   if (i==0 || i==1 ) return fMultiplicity[i];
   else  return 99999;
 }
 //____________________________________________________
 Int_t AliMUONRawCluster::GetClusterType() const 
 {
-  // Getting Cluster Type
+/// Getting Cluster Type
   return fClusterType;
 }
 //____________________________________________________
 Int_t AliMUONRawCluster::GetGhost() const 
 {
-  // Getting Ghost
+/// Getting Ghost
   return fGhost;
 }
 //____________________________________________________
 Int_t AliMUONRawCluster::GetNcluster(Int_t i) const 
 {
-  // Getting number of clusters
+/// Getting number of clusters
   if (i==0 || i==1 ) return fNcluster[i];
   else  return 99999;
 }
 //____________________________________________________
 Float_t AliMUONRawCluster::GetChi2(Int_t i) const 
 {
-  // Getting chi2 value of the cluster
+/// Getting chi2 value of the cluster
   if (i==0 || i==1) return fChi2[i];
   else  return 99999.;
 }
 //____________________________________________________
-Int_t AliMUONRawCluster::SetCharge(Int_t i, Int_t Q)
+Int_t AliMUONRawCluster::SetCharge(Int_t i, Float_t Q)
 {
-  // Setting Charge of the cluster
+/// Setting Charge of the cluster
   if (i==0 || i==1) {
     fQ[i]=Q;
     return 1;
@@ -306,7 +380,7 @@ Int_t AliMUONRawCluster::SetCharge(Int_t i, Int_t Q)
 //____________________________________________________
 Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
 {
-  // Setting X value of the cluster
+/// Setting X value of the cluster
   if (i==0 || i==1) {
     fX[i]=X;
     return 1;
@@ -316,7 +390,7 @@ Int_t AliMUONRawCluster::SetX(Int_t i, Float_t X)
 //____________________________________________________
 Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
 {
-  // Setting Y value of the cluster
+/// Setting Y value of the cluster
   if (i==0 || i==1) {
     fY[i]=Y;
     return 1;
@@ -326,7 +400,7 @@ Int_t AliMUONRawCluster::SetY(Int_t i, Float_t Y)
 //____________________________________________________
 Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
 {
-  // Setting Z value of the cluste
+/// Setting Z value of the cluste
   if (i==0 || i==1) {
     fZ[i]=Z;
     return 1;
@@ -336,7 +410,7 @@ Int_t AliMUONRawCluster::SetZ(Int_t i, Float_t Z)
 //____________________________________________________
 Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
 {
-  // Setting tracks contributing to the cluster
+/// Setting tracks contributing to the cluster
   if (i==0 || i==1 || i==2) {
     fTracks[i]=track;
     return 1;
@@ -344,9 +418,9 @@ Int_t AliMUONRawCluster::SetTrack(Int_t i, Int_t track)
   else return 0;
 }
 //____________________________________________________
-Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Int_t peaksignal)
+Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Float_t peaksignal)
 {
-  // Setting PeakSignal of the cluster
+/// Setting PeakSignal of the cluster
   if (i==0 || i==1 ) {
     fPeakSignal[i]=peaksignal;
     return 1;
@@ -356,7 +430,7 @@ Int_t AliMUONRawCluster::SetPeakSignal(Int_t i, Int_t peaksignal)
 //____________________________________________________
 Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
 {
-  // Setting multiplicity of the cluster
+/// Setting multiplicity of the cluster
   if (i==0 || i==1 ) {
     fMultiplicity[i]=mul;
     return 1;
@@ -366,21 +440,21 @@ Int_t AliMUONRawCluster::SetMultiplicity(Int_t i, Int_t mul)
 //____________________________________________________
 Int_t AliMUONRawCluster::SetClusterType(Int_t type)
 {
-  // Setting the cluster type
+/// Setting the cluster type
   fClusterType=type;
   return 1;
 }
 //____________________________________________________
 Int_t AliMUONRawCluster::SetGhost(Int_t ghost)
 {
-  // Setting the ghost
+/// Setting the ghost
   fGhost=ghost;
   return 1;
 }
 //____________________________________________________
 Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
 {
-  // Setting number the cluster
+/// Setting number the cluster
   if (i==0 || i==1 ) {
     fNcluster[i]=ncluster;
     return 1;
@@ -390,10 +464,12 @@ Int_t AliMUONRawCluster::SetNcluster(Int_t i, Int_t ncluster)
 //____________________________________________________
 Int_t AliMUONRawCluster::SetChi2(Int_t i, Float_t chi2)
 {
-  // Setting chi2 of the cluster
+/// Setting chi2 of the cluster
   if (i==0 || i==1) {
     fChi2[i]=chi2;
     return 1;
   }
   else return 0;
 }
+
+