]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITStrackerMI.cxx
Bug fix: adding SHLIB to SYSLIBS (C.Holm)
[u/mrichter/AliRoot.git] / ITS / AliITStrackerMI.cxx
index 412afc6c60abe3f71b7c5a7ac700c6164a5640de..97cc085c21f050df658e7353ea8a79913ff2aaf1 100644 (file)
@@ -31,7 +31,6 @@
 #include <TString.h>
 #include <TRandom.h>
 
-
 #include "AliESDEvent.h"
 #include "AliESDtrack.h"
 #include "AliESDVertex.h"
@@ -218,8 +217,8 @@ fPlaneEff(0) {
         break; // only one layer type to skip at once
       }
     }
-    if(!fPlaneEff->ReadFromCDB()) 
-      {AliWarning("AliITStrackerMI reading of AliITSPlaneEff from OCDB failed") ;}
+    if(AliITSReconstructor::GetRecoParam()->GetReadPlaneEffFromOCDB())
+       if(!fPlaneEff->ReadFromCDB()) {AliWarning("AliITStrackerMI reading of AliITSPlaneEff from OCDB failed") ;}
     if(AliITSReconstructor::GetRecoParam()->GetHistoPlaneEff()) {
       fPlaneEff->SetCreateHistos(kTRUE); 
       //fPlaneEff->ReadHistosFromFile();
@@ -403,6 +402,8 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
   // This functions reconstructs ITS tracks
   // The clusters must be already loaded !
   //--------------------------------------------------------------------
+
+
   fTrackingPhase="Clusters2Tracks";
 
   TObjArray itsTracks(15000);
@@ -522,11 +523,9 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
      GetBestHypothesysMIP(itsTracks); 
   } // end loop on the two tracking passes
 
-  //GetBestHypothesysMIP(itsTracks);
   if(event->GetNumberOfV0s()>0) UpdateTPCV0(event);
   if(AliITSReconstructor::GetRecoParam()->GetFindV0s()) FindV02(event);
   fAfterV0 = kTRUE;
-  //GetBestHypothesysMIP(itsTracks);
   //
   itsTracks.Delete();
   //
@@ -2857,7 +2856,8 @@ void AliITStrackerMI::AddTrackHypothesys(AliITStrackMI * track, Int_t esdindex)
   // add track to the list of hypothesys
   //------------------------------------------------------------------
 
