X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliTrackFitter.cxx;h=a02d87747b9005ac7c6bea494279b708bbeba4cc;hb=020c3cc4b8a217179fc018bb04d49e809a784e7b;hp=622089498674de768aa9c9f9357335ede82e611d;hpb=cc345ce3ffb30ad8ccf49530109e2330605cfb88;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliTrackFitter.cxx b/STEER/AliTrackFitter.cxx index 62208949867..a02d87747b9 100644 --- a/STEER/AliTrackFitter.cxx +++ b/STEER/AliTrackFitter.cxx @@ -24,52 +24,62 @@ #include "AliTrackFitter.h" #include "AliTrackPointArray.h" +#include "AliLog.h" ClassImp(AliTrackFitter) //_____________________________________________________________________________ -AliTrackFitter::AliTrackFitter() +AliTrackFitter::AliTrackFitter() : + TObject(), + fCov(0), + fPoints(0), + fPVolId(0), + fPTrack(0), + fChi2(0), + fNdf(0), + fMinNPoints(0), + fIsOwner(kFALSE) { // default constructor // for (Int_t i=0;i<6;i++) fParams[i] = 0; - fCov = 0; - fPoints = 0; - fPVolId = fPTrack = 0; - fChi2 = 0; - fNdf = 0; - fMinNPoints = 0; - fIsOwner = kFALSE; } //_____________________________________________________________________________ -AliTrackFitter::AliTrackFitter(AliTrackPointArray *array, Bool_t owner) +AliTrackFitter::AliTrackFitter(AliTrackPointArray *array, Bool_t owner) : + TObject(), + fCov(new TMatrixDSym(6)), + fPoints(0), + fPVolId(0), + fPTrack(0), + fChi2(0), + fNdf(0), + fMinNPoints(0), + fIsOwner(kFALSE) + { // constructor from space points array // for (Int_t i=0;i<6;i++) fParams[i] = 0; - fCov = new TMatrixDSym(6); - fPVolId = fPTrack = 0; - fChi2 = 0; - fNdf = 0; - fMinNPoints = 0; - fIsOwner = kFALSE; SetTrackPointArray(array,owner); } //_____________________________________________________________________________ AliTrackFitter::AliTrackFitter(const AliTrackFitter &fitter): - TObject(fitter) + TObject(fitter), + fCov(new TMatrixDSym(*fitter.fCov)), + fPoints(0), + fPVolId(0), + fPTrack(0), + fChi2(fitter.fChi2), + fNdf(fitter.fNdf), + fMinNPoints(fitter.fMinNPoints), + fIsOwner(kFALSE) { // Copy constructor // SetTrackPointArray(fitter.fPoints,fitter.fIsOwner); for (Int_t i=0;i<6;i++) fParams[i] = fitter.fParams[i]; - fCov = new TMatrixDSym(*fitter.fCov); - fChi2 = fitter.fChi2; - fNdf = fitter.fNdf; - fMinNPoints = fitter.fMinNPoints; - fIsOwner = kFALSE; } //_____________________________________________________________________________ @@ -114,6 +124,13 @@ 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) { + AliWarning("Invalid pointer to the space-points array !"); + if (fIsOwner) delete fPoints; + fPoints = NULL; + return; + } + Reset(); if (fIsOwner) delete fPoints; @@ -146,3 +163,120 @@ Bool_t AliTrackFitter::FindVolId(const TArrayI *array, UShort_t volid) const return found; } + +Bool_t AliTrackFitter::Fit(const TArrayI *volIds,const TArrayI *volIdsFit, +AliGeomManager::ELayerID layerRangeMin, +AliGeomManager::ELayerID layerRangeMax) +{ + //------------------------------------------------------------------- + // + // Fit the track points. + // + // volIds - the array of IDs of volumes where the residuals + // will be calculated. + // volIdsFit - the array of IDs of volumes having the points + // that will be fitted + // + // If volIdsFit==0, the IDs of volumes having the points to fit + // are taken in the range defined by the two last parameters + // + // + // The function fills two track-point arrays: fPVolId and fPTrack. + // The first one contains the track points from the volumes with IDs + // taken from the "volIds". The second array is filled with + // the intersection points between the fitted track and the volumes + // the points from the first arry belong to. + // + // The two arrays are used for calculation of the residuals + // and for the construction of a chi2 function to be minimized + // in the alignment procedures. + // + //-------------------------------------------------------------------- + + Int_t npoints=fPoints->GetNPoints(); + if (npointsGetVolumeID()[i])) countPnt++; + if (FindVolId(volIdsFit,fPoints->GetVolumeID()[i])) { + countFit++; + if (fst<0) fst=i; + lst=i; + } + } + } else { + for (Int_t i=0; iGetVolumeID()[i]; + if (FindVolId(volIds,id)) countPnt++; + if (id < AliGeomManager::LayerToVolUID(layerRangeMin,0)) continue; + if (id > AliGeomManager::LayerToVolUID(layerRangeMax, + AliGeomManager::LayerSize(layerRangeMax))) continue; + countFit++; + if (fst<0) fst=i; + lst=i; + } + } + if (countPnt==0) return kFALSE; + if (countFitGetVolumeID()[i])) continue; + fPoints->GetPoint(p,i); + if (!AddPoint(&p)) return kFALSE; + } + } else { + for (Int_t i=0; iGetVolumeID()[i]; + if (id < AliGeomManager::LayerToVolUID(layerRangeMin,0)) continue; + if (id > AliGeomManager::LayerToVolUID(layerRangeMax, + AliGeomManager::LayerSize(layerRangeMax))) continue; + fPoints->GetPoint(p,i); + if (!AddPoint(&p)) continue; + } + } + + if (!Update()) return kFALSE; + + + + + //************* Calculate the intersection points + + fPVolId = new AliTrackPointArray(countPnt); + fPTrack = new AliTrackPointArray(countPnt); + + Int_t n=0; + AliTrackPoint p2; + for (Int_t i=0; iGetVolumeID()[i])) continue; + fPoints->GetPoint(p,i); + if (GetPCA(p,p2)) { + fPVolId->AddPoint(n,&p); + fPTrack->AddPoint(n,&p2); + n++; + } else { + delete fPVolId; + fPVolId=0; + delete fPTrack; + fPTrack=0; + return kFALSE; + } + } + + return kTRUE; +}