4 Example macro for evaluating the tracking efficiencies of HLT tracker (runtracker.C).
5 This assumes that you have have compiled with the DOMC flag on (see doc/README).
7 path : path to where the alirunfile.root file is located. This is original rootfile
8 containing the simulated particle arrays etc...
10 trackpath : path to where the output file from the runtracker was written.
12 offlinepath : path to where the files containing lists of the simulated particles are located.
13 This are files generated by the AliTPCComparison macro (good_tracks_tpc)
15 All efficiencies and ptresoutions are filled in histograms (see AliL3Evaluate::CreateHistograms)
20 #include "AliL3Logger.h"
21 #include "AliL3Evaluate.h"
22 #include "AliL3FileHandler.h"
23 #include "AliL3DigitData.h"
24 #include "AliL3Transform.h"
25 #include "AliLevel3.h"
32 #include <TGraphErrors.h>
40 void evaltracker(Char_t *path="./",Char_t *trackpath="./tracker/",char *offlinepath="./",int nevent=1)
42 //Make sure you got the correct parameters:
43 AliL3Transform::Init(path,kTRUE);
45 //Define which slices to include:
46 Int_t slicerange[2]={0,35};
48 //Define which padrows to include (should normally be all)
49 //Int_t rowrange[2]={AliL3Transform::GetFirstRow(-1),AliL3Transform::GetLastRow(-1)};
51 //Define the minimum number of clusters on a simulated track to be found:
52 Int_t good = (Int_t)(0.4*AliL3Transform::GetNRows());
54 //Define the minumum number of clusters on a found track to be found (should normally be the same as above)
55 Int_t nclusters = (Int_t)(0.4*AliL3Transform::GetNRows());
57 //Define which pt range to include
61 //Define the maximum ratio of false clusters which are allowed on a found track (default=0.1 -> 10%)
62 Float_t maxfalseratio = 0.1;
64 AliL3Evaluate *a = new AliL3Evaluate(trackpath,nclusters,good,ptmin,ptmax,slicerange);
65 a->CreateHistos(20,0.1,4.1);//(nbins in pt,minpt,maxpt) -> the same as used by standard offline
66 a->SetMaxFalseClusters(maxfalseratio);
67 //a->SetStandardComparison(kFALSE); //use AliTPCComparison_HLT
69 //Loop over the number of events:
70 for(Int_t event=0; event<nevent; event++)
72 cout<<"Processing event "<<event<<endl;
74 //Load all reconstructed tracks for this event
75 a->LoadData(event,kTRUE); //Last argument indicates that output data from tracker is written in whole slice format
77 //Loop over cluster list for each track, retrieve MC id, and verify the found track
80 //Load the list of simulated particles in the event
81 a->GetGoodParticles(offlinepath,event);
83 //Fill the efficiency histograms
88 //Calculate efficiencies
91 //Save the plots to a rootfile:
92 a->Write2File("hlt_efficiencies.root");
96 void ploteff(Char_t *rootfile="hlt_efficiencies.root")
98 //Plot the efficiency vs pt.
100 gStyle->SetOptStat(0);
104 Double_t hltxerr[22];
105 Double_t hltyerr[22];
106 TFile *file = TFile::Open(rootfile);
108 TH1* h = (TH1*)file->Get("fTrackEffPt");
109 for(Int_t i=0; i<22; i++)
111 if(h->GetBinContent(i)==0) continue;
112 hltx[hltcounter] = h->GetBinCenter(i);
113 hlty[hltcounter] = h->GetBinContent(i);
114 hltxerr[hltcounter] = 0;
115 hltyerr[hltcounter] = h->GetBinError(i);
120 TGraphErrors *gr1 = new TGraphErrors(hltcounter,hltx,hlty,hltxerr,hltyerr);
122 TCanvas *c1 = new TCanvas("c1","",1);
123 TH1F *hist = c1->DrawFrame(0.1,0,3,1.4);
128 hist->GetXaxis()->SetTitle("p_{t} [GeV]");
129 hist->GetYaxis()->SetTitle("Tracking efficiency");
130 gr1->SetMarkerStyle(20);
131 gr1->SetLineWidth(2);
132 gr1->SetMarkerSize(1.3);
135 void plotptres(Char_t *rootfile="hlt_efficiencies.root")
137 //Plot the relative pt resolution vs pt.
141 Double_t hltx[15] = {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0};
146 TFile *file = TFile::Open(rootfile);
147 TH1F *hist = new TH1F("hist","",100,-10,10);
148 TNtuple *fNtuppel=(TNtuple*)file->Get("fNtuppel");
150 for(Int_t i=0; i<n; i++)
152 sprintf(string,"pt_gen > %f && pt_gen <= %f && nHits>63",hltx[i]-0.1,hltx[i]+0.1);
153 fNtuppel->Draw("(pt_found-pt_gen)/pt_gen*100>>hist",string,"goff");
154 TF1 *f1 = new TF1("f1","gaus");
155 hist->Fit("f1","QN");
156 hlty[i] = f1->GetParameter(2);
157 hltyerr[i] = f1->GetParError(2);
164 TGraphErrors *gr1 = new TGraphErrors(n,hltx,hlty,0,hltyerr);
165 TCanvas *c1 = new TCanvas("c1","",1);
166 hist = c1->DrawFrame(0.1,0,3,15);
171 gr1->SetMarkerStyle(20);
172 gr1->SetLineWidth(2);
173 gr1->SetMarkerSize(1.3);
174 hist->SetXTitle("p_{t} [GeV]");
175 hist->SetYTitle("#Delta P_{T} / P_{T} [%]");