-  if (esdindex>=fTrackHypothesys.GetEntriesFast()) fTrackHypothesys.Expand(esdindex*2+10);
+  if (esdindex>=fTrackHypothesys.GetEntriesFast()) 
+    fTrackHypothesys.Expand(TMath::Max(fTrackHypothesys.GetSize(),esdindex*2+10));
   //
   TObjArray * array = (TObjArray*) fTrackHypothesys.At(esdindex);
   if (!array) {
@@ -3138,7 +3138,8 @@ AliITStrackMI * AliITStrackerMI::GetBestHypothesys(Int_t esdindex, AliITStrackMI
   delete forwardtrack;
   Int_t accepted=0;
   for (Int_t i=0;i<entries;i++){    
-    AliITStrackMI * track = (AliITStrackMI*)array->At(i);   
+    AliITStrackMI * track = (AliITStrackMI*)array->At(i);
+   
     if (!track) continue;
     
     if (accepted>checkmax || track->GetChi2MIP(3)>AliITSReconstructor::GetRecoParam()->GetMaxChi2PerCluster(3)*6. || 
@@ -3156,6 +3157,7 @@ AliITStrackMI * AliITStrackerMI::GetBestHypothesys(Int_t esdindex, AliITStrackMI
   //
   array->Compress();
   SortTrackHypothesys(esdindex,checkmax,1);
+
   array = (TObjArray*) fTrackHypothesys.At(esdindex);
   if (!array) return 0; // PH What can be the reason? Check SortTrackHypothesys
   besttrack = (AliITStrackMI*)array->At(0);  
@@ -3458,12 +3460,14 @@ 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]);
+  //  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;
+
+
   
   AliCluster c(*cl);
   c.SetSigmaY2(track->GetSigmaY(layer)*track->GetSigmaY(layer));
@@ -4890,7 +4894,7 @@ Int_t AliITStrackerMI::CheckDeadZone(/*AliITStrackMI *track,*/
     if(ilayer==3) idet += AliITSgeomTGeo::GetNLadders(3)*AliITSgeomTGeo::GetNDetectors(3);
     //printf("SDD det: %d\n",idet);
     AliITSCalibrationSDD *calibSDD = (AliITSCalibrationSDD*)sddEntry->At(idet);
-    if (calibSDD->IsDead()) return 2;
+    if (calibSDD->IsBad()) return 2;
   } else if (ilayer==4 || ilayer==5) { // SSD
   } else {
     Error("CheckDeadZone","Wrong layer number\n");
@@ -5123,6 +5127,7 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
   if(key>fPlaneEff->Nblock()) return;
   Bool_t found=kFALSE;
   //if (ci>=0) {
+  Double_t chi2;
   while ((cl=layer.GetNextCluster(clidx))!=0) {
     idetc = cl->GetDetectorIndex();
     if(idet!=idetc) continue;
@@ -5131,7 +5136,8 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
     if ( (tmp.GetZ()-cl->GetZ())*(tmp.GetZ()-cl->GetZ())*msz +
          (tmp.GetY()-cl->GetY())*(tmp.GetY()-cl->GetY())*msy   > 1. ) continue;
     // calculate track-clusters chi2
-    Double_t chi2 = GetPredictedChi2MI(&tmp,cl,ilayer); // note that this method change track tmp
+    chi2 = GetPredictedChi2MI(&tmp,cl,ilayer); // note that this method change track tmp
+                                               // in particular, the error associated to the cluster 
     //Double_t chi2 = tmp.GetPredictedChi(cl); // this method does not change track tmp
     // chi2 cut
     if (chi2 > AliITSReconstructor::GetRecoParam()->GetMaxChi2s(ilayer)) continue;
@@ -5143,20 +5149,61 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
   if(!fPlaneEff->UpDatePlaneEff(found,key))
        AliWarning(Form("UseTrackForPlaneEff: cannot UpDate PlaneEff for key=%d",key));
   if(fPlaneEff->GetCreateHistos()&&  AliITSReconstructor::GetRecoParam()->GetHistoPlaneEff()) {
+    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];
-    tmp.GetXYZ(xyzGlob);
-    AliITSgeomTGeo::GlobalToLocal(ilayer+1,lad,hdet,xyzGlob,xyzLoc);
-    Float_t tr[2]={xyzLoc[0],xyzLoc[2]};
-    Float_t cl[2];
-    cl[0]=layer.GetCluster(ci)->GetDetLocalX();
-    cl[1]=layer.GetCluster(ci)->GetDetLocalZ();
-    Int_t cltype[2];
-    cltype[0]=layer.GetCluster(ci)->GetNy();
-    cltype[1]=layer.GetCluster(ci)->GetNz();
-    fPlaneEff->FillHistos(key,found,tr,cl,cltype);
+    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]);
+      }
+    }
+    if (found){
+      clu[0]=layer.GetCluster(ci)->GetDetLocalX();
+      clu[1]=layer.GetCluster(ci)->GetDetLocalZ();
+      cltype[0]=layer.GetCluster(ci)->GetNy();
+      cltype[1]=layer.GetCluster(ci)->GetNz();
+     
+     // Without the following 6 lines you would retrieve the nominal error of a cluster (e.g. for the SPD:
+     //  X->50/sqrt(12)=14 micron   Z->450/sqrt(12)= 120 micron) 
+     // Within AliTrackerMI/AliTrackMI the error on the cluster is associated to the AliITStrackMI (fSigmaY,Z)
+     // It is computed properly by calling the method 
+     // AliITStrackerMI::GetPredictedChi2MI(AliITStrackMI* track, const AliITSRecPoint *cluster,Int_t layer)
+     // T
+     //Double_t x=0.5*(tmp.GetX()+layer.GetCluster(ci)->GetX()); // Take into account the mis-alignment
+      //if (tmp.PropagateTo(x,0.,0.)) {
+        chi2=GetPredictedChi2MI(&tmp,layer.GetCluster(ci),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]);  
+          }
+        }
+      //}
+    }
+    fPlaneEff->FillHistos(key,found,tr,clu,cltype);
   }
 return;
 }