]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITStrackerMI.cxx
Coverity fix
[u/mrichter/AliRoot.git] / ITS / AliITStrackerMI.cxx
index 38a162b7957f104220004b3a745e890ad5a34078..6c22ebf7c59ed63e9dc77f3ce961bd74bd24d2f0 100644 (file)
 #include <TTreeStream.h>
 
 #include "AliLog.h"
+#include "AliGeomManager.h"
 #include "AliITSPlaneEff.h"
-#include "AliITSCalibrationSPD.h"
-#include "AliITSCalibrationSDD.h"
-#include "AliITSCalibrationSSD.h"
-#include "AliCDBEntry.h"
-#include "AliCDBManager.h"
-#include "AliAlignObj.h"
 #include "AliTrackPointArray.h"
-#include "AliESDVertex.h"
 #include "AliESDEvent.h"
 #include "AliESDtrack.h"
 #include "AliV0.h"
-#include "AliHelix.h"
 #include "AliITSChannelStatus.h"
 #include "AliITSDetTypeRec.h"
 #include "AliITSRecPoint.h"
@@ -100,6 +93,7 @@ fPlaneEff(0) {
   for(i=0;i<4;i++) fSPDdetzcentre[i]=0.;
   for(i=0;i<2;i++) {fxOverX0Shield[i]=-1.;fxTimesRhoShield[i]=-1.;}
   for(i=0;i<6;i++) {fxOverX0Layer[i]=-1.;fxTimesRhoLayer[i]=-1.;}
+  fOriginal.SetOwner();
 }
 //------------------------------------------------------------------------
 AliITStrackerMI::AliITStrackerMI(const Char_t *geom) : AliTracker(),
@@ -137,6 +131,7 @@ fPlaneEff(0) {
     AliWarning("\"geom\" is actually a dummy argument !");
   }
 
+  fOriginal.SetOwner();
   fCoefficients = 0;
   fAfterV0     = kFALSE;
 
