]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITStrackerMI.cxx
Eff C++ warning removal (Marian)
[u/mrichter/AliRoot.git] / ITS / AliITStrackerMI.cxx
index 0cd03af45300db93ba527c08ec3690df96af42d4..0b3677596c6d1e2a443c11e2702586590f98a31f 100644 (file)
@@ -12,7 +12,7 @@
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/* $Id$ */
+/* $Id:$ */
 
 //-------------------------------------------------------------------------
 //               Implementation of the ITS tracker class
@@ -220,6 +220,10 @@ fPlaneEff(0) {
     }
     if(!fPlaneEff->ReadFromCDB()) 
       {AliWarning("AliITStrackerMI reading of AliITSPlaneEff from OCDB failed") ;}
+    if(AliITSReconstructor::GetRecoParam()->GetHistoPlaneEff()) {
+      fPlaneEff->SetCreateHistos(kTRUE); 
+      //fPlaneEff->ReadHistosFromFile();
+    }
   }
 }
 //------------------------------------------------------------------------
@@ -4886,7 +4890,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");
@@ -4937,6 +4941,8 @@ Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) cons
 //
 // input: AliITStrackMI* track, ilayer= layer number [0,5]
 // output: Bool_t   -> kTRUE 2f usable track, kFALSE if not usable. 
+  if(!fPlaneEff) 
+    {AliWarning("IsOKForPlaneEff: null pointer to AliITSPlaneEff"); return kFALSE;}
   AliITSlayer &layer=fgLayers[ilayer];
   Double_t r=layer.GetR();
   //AliITStrackV2 tmp(*track);
@@ -4962,7 +4968,8 @@ Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) cons
   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. tracking) coordinate
+  // 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};
@@ -4970,29 +4977,41 @@ Bool_t AliITStrackerMI::IsOKForPlaneEff(AliITStrackMI* track, Int_t ilayer) cons
   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=a2[2]; gBlockZmx=a3[2];}
-  else            {gBlockZmn=a3[2]; gBlockZmx=a2[2];}
+  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 
   //
   //For the time being they are hard-wired, later on from AliITSRecoParam
-  Double_t dz=4.*TMath::Sqrt(tmp.GetSigmaZ2()); 
-  Double_t dy=4.*TMath::Sqrt(tmp.GetSigmaY2()); 
+  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 boundaryWidth=0; // for the time being hard-wired, later on from AliITSRecoParam
-  if ( (tmp.GetY()-dy < gBlockYmn+boundaryWidth) ||
-       (tmp.GetY()+dy > gBlockYmx-boundaryWidth) ||
-       (tmp.GetZ()-dz < gBlockZmn+boundaryWidth) ||
-       (tmp.GetZ()+dz > gBlockZmx-boundaryWidth) ) return kFALSE;
+  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;
 
   return kTRUE;
 }
@@ -5013,6 +5032,8 @@ void AliITStrackerMI::UseTrackForPlaneEff(AliITStrackMI* track, Int_t ilayer) {
 //                  AliITSPlaneEff::UpDatePlaneEff(key,kTRUE);
 //               - if not, the AliITSPlaneEff::UpDatePlaneEff(key,kFALSE) is called
 //
+  if(!fPlaneEff)
+    {AliWarning("UseTrackForPlaneEff: null pointer to AliITSPlaneEff"); return;}
   AliITSlayer &layer=fgLayers[ilayer];
   Double_t r=layer.GetR();
   //AliITStrackV2 tmp(*track);
@@ -5102,6 +5123,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;
@@ -5110,7 +5132,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;
@@ -5121,5 +5144,62 @@ 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],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;
 }