]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliTrackResiduals.cxx
Bug fix in copy constructor and assignment operator.
[u/mrichter/AliRoot.git] / STEER / AliTrackResiduals.cxx
index 3e887e0c89e944bdfd74b0b5e4d584cf0b201346..4d0e7342768f07bd2b686f35ab8b9a813e1802a1 100644 (file)
@@ -22,7 +22,7 @@
 #include "AliTrackResiduals.h"
 
 #include "AliAlignObj.h"
-#include "AliAlignObjAngles.h"
+#include "AliAlignObjParams.h"
 #include "AliTrackPointArray.h"
 
 ClassImp(AliTrackResiduals)
@@ -65,6 +65,7 @@ AliTrackResiduals::AliTrackResiduals(Int_t ntracks):
     for (Int_t itrack = 0; itrack < ntracks; itrack++)
       fVolArray[itrack] = fTrackArray[itrack] = 0x0;
   }
+
   for (Int_t ipar=0; ipar<6; ipar++){
     fBFixed[ipar] = kFALSE;
     fFixed[ipar]  = 0.;
@@ -165,6 +166,9 @@ void AliTrackResiduals::SetNTracks(Int_t ntracks)
     for (Int_t itrack = 0; itrack < ntracks; itrack++)
       fVolArray[itrack] = fTrackArray[itrack] = 0x0;
   }
+  else {
+    fVolArray = fTrackArray = 0x0;
+  }
 }
 
 //_____________________________________________________________________________
@@ -193,7 +197,7 @@ void AliTrackResiduals::InitAlignObj()
   // Create the alignment object 
   // to be updated
   if (fAlignObj) delete fAlignObj;
-  fAlignObj = new AliAlignObjAngles;
+  fAlignObj = new AliAlignObjParams;
 }
 
 
@@ -220,12 +224,26 @@ void AliTrackResiduals::DeleteTrackPointArrays()
   // the object is their owner.
   // Called by the destructor and SetNTracks methods.
   if (fIsOwner) {
-    for (Int_t itrack = 0; itrack < fLast; itrack++)
-      {
-       delete fVolArray[itrack];
-       delete fTrackArray[itrack];
+    if (fVolArray) {
+      for (Int_t itrack = 0; itrack < fN; itrack++) {
+       if (fVolArray[itrack]) delete fVolArray[itrack];
       }
-    delete [] fVolArray;
-    delete [] fTrackArray;
+      delete [] fVolArray;
+    }
+    if (fTrackArray) {
+      for (Int_t itrack = 0; itrack < fN; itrack++) {
+       if (fTrackArray[itrack]) delete fTrackArray[itrack];
+      }
+      delete [] fTrackArray;
+    }
+  }
+}
+
+//_____________________________________________________
+Int_t AliTrackResiduals::GetNFreeParam(){ 
+  Int_t unfixedparam=6;
+  for(Int_t j=0;j<6;j++){
+    if(fBFixed[j]==kTRUE)unfixedparam--;
   }
+  return unfixedparam;
 }