From 612ae7edcde1e2083a6b8d65a5ac596ee0d14ab3 Mon Sep 17 00:00:00 2001 From: abercuci Date: Tue, 18 Nov 2008 13:43:41 +0000 Subject: [PATCH] improve tracklet-MC matching diagnostics --- TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.cxx | 20 ++++- TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.h | 2 +- TRD/qaRec/AliTRDtrackingResolution.cxx | 76 ++++++++++++++----- 3 files changed, 72 insertions(+), 26 deletions(-) diff --git a/TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.cxx b/TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.cxx index e1a03feaaed..4be6aaf8b81 100644 --- a/TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.cxx +++ b/TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.cxx @@ -31,6 +31,7 @@ #include "AliTRDseedV1.h" #include "AliTRDtrackV1.h" +#include "AliTRDgeometry.h" #include #include @@ -348,10 +349,17 @@ void AliTRDtrackInfo::SetSlices(Int_t n, Double32_t *s) } //___________________________________________________ -Bool_t AliTRDtrackInfo::AliMCinfo::GetDirections(Float_t x0, Float_t &y0, Float_t &z0, Float_t &dydx, Float_t &dzdx) const +Bool_t AliTRDtrackInfo::AliMCinfo::GetDirections(Float_t x0, Float_t &y0, Float_t &z0, Float_t &dydx, Float_t &dzdx, UChar_t &status) const { - // check for 2 track ref where the radial position has a distance less than 3.7mm and are close to the x0 - +// Check for 2 track ref for the tracklet defined bythe radial position x0 +// The "status" is a bit map and gives a more informative output in case of failure: +// - 0 : everything is OK +// - BIT(0) : 0 track refs found +// - BIT(1) : 1 track reference found +// - BIT(2) : dx <= 0 between track references +// - BIT(3) : dx > 0 && dx < 3.7 - tangent tracks + + status = 0; Int_t nFound = 0; AliTrackReference *tr[2] = {0x0, 0x0}; AliTrackReference * const* jtr = &fTrackRefs[0]; @@ -365,13 +373,17 @@ Bool_t AliTRDtrackInfo::AliMCinfo::GetDirections(Float_t x0, Float_t &y0, Float_ } if(nFound < 2){ AliWarningGeneral("AliTRDtrackInfo::AliMCinfo::GetDirections()", Form("Missing track ref x0[%6.3f] nref[%d]\n", x0, nFound)); + if(!nFound) SETBIT(status, 0); + else SETBIT(status, 1); return kFALSE; } Double_t dx = tr[1]->LocalX() - tr[0]->LocalX(); - if(dx <= 0. || TMath::Abs(dx-3.7)>1.E-3){ + if(dx <= 0.){ AliWarningGeneral("AliTRDtrackInfo::AliMCinfo::GetDirections()", Form("Track ref with wrong radial distances refX0[%6.3f] refX1[%6.3f]", tr[0]->LocalX(), tr[1]->LocalX())); + SETBIT(status, 2); return kFALSE; } + if(TMath::Abs(dx-AliTRDgeometry::CamHght()-AliTRDgeometry::CdrHght())>1.E-3) SETBIT(status, 3); dydx = (tr[1]->LocalY() - tr[0]->LocalY()) / dx; dzdx = (tr[1]->Z() - tr[0]->Z()) / dx; diff --git a/TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.h b/TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.h index c095de2f058..68f35b3985e 100644 --- a/TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.h +++ b/TRD/qaRec/AliTRDtrackInfo/AliTRDtrackInfo.h @@ -71,7 +71,7 @@ public: Int_t GetLabel() const {return fLabel;} Int_t GetNTrackRefs() const {return fNTrackRefs;} Int_t GetPDG() const {return fPDG;} - Bool_t GetDirections(Float_t x0, Float_t &y0, Float_t &z0, Float_t &dydx, Float_t &dzdx) const; + Bool_t GetDirections(Float_t x0, Float_t &y0, Float_t &z0, Float_t &dydx, Float_t &dzdx, UChar_t &s) const; AliTrackReference const* GetTrackRef(Int_t ref=0) const {return fTrackRefs[ref];} protected: diff --git a/TRD/qaRec/AliTRDtrackingResolution.cxx b/TRD/qaRec/AliTRDtrackingResolution.cxx index 31548719b4a..e246b4eb3fc 100644 --- a/TRD/qaRec/AliTRDtrackingResolution.cxx +++ b/TRD/qaRec/AliTRDtrackingResolution.cxx @@ -330,6 +330,7 @@ TH1* AliTRDtrackingResolution::PlotClusterResiduals(const AliTRDtrackV1 *track) } Int_t pdg = fMC ? fMC->GetPDG() : 0; + UChar_t s; Float_t x0, y0, z0, dy, dydx, dzdx; AliTRDseedV1 *fTracklet = 0x0; for(Int_t ily=0; ilyGetDirections(x0, y0, z0, dydx, dzdx)) continue; + if(!fMC->GetDirections(x0, y0, z0, dydx, dzdx, s)) continue; }else{ y0 = fTracklet->GetYref(0); z0 = fTracklet->GetZref(0); @@ -418,6 +419,7 @@ TH1* AliTRDtrackingResolution::PlotResolution(const AliTRDtrackV1 *track) return 0x0; } //printf("called for %d tracklets ... \n", fTrack->GetNumberOfTracklets()); + UChar_t s; Int_t pdg = fMC->GetPDG(), det=-1; Float_t x0, y0, z0, dy, dydx, dzdx; AliTRDseedV1 *fTracklet = 0x0; @@ -428,16 +430,14 @@ TH1* AliTRDtrackingResolution::PlotResolution(const AliTRDtrackV1 *track) // retrive the track position and direction within the chamber det = fTracklet->GetDetector(); x0 = fTracklet->GetX0(); - if(!fMC->GetDirections(x0, y0, z0, dydx, dzdx)) continue; + if(!fMC->GetDirections(x0, y0, z0, dydx, dzdx, s)) continue; - if(fMC->GetLabel() == 189){ - printf("x0[%f] y0[%f] z0[%f] dydx[%f] dzdx[%f]\n", x0, y0, z0, dydx, dzdx); - } // recalculate tracklet based on the MC info AliTRDseedV1 tt(*fTracklet); tt.SetZref(0, z0); tt.SetZref(1, dzdx); - if(!tt.Fit()) continue; + if(!tt.Fit(kFALSE)) continue; + //tt.Update(); dy = tt.GetYfit(0) - y0; Float_t dphi = TMath::ATan(tt.GetYfit(1)) - TMath::ATan(dydx); Float_t dz = 100.; @@ -445,7 +445,7 @@ TH1* AliTRDtrackingResolution::PlotResolution(const AliTRDtrackV1 *track) if(cross){ Double_t *xyz = tt.GetCrossXYZ(); dz = xyz[2] - (z0 - (x0 - xyz[0])*dzdx) ; - ((TH2I*)fContainer->At(kTrackletYResolution))->Fill(dzdx, dz); + ((TH2I*)fContainer->At(kTrackletZResolution))->Fill(dzdx, dz); } // Fill Histograms @@ -552,7 +552,7 @@ void AliTRDtrackingResolution::GetRefFigure(Int_t ifig) ax->SetRangeUser(-.5, 1.); ax->SetTitle("Tracklet Y Resolution #sigma/#mu [mm]"); ax = g->GetHistogram()->GetXaxis(); - ax->SetTitle("#tg(phi)"); + ax->SetTitle("tg(#phi)"); g->Draw("apl"); if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; g->Draw("pl"); @@ -563,7 +563,7 @@ void AliTRDtrackingResolution::GetRefFigure(Int_t ifig) ax->SetRangeUser(-.5, 1.); ax->SetTitle("Tracklet Z Resolution #sigma/#mu [mm]"); ax = g->GetHistogram()->GetXaxis(); - ax->SetTitle("#tg(theta)"); + ax->SetTitle("tg(#theta)"); g->Draw("apl"); if(!(g = (TGraphErrors*)fGraphM->At(ifig))) break; g->Draw("pl"); @@ -673,18 +673,22 @@ Bool_t AliTRDtrackingResolution::PostProcess() fGraphS->AddAt(gs, kClusterResolution); for(Int_t iphi=1; iphi<=h2->GetNbinsX(); iphi++){ h = h2->ProjectionY("py", iphi, iphi); - AdjustF1(h, &fb); + if(h->GetEntries()<100.) continue; + AdjustF1(h, &f); if(IsVisual()){c->cd(); c->SetLogy();} - h->Fit(&fb, opt, "", -0.5, 0.5); + h->Fit(&f, opt, "", -0.5, 0.5); + if(IsVerbose()){ + printf("phi[%d] mean[%e] sigma[%e]\n\n", iphi, 10.*f.GetParameter(1), 10.*f.GetParameter(2)); + } if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} Double_t phi = h2->GetXaxis()->GetBinCenter(iphi); Int_t jphi = iphi -1; - gm->SetPoint(jphi, TMath::Tan(phi*TMath::DegToRad()), 10.*fb.GetParameter(1)); - gm->SetPointError(jphi, 0., 10.*fb.GetParError(1)); - gs->SetPoint(jphi, TMath::Tan(phi*TMath::DegToRad()), 10.*fb.GetParameter(2)); - gs->SetPointError(jphi, 0., 10.*fb.GetParError(2)); + gm->SetPoint(jphi, TMath::Tan(phi*TMath::DegToRad()), 10.*f.GetParameter(1)); + gm->SetPointError(jphi, 0., 10.*f.GetParError(1)); + gs->SetPoint(jphi, TMath::Tan(phi*TMath::DegToRad()), 10.*f.GetParameter(2)); + gs->SetPointError(jphi, 0., 10.*f.GetParError(2)); } // tracklet y resolution @@ -717,6 +721,36 @@ Bool_t AliTRDtrackingResolution::PostProcess() gs->SetPointError(jphi, 0., 10.*fb.GetParError(2)); } + // tracklet z resolution + h2 = (TH2I*)fContainer->At(kTrackletZResolution); + gm = new TGraphErrors(h2->GetNbinsX()); + gm->SetLineColor(kBlue); + gm->SetMarkerStyle(7); + gm->SetMarkerColor(kBlue); + gm->SetNameTitle("trkltzm", ""); + fGraphM->AddAt(gm, kTrackletZResolution); + gs = new TGraphErrors(h2->GetNbinsX()); + gs->SetLineColor(kRed); + gs->SetMarkerStyle(23); + gs->SetMarkerColor(kRed); + gs->SetNameTitle("trkltzs", ""); + fGraphS->AddAt(gs, kTrackletZResolution); + for(Int_t iphi=1; iphi<=h2->GetNbinsX(); iphi++){ + h = h2->ProjectionY("py", iphi, iphi); + AdjustF1(h, &fb); + + if(IsVisual()){c->cd(); c->SetLogy();} + h->Fit(&fb, opt, "", -0.5, 0.5); + if(IsVisual()){c->Modified(); c->Update(); gSystem->Sleep(500);} + + Double_t phi = h2->GetXaxis()->GetBinCenter(iphi); + Int_t jphi = iphi -1; + gm->SetPoint(jphi, phi, 10.*fb.GetParameter(1)); + gm->SetPointError(jphi, 0., 10.*fb.GetParError(1)); + gs->SetPoint(jphi, phi, 10.*fb.GetParameter(2)); + gs->SetPointError(jphi, 0., 10.*fb.GetParError(2)); + } + // tracklet phi resolution h2 = (TH2I*)fContainer->At(kTrackletAngleResolution); gm = new TGraphErrors(h2->GetNbinsX()); @@ -777,7 +811,7 @@ void AliTRDtrackingResolution::AdjustF1(TH1 *h, TF1 *f) f->SetParameter(0, .9*sum); f->SetParLimits(1, -.2, .2); - f->SetParameter(1, 0.); + f->SetParameter(1, -0.1); f->SetParLimits(2, 0., 4.e-1); f->SetParameter(2, 2.e-2); @@ -802,7 +836,7 @@ TObjArray* AliTRDtrackingResolution::Histos() TH1 *h = 0x0; // cluster to tracklet residuals [2] - fContainer->AddAt(h = new TH2I("fYClRes", "Clusters Residuals", 21, -.33, .33, 100, -.5, .5), kClusterResidual); + fContainer->AddAt(h = new TH2I("fYCl", "Clusters Residuals", 21, -.33, .33, 100, -.5, .5), kClusterResidual); h->GetXaxis()->SetTitle("tg(#phi)"); h->GetYaxis()->SetTitle("#Delta y [cm]"); h->GetZaxis()->SetTitle("entries"); @@ -815,22 +849,22 @@ TObjArray* AliTRDtrackingResolution::Histos() // Resolution histos if(HasMCdata()){ // cluster y resolution [0] - fContainer->AddAt(h = new TH2I("fCY", "Cluster Resolution", 31, -.48, .48, 100, -.5, .5), kClusterResolution); + fContainer->AddAt(h = new TH2I("fYClMC", "Cluster Resolution", 31, -.48, .48, 100, -.5, .5), kClusterResolution); h->GetXaxis()->SetTitle("tg(#phi)"); h->GetYaxis()->SetTitle("#Delta y [cm]"); h->GetZaxis()->SetTitle("entries"); // tracklet y resolution [0] - fContainer->AddAt(h = new TH2I("fY", "Tracklet Resolution", 31, -.48, .48, 100, -.5, .5), kTrackletYResolution); + fContainer->AddAt(h = new TH2I("fYTrkltMC", "Tracklet Resolution (Y)", 31, -.48, .48, 100, -.5, .5), kTrackletYResolution); h->GetXaxis()->SetTitle("tg(#phi)"); h->GetYaxis()->SetTitle("#Delta y [cm]"); h->GetZaxis()->SetTitle("entries"); // tracklet y resolution [0] - fContainer->AddAt(h = new TH2I("fY", "Tracklet Resolution", 31, -.48, .48, 100, -.5, .5), kTrackletZResolution); + fContainer->AddAt(h = new TH2I("fZTrkltMC", "Tracklet Resolution (Z)", 31, -.48, .48, 100, -.5, .5), kTrackletZResolution); h->GetXaxis()->SetTitle("tg(#theta)"); h->GetYaxis()->SetTitle("#Delta z [cm]"); h->GetZaxis()->SetTitle("entries"); // tracklet angular resolution [1] - fContainer->AddAt(h = new TH2I("fPhi", "Tracklet Angular Resolution", 31, -.48, .48, 100, -10., 10.), kTrackletAngleResolution); + fContainer->AddAt(h = new TH2I("fPhiTrkltMC", "Tracklet Resolution (Angular)", 31, -.48, .48, 100, -10., 10.), kTrackletAngleResolution); h->GetXaxis()->SetTitle("tg(#phi)"); h->GetYaxis()->SetTitle("#Delta #phi [deg]"); h->GetZaxis()->SetTitle("entries"); -- 2.43.0