+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/* $Id$ */
+
+////////////////////////////////////////////////////////////////////
+// //
+// Fills a set of QA histograms to check the correctness of //
+// the TRD reconstruction //
+// //
+////////////////////////////////////////////////////////////////////
#include "AliTRDtrackingAnalysis.h"
-
#include "TFile.h"
#include "TTree.h"
#include "TH1D.h"
#include "TStyle.h"
#include "TGraphErrors.h"
#include "TF1.h"
+#include "TMath.h"
#include "AliRunLoader.h"
#include "AliTRDgeometry.h"
#include "AliRun.h"
-#include "AliESD.h"
+#include "AliESDEvent.h"
#include "AliESDtrack.h"
#include "AliTrackReference.h"
+#include "AliTracker.h"
#include "AliTRDcluster.h"
-#include "AliTRDCommonParam.h"
#include "AliTRDpadPlane.h"
#include "AliTRDcalibDB.h"
-#include "AliTracker.h"
#include "AliTRDtracker.h"
//#include "AliTRDtracklet.h"
AliTRDtrackingAnalysis::AliTRDtrackingAnalysis():
TObject(),
+ fPath(0),
+ fRefTPC(0),
+ fRefTRD(0),
fLoader(0),
fEsdTree(0),
fESD(0),
+ fTracker(0),
+ fDeltaPt(0),
+ fDeltaZ(0),
+ fDeltaX(0),
+ fDeltaYPos(0),
+ fDeltaYNeg(0),
+ fNPoints(0),
+ fNGood(0),
+ fRefSpace(0),
+ fGeo(0),
+ fClY2(0),
+ fClY3(0),
+ fTgPhi(0),
+ fGrResTgPhi(0),
+ fGrMeanTgPhi(0),
+ fTrklY(0),
+ fTrklZ(0),
+ fClZ(0),
+ fClZZ(0),
+ fClYY(0),
+ fClYX(0),
+ fNLabels(0),
+ fTestBits(0),
+ fRefDx(0),
+ fClZXref(0),
+ fClZXcl(0),
+ fClPos(0)
+{
+
+ fDeltaX = new TH1D("deltaX", ";delta X (cm)", 100, -1, 1);
+ fDeltaZ = new TH1D("deltaZ", ";delta Z (cm)", 100, -2, 2);
+
+ fDeltaYPos = new TH1D("deltaYpos", ";delta Y (mm)", 100, -1, 1);
+ fDeltaYNeg = new TH1D("deltaYneg", ";delta Y (mm)", 100, -1, 1);
+
+ fNPoints = new TH1D("nPoints", ";np", 40, -0.5, 39.5);
+ fNGood = new TH1D("nGood", ";np", 40, -0.5, 39.5);
+
+ fDeltaPt = new TH1D("deltaPt", ";delta Pt/Pt (%)", 100, -10, 10);
+ fRefSpace = new TH2D("refSpace", ";y;x", 120, -60, 60, 200, -4, 1);
+
+ fTrklY = new TH1D("trklY", ";delta Y (mm)", 100, -1, 1);
+ fTrklZ = new TH1D("trklZ", ";delta Z (cm)", 100, -10, 10);
+
+
+ // cluster studies
+ fClY2 = new TH1D("clY2", ";delta Y (mm)", 100, -10, 10);
+ fClY3 = new TH1D("clY3", ";delta Y (mm)", 100, -10, 10);
+
+ for(int i=0; i<12; i++) // bewere hidden constants in the code
+ fClYTgPhi[i] = new TH1D(Form("clYtgPhi%d", i), ";delta Y (mm)", 100, -3, 3);
+
+ fTgPhi = new TH1D("tgPhi", ";Tg(#phi)", 100, -0.3, 0.3);
+ fGrResTgPhi = new TGraphErrors();
+ fGrMeanTgPhi = new TGraphErrors();
+
+ //fPullY2 = new TH1D("pullY2", ";pulls Y", 100, -5, 5);
+ //fPullY3 = new TH1D("pullY3", ";pulls Y", 100, -5, 5);
+
+
+ fClZ = new TH1D("clZ", ";delta Z (cm)", 200, -20, 20);
+ fClZZ = new TH2D("clZZ", ";z ref;z cl", 600, -300, 300, 600, -300, 300);
+
+ fClYY = new TH2D("clYY", ";dY;dY", 100, -3, 3, 100, -3, 3);
+ fClYX = new TH2D("clYX", ";Y;X", 250, -60, 60, 100, -4, 1);
+
+ fNLabels = new TH1D("clLabels", ";n labels", 10, -0.5, 9.5);
+ fTestBits = new TH1D("bits", ";bits", 10, -0.5, 9.5);
+
+ fRefDx = new TH1D("refDX", ";delta X", 100, 0, 20);
+ fClPos = new TH2D("clPos", ";z;y", 400, -400, 400, 120, -60, 60);
+
+ fClZXref = new TH2D("clZXref", ";z;x", 36, -54, 54, 300, 280, 380);
+ fClZXcl = new TH2D("clZXcl", ";z;x", 36, -54, 54, 300, 280, 380);
+
+ //fGeo = new AliTRDgeometry();
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+AliTRDtrackingAnalysis::AliTRDtrackingAnalysis(const AliTRDtrackingAnalysis &t):
+ TObject(t),
+ fPath(0),
fRefTPC(0),
- fRefTRD(0)
+ fRefTRD(0),
+ fLoader(0),
+ fEsdTree(0),
+ fESD(0),
+ fTracker(0),
+ fDeltaPt(0),
+ fDeltaZ(0),
+ fDeltaX(0),
+ fDeltaYPos(0),
+ fDeltaYNeg(0),
+ fNPoints(0),
+ fNGood(0),
+ fRefSpace(0),
+ fGeo(0),
+ fClY2(0),
+ fClY3(0),
+ fTgPhi(0),
+ fGrResTgPhi(0),
+ fGrMeanTgPhi(0),
+ fTrklY(0),
+ fTrklZ(0),
+ fClZ(0),
+ fClZZ(0),
+ fClYY(0),
+ fClYX(0),
+ fNLabels(0),
+ fTestBits(0),
+ fRefDx(0),
+ fClZXref(0),
+ fClZXcl(0),
+ fClPos(0)
{
fDeltaX = new TH1D("deltaX", ";delta X (cm)", 100, -1, 1);
fClYX = new TH2D("clYX", ";Y;X", 250, -60, 60, 100, -4, 1);
fNLabels = new TH1D("clLabels", ";n labels", 10, -0.5, 9.5);
- fBits = new TH1D("bits", ";bits", 10, -0.5, 9.5);
+ fTestBits = new TH1D("bits", ";bits", 10, -0.5, 9.5);
fRefDx = new TH1D("refDX", ";delta X", 100, 0, 20);
fClPos = new TH2D("clPos", ";z;y", 400, -400, 400, 120, -60, 60);
//////////////////////////////////////////////////////////////////////////////////////////
-void AliTRDtrackingAnalysis::DrawResolutionPt(int startEvent, int stopEvent) {
+void AliTRDtrackingAnalysis::DrawResolutionPt(int startEvent, int stopEvent)
+{
+ //
+ // Check the pt resolution
+ //
CheckFiles();
if (!(status & AliESDtrack::kTRDout)) continue;
if (!(status & AliESDtrack::kTRDrefit)) continue;
- if (fabs(esdTrack->GetOuterParam()->GetPt()) < 1.0) continue;
+ if (esdTrack->GetOuterParam()->Pt() < 1.0) continue;
int ch=0;
while(param->GetX() > fGeo->GetTime0(ch)+2) ch++;
lastX = (aRef->LocalX() < lastX)? lastX : aRef->LocalX();
double dx = aRef->LocalX() - param->GetX();
- if (fabs(dx) > 1.) continue;
+ if (TMath::Abs(dx) > 1.) continue;
ngood++;
double bz=fESD->GetMagneticField();
AliExternalTrackParam out(*param);
out.PropagateTo(aRef->LocalX(),bz);
- double dp = aRef->Pt() + out.GetPt();
+ double dp = aRef->Pt() + out.GetSignedPt();
double dy = 10. * (aRef->LocalY() - out.GetY()); // in mm
fDeltaPt->Fill(100. * dp / aRef->Pt());
//////////////////////////////////////////////////////////////////////////////////////////
-void AliTRDtrackingAnalysis::DrawRecPointResolution(int startEvent, int stopEvent) {
+void AliTRDtrackingAnalysis::DrawRecPointResolution(int startEvent, int stopEvent)
+{
+ //
+ // Check the resolution of the reconstructed points
+ //
LoadRecPointsFile();
TObjArray *module = new TObjArray();
Info("Res", "Refs Loaded");
- int N = tree->GetEntries();
- for(int i=0; i<N; i++) {
+ Int_t nn = tree->GetEntries();
+ for(int i=0; i<nn; i++) {
tree->GetEntry(i);
int m = module->GetEntries();
AliTRDcluster *cls = (AliTRDcluster*)module->At(j);
if (cls->GetQ() < 10) continue;
- fTracker->Transform(cls);
+ //fTracker->Transform(cls);
fClPos->Fill(cls->GetZ(), cls->GetY());
- int plane = fGeo->GetPlane(cls->GetDetector());
+ int layer = fGeo->GetLayer(cls->GetDetector());
int nl = 0;
for(int k=0; k<3; k++) if (cls->GetLabel(k) > -1) nl++;
fClZXcl->Fill(cls->GetZ(), cls->GetX());
fClZXref->Fill(zref, cls->GetX());
- AliTRDpadPlane *padPlane = AliTRDCommonParam::Instance()->GetPadPlane(plane,0);
+ AliTRDpadPlane *padPlane = fGeo->GetPadPlane(layer,0);
Double_t h01 = TMath::Tan(-TMath::Pi() / 180.0 * padPlane->GetTiltingAngle());
//double dz = zref - padPlane->GetRow0();
double dy = dz * h01;
double yy = cls->GetY() - dy;
- if (cls->From2pad()) fClY2->Fill(10 * (yy - yref));
- if (cls->From3pad()) fClY3->Fill(10 * (yy - yref));
+ if (cls->GetNPads() == 2) fClY2->Fill(10 * (yy - yref));
+ if (cls->GetNPads() == 3) fClY3->Fill(10 * (yy - yref));
int idx = GetPhiBin(tgphi);
if (idx >= 0 && idx < 12) fClYTgPhi[idx]->Fill(10 * (yy - yref));
fClZZ->Fill(zref, cls->GetZ());
fClZ->Fill(dz);
fTgPhi->Fill(tgphi);
- fClYX->Fill(cls->GetY(), cls->GetX() - fGeo->GetTime0(plane));
+ fClYX->Fill(cls->GetY(), cls->GetX() - fGeo->GetTime0(layer));
}
}
}
//fClPos->Draw("colz");
//new TCanvas();
- //fBits->Draw();
+ //fTestBits->Draw();
//new TCanvas();
//fRefDx->Draw();
//////////////////////////////////////////////////////////////////////////////////////////
-void AliTRDtrackingAnalysis::LoadRecPointsFile() {
+void AliTRDtrackingAnalysis::LoadRecPointsFile()
+{
+ //
+ // Load the clusters from the input file
+ //
char filename[256];
sprintf(filename, "%s/galice.root", fPath);
//////////////////////////////////////////////////////////////////////////////////////////
-void AliTRDtrackingAnalysis::CheckFiles() {
+void AliTRDtrackingAnalysis::CheckFiles()
+{
+ //
+ // Check the presence of the input files
+ //
// MC info
}
fEsdTree = (TTree*)esdFile->Get("esdTree");
- fESD = new AliESD();
-
- fEsdTree->SetBranchAddress("ESD", &fESD);
+ fESD = new AliESDEvent();
+ fESD->ReadFromTree(fEsdTree);
+ //fEsdTree->SetBranchAddress("ESD", &fESD);
}
//////////////////////////////////////////////////////////////////////////////////////////
-void AliTRDtrackingAnalysis::LoadRefs() {
+void AliTRDtrackingAnalysis::LoadRefs()
+{
+ //
+ // Load the track references
+ //
if (fRefTPC) delete fRefTPC;
if (fRefTRD) delete fRefTRD;
//AliStack* stack = gAlice->Stack();
TTree *refTree = fLoader->TreeTR();
- const int nBranch = 2;
- const char *brName[] = {"TPC", "TRD"};
TClonesArray *clRefs = new TClonesArray("AliTrackReference");
-
- for(int b=0; b<nBranch; b++) {
- TBranch *branch = refTree->GetBranch(brName[b]);
- refTree->SetBranchAddress(brName[b],&clRefs);
+ TBranch *branch = refTree->GetBranch("TrackReferences");
+ refTree->SetBranchAddress("TrackReferences",&clRefs);
- int nEntries = branch->GetEntries();
- for(int iTrack = 0; iTrack < nEntries; iTrack++) {
+ int nEntries = branch->GetEntries();
+ for(int iTrack = 0; iTrack < nEntries; iTrack++) {
- refTree->GetEvent(iTrack);
- int nPoints = clRefs->GetEntries();
- for(int iPoint=0; iPoint<nPoints; iPoint++) {
- AliTrackReference *ref = (AliTrackReference*)clRefs->At(iPoint);
- if (b == 0) fRefTPC->Add(new AliTrackReference(*ref));
- if (b == 1) fRefTRD->Add(new AliTrackReference(*ref));
- }
- }
+ refTree->GetEvent(iTrack);
+ int nPoints = clRefs->GetEntries();
+ for(int iPoint=0; iPoint<nPoints; iPoint++) {
+ AliTrackReference *ref = (AliTrackReference*)clRefs->At(iPoint);
+ if (ref->DetectorId() == AliTrackReference::kTPC) fRefTPC->Add(new AliTrackReference(*ref));
+ if (ref->DetectorId() == AliTrackReference::kTRD) fRefTRD->Add(new AliTrackReference(*ref));
+ }
}
fRefTPC->Sort();
while(ref->LocalX() > fGeo->GetTime0(p)+2) p++;
fRefSpace->Fill(ref->LocalY(), ref->LocalX()-fGeo->GetTime0(p));
- //for(int bit=0; bit<9; bit++) if (ref->TestBit(bit)) fBits->Fill(bit);
+ //for(int bit=0; bit<9; bit++) if (ref->TestBit(bit)) fTestBits->Fill(bit);
}
delete clRefs;
//////////////////////////////////////////////////////////////////////////////////////////
-Int_t AliTRDtrackingAnalysis::GetReference(Int_t label) {
+Int_t AliTRDtrackingAnalysis::GetReference(Int_t label)
+{
+ //
+ // Sort the track references
+ //
int start = TMath::BinarySearch(fRefTRD->GetEntries(), fLabels, label);
//////////////////////////////////////////////////////////////////////////////////////////
-int AliTRDtrackingAnalysis::GetMCPosition(Int_t label, Double_t x, Double_t &Y, Double_t &Z, Double_t &tgphi) {
+int AliTRDtrackingAnalysis::GetMCPosition(Int_t label, Double_t x, Double_t &Y, Double_t &Z, Double_t &tgphi)
+{
+ //
+ // Determine the MC positions from the track references
+ //
double lowX = 100.;
double highX = 100.;
highX = dX;
}
} else {
- dX = fabs(dX);
+ dX = TMath::Abs(dX);
if (dX < lowX) {
idLow = i;
lowX = dX;
}
//////////////////////////////////////////////////////////////////////////////////////////
-Int_t AliTRDtrackingAnalysis::GetPhiBin(Double_t phi) {
+Int_t AliTRDtrackingAnalysis::GetPhiBin(Double_t phi) const
+{
+ //
+ // Return the phi bin
+ //
return (int)((phi+0.3)/0.05);
}
//////////////////////////////////////////////////////////////////////////////////////////
-
-Double_t AliTRDtrackingAnalysis::GetPhi(Int_t bin) {
+Double_t AliTRDtrackingAnalysis::GetPhi(Int_t bin) const
+{
+ //
+ // Return phi for a given bin
+ //
return bin * 0.05 - 0.3 + 0.025;
}
//////////////////////////////////////////////////////////////////////////////////////////