]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliTracker.cxx
turned off HLTError into Debug
[u/mrichter/AliRoot.git] / STEER / AliTracker.cxx
index 8e9ec1322a3e76659fa39f944d46661af1af1937..5cac8da6493c85243e1bb21e628378c7871f89fa 100644 (file)
 //-------------------------------------------------------------------------
 
 #include <TMath.h>
+#include <TH1F.h>
+#include <TGeoMatrix.h>
 
 #include "AliTracker.h"
+#include "AliGeomManager.h"
 #include "AliCluster.h"
 #include "AliKalmanTrack.h"
-#include "AliRun.h"
-#include "AliMagF.h"
+#include "AliGlobalQADataMaker.h"
 
-extern AliRun* gAlice;
-
-const AliMagF *AliTracker::fgkFieldMap=0;
+Bool_t AliTracker::fFillResiduals=kFALSE;
+TObjArray **AliTracker::fResiduals=NULL;
+AliRecoParam::EventSpecie_t AliTracker::fEventSpecie=AliRecoParam::kDefault;
 
 ClassImp(AliTracker)
 
 AliTracker::AliTracker():
-  fEventN(0),
-  fStoreBarrel(1),
-  fX(0),
-  fY(0),
-  fZ(0),
-  fSigmaX(0.005),
-  fSigmaY(0.005),
-  fSigmaZ(0.010)
+  AliTrackerBase(),
+  fEventInfo(NULL)
 {
   //--------------------------------------------------------------------
   // The default constructor.
   //--------------------------------------------------------------------
- AliMagF *field=gAlice->Field();
- if (field==0) Fatal("AliTracker()","Can't access the field map !");
- SetFieldMap(field);
 }
 
-void AliTracker::SetFieldMap(const AliMagF* map) {
+//__________________________________________________________________________
+AliTracker::AliTracker(const AliTracker &atr):
+  AliTrackerBase(atr),
+  fEventInfo(atr.fEventInfo)
+{
   //--------------------------------------------------------------------
-  //This passes the field map to the reconstruction.
+  // The default constructor.
   //--------------------------------------------------------------------
-  if (map==0) ::Fatal("SetFieldMap","Can't access the field map !");
-  AliKalmanTrack::SetConvConst(1000/0.299792458/map->SolenoidField());
-  fgkFieldMap=map;
+}
+
+//__________________________________________________________________________
+void AliTracker::FillClusterArray(TObjArray* /*array*/) const
+{
+  // Publishes all pointers to clusters known to the tracker into the
+  // passed object array.
+  // The ownership is not transfered - the caller is not expected to delete
+  // the clusters.
+
+  AliWarning("should be overriden by a sub-class.");
 }
 
 //__________________________________________________________________________
@@ -68,6 +73,7 @@ void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
   //This function "cooks" a track label. If label<0, this track is fake.
   //--------------------------------------------------------------------
   Int_t noc=t->GetNumberOfClusters();
+  if (noc<1) return;
   Int_t *lb=new Int_t[noc];
   Int_t *mx=new Int_t[noc];
   AliCluster **clusters=new AliCluster*[noc];
@@ -85,8 +91,10 @@ void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
     lab=TMath::Abs(c->GetLabel(0));
     Int_t j;
     for (j=0; j<noc; j++) if (lb[j]==lab || mx[j]==0) break;
-    lb[j]=lab;
-    (mx[j])++;
+    if (j<noc) {
+       lb[j]=lab;
+       (mx[j])++;
+    }
   }
 
   Int_t max=0;
@@ -94,11 +102,15 @@ void AliTracker::CookLabel(AliKalmanTrack *t, Float_t wrong) const {
     
   for (i=0; i<noc; i++) {
     AliCluster *c=clusters[i];
-    if (TMath::Abs(c->GetLabel(1)) == lab ||
-        TMath::Abs(c->GetLabel(2)) == lab ) max++;
+    //if (TMath::Abs(c->GetLabel(1)) == lab ||
+    //    TMath::Abs(c->GetLabel(2)) == lab ) max++;
+    if (TMath::Abs(c->GetLabel(0)!=lab))
+       if (TMath::Abs(c->GetLabel(1)) == lab ||
+           TMath::Abs(c->GetLabel(2)) == lab ) max++;
   }
 
   if ((1.- Float_t(max)/noc) > wrong) lab=-lab;
+  t->SetFakeRatio((1.- Float_t(max)/noc));
   t->SetLabel(lab);
 
   delete[] lb;
@@ -118,3 +130,96 @@ void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const {
      c->Use();   
   }
 }
