]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITStrackerMI.cxx
modifications to satisfy the coding conventions
[u/mrichter/AliRoot.git] / ITS / AliITStrackerMI.cxx
index a211ba0e65c06edd11795b8c37d675c2623980ac..85b1ccdc68cdfce9562a0162675c08c873f2dc0b 100644 (file)
@@ -171,6 +171,14 @@ fPlaneEff(0) {
 
         AliITSdetector &det=fgLayers[i-1].GetDetector((j-1)*ndet + k-1); 
         new(&det) AliITSdetector(r,phi); 
+       // compute the real radius (with misalignment)
+        TGeoHMatrix mmisal(*(AliITSgeomTGeo::GetMatrix(i,j,k)));
+        mmisal.Multiply(tm);
+       xyz[0]=0.;xyz[1]=0.;xyz[2]=0.;
+        mmisal.LocalToMaster(txyz,xyz);
+        Double_t rmisal=TMath::Sqrt(xyz[0]*xyz[0] + xyz[1]*xyz[1]);
+       det.SetRmisal(rmisal);
+       
       } // end loop on detectors
     } // end loop on ladders
   } // end loop on layers
@@ -219,21 +227,15 @@ fPlaneEff(0) {
 
   // only for plane efficiency evaluation
   if (AliITSReconstructor::GetRecoParam()->GetComputePlaneEff()) {
-    for(Int_t ilay=0;ilay<6;ilay++) { 
-      if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(ilay)) {
-        if (ilay<2) fPlaneEff = new AliITSPlaneEffSPD();
-        else if (ilay<4) fPlaneEff = new AliITSPlaneEffSDD();
-        else fPlaneEff = new AliITSPlaneEffSSD();
-        break; // only one layer type to skip at once
-      }
-    }
+    Int_t iplane=AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff();
+    if(AliITSReconstructor::GetRecoParam()->GetLayersToSkip(iplane))
+      AliWarning(Form("Evaluation of Plane Eff for layer %d will be attempted without removing it from tracker",iplane));
+    if (iplane<2) fPlaneEff = new AliITSPlaneEffSPD();
+    else if (iplane<4) fPlaneEff = new AliITSPlaneEffSDD();
+    else fPlaneEff = new AliITSPlaneEffSSD();
     if(AliITSReconstructor::GetRecoParam()->GetReadPlaneEffFromOCDB())
-      if(!fPlaneEff->ReadFromCDB()) 
-       {AliWarning("AliITStrackerMI reading of AliITSPlaneEff from OCDB failed") ;}
-    if(AliITSReconstructor::GetRecoParam()->GetHistoPlaneEff()) {
-      fPlaneEff->SetCreateHistos(kTRUE); 
-      //fPlaneEff->ReadHistosFromFile();
-    }
+       if(!fPlaneEff->ReadFromCDB()) {AliWarning("AliITStrackerMI reading of AliITSPlaneEff from OCDB failed") ;}
+    if(AliITSReconstructor::GetRecoParam()->GetHistoPlaneEff()) fPlaneEff->SetCreateHistos(kTRUE);
   }
 }
 //------------------------------------------------------------------------
