]>
Commit | Line | Data |
---|---|---|
4a8b7bdd | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | #include <TCanvas.h> | |
3 | #include <TGrid.h> | |
4 | #include <TFile.h> | |
5 | #include <TList.h> | |
6 | #include <TPaveStats.h> | |
7 | #include <TGraph.h> | |
8 | #include <TGraphErrors.h> | |
9 | #include <TH1.h> | |
10 | #include <TF1.h> | |
11 | #include <TH2.h> | |
12 | #include <TLegend.h> | |
13 | #include <TLegendEntry.h> | |
14 | #include <TLatex.h> | |
15 | #include <TStyle.h> | |
16 | #include <TROOT.h> | |
17 | #endif | |
18 | ||
19 | /* $Id$ */ | |
20 | ||
21 | //------------------------------------------------------- | |
22 | // | |
23 | // Macro do plot the output histograms of the QA task for ITS standalone tracks | |
24 | // General Plots: ratios between ITSsa, ITSpureSA and TPC+ITS tracks | |
25 | // eta phi distributions of tracks | |
26 | // number of clusters per track | |
27 | // Pt resolution (matching ITSèureSA with TPC+ITS tracks) | |
28 | // d0 resolution and bias | |
29 | // | |
30 | // Authors: Leonardo Milano, Francesco Prino | |
31 | // | |
32 | //------------------------------------------------------- | |
33 | ||
34 | enum{kDoGeneral,kDoPt,kDoImpPar,kDoAll}; | |
35 | ||
36 | void PlotITSsa(TList* l); | |
37 | void PlotPtResol(TList* l, Bool_t optFromMC); | |
38 | void PlotImpPar(TList* l); | |
39 | void SetDrawAtt(Int_t markerstyle,Int_t markercolor,Int_t markersize,Int_t linecolor,Int_t linewidth,TH1 *h1); | |
40 | ||
41 | void PlotOutputQATaskITSsa(TString filename, Int_t analysisType=kDoAll, Bool_t isMC=kFALSE){ | |
42 | ||
43 | gROOT->SetStyle("Plain"); | |
44 | ||
45 | if(filename.Contains("alien")) TGrid::Connect("alien:"); | |
46 | TFile* fil=TFile::Open(filename.Data()); | |
47 | TDirectoryFile* df=(TDirectoryFile*)fil->Get("TracksITSsa"); | |
48 | if(!df) df=(TDirectoryFile*)fil->Get("ITSsaTracks"); | |
49 | TList* l=(TList*)df->Get("clistITSsaTracks"); | |
50 | if(analysisType==kDoAll || analysisType==kDoGeneral) PlotITSsa(l); | |
51 | if(analysisType==kDoAll || analysisType==kDoPt) PlotPtResol(l,isMC); | |
52 | if(analysisType==kDoAll || analysisType==kDoImpPar) PlotImpPar(l); | |
53 | ||
54 | } | |
55 | ||
56 | //----------------------------------------------------- | |
57 | ||
58 | void PlotITSsa(TList* l){ | |
59 | ||
60 | TH1F* hPtTPCITS=(TH1F*)l->FindObject("hPtTPCITS"); | |
61 | TH1F* hPtITSsa=(TH1F*)l->FindObject("hPtITSsa"); | |
62 | TH1F* hPtITSpureSA=(TH1F*)l->FindObject("hPtITSpureSA"); | |
63 | ||
64 | TH2F* hEtaPhiTPCITS=(TH2F*)l->FindObject("hEtaPhiTPCITS"); | |
65 | TH2F* hEtaPhiITSsa=(TH2F*)l->FindObject("hEtaPhiITSsa"); | |
66 | TH2F* hEtaPhiITSpureSA=(TH2F*)l->FindObject("hEtaPhiITSpureSA"); | |
67 | ||
68 | TH1F* hChi2TPCITS=(TH1F*)l->FindObject("hChi2TPCITS"); | |
69 | TH1F* hChi2ITSsa=(TH1F*)l->FindObject("hChi2ITSsa"); | |
70 | TH1F* hChi2ITSpureSA=(TH1F*)l->FindObject("hChi2ITSpureSA"); | |
71 | ||
72 | TH1F* hNcluTPCITS=(TH1F*)l->FindObject("hNcluTPCITS"); | |
73 | TH1F* hNcluITSsa=(TH1F*)l->FindObject("hNcluITSsa"); | |
74 | TH1F* hNcluITSpureSA=(TH1F*)l->FindObject("hNcluITSpureSA"); | |
75 | ||
76 | ||
77 | TH1F* hRatio=(TH1F*)hPtTPCITS->Clone("hRatio"); | |
78 | hRatio->Add(hPtITSsa); | |
79 | hRatio->Divide(hPtITSpureSA); | |
80 | hRatio->SetStats(0); | |
81 | ||
82 | TCanvas* c1=new TCanvas("c1","Pt",800,1000); | |
83 | c1->Divide(1,2); | |
84 | c1->cd(1); | |
85 | hPtITSpureSA->Draw(); | |
86 | hPtITSpureSA->GetXaxis()->SetTitle("Pt (GeV/c)"); | |
87 | gPad->Update(); | |
88 | TPaveStats *st1=(TPaveStats*)hPtITSpureSA->GetListOfFunctions()->FindObject("stats"); | |
89 | st1->SetY1NDC(0.71); | |
90 | st1->SetY2NDC(0.9); | |
91 | hPtTPCITS->SetLineColor(2); | |
92 | hPtTPCITS->Draw("sames"); | |
93 | gPad->Update(); | |
94 | TPaveStats *st2=(TPaveStats*)hPtTPCITS->GetListOfFunctions()->FindObject("stats"); | |
95 | st2->SetY1NDC(0.51); | |
96 | st2->SetY2NDC(0.7); | |
97 | st2->SetTextColor(2); | |
98 | ||
99 | hPtITSsa->SetLineColor(4); | |
100 | hPtITSsa->Draw("sames"); | |
101 | gPad->Update(); | |
102 | TPaveStats *st3=(TPaveStats*)hPtITSsa->GetListOfFunctions()->FindObject("stats"); | |
103 | st3->SetY1NDC(0.31); | |
104 | st3->SetY2NDC(0.5); | |
105 | st3->SetTextColor(4); | |
106 | TLegend* leg=new TLegend(0.5,0.5,0.69,0.69); | |
107 | leg->SetFillColor(0); | |
108 | TLegendEntry* ent=leg->AddEntry(hPtITSpureSA,"ITS pureSA","L"); | |
109 | ent->SetTextColor(hPtITSpureSA->GetLineColor()); | |
110 | ent=leg->AddEntry(hPtTPCITS,"TPC+ITS","L"); | |
111 | ent->SetTextColor(hPtTPCITS->GetLineColor()); | |
112 | ent=leg->AddEntry(hPtITSsa,"ITSsa","L"); | |
113 | ent->SetTextColor(hPtITSsa->GetLineColor()); | |
114 | leg->Draw(); | |
115 | c1->cd(2); | |
116 | gPad->SetGridx(); | |
117 | gPad->SetGridy(); | |
118 | hRatio->Draw(); | |
119 | hRatio->GetXaxis()->SetTitle("Pt (GeV/c)"); | |
120 | hRatio->GetYaxis()->SetTitle("(TPCITS+ITSsa)/ITSpureSA"); | |
121 | ||
122 | hChi2ITSpureSA->Scale(1./hChi2ITSpureSA->GetEntries()); | |
123 | hChi2ITSsa->Scale(1./hChi2ITSsa->GetEntries()); | |
124 | hChi2TPCITS->Scale(1./hChi2TPCITS->GetEntries()); | |
125 | ||
126 | TCanvas* c2=new TCanvas("c2","Chi2"); | |
127 | hChi2ITSpureSA->Draw(); | |
128 | hChi2ITSpureSA->GetXaxis()->SetTitle("Chi2"); | |
129 | gPad->Update(); | |
130 | TPaveStats *stc1=(TPaveStats*)hChi2ITSpureSA->GetListOfFunctions()->FindObject("stats"); | |
131 | stc1->SetY1NDC(0.71); | |
132 | stc1->SetY2NDC(0.9); | |
133 | hChi2TPCITS->SetLineColor(2); | |
134 | hChi2TPCITS->Draw("sames"); | |
135 | gPad->Update(); | |
136 | TPaveStats *stc2=(TPaveStats*)hChi2TPCITS->GetListOfFunctions()->FindObject("stats"); | |
137 | stc2->SetY1NDC(0.51); | |
138 | stc2->SetY2NDC(0.7); | |
139 | stc2->SetTextColor(2); | |
140 | c2->Update(); | |
141 | hChi2ITSsa->SetLineColor(4); | |
142 | hChi2ITSsa->Draw("sames"); | |
143 | gPad->Update(); | |
144 | TPaveStats *stc3=(TPaveStats*)hChi2ITSsa->GetListOfFunctions()->FindObject("stats"); | |
145 | stc3->SetY1NDC(0.31); | |
146 | stc3->SetY2NDC(0.5); | |
147 | stc3->SetTextColor(4); | |
148 | leg->Draw(); | |
149 | ||
150 | hNcluITSpureSA->Scale(1./hNcluITSpureSA->GetEntries()); | |
151 | hNcluITSsa->Scale(1./hNcluITSsa->GetEntries()); | |
152 | hNcluTPCITS->Scale(1./hNcluTPCITS->GetEntries()); | |
153 | ||
154 | TCanvas* c3=new TCanvas("c3","Nclu"); | |
155 | c3->SetRightMargin(0.22); | |
156 | hNcluITSpureSA->Draw(); | |
157 | hNcluITSpureSA->GetXaxis()->SetTitle("n. ITS clusters"); | |
158 | gPad->Update(); | |
159 | TPaveStats *stn1=(TPaveStats*)hNcluITSpureSA->GetListOfFunctions()->FindObject("stats"); | |
160 | stn1->SetY1NDC(0.71); | |
161 | stn1->SetY2NDC(0.9); | |
162 | hNcluTPCITS->SetLineColor(2); | |
163 | hNcluTPCITS->Draw("sames"); | |
164 | gPad->Update(); | |
165 | TPaveStats *stn2=(TPaveStats*)hNcluTPCITS->GetListOfFunctions()->FindObject("stats"); | |
166 | stn2->SetY1NDC(0.51); | |
167 | stn2->SetY2NDC(0.7); | |
168 | stn2->SetTextColor(2); | |
169 | ||
170 | hNcluITSsa->SetLineColor(4); | |
171 | hNcluITSsa->Draw("sames"); | |
172 | gPad->Update(); | |
173 | TPaveStats *stn3=(TPaveStats*)hNcluITSsa->GetListOfFunctions()->FindObject("stats"); | |
174 | stn3->SetY1NDC(0.31); | |
175 | stn3->SetY2NDC(0.5); | |
176 | stn3->SetTextColor(4); | |
177 | leg->Draw(); | |
178 | ||
179 | gStyle->SetPalette(1); | |
180 | hEtaPhiITSpureSA->SetStats(0); | |
181 | hEtaPhiITSpureSA->SetTitle("ITS pureSA"); | |
182 | hEtaPhiITSsa->SetStats(0); | |
183 | hEtaPhiITSsa->SetTitle("ITSsa"); | |
184 | hEtaPhiTPCITS->SetStats(0); | |
185 | hEtaPhiTPCITS->SetTitle("TPC+ITS"); | |
186 | TCanvas* c4=new TCanvas("c4","EtaPhi",1000,700); | |
187 | c4->Divide(3,1); | |
188 | c4->cd(1); | |
189 | hEtaPhiITSpureSA->Draw("colz"); | |
190 | hEtaPhiITSpureSA->GetXaxis()->SetTitle("Eta"); | |
191 | hEtaPhiITSpureSA->GetYaxis()->SetTitle("Phi"); | |
192 | c4->cd(2); | |
193 | hEtaPhiITSsa->Draw("colz"); | |
194 | hEtaPhiITSsa->GetXaxis()->SetTitle("Eta"); | |
195 | hEtaPhiITSsa->GetYaxis()->SetTitle("Phi"); | |
196 | c4->cd(3); | |
197 | hEtaPhiTPCITS->Draw("colz"); | |
198 | hEtaPhiTPCITS->GetXaxis()->SetTitle("Eta"); | |
199 | hEtaPhiTPCITS->GetYaxis()->SetTitle("Phi"); | |
200 | } | |
201 | ||
202 | //----------------------------------------------------- | |
203 | ||
204 | void PlotPtResol(TList* l, Bool_t optFromMC){ | |
205 | TString hNameR,hNameA; | |
206 | TString partName[3]={"Pion","Kaon","Proton"}; | |
207 | TString prefix; | |
208 | if(optFromMC) prefix="hMC"; | |
209 | else prefix="h"; | |
210 | ||
211 | TCanvas* c2d[3]; | |
212 | TCanvas* c1dA[3]; | |
213 | TCanvas* c1dR[3]; | |
214 | ||
215 | TH2F* h2DA[3]; | |
216 | TH2F* h2DR[3]; | |
217 | TH1F* hptres[3][40]; | |
218 | TH1F* h1ptrelres[3][40]; | |
219 | TH1F* hptreco[3][40]; | |
220 | ||
221 | TGraphErrors* gbias[3]; | |
222 | TGraphErrors* grelresol[3]; | |
223 | ||
224 | gStyle->SetPalette(1); | |
225 | ||
226 | for(Int_t iSpec=0; iSpec<3; iSpec++){ | |
227 | hNameA=Form("%sPtResid%s",prefix.Data(),partName[iSpec].Data()); | |
228 | hNameR=Form("%sInvPtRelResid%s",prefix.Data(),partName[iSpec].Data()); | |
229 | printf("%s %s\n",hNameA.Data(),hNameR.Data()); | |
230 | h2DA[iSpec]=(TH2F*)l->FindObject(hNameA.Data()); | |
231 | h2DR[iSpec]=(TH2F*)l->FindObject(hNameR.Data()); | |
232 | c2d[iSpec]=new TCanvas(Form("c2d%s",partName[iSpec].Data()),Form("c2d%s",partName[iSpec].Data())); | |
233 | c2d[iSpec]->Divide(2,1); | |
234 | c2d[iSpec]->cd(1); | |
235 | h2DA[iSpec]->Draw("colz"); | |
236 | c2d[iSpec]->cd(2); | |
237 | h2DR[iSpec]->Draw("colz"); | |
238 | ||
239 | Int_t nptbins=h2DR[iSpec]->GetNbinsX(); | |
240 | ||
241 | Int_t nybinsA=h2DA[iSpec]->GetNbinsY(); | |
242 | Float_t minyA=h2DA[iSpec]->GetYaxis()->GetBinLowEdge(1); | |
243 | Float_t maxyA=h2DA[iSpec]->GetYaxis()->GetBinUpEdge(nybinsA); | |
244 | ||
245 | Int_t nybinsR=h2DR[iSpec]->GetNbinsY(); | |
246 | Float_t minyR=h2DR[iSpec]->GetYaxis()->GetBinLowEdge(1); | |
247 | Float_t maxyR=h2DR[iSpec]->GetYaxis()->GetBinUpEdge(nybinsR); | |
248 | printf("%d %d %f %f %d %f %f\n",nptbins,nybinsA,minyA,maxyA,nybinsR,minyR,maxyR); | |
249 | ||
250 | c1dA[iSpec]=new TCanvas(Form("c1dA%s",partName[iSpec].Data()),Form("c1dA%s",partName[iSpec].Data())); | |
251 | c1dA[iSpec]->Divide(6,5); | |
252 | c1dR[iSpec]=new TCanvas(Form("c1dR%s",partName[iSpec].Data()),Form("c1dR%s",partName[iSpec].Data())); | |
253 | c1dR[iSpec]->Divide(6,5); | |
254 | ||
255 | ||
256 | gbias[iSpec]=new TGraphErrors(0); | |
257 | grelresol[iSpec]=new TGraphErrors(0); | |
258 | gbias[iSpec]->SetTitle(""); | |
259 | grelresol[iSpec]->SetTitle(""); | |
260 | ||
261 | for(Int_t iptbin=0; iptbin<nptbins;iptbin++){ | |
262 | Float_t avept=h2DA[iSpec]->GetXaxis()->GetBinCenter(iptbin+1); | |
263 | Float_t widpt=0.5*h2DA[iSpec]->GetXaxis()->GetBinWidth(iptbin+1); | |
264 | Int_t minptbinmev=(Int_t)(h2DA[iSpec]->GetXaxis()->GetBinLowEdge(iptbin+1)*1000.+0.5); | |
265 | ||
266 | hptres[iSpec][iptbin]=new TH1F(Form("hptres%s_%d",partName[iSpec].Data(),minptbinmev), | |
267 | Form("hptres%s_%d",partName[iSpec].Data(),minptbinmev), | |
268 | nybinsA,minyA,maxyA); | |
269 | h1ptrelres[iSpec][iptbin]=new TH1F(Form("h1ptrelres%s_%d",partName[iSpec].Data(),minptbinmev), | |
270 | Form("h1ptrelres%s_%d",partName[iSpec].Data(),minptbinmev), | |
271 | nybinsR,minyR,maxyR); | |
272 | hptreco[iSpec][iptbin]=new TH1F(Form("hptreco%s_%d",partName[iSpec].Data(),minptbinmev), | |
273 | Form("hptreco%s_%d",partName[iSpec].Data(),minptbinmev), | |
274 | 400,0.,2.); | |
275 | for(Int_t iBin=1; iBin<=nybinsA; iBin++){ | |
276 | hptres[iSpec][iptbin]->SetBinContent(iBin,h2DA[iSpec]->GetBinContent(iptbin+1,iBin)); | |
277 | hptres[iSpec][iptbin]->SetBinError(iBin,h2DA[iSpec]->GetBinError(iptbin+1,iBin)); | |
278 | } | |
279 | for(Int_t iBin=1; iBin<=nybinsR; iBin++){ | |
280 | h1ptrelres[iSpec][iptbin]->SetBinContent(iBin,h2DR[iSpec]->GetBinContent(iptbin+1,iBin)); | |
281 | h1ptrelres[iSpec][iptbin]->SetBinError(iBin,h2DR[iSpec]->GetBinError(iptbin+1,iBin)); | |
282 | } | |
283 | ||
284 | c1dA[iSpec]->cd(iptbin+1); | |
285 | hptres[iSpec][iptbin]->Draw(); | |
286 | if(hptres[iSpec][iptbin]->Integral()>50){ | |
287 | hptres[iSpec][iptbin]->Fit("gaus"); | |
288 | hptres[iSpec][iptbin]->GetXaxis()->SetTitle("Pt residuals (GeV/c)"); | |
289 | hptres[iSpec][iptbin]->GetXaxis()->CenterTitle(); | |
290 | TF1* fgaus= (TF1*)hptres[iSpec][iptbin]->GetListOfFunctions()->FindObject("gaus"); | |
291 | Int_t nPoint=gbias[iSpec]->GetN(); | |
292 | gbias[iSpec]->SetPoint(nPoint, avept, fgaus->GetParameter(1));//hptres[iSpec][iptbin]->GetMean()); | |
293 | gbias[iSpec]->SetPointError(nPoint, widpt, fgaus->GetParError(1)); //hptres[iSpec][iptbin]->GetMeanError()); | |
294 | } | |
295 | c1dR[iSpec]->cd(iptbin+1); | |
296 | h1ptrelres[iSpec][iptbin]->Draw(); | |
297 | if(h1ptrelres[iSpec][iptbin]->Integral()>50){ | |
298 | h1ptrelres[iSpec][iptbin]->Fit("gaus");//,"L"); | |
299 | h1ptrelres[iSpec][iptbin]->GetXaxis()->SetTitle("1/Pt relative residuals"); | |
300 | h1ptrelres[iSpec][iptbin]->GetXaxis()->CenterTitle(); | |
301 | TF1* fgaus= (TF1*)h1ptrelres[iSpec][iptbin]->GetListOfFunctions()->FindObject("gaus"); | |
302 | Int_t nPoint=grelresol[iSpec]->GetN(); | |
303 | grelresol[iSpec]->SetPoint(nPoint, avept, fgaus->GetParameter(2)); | |
304 | grelresol[iSpec]->SetPointError(nPoint, widpt, fgaus->GetParError(2)); | |
305 | } | |
306 | ||
307 | } | |
308 | } | |
309 | ||
310 | ||
311 | TCanvas* cb=new TCanvas("cb","Bias"); | |
312 | gbias[2]->SetMarkerStyle(22); | |
313 | gbias[2]->SetMarkerColor(4); | |
314 | gbias[2]->SetLineColor(4); | |
315 | gbias[2]->Draw("PA"); | |
316 | gbias[0]->SetMarkerStyle(20); | |
317 | gbias[0]->SetMarkerColor(1); | |
318 | gbias[0]->SetLineColor(1); | |
319 | gbias[0]->Draw("PSAME"); | |
320 | gbias[1]->SetMarkerStyle(25); | |
321 | gbias[1]->SetMarkerColor(2); | |
322 | gbias[1]->SetLineColor(2); | |
323 | gbias[1]->Draw("PSAME"); | |
324 | gbias[2]->GetXaxis()->SetTitle("p_{T} (GeV/c)"); | |
325 | if(optFromMC) gbias[2]->GetYaxis()->SetTitle("<p_{T}(ITSsa)-p_{T}(MC)> (GeV/c)"); | |
326 | else gbias[2]->GetYaxis()->SetTitle("<p_{T}(ITSsa)-p_{T}(TPCITS)> (GeV/c)"); | |
327 | gbias[2]->GetYaxis()->SetTitleOffset(1.2); | |
328 | cb->Update(); | |
329 | ||
330 | TCanvas* cr=new TCanvas("cr","Resol"); | |
331 | grelresol[2]->SetMinimum(0.); | |
332 | grelresol[2]->SetMaximum(0.2); | |
333 | grelresol[2]->SetMarkerStyle(22); | |
334 | grelresol[2]->SetMarkerColor(4); | |
335 | grelresol[2]->SetLineColor(4); | |
336 | grelresol[2]->Draw("PA"); | |
337 | grelresol[0]->SetMarkerStyle(20); | |
338 | grelresol[0]->SetMarkerColor(1); | |
339 | grelresol[0]->SetLineColor(1); | |
340 | grelresol[0]->Draw("PSAME"); | |
341 | grelresol[1]->SetMarkerStyle(25); | |
342 | grelresol[1]->SetMarkerColor(2); | |
343 | grelresol[1]->SetLineColor(2); | |
344 | grelresol[1]->Draw("PSAME"); | |
345 | grelresol[2]->GetXaxis()->SetTitle("p_{T} (GeV/c)"); | |
346 | grelresol[2]->GetYaxis()->SetTitle("1/Pt relative resolution (%)"); | |
347 | grelresol[2]->GetYaxis()->SetTitleOffset(1.2); | |
348 | cr->Update(); | |
349 | ||
350 | } | |
351 | ||
352 | //----------------------------------------------------- | |
353 | ||
354 | void PlotImpPar(TList* l){ | |
355 | ||
356 | TString particle[3]={"Pion","Kaon","Proton"}; | |
357 | Int_t colors[3]={1,2,4}; | |
358 | TCanvas *cImpPar=new TCanvas("ImpParRes","ImpParRes",1000,800); | |
359 | cImpPar->SetGridx(); | |
360 | cImpPar->SetLogx(); | |
361 | cImpPar->SetLeftMargin(0.14); | |
362 | TCanvas *cImpParMean=new TCanvas("ImpParMean","ImpParMean",1000,800); | |
363 | cImpParMean->SetGridx(); | |
364 | cImpParMean->SetLogx(); | |
365 | cImpParMean->SetLeftMargin(0.14); | |
366 | ||
367 | TLegend* leg1=new TLegend(0.6,0.7,0.89,0.89); | |
368 | leg1->SetFillColor(0); | |
369 | TLegendEntry* ent; | |
370 | ||
371 | TH2F *hd0rphiITSpureSA[3]; | |
372 | //binning | |
373 | const Int_t nbins = 29; | |
374 | Double_t xbins[nbins+1]={0.06,0.08,0.10,0.12,0.14,0.16,0.18,0.20,0.25,0.30, | |
375 | 0.35,0.40,0.45,0.50,0.55,0.60,0.65,0.70,0.75,0.80, | |
376 | 0.85,0.90,0.95,1.00,1.20,1.40,1.60,1.80,1.90,2.00}; | |
377 | ||
378 | TH1F *fHistDCA[nbins]; | |
379 | ||
380 | for(Int_t iparticle=0;iparticle<3;iparticle++){ | |
381 | hd0rphiITSpureSA[iparticle]=(TH2F*)l->FindObject(Form("hd0rphiITSpureSA%s",particle[iparticle].Data())); | |
382 | ||
383 | ||
384 | TH1F *fHistImpParRes = new TH1F(Form("fHistImpParRes%s",particle[iparticle].Data()),"",nbins,xbins); | |
385 | fHistImpParRes->SetStats(0); | |
386 | fHistImpParRes->GetXaxis()->SetTitle("Pt [GeV/c]"); | |
387 | fHistImpParRes->GetYaxis()->SetTitle("d0 r#phi resolution [#mum]"); | |
388 | fHistImpParRes->GetYaxis()->SetTitleOffset(1.4); | |
389 | TH1F *fHistImpParMean = new TH1F(Form("fHistImpParMean%s",particle[iparticle].Data()),"",nbins,xbins); | |
390 | fHistImpParMean->SetStats(0); | |
391 | fHistImpParMean->GetXaxis()->SetTitle("Pt [GeV/c]"); | |
392 | fHistImpParMean->GetYaxis()->SetTitle("d0 r#phi mean [#mum]"); | |
393 | fHistImpParMean->GetYaxis()->SetTitleOffset(1.4); | |
394 | TF1 *fPar = new TF1("fPar","gaus",-1,1); | |
395 | for(Int_t m=0;m<nbins;m++){ | |
396 | ||
397 | fHistDCA[m]= (TH1F*)hd0rphiITSpureSA[iparticle]->ProjectionY(Form("%s%i",particle[iparticle].Data(),m),hd0rphiITSpureSA[iparticle]->GetXaxis()->FindBin(xbins[m]+0.000001),hd0rphiITSpureSA[iparticle]->GetXaxis()->FindBin(xbins[m+1]-0.000001)); | |
398 | fHistDCA[m]->Rebin(); | |
399 | } | |
400 | ||
401 | TCanvas *cgaus=new TCanvas(Form("cgaus%s",particle[iparticle].Data()),Form("DCA dist %s ",particle[iparticle].Data()),1000,800); | |
402 | cgaus->Divide(8,4,0.001,0.001); | |
403 | for(Int_t i=0; i<nbins; i++){ | |
404 | cgaus->cd(i+1); | |
405 | fHistDCA[i]->SetLineColor(colors[iparticle]); | |
406 | fHistDCA[i]->SetMarkerColor(colors[iparticle]); | |
407 | fPar->SetLineColor(colors[iparticle]); | |
408 | ||
409 | fHistDCA[i]->Draw(); | |
410 | fHistDCA[i]->SetFillColor(16); | |
411 | printf("\n\n\n\n\n\n first fit step\n\n\n\n\n"); | |
412 | fHistDCA[i]->Fit(fPar,"NM","",-1,1); | |
413 | printf("\n\n\n\n\n\n second fit step\n\n\n\n\n"); | |
414 | Float_t nsigmas=1.; | |
415 | Float_t sigma=fPar->GetParameter(2); | |
416 | fHistDCA[i]->Fit(fPar,"NM","",fPar->GetParameter(1)-nsigmas*sigma,fPar->GetParameter(1)+nsigmas*sigma); | |
417 | fHistDCA[i]->GetXaxis()->SetRangeUser(fPar->GetParameter(1)-nsigmas*sigma,fPar->GetParameter(1)+nsigmas*sigma); | |
418 | fPar->DrawClone("same"); | |
419 | fHistImpParRes->Fill((xbins[i]+xbins[i+1])/2,10000*fPar->GetParameter(2)); | |
420 | fHistImpParRes->SetBinError(fHistImpParRes->FindBin((xbins[i]+xbins[i+1])/2),10000*fPar->GetParError(2)); | |
421 | fHistImpParMean->Fill((xbins[i]+xbins[i+1])/2,10000*fPar->GetParameter(1)); | |
422 | fHistImpParMean->SetBinError(fHistImpParMean->FindBin((xbins[i]+xbins[i+1])/2),10000*fPar->GetParError(1)); | |
423 | } | |
424 | fHistImpParRes->SetMaximum(1000); | |
425 | fHistImpParRes->SetMinimum(0); | |
426 | fHistImpParMean->SetMaximum(80); | |
427 | fHistImpParMean->SetMinimum(-80); | |
428 | ||
429 | SetDrawAtt(iparticle+20,colors[iparticle],1,colors[iparticle],1,fHistImpParRes); | |
430 | SetDrawAtt(iparticle+20,colors[iparticle],1,colors[iparticle],1,fHistImpParMean); | |
431 | ||
432 | cImpPar->cd(); | |
433 | if(iparticle==0)fHistImpParRes->DrawCopy("p"); | |
434 | else fHistImpParRes->DrawCopy("psame"); | |
435 | ||
436 | cImpParMean->cd(); | |
437 | if(iparticle==0)fHistImpParMean->DrawCopy("p"); | |
438 | else fHistImpParMean->DrawCopy("psame"); | |
439 | ||
440 | ent=leg1->AddEntry(fHistImpParMean,Form("%s",particle[iparticle].Data()),"PL"); | |
441 | ent->SetTextColor(fHistImpParMean->GetLineColor()); | |
442 | } | |
443 | cImpPar->cd(); | |
444 | leg1->Draw(); | |
445 | cImpParMean->cd(); | |
446 | leg1->Draw(); | |
447 | ||
448 | } | |
449 | ||
450 | ||
451 | void SetDrawAtt(Int_t markerstyle,Int_t markercolor,Int_t markersize,Int_t linecolor,Int_t linewidth,TH1 *h1){ | |
452 | ||
453 | ||
454 | h1->SetMarkerStyle(markerstyle); | |
455 | h1->SetMarkerColor(markercolor); | |
456 | h1->SetMarkerSize(markersize); | |
457 | h1->SetLineColor(linecolor); | |
458 | h1->SetLineWidth(linewidth); | |
459 | } | |
460 | ||
461 |