Introducing event specie in QA (Yves)
[u/mrichter/AliRoot.git] / STEER / AliTracker.cxx
index 1311980..3681118 100644 (file)
 //-------------------------------------------------------------------------
 #include <TClass.h>
 #include <TMath.h>
+#include <TH1F.h>
 #include <TGeoManager.h>
 
 #include "AliMagF.h"
 #include "AliTracker.h"
+#include "AliGeomManager.h"
 #include "AliCluster.h"
 #include "AliKalmanTrack.h"
 
@@ -34,6 +36,9 @@ extern TGeoManager *gGeoManager;
 Bool_t AliTracker::fgUniformField=kTRUE;
 Double_t AliTracker::fgBz=kAlmost0Field;
 const AliMagF *AliTracker::fgkFieldMap=0;
+Bool_t AliTracker::fFillResiduals=kFALSE;
+TObjArray **AliTracker::fResiduals=NULL;
+AliRecoParam::EventSpecie_t AliTracker::fEventSpecie=AliRecoParam::kDefault;
 
 ClassImp(AliTracker)
 
@@ -44,7 +49,7 @@ AliTracker::AliTracker():
   fZ(0),
   fSigmaX(0.005),
   fSigmaY(0.005),
-  fSigmaZ(0.010)
+  fSigmaZ(0.010) 
 {
   //--------------------------------------------------------------------
   // The default constructor.
@@ -92,11 +97,23 @@ void AliTracker::SetFieldMap(const AliMagF* map, Bool_t uni) {
 }
 
 //__________________________________________________________________________
+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.");
+}
+
+//__________________________________________________________________________
 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];
@@ -152,7 +169,7 @@ void AliTracker::UseClusters(const AliKalmanTrack *t, Int_t from) const {
   }
 }
 
-Double_t AliTracker::GetBz(Float_t *r) {
+Double_t AliTracker::GetBz(const Float_t *r) {
   //------------------------------------------------------------------
   // Returns Bz (kG) at the point "r" .
   //------------------------------------------------------------------
@@ -162,7 +179,7 @@ Double_t AliTracker::GetBz(Float_t *r) {
 }
 
 Double_t 
-AliTracker::MeanMaterialBudget(Double_t *start,Double_t *end,Double_t *mparam)
+AliTracker::MeanMaterialBudget(const Double_t *start, const Double_t *end, Double_t *mparam)
 {
   // 
   // Calculate mean material budget and material properties between 
@@ -216,7 +233,7 @@ AliTracker::MeanMaterialBudget(Double_t *start,Double_t *end,Double_t *mparam)
   TGeoNode *startnode = gGeoManager->InitTrack(start, dir);
   //printf("%s length=%f\n",gGeoManager->GetPath(),length);
   if (!startnode) {
-    AliErrorClass(Form("start point out of geometry: x %f, y %f, z %f\n",
+    AliErrorClass(Form("start point out of geometry: x %f, y %f, z %f",
                  start[0],start[1],start[2]));
     return 0.0;
   }
@@ -367,3 +384,45 @@ Double_t mass, Double_t maxStep, Bool_t rotateTo, Double_t maxSnp){
   return kTRUE;
 }
 
+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;
+  AliGeomManager::ELayerID layer=AliGeomManager::VolUIDToLayer(id);
+  h=(TH1F*)fResiduals[fEventSpecie]->At(2*layer-2);
+  h->Fill(residuals[0]);
+  h=(TH1F*)fResiduals[fEventSpecie]->At(2*layer-1);
+  h->Fill(residuals[1]);
+
+  if (layer==5) {
+    if (p[1]<0) {  // SSD1 absolute residuals
+       ((TH1F*)fResiduals[fEventSpecie]->At(40))->Fill(t->GetY()-p[0]); //C side
+       ((TH1F*)fResiduals[fEventSpecie]->At(41))->Fill(t->GetZ()-p[1]);
+    } else {             
+       ((TH1F*)fResiduals[fEventSpecie]->At(42))->Fill(t->GetY()-p[0]); //A side
+       ((TH1F*)fResiduals[fEventSpecie]->At(43))->Fill(t->GetZ()-p[1]);
+    }           
+  }
+  if (layer==6) {  // SSD2 absolute residuals
+    if (p[1]<0) {
+       ((TH1F*)fResiduals[fEventSpecie]->At(44))->Fill(t->GetY()-p[0]); //C side
+       ((TH1F*)fResiduals[fEventSpecie]->At(45))->Fill(t->GetZ()-p[1]);
+    } else {
+       ((TH1F*)fResiduals[fEventSpecie]->At(46))->Fill(t->GetY()-p[0]); //A side
+       ((TH1F*)fResiduals[fEventSpecie]->At(47))->Fill(t->GetZ()-p[1]);
+    }
+  }
+
+}
+