@@ -213,6 +208,7 @@ fPlaneEff(0) {
   // store positions of centre of SPD modules (in z)
   //  The convetion is that fSPDdetzcentre is ordered from -z to +z
   Double_t tr[3];
+  AliITSgeomTGeo::GetTranslation(1,1,1,tr);
   if (tr[2]<0) { // old geom (up to v5asymmPPR)
     AliITSgeomTGeo::GetTranslation(1,1,1,tr);
     fSPDdetzcentre[0] = tr[2];
@@ -242,7 +238,8 @@ fPlaneEff(0) {
   for(Int_t i=0;i<2;i++) {fxOverX0Shield[i]=-1.;fxTimesRhoShield[i]=-1.;}
   for(Int_t i=0;i<6;i++) {fxOverX0Layer[i]=-1.;fxTimesRhoLayer[i]=-1.;}
   
-  fDebugStreamer = new TTreeSRedirector("ITSdebug.root");
+  if (AliITSReconstructor::GetRecoParam()->GetESDV0Params()->StreamLevel()>0)
+    fDebugStreamer = new TTreeSRedirector("ITSdebug.root");
 
   // only for plane efficiency evaluation
   if (AliITSReconstructor::GetRecoParam()->GetComputePlaneEff() &&
@@ -288,6 +285,7 @@ fITSChannelStatus(tracker.fITSChannelStatus),
 fkDetTypeRec(tracker.fkDetTypeRec),
 fPlaneEff(tracker.fPlaneEff) {
   //Copy constructor
+  fOriginal.SetOwner();
   Int_t i;
   for(i=0;i<4;i++) {
     fSPDdetzcentre[i]=tracker.fSPDdetzcentre[i];
@@ -625,7 +623,7 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
   if(AliITSReconstructor::GetRecoParam()->GetFindV0s()) AliITSV0Finder::FindV02(event,this);
   fAfterV0 = kTRUE;
   //
-  itsTracks.Delete();
+  itsTracks.Clear();
   //
   Int_t entries = fTrackHypothesys.GetEntriesFast();
   for (Int_t ientry=0; ientry<entries; ientry++) {
@@ -635,6 +633,12 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
   }
 
   fTrackHypothesys.Delete();
+  entries = fBestHypothesys.GetEntriesFast();
+  for (Int_t ientry=0; ientry<entries; ientry++) {
+    TObjArray * array =(TObjArray*)fBestHypothesys.UncheckedAt(ientry);
+    if (array) array->Delete();
+    delete fBestHypothesys.RemoveAt(ientry);
+  }
   fBestHypothesys.Delete();
   fOriginal.Clear();
   delete [] fCoefficients;
@@ -873,7 +877,7 @@ Bool_t AliITStrackerMI::GetTrackPointTrackingError(Int_t index,
   detxy[1] = det.GetR()*TMath::Sin(det.GetPhi());
   Double_t alpha = t->GetAlpha();
   Double_t xdetintrackframe = detxy[0]*TMath::Cos(alpha)+detxy[1]*TMath::Sin(alpha);
-  Float_t phi = TMath::ASin(t->GetSnpAt(xdetintrackframe,GetBz()));
+  Float_t phi = TMath::ASin(t->GetSnpAt(xdetintrackframe+cl->GetX(),GetBz()));
   phi += alpha-det.GetPhi();
   Float_t tgphi = TMath::Tan(phi);
 
@@ -960,6 +964,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
   TObjArray *bestarray = (TObjArray*)fBestHypothesys.At(esdindex);
   if (!bestarray){
     bestarray = new TObjArray(5);
+    bestarray->SetOwner();
     fBestHypothesys.AddAt(bestarray,esdindex);
   }
 
@@ -1040,7 +1045,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
        if(LocalModuleCoord(ilayer,idet,vtrack,xloc,zloc)) { // local module coords
          vtrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc);
        }
-       if(constrain) vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
+       if(constrain && AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
        ntracks[ilayer]++;
        continue;
       }
@@ -1131,7 +1136,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
                TMath::Abs(updatetrack->GetD(1)/(1.+ilayer)) > // z
                AliITSReconstructor::GetRecoParam()->GetMaxDZforPrimTrk()) isPrim=kFALSE;
          }
-         if (isPrim) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
+         if (isPrim && AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
        }
        updatetrack->SetNDeadZone(updatetrack->GetNDeadZone()+1);
        if (dead) {
@@ -1152,7 +1157,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
       while ((cl=layer.GetNextCluster(clidx))!=0) { 
        if (ntracks[ilayer]>95) break; //space for skipped clusters  
        Bool_t changedet =kFALSE;  
-       if (cl->GetQ()==0 && deadzoneSPD==kTRUE) continue;
+       if (TMath::Abs(cl->GetQ())<1.e-13 && deadzoneSPD==kTRUE) continue;
        Int_t idetc=cl->GetDetectorIndex();
 
        if (currenttrack->GetDetectorIndex()==idetc) { // track already on the cluster's detector
@@ -1164,6 +1169,9 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
               (currenttrack->GetY()-cl->GetY())*(currenttrack->GetY()-cl->GetY())*msy > 1. ) 
            {  // cluster not associated to track
              AliDebug(2,"not associated");
+             // MvL: added here as well
+             // bring track back to ideal detector plane
+             currenttrack->Propagate(xTrOrig);
              continue;
            }
          // bring track back to ideal detector plane
@@ -1196,13 +1204,13 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
        // chi2 cut
        AliDebug(2,Form("chi2 %f max %f",chi2trkcl,AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer)));
        if (chi2trkcl < AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer)) {
-         if (cl->GetQ()==0) deadzoneSPD=kTRUE; // only 1 prolongation with virtual cluster       
+         if (TMath::Abs(cl->GetQ())<1.e-13) deadzoneSPD=kTRUE; // only 1 prolongation with virtual cluster       
          if (ntracks[ilayer]>=100) continue;
          AliITStrackMI * updatetrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(*currenttrack);
          updatetrack->SetClIndex(ilayer,-1);
          if (changedet) new (&currenttrack2) AliITStrackMI(backuptrack);
 
-         if (cl->GetQ()!=0) { // real cluster
+         if (TMath::Abs(cl->GetQ())>1.e-13) { // real cluster
            if (!UpdateMI(updatetrack,cl,chi2trkcl,(ilayer<<28)+clidx)) {
              AliDebug(2,"update failed");
              continue;
@@ -1238,7 +1246,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
                  TMath::Abs(updatetrack->GetD(1)/(1.+ilayer)) > // z
                  AliITSReconstructor::GetRecoParam()->GetMaxDZforPrimTrk()) isPrim=kFALSE;
            }
-           if (isPrim) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
+           if (isPrim && AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) updatetrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
          } //apply vertex constrain              
          ntracks[ilayer]++;
        }  // create new hypothesis
@@ -1249,14 +1257,14 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
       } // loop over possible prolongations 
      
       // allow one prolongation without clusters
-      if (constrain && itrack<=1 && currenttrack1.GetNSkipped()==0 && deadzoneSPD==kFALSE && ntracks[ilayer]<100) {
+      if (constrain && itrack<=1 && TMath::Abs(currenttrack1.GetNSkipped())<1.e-13 && deadzoneSPD==kFALSE && ntracks[ilayer]<100) {
        AliITStrackMI* vtrack = new (&tracks[ilayer][ntracks[ilayer]]) AliITStrackMI(currenttrack1);
        // apply correction for material of the current layer
        CorrectForLayerMaterial(vtrack,ilayer,trackGlobXYZ1,"inward");
        vtrack->SetClIndex(ilayer,-1);
        modstatus = 3; // skipped 
        vtrack->SetModuleIndexInfo(ilayer,idet,modstatus,xloc,zloc);
-       vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
+       if(AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) vtrack->Improve(budgetToPrimVertex,xyzVtx,ersVtx);
        vtrack->IncrementNSkipped();
        ntracks[ilayer]++;
       }
@@ -1966,7 +1974,7 @@ const AliITSRecPoint *AliITStrackerMI::AliITSlayer::GetNextCluster(Int_t &ci,Boo
       if (z+fNMaxSigmaCl*TMath::Sqrt(fClusters[i]->GetSigmaZ2())<fZmin+fNMaxSigmaCl*fMaxSigmaClZ) continue;
       if (z-fNMaxSigmaCl*TMath::Sqrt(fClusters[i]->GetSigmaZ2())>fZmax-fNMaxSigmaCl*fMaxSigmaClZ) continue;
       //
-      if (fClusters[i]->GetQ()==0&&fSkip==2) continue;
+      if (TMath::Abs(fClusters[i]->GetQ())<1.e-13 && fSkip==2) continue;
       ci=i;
       if (!test) fI=i+1;
       return fClusters[i];
@@ -1975,7 +1983,7 @@ const AliITSRecPoint *AliITStrackerMI::AliITSlayer::GetNextCluster(Int_t &ci,Boo
     for (Int_t i=fI; i<fImax; i++) {
       if (fYcs[i]<fYmin) continue;
       if (fYcs[i]>fYmax) continue;
-      if (fClustersCs[i]->GetQ()==0&&fSkip==2) continue;
+      if (TMath::Abs(fClustersCs[i]->GetQ())<1.e-13 && fSkip==2) continue;
       ci=fClusterIndexCs[i];
       if (!test) fI=i+1;
       return fClustersCs[i];
@@ -2255,14 +2263,32 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
     index[k]=clusters[k]; 
   }
 
-  // special for cosmics: check which the innermost layer crossed
-  // by the track
-  Int_t innermostlayer=5;
-  Double_t drphi = TMath::Abs(track->GetD(0.,0.));
-  for(innermostlayer=0; innermostlayer<AliITSgeomTGeo::GetNLayers(); innermostlayer++) {
-    if(drphi < fgLayers[innermostlayer].GetR()) break;
+  // special for cosmics and TPC prolonged tracks: 
+  // propagate to the innermost of:
+  // - innermost layer crossed by the track
+  // - innermost layer where a cluster was associated to the track
+  static AliITSRecoParam *repa = NULL;
+  if(!repa){
+    repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
+    if(!repa){
+      repa = AliITSRecoParam::GetHighFluxParam();
+      AliWarning("Using default AliITSRecoParam class");
+    }
+  }
+  Int_t evsp=repa->GetEventSpecie();
+  ULong_t trStatus=0;
+  if(track->GetESDtrack()) trStatus=track->GetStatus();
+  Int_t innermostlayer=0;
+  if((evsp&AliRecoParam::kCosmic) || (trStatus&AliESDtrack::kTPCin))  {
+    innermostlayer=5;
+    Double_t drphi = TMath::Abs(track->GetD(0.,0.));
+    for(innermostlayer=0; innermostlayer<AliITSgeomTGeo::GetNLayers(); innermostlayer++) {
+      if( (drphi < (fgLayers[innermostlayer].GetR()+1.)) ||
+         index[innermostlayer] >= 0 ) break;
+    }
+
+    AliDebug(2,Form(" drphi  %f  innermost %d",drphi,innermostlayer));
   }
-  AliDebug(2,Form(" drphi  %f  innermost %d",drphi,innermostlayer));
 
   Int_t modstatus=1; // found
   Float_t xloc,zloc;
@@ -2532,7 +2558,7 @@ Double_t AliITStrackerMI::GetNormalizedChi2(AliITStrackMI * track, Int_t mode)
     Int_t nDeadZoneWithProbNot1=(Int_t)(track->GetNDeadZone())-sumDeadZoneProbability;
     if(nDeadZoneWithProbNot1>0) {
       Float_t deadZoneProbability = track->GetNDeadZone()-(Float_t)sumDeadZoneProbability;
-      AliDebug(2,Form("nDeadZone %f sumDZProbability %f nDZWithProbNot1 %f deadZoneProb %f\n",track->GetNDeadZone(),sumDeadZoneProbability,nDeadZoneWithProbNot1,deadZoneProbability));
+      AliDebug(2,Form("nDeadZone %f sumDZProbability %d nDZWithProbNot1 %d deadZoneProb %f\n",track->GetNDeadZone(),sumDeadZoneProbability,nDeadZoneWithProbNot1,deadZoneProbability));
       deadZoneProbability /= (Float_t)nDeadZoneWithProbNot1;
       Float_t one = 1.;
       deadZoneProbability = TMath::Min(deadZoneProbability,one);
@@ -2543,7 +2569,7 @@ Double_t AliITStrackerMI::GetNormalizedChi2(AliITStrackMI * track, Int_t mode)
   Double_t normchi2 = 2*track->GetNSkipped()+match+deadzonefactor+(1+(2*track->GetNSkipped()+deadzonefactor)/track->GetNumberOfClusters())*
     (chi2)/TMath::Max(double(sum-track->GetNSkipped()),
                                1./(1.+track->GetNSkipped()));     
-  AliDebug(2,Form("match %f deadzonefactor %f chi2 %f sum %f skipped\n",match,deadzonefactor,chi2,sum,track->GetNSkipped()));
+  AliDebug(2,Form("match %f deadzonefactor %f chi2 %f sum %f skipped %f\n",match,deadzonefactor,chi2,sum,track->GetNSkipped()));
   AliDebug(2,Form("NormChi2 %f  cls %d\n",normchi2,track->GetNumberOfClusters()));
   return normchi2;
 }
@@ -2762,9 +2788,9 @@ Float_t AliITStrackerMI::GetNumberOfSharedClusters(AliITStrackMI* track,Int_t id
     Int_t l=(index & 0xf0000000) >> 28;
     Int_t c=(index & 0x0fffffff) >> 00;
     if (c>fgLayers[l].GetNumberOfClusters()) continue;
-    if (ny[l]==0){
-      printf("problem\n");
-    }
+    // if (ny[l]<1.e-13){
+    //   printf("problem\n");
+    // }
     AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(index);
     Float_t weight=1;
     //
@@ -2812,9 +2838,9 @@ Int_t AliITStrackerMI::GetOverlapTrack(const AliITStrackMI *track, Int_t trackID
     Int_t index = clusterlist[icluster];
     Int_t l=(index & 0xf0000000) >> 28;
     Int_t c=(index & 0x0fffffff) >> 00;
-    if (ny[l]==0){
-      printf("problem\n");
-    }
+    // if (ny[l]<1.e-13){
+    //   printf("problem\n");
+    // }
     if (c>fgLayers[l].GetNumberOfClusters()) continue;
     //if (l>3) continue;
     AliITSRecPoint *cl = (AliITSRecPoint*)GetCluster(index);
@@ -3388,7 +3414,9 @@ AliITStrackMI * AliITStrackerMI::GetBestHypothesys(Int_t esdindex, AliITStrackMI
     backtrack = new(backtrack) AliITStrackMI(*track); 
     if (track->GetConstrain()) {
       if (!CorrectForPipeMaterial(backtrack,"inward")) continue;
-      if (!backtrack->Improve(0,xyzVtx,ersVtx))         continue;     
+      if (AliITSReconstructor::GetRecoParam()->GetImproveWithVertex()) {
+       if (!backtrack->Improve(0,xyzVtx,ersVtx)) continue;     
+      }
       backtrack->ResetCovariance(10.);      
     }else{
       backtrack->ResetCovariance(10.);
@@ -3681,8 +3709,9 @@ void AliITStrackerMI::CookLabel(AliITStrackMI *track,Float_t wrong) const {
    
 }
 //------------------------------------------------------------------------
-void AliITStrackerMI::CookdEdx(AliITStrackMI* track)
-{
+void AliITStrackerMI::CookdEdx(AliITStrackMI* track){
+  //
+  // Fill the dE/dx in this track
   //
   track->SetChi2MIP(9,0);
   for (Int_t i=0;i<track->GetNumberOfClusters();i++){
@@ -3715,15 +3744,15 @@ Double_t AliITStrackerMI::GetPredictedChi2MI(AliITStrackMI* track, const AliITSR
   //
   // Compute predicted chi2
   //
+  // Take into account the mis-alignment (bring track to cluster plane)
+  Double_t xTrOrig=track->GetX();
+  if (!track->Propagate(xTrOrig+cluster->GetX())) return 1000.;
   Float_t erry,errz,covyz;
   Float_t theta = track->GetTgl();
   Float_t phi   = track->GetSnp();
-  phi = TMath::Abs(phi)*TMath::Sqrt(1./((1.-phi)*(1.+phi)));
+  phi *= TMath::Sqrt(1./((1.-phi)*(1.+phi)));
   AliITSClusterParam::GetError(layer,cluster,theta,phi,track->GetExpQ(),erry,errz,covyz);
   AliDebug(2,Form(" chi2: tr-cl   %f  %f   tr X %f cl X %f",track->GetY()-cluster->GetY(),track->GetZ()-cluster->GetZ(),track->GetX(),cluster->GetX()));
-  // Take into account the mis-alignment (bring track to cluster plane)
-  Double_t xTrOrig=track->GetX();
-  if (!track->Propagate(xTrOrig+cluster->GetX())) return 1000.;
   AliDebug(2,Form(" chi2: tr-cl   %f  %f   tr X %f cl X %f",track->GetY()-cluster->GetY(),track->GetZ()-cluster->GetZ(),track->GetX(),cluster->GetX()));
   Double_t chi2 = track->GetPredictedChi2MI(cluster->GetY(),cluster->GetZ(),erry,errz,covyz);
   // Bring the track back to detector plane in ideal geometry
@@ -3762,7 +3791,7 @@ Int_t AliITStrackerMI::UpdateMI(AliITStrackMI* track, const AliITSRecPoint* cl,D
     }
   }
 
-  if (cl->GetQ()<=0) return 0;  // ingore the "virtual" clusters
+  if (TMath::Abs(cl->GetQ())<1.e-13) return 0;  // ingore the "virtual" clusters
 
 
   // Take into account the mis-alignment (bring track to cluster plane)
@@ -3879,9 +3908,9 @@ void AliITStrackerMI::UpdateESDtrack(AliITStrackMI* track, ULong_t flags) const
   AliITStrackMI * oldtrack = (AliITStrackMI*)(track->GetESDtrack()->GetITStrack());
   if (oldtrack) delete oldtrack; 
   track->GetESDtrack()->SetITStrack(new AliITStrackMI(*track));
-  if (TMath::Abs(track->GetDnorm(1))<0.000000001){
-    printf("Problem\n");
-  }
+  // if (TMath::Abs(track->GetDnorm(1))<0.000000001){
+  //   printf("Problem\n");
+  // }
 }
 //------------------------------------------------------------------------
 Int_t AliITStrackerMI::GetNearestLayer(const Double_t *xr) const{
@@ -4574,19 +4603,29 @@ Bool_t AliITStrackerMI::IsOKForPlaneEff(const AliITStrackMI* track, const Int_t
   AliITStrackMI tmp(*track);
 
 // require a minimal number of cluster in other layers and eventually clusters in closest layers 
-  Int_t ncl=0; 
-  for(Int_t lay=AliITSgeomTGeo::kNLayers-1;lay>ilayer;lay--) {
+  Int_t ncl_out=0; Int_t ncl_in=0;
+  for(Int_t lay=AliITSgeomTGeo::kNLayers-1;lay>ilayer;lay--) { // count n. of cluster in outermost layers
     AliDebug(2,Form("trak=%d  lay=%d  ; index=%d ESD label= %d",tmp.GetLabel(),lay,
                     tmp.GetClIndex(lay),((AliESDtrack*)tmp.GetESDtrack())->GetLabel())) ;
-    if (tmp.GetClIndex(lay)>=0) ncl++;
+    if (tmp.GetClIndex(lay)>=0) ncl_out++;
   }
+  for(Int_t lay=ilayer-1; lay>=0;lay--) { // count n. of cluster in innermost layers
+    AliDebug(2,Form("trak=%d  lay=%d  ; index=%d ESD label= %d",tmp.GetLabel(),lay,
+                    tmp.GetClIndex(lay),((AliESDtrack*)tmp.GetESDtrack())->GetLabel())) ;
+    if (tmp.GetClIndex(lay)>=0) ncl_in++;
+  }
+  Int_t ncl=ncl_out+ncl_in;
   Bool_t nextout = kFALSE;
   if(ilayer==AliITSgeomTGeo::kNLayers-1) nextout=kTRUE; // you are already on the outermost layer
   else nextout = ((tmp.GetClIndex(ilayer+1)>=0)? kTRUE : kFALSE );
   Bool_t nextin = kFALSE;
   if(ilayer==0) nextin=kTRUE; // you are already on the innermost layer
   else nextin = ((index[ilayer-1]>=0)? kTRUE : kFALSE );
-  if(ncl<AliITSgeomTGeo::kNLayers-(ilayer+1)-AliITSReconstructor::GetRecoParam()->GetMaxMissingClustersPlaneEff()) 
+  // maximum number of missing clusters allowed in outermost layers
+  if(ncl_out<AliITSgeomTGeo::kNLayers-(ilayer+1)-AliITSReconstructor::GetRecoParam()->GetMaxMissingClustersOutPlaneEff()) 
+     return kFALSE; 
+  // maximum number of missing clusters allowed (both in innermost and in outermost layers)
+  if(ncl<AliITSgeomTGeo::kNLayers-1-AliITSReconstructor::GetRecoParam()->GetMaxMissingClustersPlaneEff()) 
      return kFALSE; 
   if(AliITSReconstructor::GetRecoParam()->GetRequireClusterInOuterLayerPlaneEff() && !nextout)  return kFALSE;
   if(AliITSReconstructor::GetRecoParam()->GetRequireClusterInInnerLayerPlaneEff() && !nextin)   return kFALSE;
@@ -4617,10 +4656,10 @@ Bool_t AliITStrackerMI::IsOKForPlaneEff(const AliITStrackMI* track, const Int_t
   // DEFINITION OF SEARCH ROAD FOR accepting a track
   //
   //For the time being they are hard-wired, later on from AliITSRecoParam
-  // Double_t nsigx=AliITSRecoParam::GetNSigXFarFromBoundary();
-  // Double_t nsigz=AliITSRecoParam::GetNSigZFarFromBoundary();
-  Double_t nsigz=4; 
-  Double_t nsigx=4; 
+  Double_t nsigx=AliITSReconstructor::GetRecoParam()->GetNSigXFromBoundaryPlaneEff();
+  Double_t nsigz=AliITSReconstructor::GetRecoParam()->GetNSigZFromBoundaryPlaneEff();
+  // Double_t nsigz=4; 
+  // Double_t nsigx=4; 
   Double_t dx=nsigx*TMath::Sqrt(tmp.GetSigmaY2());  // those are precisions in the tracking reference system
   Double_t dz=nsigz*TMath::Sqrt(tmp.GetSigmaZ2());  // Use it also for the module reference system, as it is
                                                 // done for RecPoints