]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - JETAN/AliKMeansClustering.cxx
new plot w/wo TRD contribution for pt @ vertex
[u/mrichter/AliRoot.git] / JETAN / AliKMeansClustering.cxx
index 9947da755d9a074b27ab9abe99e7f4e1d7e66b3a..b161e06b0a6ca220b58f0b750cd929c98a8e88b9 100755 (executable)
@@ -163,7 +163,6 @@ Int_t AliKMeansClustering::SoftKMeans2(Int_t k, Int_t n, Double_t* x, Double_t*
     } // data point j
     // (3) Iterations
     Int_t nit = 0;
-    Bool_t rmovalStep = kFALSE;
 
     while(1) {
        nit++;
@@ -291,7 +290,6 @@ Int_t AliKMeansClustering::SoftKMeans3(Int_t k, Int_t n, Double_t* x, Double_t*
     } // data point j
     // (3) Iterations
     Int_t nit = 0;
-    Bool_t rmovalStep = kFALSE;
 
     while(1) {
        nit++;
@@ -457,6 +455,46 @@ AliKMeansResult::AliKMeansResult(Int_t k):
 // Constructor
 }
 
+AliKMeansResult::AliKMeansResult(const AliKMeansResult &res):
+  TObject(res),
+  fK(res.GetK()),
+  fMx(0),
+  fMy(0),
+  fSigma2(0),
+  fRk(0),
+  fTarget(0),
+  fInd(0)
+{
+  // Copy constructor
+  for (Int_t i = 0; i <fK; i++) {
+    fMx[i]     = (res.GetMx())    [i];
+    fMy[i]     = (res.GetMy())    [i];
+    fSigma2[i] = (res.GetSigma2())[i];
+    fRk[i]     = (res.GetRk())    [i];
+    fTarget[i] = (res.GetTarget())[i];
+    fInd[i]    = (res.GetInd())   [i];
+  }
+}
+
+AliKMeansResult& AliKMeansResult::operator=(const AliKMeansResult& res)
+{
+  //
+  // Assignment operator
+  if (this != &res) {
+    fK = res.GetK();
+    for (Int_t i = 0; i <fK; i++) {
+      fMx[i]     = (res.GetMx())    [i];
+      fMy[i]     = (res.GetMy())    [i];
+      fSigma2[i] = (res.GetSigma2())[i];
+      fRk[i]     = (res.GetRk())    [i];
+      fTarget[i] = (res.GetTarget())[i];
+      fInd[i]    = (res.GetInd())   [i];
+    }
+  }
+  return *this;
+}
+
+
 AliKMeansResult::~AliKMeansResult()
 {
 // Destructor
@@ -499,3 +537,16 @@ void AliKMeansResult::Sort(Int_t n, Double_t* x, Double_t* y)
 
   TMath::Sort(fK, fTarget, fInd);
 }
+
+void AliKMeansResult::CopyResults(AliKMeansResult* res)
+{
+  fK = res->GetK();
+  for (Int_t i = 0; i <fK; i++) {
+    fMx[i]     = (res->GetMx())    [i];
+    fMy[i]     = (res->GetMy())    [i];
+    fSigma2[i] = (res->GetSigma2())[i];
+    fRk[i]     = (res->GetRk())    [i];
+    fTarget[i] = (res->GetTarget())[i];
+    fInd[i]    = (res->GetInd())   [i];
+  }
+}