Bugfixes and additional protection (Cvetan and Marian)
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 May 2006 15:34:04 +0000 (15:34 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 May 2006 15:34:04 +0000 (15:34 +0000)
STEER/AliAlignmentTracks.cxx
STEER/AliTrackFitter.cxx

index 3883cdb8b9afe9edf6630102a820f16e377b90f1..08a7b3d11ab7591a735a9d1c31125d9c8ff3ea82 100644 (file)
@@ -229,6 +229,10 @@ void AliAlignmentTracks::BuildIndex()
 
   fIsIndexBuilt = kTRUE;
 
+  // Dummy object is created in order
+  // to initialize the volume paths
+  AliAlignObjAngles alobj;
+
   TFile *fPointsFile = TFile::Open(fPointsFilename);
   if (!fPointsFile || !fPointsFile->IsOpen()) {
     AliWarning(Form("Can't open %s !",fPointsFilename.Data()));
@@ -251,6 +255,8 @@ void AliAlignmentTracks::BuildIndex()
       if (!array) continue;
       for (Int_t ipoint = 0; ipoint < array->GetNPoints(); ipoint++) {
        UShort_t volId = array->GetVolumeID()[ipoint];
+       // check if the volId is valid
+       if (!AliAlignObj::GetVolPath(volId)) continue;
        Int_t modId;
        Int_t layerId = AliAlignObj::VolUIDToLayer(volId,modId)
                      - AliAlignObj::kFirstLayer;
@@ -487,8 +493,9 @@ void AliAlignmentTracks::AlignVolumes(const TArrayI *volids, const TArrayI *voli
     minimizer->InitAlignObj();
     AliTrackFitter *fitter = CreateFitter();
     for (Int_t iArray = 0; iArray < nArrays; iArray++) {
+      if (!points[iArray]) continue;
       fitter->SetTrackPointArray(points[iArray], kFALSE);
-      fitter->Fit(volids,volidsfit,layerRangeMin,layerRangeMax);
+      if (fitter->Fit(volids,volidsfit,layerRangeMin,layerRangeMax) == kFALSE) continue;
       AliTrackPointArray *pVolId,*pTrack;
       fitter->GetTrackResiduals(pVolId,pTrack);
       minimizer->AddTrackPointArrays(pVolId,pTrack);
@@ -595,6 +602,8 @@ Int_t AliAlignmentTracks::LoadPoints(const TArrayI *volids, AliTrackPointArray**
        array->GetPoint(p,iPoint);
        Int_t modnum;
        AliAlignObj::ELayerID layer = AliAlignObj::VolUIDToLayer(p.GetVolumeID(),modnum);
+       // check if the layer id is valid
+       if (layer == AliAlignObj::kInvalidLayer) continue;
 
        // Misalignment is introduced here
        // Switch it off in case of real
index 4eec5c81d52e00299762209bc21724f0886a4ae7..5ca611f6c2ddad7582aa578050e835cc409be501 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "AliTrackFitter.h"
 #include "AliTrackPointArray.h"
+#include "AliLog.h"
 
 ClassImp(AliTrackFitter)
 
@@ -114,7 +115,12 @@ void AliTrackFitter::SetTrackPointArray(AliTrackPointArray *array, Bool_t owner)
   // Load space points from array
   // By default we don't copy them but
   // just put the pointers to them
-  if (!array) return;
+  if (!array) {
+    AliWarning("Invalid pointer to the space-points array !");
+    if (fIsOwner) delete fPoints;
+    fPoints = NULL;
+    return;
+  }
 
   Reset();