+
+void AliTracker::FillResiduals(const AliExternalTrackParam *t,
+                             Double_t *p, Double_t *cov, 
+                              UShort_t id, Bool_t updated) {
+  //
+  // This function fills the histograms of residuals 
+  // The array of these histos is external for this AliTracker class.
+  // Normally, this array belong to AliGlobalQADataMaker class.  
+  // 
+  if (!fFillResiduals) return; 
+  if (!fResiduals) return; 
+
+  const Double_t *residuals=t->GetResiduals(p,cov,updated);
+  if (!residuals) return;
+
+  TH1F *h=0;
+  Int_t esIndex = AliRecoParam::AConvert(fEventSpecie) ; 
+  AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id);
+  h=(TH1F*)fResiduals[esIndex]->At(2*layer-2);
+  if (h) h->Fill(residuals[0]);
+  h=(TH1F*)fResiduals[esIndex]->At(2*layer-1);
+  if (h) h->Fill(residuals[1]);
+
+  if (layer==5) {
+    if (p[1]<0) {  // SSD1 absolute residuals
+      h = (TH1F*)fResiduals[esIndex]->At(40);
+      if (h) h->Fill(t->GetY()-p[0]); //C side
+      h = (TH1F*)fResiduals[esIndex]->At(41);
+      if (h) h->Fill(t->GetZ()-p[1]);
+    } else {             
+      h = (TH1F*)fResiduals[esIndex]->At(42);
+      if (h) h->Fill(t->GetY()-p[0]); //A side
+      h = (TH1F*)fResiduals[esIndex]->At(43);
+      if (h) h->Fill(t->GetZ()-p[1]);
+    }           
+  }
+  if (layer==6) {  // SSD2 absolute residuals
+    if (p[1]<0) {
+      h = (TH1F*)fResiduals[esIndex]->At(44);
+      if (h) h->Fill(t->GetY()-p[0]); //C side
+      h = (TH1F*)fResiduals[esIndex]->At(45);
+      if (h) h->Fill(t->GetZ()-p[1]);
+    } else {
+      h = (TH1F*)fResiduals[esIndex]->At(46);
+      if (h) h->Fill(t->GetY()-p[0]); //A side
+      h = (TH1F*)fResiduals[esIndex]->At(47);
+      if (h) h->Fill(t->GetZ()-p[1]);
+    }
+  }
+
+}
+
+void AliTracker::FillResiduals(const AliExternalTrackParam *t,
+                               const AliCluster *c, Bool_t /*updated*/) {
+  //
+  // This function fills the histograms of residuals 
+  // The array of these histos is external for this AliTracker class.
+  // Normally, this array belong to AliGlobalQADataMaker class.  
+  // 
+  // For the moment, the residuals are absolute !
+  //
+
+  if (!fFillResiduals) return; 
+  if (!fResiduals) return; 
+
+  UShort_t id=c->GetVolumeId();
+  const TGeoHMatrix *matrixT2L=AliGeomManager::GetTracking2LocalMatrix(id);
+
+  // Position of the cluster in the tracking c.s.
+  Double_t clsTrk[3]={c->GetX(), c->GetY(), c->GetZ()};
+  // Position of the cluster in the local module c.s.
+  Double_t clsLoc[3]={0.,0.,0.};
+  matrixT2L->LocalToMaster(clsTrk,clsLoc);
+
+
+  // Position of the intersection point in the tracking c.s.
+  Double_t trkTrk[3]={t->GetX(),t->GetY(),t->GetZ()};
+  // Position of the intersection point in the local module c.s.
+  Double_t trkLoc[3]={0.,0.,0.};
+  matrixT2L->LocalToMaster(trkTrk,trkLoc);
+
+  Double_t residuals[2]={trkLoc[0]-clsLoc[0], trkLoc[2]-clsLoc[2]};
+
+  TH1F *h=0;
+  Int_t esIndex = AliRecoParam::AConvert(fEventSpecie) ; 
+  AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id);
+  h=(TH1F*)fResiduals[esIndex]->At(2*layer-2);
+  if (h) h->Fill(residuals[0]);
+  h=(TH1F*)fResiduals[esIndex]->At(2*layer-1);
+  if (h) h->Fill(residuals[1]);
+
+}
+