]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/STEER/AliRelAlignerKalman.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / STEER / STEER / AliRelAlignerKalman.cxx
index ebed7a4d8b60a0aca5cf4e64e474a2f4978bbd75..32c4d0b6d32ce19e9dc4f0182e55c4c38892417b 100644 (file)
@@ -199,7 +199,10 @@ AliRelAlignerKalman::AliRelAlignerKalman(const AliRelAlignerKalman& a):
 AliRelAlignerKalman& AliRelAlignerKalman::operator=(const AliRelAlignerKalman& a)
 {
   //assignment operator
-  fMagField=a.fMagField,
+  if(&a == this) return *this;
+  TObject::operator=(a);
+
+  fMagField=a.fMagField;
   fNMeasurementParams=a.fNMeasurementParams;
   *fPX = *a.fPX;
   *fPXcov = *a.fPXcov;
@@ -1555,3 +1558,23 @@ void AliRelAlignerKalman::SetRejectOutliersSigma2Median(const Bool_t set )
     fRejectOutliersSigma2Median = kFALSE;
   }//if
 }
+
+
+Int_t AliRelAlignerKalman::CheckCovariance(){
+  //
+  // check covariance matrix
+  // Return values:
+  //         -1    - everything OK
+  //          >=0  - index of "corrupted" element in the covariance matrix
+  TMatrixDSym& mat =(*fPXcov);
+  for (Int_t irow=0; irow<9; irow++){
+    if (mat(irow,irow)<=0.) return  irow*9;
+    for (Int_t icol=0; icol<irow; icol++){
+      Double_t corel = mat(irow,irow)*mat(icol,icol);
+      if (corel<=0.) return irow*9+icol;
+      corel=mat(irow,icol)/TMath::Sqrt(corel);
+      if (TMath::Abs(corel)>=1.) return irow*9+icol;
+    }  
+  }
+  return -1;
+}