@@ -553,9 +555,9 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
   for (fPass=0; fPass<2; fPass++) {
      Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue;
      for (fCurrentEsdTrack=0; fCurrentEsdTrack<nentr; fCurrentEsdTrack++) {
-       //cerr<<fPass<<"    "<<fCurrentEsdTrack<<'\n';
        AliITStrackMI *t=(AliITStrackMI*)itsTracks.UncheckedAt(fCurrentEsdTrack);
        if (t==0) continue;              //this track has been already tracked
+       //cout<<"========== "<<fPass<<"    "<<fCurrentEsdTrack<<" =========\n";
        if (t->GetReconstructed()&&(t->GetNUsed()<1.5)) continue;  //this track was  already  "succesfully" reconstructed
        Float_t dz[2]; t->GetDZ(GetX(),GetY(),GetZ(),dz);              //I.B.
        if (fConstraint[fPass]) { 
@@ -569,6 +571,7 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
        ResetBestTrack();
 
        FollowProlongationTree(t,fCurrentEsdTrack,fConstraint[fPass]);
 
        SortTrackHypothesys(fCurrentEsdTrack,20,0);  //MI change
        //
@@ -584,7 +587,7 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
        if (fConstraint[fPass]&&(!besttrack->IsGoldPrimary())) continue;  //to be tracked also without vertex constrain 
 
        t->SetReconstructed(kTRUE);
-       ntrk++;                     
+       ntrk++;  
      }
      GetBestHypothesysMIP(itsTracks); 
   } // end loop on the two tracking passes
@@ -771,7 +774,8 @@ Bool_t AliITStrackerMI::GetTrackPoint(Int_t index, AliTrackPoint& p) const {
   cl->GetGlobalXYZ(xyz);
   cl->GetGlobalCov(cov);
   p.SetXYZ(xyz, cov);
-
+  p.SetCharge(cl->GetQ());
+  p.SetDriftTime(cl->GetDriftTime());
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; 
   switch (l) {
   case 0:
@@ -828,7 +832,8 @@ Bool_t AliITStrackerMI::GetTrackPointTrackingError(Int_t index,
   Float_t expQ = TMath::Max(0.8*t->GetTPCsignal(),30.);
 
   Float_t errlocalx,errlocalz;
-  AliITSClusterParam::GetError(l,cl,tgl,tgphi,expQ,errlocalx,errlocalz);
+  Bool_t addMisalErr=kFALSE;
+  AliITSClusterParam::GetError(l,cl,tgl,tgphi,expQ,errlocalx,errlocalz,addMisalErr);
 
   Float_t xyz[3];
   Float_t cov[6];
@@ -839,6 +844,8 @@ Bool_t AliITStrackerMI::GetTrackPointTrackingError(Int_t index,
   tmpcl.GetGlobalCov(cov);
 
   p.SetXYZ(xyz, cov);
+  p.SetCharge(cl->GetQ());
+  p.SetDriftTime(cl->GetDriftTime());
 
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; 
   switch (l) {
@@ -926,6 +933,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
   //
   // follow prolongations
   for (Int_t ilayer=5; ilayer>=0; ilayer--) {
+    //printf("FollowProlongationTree: layer %d\n",ilayer);
     fI = ilayer;
     //
     AliITSlayer &layer=fgLayers[ilayer];
@@ -990,46 +998,17 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
       const AliITSdetector &det=layer.GetDetector(idet);
       new(&currenttrack2)  AliITStrackMI(currenttrack1);
       if (!currenttrack1.Propagate(det.GetPhi(),det.GetR())) continue;
-
-      LocalModuleCoord(ilayer,idet,&currenttrack1,xloc,zloc); // local module coords
       currenttrack2.Propagate(det.GetPhi(),det.GetR());
       currenttrack1.SetDetectorIndex(idet);
       currenttrack2.SetDetectorIndex(idet);
+      LocalModuleCoord(ilayer,idet,&currenttrack1,xloc,zloc); // local module coords
 
       //***************
-      // DEFINITION OF SEARCH ROAD FOR CLUSTERS SELECTION
+      // DEFINITION OF SEARCH ROAD AND CLUSTERS SELECTION
       //
-      Double_t dz=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadZ()*
-                    TMath::Sqrt(currenttrack1.GetSigmaZ2() + 
-                   AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
-                   AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
-                   AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer));
-      Double_t dy=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadY()*
-                    TMath::Sqrt(currenttrack1.GetSigmaY2() + 
-                   AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
-                   AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
-                   AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer));
-      
-      // track at boundary between detectors, enlarge road
-      Double_t boundaryWidth=AliITSRecoParam::GetBoundaryWidth();
-      if ( (currenttrack1.GetY()-dy < det.GetYmin()+boundaryWidth) || 
-          (currenttrack1.GetY()+dy > det.GetYmax()-boundaryWidth) || 
-          (currenttrack1.GetZ()-dz < det.GetZmin()+boundaryWidth) ||
-          (currenttrack1.GetZ()+dz > det.GetZmax()-boundaryWidth) ) {
-       Float_t tgl = TMath::Abs(currenttrack1.GetTgl());
-       if (tgl > 1.) tgl=1.;
-       Double_t deltaXNeighbDets=AliITSRecoParam::GetDeltaXNeighbDets();
-       dz = TMath::Sqrt(dz*dz+deltaXNeighbDets*deltaXNeighbDets*tgl*tgl);
-       Float_t snp = TMath::Abs(currenttrack1.GetSnp());
-       if (snp > AliITSReconstructor::GetRecoParam()->GetMaxSnp()) continue;
-       dy = TMath::Sqrt(dy*dy+deltaXNeighbDets*deltaXNeighbDets*snp*snp);
-      } // boundary
-      
       // road in global (rphi,z) [i.e. in tracking ref. system]
-      Double_t zmin = currenttrack1.GetZ() - dz; 
-      Double_t zmax = currenttrack1.GetZ() + dz;
-      Double_t ymin = currenttrack1.GetY() + r*det.GetPhi() - dy;
-      Double_t ymax = currenttrack1.GetY() + r*det.GetPhi() + dy;
+      Double_t zmin,zmax,ymin,ymax;
+      if (!ComputeRoad(&currenttrack1,ilayer,idet,zmin,zmax,ymin,ymax)) continue;
 
       // select clusters in road
       layer.SelectClusters(zmin,zmax,ymin,ymax); 
@@ -1053,6 +1032,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
       }
       msz = 1./msz; // 1/RoadZ^2
       msy = 1./msy; // 1/RoadY^2
+
       //
       //
       // LOOP OVER ALL POSSIBLE TRACK PROLONGATIONS ON THIS LAYER
@@ -1066,7 +1046,10 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
       // check if the road contains a dead zone 
       Bool_t noClusters = kFALSE;
       if (!layer.GetNextCluster(clidx,kTRUE)) noClusters=kTRUE;
-      Int_t dead = CheckDeadZone(&currenttrack1,ilayer,idet,zmin,zmax,ymin,ymax,noClusters); 
+      //if (noClusters) printf("no clusters in road\n");
+      Double_t dz=0.5*(zmax-zmin);
+      Double_t dy=0.5*(ymax-ymin);
+      Int_t dead = CheckDeadZone(&currenttrack1,ilayer,idet,dz,dy,noClusters); 
       // create a prolongation without clusters (check also if there are no clusters in the road)
       if (dead || 
          (noClusters && 
@@ -1114,15 +1097,23 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
        Int_t idetc=cl->GetDetectorIndex();
 
        if (currenttrack->GetDetectorIndex()==idetc) { // track already on the cluster's detector
+         // take into account misalignment (bring track to real detector plane)
+         Double_t xTrOrig = currenttrack->GetX();
+         currenttrack->PropagateTo(xTrOrig+cl->GetX(),0.,0.);
          // a first cut on track-cluster distance
          if ( (currenttrack->GetZ()-cl->GetZ())*(currenttrack->GetZ()-cl->GetZ())*msz + 
               (currenttrack->GetY()-cl->GetY())*(currenttrack->GetY()-cl->GetY())*msy > 1. ) 
-           continue; // cluster not associated to track
+           {  // cluster not associated to track
+             //printf("not ass\n");
+             continue;
+           }
+         // bring track back to ideal detector plane
+         currenttrack->PropagateTo(xTrOrig,0.,0.);
        } else {                                      // have to move track to cluster's detector
          const AliITSdetector &detc=layer.GetDetector(idetc);
          // a first cut on track-cluster distance
          Double_t y;
-         if (!currenttrack2.GetProlongationFast(detc.GetPhi(),detc.GetR(),y,z)) continue;
+         if (!currenttrack2.GetProlongationFast(detc.GetPhi(),detc.GetR()+cl->GetX(),y,z)) continue;
          if ( (z-cl->GetZ())*(z-cl->GetZ())*msz + 
               (y-cl->GetY())*(y-cl->GetY())*msy > 1. ) 
            continue; // cluster not associated to track
@@ -1144,6 +1135,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
        // calculate track-clusters chi2
        chi2trkcl = GetPredictedChi2MI(currenttrack,cl,ilayer); 
        // chi2 cut
+       //printf("chi2 %f max %f\n",chi2trkcl,AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer));
        if (chi2trkcl < AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer)) {
          if (cl->GetQ()==0) deadzoneSPD=kTRUE; // only 1 prolongation with virtual cluster       
          if (ntracks[ilayer]>=100) continue;
@@ -1152,7 +1144,10 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
          if (changedet) new (&currenttrack2) AliITStrackMI(backuptrack);
 
          if (cl->GetQ()!=0) { // real cluster
-           if (!UpdateMI(updatetrack,cl,chi2trkcl,(ilayer<<28)+clidx)) continue; 
+           if (!UpdateMI(updatetrack,cl,chi2trkcl,(ilayer<<28)+clidx)) {
+             //printf("update failed\n");
+             continue;
+           } 
            updatetrack->SetSampledEdx(cl->GetQ(),updatetrack->GetNumberOfClusters()-1); //b.b.
            modstatus = 1; // found
          } else {             // virtual cluster in dead zone
@@ -1187,6 +1182,7 @@ void AliITStrackerMI::FollowProlongationTree(AliITStrackMI * otrack, Int_t esdin
          } //apply vertex constrain              
          ntracks[ilayer]++;
        }  // create new hypothesis
+       //else printf("chi2 too large\n");
       } // loop over possible prolongations 
      
       // allow one prolongation without clusters
@@ -1681,6 +1677,58 @@ Int_t AliITStrackerMI::AliITSlayer::FindClusterIndex(Float_t z) const {
   return m;
 }
 //------------------------------------------------------------------------
+Bool_t AliITStrackerMI::ComputeRoad(AliITStrackMI* track,Int_t ilayer,Int_t idet,Double_t &zmin,Double_t &zmax,Double_t &ymin,Double_t &ymax) const {
+  //--------------------------------------------------------------------
+  // This function computes the rectangular road for this track
+  //--------------------------------------------------------------------
+
+
+  AliITSdetector &det = fgLayers[ilayer].GetDetector(idet);
+  // take into account the misalignment: propagate track to misaligned detector plane
+  if (!track->Propagate(det.GetPhi(),det.GetRmisal())) return kFALSE;
+
+  Double_t dz=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadZ()*
+                    TMath::Sqrt(track->GetSigmaZ2() + 
+                   AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
+                   AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
+                   AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer));
+  Double_t dy=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadY()*
+                    TMath::Sqrt(track->GetSigmaY2() + 
+                   AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
+                   AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
+                   AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer));
+      
+  // track at boundary between detectors, enlarge road
+  Double_t boundaryWidth=AliITSRecoParam::GetBoundaryWidth();
+  if ( (track->GetY()-dy < det.GetYmin()+boundaryWidth) || 
+       (track->GetY()+dy > det.GetYmax()-boundaryWidth) || 
+       (track->GetZ()-dz < det.GetZmin()+boundaryWidth) ||
+       (track->GetZ()+dz > det.GetZmax()-boundaryWidth) ) {
+    Float_t tgl = TMath::Abs(track->GetTgl());
+    if (tgl > 1.) tgl=1.;
+    Double_t deltaXNeighbDets=AliITSRecoParam::GetDeltaXNeighbDets();
+    dz = TMath::Sqrt(dz*dz+deltaXNeighbDets*deltaXNeighbDets*tgl*tgl);
+    Float_t snp = TMath::Abs(track->GetSnp());
+    if (snp > AliITSReconstructor::GetRecoParam()->GetMaxSnp()) return kFALSE;
+    dy = TMath::Sqrt(dy*dy+deltaXNeighbDets*deltaXNeighbDets*snp*snp);
+  } // boundary
+  
+  // add to the road a term (up to 2-3 mm) to deal with misalignments
+  dy = TMath::Sqrt(dy*dy + AliITSReconstructor::GetRecoParam()->GetRoadMisal()*AliITSReconstructor::GetRecoParam()->GetRoadMisal());
+  dz = TMath::Sqrt(dz*dz + AliITSReconstructor::GetRecoParam()->GetRoadMisal()*AliITSReconstructor::GetRecoParam()->GetRoadMisal());
+
+  Double_t r = fgLayers[ilayer].GetR();
+  zmin = track->GetZ() - dz; 
+  zmax = track->GetZ() + dz;
+  ymin = track->GetY() + r*det.GetPhi() - dy;
+  ymax = track->GetY() + r*det.GetPhi() + dy;
+
+  // bring track back to idead detector plane
+  if (!track->Propagate(det.GetPhi(),det.GetR())) return kFALSE;
+
+  return kTRUE;
+}
+//------------------------------------------------------------------------
 void AliITStrackerMI::AliITSlayer::
 SelectClusters(Double_t zmin,Double_t zmax,Double_t ymin, Double_t ymax) {
   //--------------------------------------------------------------------
@@ -1932,6 +1980,7 @@ const {
 //------------------------------------------------------------------------
 AliITStrackerMI::AliITSdetector::AliITSdetector(const AliITSdetector& det):
 fR(det.fR),
+fRmisal(det.fRmisal),
 fPhi(det.fPhi),
 fSinPhi(det.fSinPhi),
 fCosPhi(det.fCosPhi),
@@ -1978,7 +2027,7 @@ void AliITStrackerMI::AliITSdetector::ReadBadDetectorAndChips(Int_t ilayer,Int_t
       (detType==0 && calibSPDdead->IsBad())) // TEMPORARY
     {
       SetBad();
-      printf("lay %d bad %d\n",ilayer,idet);
+      //      printf("lay %d bad %d\n",ilayer,idet);
     }
 
   // Get segmentation from AliITSDetTypeRec
@@ -2173,8 +2222,7 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
      if (idet<0) return kFALSE;
 
      const AliITSdetector &det=layer.GetDetector(idet);
-     phi=det.GetPhi();
-     if (!track->Propagate(phi,det.GetR())) return kFALSE;
+     if (!track->Propagate(det.GetPhi(),det.GetR())) return kFALSE;
 
      track->SetDetectorIndex(idet);
      LocalModuleCoord(ilayer,idet,track,xloc,zloc); // local module coords
@@ -2196,7 +2244,6 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
           track->SetDetectorIndex(idet);
           LocalModuleCoord(ilayer,idet,track,xloc,zloc); // local module coords
         }
-        //Double_t chi2=track->GetPredictedChi2(cl);
         Int_t cllayer = (idx & 0xf0000000) >> 28;;
         Double_t chi2=GetPredictedChi2MI(track,cl,cllayer);
         if (chi2<maxchi2) { 
@@ -2210,29 +2257,18 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
      } else { // no cluster in this layer
        if (skip==1) {
         modstatus = 3; // skipped
-         // Plane Eff determination: 
-         if (planeeff && AliITSReconstructor::GetRecoParam()->GetLayersToSkip(ilayer)) { 
-           if (IsOKForPlaneEff(track,ilayer))  // only adequate track for plane eff. evaluation
-              UseTrackForPlaneEff(track,ilayer); 
+         // Plane Eff determination:
+         if (planeeff && ilayer==AliITSReconstructor::GetRecoParam()->GetIPlanePlaneEff()) {
+           if (IsOKForPlaneEff(track,clusters,ilayer))  // only adequate track for plane eff. evaluation
+              UseTrackForPlaneEff(track,ilayer);
          }
        } else {
         modstatus = 5; // no cls in road
         // check dead
-        dz=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadZ()*
-                    TMath::Sqrt(track->GetSigmaZ2() + 
-                   AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
-                   AliITSReconstructor::GetRecoParam()->GetNSigmaZLayerForRoadZ()*
-                   AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer));
-        zmin=track->GetZ() - dz;
-        zmax=track->GetZ() + dz;
-        dy=AliITSReconstructor::GetRecoParam()->GetNSigmaRoadY()*
-                    TMath::Sqrt(track->GetSigmaY2() + 
-                   AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
-                   AliITSReconstructor::GetRecoParam()->GetNSigmaYLayerForRoadY()*
-                   AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer));
-        ymin=track->GetY() - dy;
-        ymax=track->GetY() + dy;
-        Int_t dead = CheckDeadZone(track,ilayer,idet,zmin,zmax,ymin,ymax,kTRUE);
+        if (!ComputeRoad(track,ilayer,idet,zmin,zmax,ymin,ymax)) return kFALSE;
+        dz = 0.5*(zmax-zmin);
+        dy = 0.5*(ymax-ymin);
+        Int_t dead = CheckDeadZone(track,ilayer,idet,dz,dy,kTRUE);
         if (dead==1) modstatus = 7; // holes in z in SPD
         if (dead==2 || dead==3) modstatus = 2; // dead from OCDB
        }
@@ -2247,16 +2283,8 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
 
      if (extra) { // search for extra clusters in overlapped modules
        AliITStrackV2 tmp(*track);
-       Double_t dY,yMin,yMax;
-       dz=4*TMath::Sqrt(tmp.GetSigmaZ2()+AliITSReconstructor::GetRecoParam()->GetSigmaZ2(ilayer));
-       if (dz < 0.5*TMath::Abs(tmp.GetTgl())) dz=0.5*TMath::Abs(tmp.GetTgl());
-       dY=4*TMath::Sqrt(track->GetSigmaY2()+AliITSReconstructor::GetRecoParam()->GetSigmaY2(ilayer));
-       if (dY < 0.5*TMath::Abs(tmp.GetSnp())) dY=0.5*TMath::Abs(tmp.GetSnp());
-       zmin=track->GetZ() - dz;
-       zmax=track->GetZ() + dz;
-       yMin=track->GetY() + phi*r - dY;
-       yMax=track->GetY() + phi*r + dY;
-       layer.SelectClusters(zmin,zmax,yMin,yMax);
+       if (!ComputeRoad(track,ilayer,idet,zmin,zmax,ymin,ymax)) return kFALSE;
+       layer.SelectClusters(zmin,zmax,ymin,ymax);
        
        const AliITSRecPoint *clExtra=0; Int_t ci=-1,cci=-1;
        Int_t idetExtra=-1;  
@@ -2269,10 +2297,10 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
         
         const AliITSdetector &detx=layer.GetDetector(idetExtra);
         
-        if (!tmp.Propagate(detx.GetPhi(),detx.GetR())) continue;
-        
+        if (!tmp.Propagate(detx.GetPhi(),detx.GetR()+clExtra->GetX())) continue;
         if (TMath::Abs(tmp.GetZ() - clExtra->GetZ()) > tolerance) continue;
         if (TMath::Abs(tmp.GetY() - clExtra->GetY()) > tolerance) continue;
+        if (!tmp.Propagate(detx.GetPhi(),detx.GetR())) continue;
         
         Double_t chi2=tmp.GetPredictedChi2(clExtra);
         if (chi2<maxchi2) { maxchi2=chi2; cci=ci; }
@@ -2282,7 +2310,7 @@ Bool_t AliITStrackerMI::RefitAt(Double_t xx,AliITStrackMI *track,
         track->SetExtraModule(ilayer,idetExtra);
        }
      } // end search for extra clusters in overlapped modules
-
+     
      // Correct for material of the current layer
      if(!CorrectForLayerMaterial(track,ilayer,oldGlobXYZ,dir)) return kFALSE;
                  
@@ -3579,7 +3607,16 @@ Double_t AliITStrackerMI::GetPredictedChi2MI(AliITStrackMI* track, const AliITSR
   Float_t phi   = track->GetSnp();
   phi = TMath::Sqrt(phi*phi/(1.-phi*phi));
   AliITSClusterParam::GetError(layer,cluster,theta,phi,track->GetExpQ(),erry,errz);
+  //printf(" chi2: tr-cl   %f  %f   tr X %f cl X %f\n",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->PropagateTo(xTrOrig+cluster->GetX(),0.,0.)) return 1000.;
+  //printf(" chi2: tr-cl   %f  %f   tr X %f cl X %f\n",track->GetY()-cluster->GetY(),track->GetZ()-cluster->GetZ(),track->GetX(),cluster->GetX());
   Double_t chi2 = track->GetPredictedChi2MI(cluster->GetY(),cluster->GetZ(),erry,errz);
+  // Bring the track back to detector plane in ideal geometry
+  // [mis-alignment will be accounted for in UpdateMI()]
+  if (!track->PropagateTo(xTrOrig,0.,0.)) return 1000.;
   Float_t ny,nz;
   AliITSClusterParam::GetNTeor(layer,cluster,theta,phi,ny,nz);  
   Double_t delta = cluster->GetNy()+cluster->GetNz()-nz-ny;
@@ -3614,20 +3651,27 @@ Int_t AliITStrackerMI::UpdateMI(AliITStrackMI* track, const AliITSRecPoint* cl,D
 
   if (cl->GetQ()<=0) return 0;  // ingore the "virtual" clusters
 
-  //  Float_t clxyz[3]; cl->GetGlobalXYZ(clxyz);Double_t trxyz[3]; track->GetXYZ(trxyz);//printf("gtr %f %f %f\n",trxyz[0],trxyz[1],trxyz[2]);printf("gcl %f %f %f\n",clxyz[0],clxyz[1],clxyz[2]);
-
 
-  // Take into account the mis-alignment
-  Double_t x=track->GetX()+cl->GetX();
-  if (!track->PropagateTo(x,0.,0.)) return 0;
+  // Take into account the mis-alignment (bring track to cluster plane)
+  Double_t xTrOrig=track->GetX();
+  //Float_t clxyz[3]; cl->GetGlobalXYZ(clxyz);Double_t trxyz[3]; track->GetXYZ(trxyz);printf("gtr %f %f %f\n",trxyz[0],trxyz[1],trxyz[2]);printf("gcl %f %f %f\n",clxyz[0],clxyz[1],clxyz[2]);
+  //printf(" xtr %f  xcl %f\n",track->GetX(),cl->GetX());
 
+  if (!track->PropagateTo(xTrOrig+cl->GetX(),0.,0.)) return 0;
 
   
   AliCluster c(*cl);
   c.SetSigmaY2(track->GetSigmaY(layer)*track->GetSigmaY(layer));
   c.SetSigmaZ2(track->GetSigmaZ(layer)*track->GetSigmaZ(layer));
 
-  return track->UpdateMI(&c,chi2,index);
+
+  Int_t updated = track->UpdateMI(&c,chi2,index);
+
+  // Bring the track back to detector plane in ideal geometry
+  if (!track->PropagateTo(xTrOrig,0.,0.)) return 0;
+
+  //if(!updated) printf("update failed\n");
+  return updated;
 }
 
 //------------------------------------------------------------------------
@@ -4355,7 +4399,7 @@ void AliITStrackerMI::FindV02(AliESDEvent *event)
        if (fnorm0<0) fnorm0*=-3;
        Float_t fnorm1 = normdist[itrack1];
        if (fnorm1<0) fnorm1*=-3;
-       if (pvertex->GetAnglep()[2]>0.1 ||  (pvertex->GetRr()<10.5)&& pvertex->GetAnglep()[2]>0.05 || pvertex->GetRr()<3){
+       if ((pvertex->GetAnglep()[2]>0.1) || ( (pvertex->GetRr()<10.5)&& pvertex->GetAnglep()[2]>0.05 ) || (pvertex->GetRr()<3)){
          pb0    =  TMath::Exp(-TMath::Min(fnorm0,Float_t(16.))/12.);
          pb1    =  TMath::Exp(-TMath::Min(fnorm1,Float_t(16.))/12.);
        }
@@ -4574,8 +4618,8 @@ void AliITStrackerMI::BuildMaterialLUT(TString material) {
   Double_t point1[3],point2[3];
   Double_t phi,cosphi,sinphi,z;
   // 0-5 layers, 6 pipe, 7-8 shields 
-  Double_t rmin[9]={ 3.5, 5.5,13.0,22.0,35.0,41.0, 2.0, 7.5,25.0};
-  Double_t rmax[9]={ 5.5, 7.3,17.0,26.0,41.0,47.0, 3.0,10.5,30.0};
+  Double_t rmin[9]={ 3.5, 5.5,13.0,22.0,35.0,41.0, 2.0, 8.0,25.0};
+  Double_t rmax[9]={ 5.5, 8.0,17.0,26.0,41.0,47.0, 3.0,10.5,30.0};
 
   Int_t ifirst=0,ilast=0;  
   if(material.Contains("Pipe")) {
@@ -4674,7 +4718,8 @@ Int_t AliITStrackerMI::CorrectForPipeMaterial(AliITStrackMI *t,
 
   Float_t  dir = (direction.Contains("inward") ? 1. : -1.);
   Double_t rToGo=(dir>0 ? AliITSRecoParam::GetrInsidePipe() : AliITSRecoParam::GetrOutsidePipe());
-  Double_t xToGo; t->GetLocalXat(rToGo,xToGo);
+  Double_t xToGo;
+  if (!t->GetLocalXat(rToGo,xToGo)) return 0;
 
   Double_t xOverX0,x0,lengthTimesMeanDensity;
   Bool_t anglecorr=kTRUE;
@@ -4768,7 +4813,8 @@ Int_t AliITStrackerMI::CorrectForShieldMaterial(AliITStrackMI *t,
     Error("CorrectForShieldMaterial"," Wrong shield name\n");
     return 0;
   }
-  Double_t xToGo; t->GetLocalXat(rToGo,xToGo);
+  Double_t xToGo;
+  if (!t->GetLocalXat(rToGo,xToGo)) return 0;
 
   Int_t index=2*fCurrentEsdTrack+shieldindex;
 
@@ -4858,7 +4904,8 @@ Int_t AliITStrackerMI::CorrectForLayerMaterial(AliITStrackMI *t,
   Double_t deltar=(layerindex<2 ? 0.10*r : 0.05*r);
 
   Double_t rToGo=TMath::Sqrt(t->GetX()*t->GetX()+t->GetY()*t->GetY())-deltar*dir;
-  Double_t xToGo; t->GetLocalXat(rToGo,xToGo);
+  Double_t xToGo;
+  if (!t->GetLocalXat(rToGo,xToGo)) return 0;
 
   Int_t index=6*fCurrentEsdTrack+layerindex;
 
@@ -4992,8 +5039,7 @@ Int_t AliITStrackerMI::CheckSkipLayer(AliITStrackMI *track,
 //------------------------------------------------------------------------
 Int_t AliITStrackerMI::CheckDeadZone(AliITStrackMI *track,
                                     Int_t ilayer,Int_t idet,
-                                    Double_t zmin,Double_t zmax,
-                                    Double_t ymin,Double_t ymax,
+                                    Double_t dz,Double_t dy,
                                     Bool_t noClusters) const {
   //-----------------------------------------------------------------
   // This method is used to decide whether to allow a prolongation 
@@ -5013,7 +5059,7 @@ Int_t AliITStrackerMI::CheckDeadZone(AliITStrackMI *track,
                          fSPDdetzcentre[2] - 0.5*AliITSRecoParam::GetSPDdetzlength(),
                          fSPDdetzcentre[3] - 0.5*AliITSRecoParam::GetSPDdetzlength()};
     for (Int_t i=0; i<3; i++)
-      if (zmin<zmaxdead[i] && zmax>zmindead[i]) return 1;  
+      if (track->GetZ()-dz<zmaxdead[i] && track->GetZ()+dz>zmindead[i]) return 1;  
   }
 
   // check bad zones from OCDB
@@ -5047,10 +5093,10 @@ Int_t AliITStrackerMI::CheckDeadZone(AliITStrackMI *track,
   // check if the road overlaps with bad chips
   Float_t xloc,zloc;
   LocalModuleCoord(ilayer,idet,track,xloc,zloc);
-  Float_t zlocmin = zloc-0.5*(zmax-zmin);
-  Float_t zlocmax = zloc+0.5*(zmax-zmin);
-  Float_t xlocmin = xloc-0.5*(ymax-ymin);
-  Float_t xlocmax = xloc+0.5*(ymax-ymin);
+  Float_t zlocmin = zloc-dz;
+  Float_t zlocmax = zloc+dz;
+  Float_t xlocmin = xloc-dy;
+  Float_t xlocmax = xloc+dy;
   Int_t chipsInRoad[100];
 
   if (TMath::Max(TMath::Abs(xlocmin),TMath::Abs(xlocmax))>0.5*detSizeX ||
@@ -5113,7 +5159,9 @@ Bool_t AliITStrackerMI::LocalModuleCoord(Int_t ilayer,Int_t idet,
 
   Double_t xyzGlob[3],xyzLoc[3];
 
-  track->GetXYZ(xyzGlob);
+  AliITSdetector &detector = fgLayers[ilayer].GetDetector(idet);
+  // take into account the misalignment: xyz at real detector plane
+  track->GetXYZAt(detector.GetRmisal(),GetBz(),xyzGlob);
 
   AliITSgeomTGeo::GlobalToLocal(ilayer+1,lad,det,xyzGlob,xyzLoc);
 
@@ -5123,8 +5171,18 @@ Bool_t AliITStrackerMI::LocalModuleCoord(Int_t ilayer,Int_t idet,
   return kTRUE;
 }
 //------------------------------------------------------------------------
-Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) const {
-// Method still to be implemented: 
+Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, const Int_t *clusters, Int_t ilayer) const {
+//
+// Method to be optimized further: 
+// Aim: decide whether a track can be used for PlaneEff evaluation
+//      the decision is taken based on the track quality at the layer under study
+//      no information on the clusters on this layer has to be used
+//      The criterium is to reject tracks at boundaries between basic block (e.g. SPD chip)
+//      the cut is done on number of sigmas from the boundaries
+//
+//  Input: Actual track, layer [0,5] under study
+//  Output: none
+//  Return: kTRUE if this is a good track
 //
 // it will apply a pre-selection to obtain good quality tracks.  
 // Here also  you will have the possibility to put a control on the 
@@ -5132,14 +5190,42 @@ Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) cons
 // this will be done by calling a proper method of the AliITSPlaneEff class.  
 //
 // input: AliITStrackMI* track, ilayer= layer number [0,5]
-// output: Bool_t   -> kTRUE 2f usable track, kFALSE if not usable. 
-  if(!fPlaneEff) 
+// return: Bool_t   -> kTRUE if usable track, kFALSE if not usable. 
+//
+  Int_t index[AliITSgeomTGeo::kNLayers];
+  Int_t k;
+  for (k=0; k<AliITSgeomTGeo::GetNLayers(); k++) index[k]=-1;
+  //
+  for (k=0; k<AliITSgeomTGeo::GetNLayers(); k++) {
+    index[k]=clusters[k];
+  }
+
+  if(!fPlaneEff)
     {AliWarning("IsOKForPlaneEff: null pointer to AliITSPlaneEff"); return kFALSE;}
   AliITSlayer &layer=fgLayers[ilayer];
   Double_t r=layer.GetR();
-  //AliITStrackV2 tmp(*track);
   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--) {
+    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++;
+  }
+  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()) 
+     return kFALSE; 
+  if(AliITSReconstructor::GetRecoParam()->GetRequireClusterInOuterLayerPlaneEff() && !nextout)  return kFALSE;
+  if(AliITSReconstructor::GetRecoParam()->GetRequireClusterInInnerLayerPlaneEff() && !nextin)   return kFALSE;
+  if(tmp.Pt() < AliITSReconstructor::GetRecoParam()->GetMinPtPlaneEff()) return kFALSE;
+ //  if(AliITSReconstructor::GetRecoParam()->GetOnlyConstraintPlaneEff()  && !tmp.GetConstrain()) return kFALSE;
+
 // detector number
   Double_t phi,z;
   if (!tmp.GetPhiZat(r,phi,z)) return kFALSE;
@@ -5155,56 +5241,34 @@ Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) cons
 
   Float_t locx; //
   Float_t locz; //
-  LocalModuleCoord(ilayer,idet,&tmp,locx,locz);
+  if(!LocalModuleCoord(ilayer,idet,&tmp,locx,locz)) return kFALSE;
   UInt_t key=fPlaneEff->GetKeyFromDetLocCoord(ilayer,idet,locx,locz);
   if(key>fPlaneEff->Nblock()) return kFALSE;
   Float_t blockXmn,blockXmx,blockZmn,blockZmx;
   if (!fPlaneEff->GetBlockBoundaries(key,blockXmn,blockXmx,blockZmn,blockZmx)) return kFALSE;
-  // transform Local boundaries of the basic block into 
-  //  Global (i.e. ALICE, not tracking reference) coordinate
-  //
-  Double_t a1[3]={blockXmn,0.,blockZmn};
-  Double_t a2[3]={blockXmx,0.,blockZmn};
-  Double_t a3[3]={blockXmn,0.,blockZmx};
-  Int_t ndet=AliITSgeomTGeo::GetNDetectors(ilayer+1); // layers from 1 to 6
-  Int_t lad = Int_t(idet/ndet) + 1;
-  Int_t hdet = idet - (lad-1)*ndet + 1;
-  Double_t xyzGlob[3];
-  AliITSgeomTGeo::LocalToGlobal(ilayer+1,lad,hdet,a1,a1);
-  AliITSgeomTGeo::LocalToGlobal(ilayer+1,lad,hdet,a2,a2);
-  AliITSgeomTGeo::LocalToGlobal(ilayer+1,lad,hdet,a3,a3);
-  Double_t gBlockYmn,gBlockYmx,gBlockZmn,gBlockZmx;
-  if(a1[1]>a2[1]) {gBlockYmn=a2[1]; gBlockYmx=a1[1];}
-  else            {gBlockYmn=a1[1]; gBlockYmx=a2[1];}
-  if(a2[2]>a3[2]) {gBlockZmn=a3[2]; gBlockZmx=a2[2];}
-  else            {gBlockZmn=a2[2]; gBlockZmx=a3[2];}
-  AliDebug(2,Form("Boundaries in Global system Ymin=%f, Ymax=%f, Zmin=%f, Zmax=%f", 
-           gBlockYmn,gBlockYmx,gBlockZmn,gBlockZmx));
-
   //***************
-  // DEFINITION OF SEARCH ROAD FOR accepting a track 
+  // DEFINITION OF SEARCH ROAD FOR accepting a track
   //
   //For the time being they are hard-wired, later on from AliITSRecoParam
-  Double_t dz=4.*TMath::Sqrt(tmp.GetSigmaZ2());  // those are precisions in the tracking reference system
-  Double_t dy=4.*TMath::Sqrt(tmp.GetSigmaY2());  // dy needs to be reduced (it is max now) if you do  
-                                                 // comparison in Global Reference system 
-  Float_t gdz=dz;
-  Float_t gdy=dy*TMath::Abs(TMath::Cos(tmp.GetAlpha()));
-
- // exclude tracks at boundary between detectors
-  //Double_t boundaryWidth=AliITSRecoParam::GetBoundaryWidth();
+  // Double_t nsigx=AliITSRecoParam::GetNSigXFarFromBoundary();
+  // Double_t nsigz=AliITSRecoParam::GetNSigZFarFromBoundary();
+  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
+
+  // exclude tracks at boundary between detectors
+  //Double_t boundaryWidth=AliITSRecoParam::GetBoundaryWidthPlaneEff();
   Double_t boundaryWidth=0; // for the time being hard-wired, later on from AliITSRecoParam
   AliDebug(2,Form("Tracking: track impact x=%f, y=%f, z=%f",tmp.GetX(), tmp.GetY(), tmp.GetZ()));
-  tmp.GetXYZ(xyzGlob);
-  AliDebug(2,Form("Global:   track impact x=%f, y=%f, z=%f",xyzGlob[0],xyzGlob[1],xyzGlob[2]));
-  //AliInfo(Form("TEST GLOBAL track y = %f, z=%f",tmp.GetY(),tmp.GetZ()));
-  AliDebug(2,Form("Search Road. Tracking: dy=%f , dz=%f",dy,dz));
-  AliDebug(2,Form("Search Road. Global: Gdy=%f , Gdz=%f",gdy,gdz));
-  if ( (xyzGlob[1]-gdy < gBlockYmn+boundaryWidth) ||
-       (xyzGlob[1]+gdy > gBlockYmx-boundaryWidth) ||
-       (xyzGlob[2]-gdz < gBlockZmn+boundaryWidth) ||
-       (xyzGlob[2]+gdz > gBlockZmx-boundaryWidth) ) return kFALSE;
+  AliDebug(2,Form("Local:    track impact x=%f, z=%f",locx,locz));
+  AliDebug(2,Form("Search Road. Tracking: dy=%f , dz=%f",dx,dz));
 
+  if ( (locx-dx < blockXmn+boundaryWidth) ||
+       (locx+dx > blockXmx-boundaryWidth) ||
+       (locz-dz < blockZmn+boundaryWidth) ||
+       (locz+dz > blockZmx-boundaryWidth) ) return kFALSE;
   return kTRUE;
 }
 //------------------------------------------------------------------------
@@ -5228,7 +5292,6 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
     {AliWarning("UseTrackForPlaneEff: null pointer to AliITSPlaneEff"); return;}
   AliITSlayer &layer=fgLayers[ilayer];
   Double_t r=layer.GetR();
-  //AliITStrackV2 tmp(*track);
   AliITStrackMI tmp(*track);
 
 // detector number
@@ -5239,14 +5302,11 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
   if(idet<0) { AliInfo(Form("cannot find detector"));
     return;}
 
-  //Double_t trackGlobXYZ1[3];
-  //tmp.GetXYZ(trackGlobXYZ1);
 
 //propagate to the intersection with the detector plane
   const AliITSdetector &det=layer.GetDetector(idet);
   if (!tmp.Propagate(det.GetPhi(),det.GetR())) return;
 
-  //Float_t xloc,zloc;
 
 //***************
 // DEFINITION OF SEARCH ROAD FOR CLUSTERS SELECTION
@@ -5308,7 +5368,7 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
   }*/
   Float_t locx; //
   Float_t locz; //
-  LocalModuleCoord(ilayer,idet,&tmp,locx,locz);
+  if(!LocalModuleCoord(ilayer,idet,&tmp,locx,locz)) return;
 //
   AliDebug(2,Form("ilayer= %d, idet=%d, x= %f, z=%f",ilayer,idet,locx,locz));
   UInt_t key=fPlaneEff->GetKeyFromDetLocCoord(ilayer,idet,locx,locz);
@@ -5340,25 +5400,12 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
     Float_t tr[4]={99999.,99999.,9999.,9999.};    // initialize to high values 
     Float_t clu[4]={-99999.,-99999.,9999.,9999.}; // (in some cases GetCov fails) 
     Int_t cltype[2]={-999,-999};
-    Int_t ndet=AliITSgeomTGeo::GetNDetectors(ilayer+1); // layers from 1 to 6
-    Int_t lad = Int_t(idet/ndet) + 1;
-    Int_t hdet = idet - (lad-1)*ndet + 1;
-    Double_t xyzGlob[3],xyzLoc[3],cv[21],exyzLoc[3],exyzGlob[3];
-    if(tmp.GetXYZ(xyzGlob)) {
-      if (AliITSgeomTGeo::GlobalToLocal(ilayer+1,lad,hdet,xyzGlob,xyzLoc)) {
-        tr[0]=xyzLoc[0];
-        tr[1]=xyzLoc[2];
-      }
-    }
-    if(tmp.GetCovarianceXYZPxPyPz(cv)) {
-      exyzGlob[0]=TMath::Sqrt(cv[0]);
-      exyzGlob[1]=TMath::Sqrt(cv[2]);
-      exyzGlob[2]=TMath::Sqrt(cv[5]);
-      if (AliITSgeomTGeo::GlobalToLocalVect(AliITSgeomTGeo::GetModuleIndex(ilayer+1,lad,hdet),exyzGlob,exyzLoc)) { 
-        tr[2]=TMath::Abs(exyzLoc[0]);
-        tr[3]=TMath::Abs(exyzLoc[2]);
-      }
-    }
+
+    tr[0]=locx;
+    tr[1]=locz;
+    tr[2]=TMath::Sqrt(tmp.GetSigmaY2());  // those are precisions in the tracking reference system
+    tr[3]=TMath::Sqrt(tmp.GetSigmaZ2());  // Use it also for the module reference system, as it is
+
     if (found){
       clu[0]=layer.GetCluster(ci)->GetDetLocalX();
       clu[1]=layer.GetCluster(ci)->GetDetLocalZ();
@@ -5377,18 +5424,9 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
         AliCluster c(*layer.GetCluster(ci));
         c.SetSigmaY2(tmp.GetSigmaY(ilayer)*tmp.GetSigmaY(ilayer));
         c.SetSigmaZ2(tmp.GetSigmaZ(ilayer)*tmp.GetSigmaZ(ilayer));
-        Float_t cov[6];
         //if (layer.GetCluster(ci)->GetGlobalCov(cov))  // by using this, instead, you got nominal cluster errors
-        if (c.GetGlobalCov(cov)) 
-        {
-          exyzGlob[0]=TMath::Sqrt(cov[0]);
-          exyzGlob[1]=TMath::Sqrt(cov[3]);
-          exyzGlob[2]=TMath::Sqrt(cov[5]);
-          if (AliITSgeomTGeo::GlobalToLocalVect(AliITSgeomTGeo::GetModuleIndex(ilayer+1,lad,hdet),exyzGlob,exyzLoc)) {
-            clu[2]=TMath::Abs(exyzLoc[0]);  
-            clu[3]=TMath::Abs(exyzLoc[2]);  
-          }
-        }
+        clu[2]=TMath::Sqrt(c.GetSigmaY2());
+        clu[3]=TMath::Sqrt(c.GetSigmaZ2());
       //}
     }
     fPlaneEff->FillHistos(key,found,tr,clu,cltype);