1 #if !defined(__CINT__) || defined(__MAKECINT__)
9 #include <TLegendEntry.h>
20 #include <TFitResult.h>
21 #include <TFitResultPtr.h>
26 extern TStyle *gStyle;
28 static Double_t xBins[]={
29 0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,
30 1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,
31 2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0,
32 4.5,5.0,5.5,6.5,8.0,10.0,12.0
34 const Int_t nBins=sizeof(xBins)/sizeof(Double_t) - 1; //37
36 static Bool_t gFlag=kFALSE;
38 //*** The systematic uncertainties for combining
39 // TPC crossed/findable
41 // DCA between V0 daughters
42 // TPC crossed pad rows
43 // DCA daughters <-> PV
46 Double_t sysEffK0s[nBins]={//Efficiency, combined over cuts mentioned above
48 0.05,0.05,0.04,0.03, //Dominated by cos(PA)
49 0.04,0.05,0.06,0.07,0.08,0.09, //Dominated by TPC crossed/findable
50 0.10,0.10,0.11,0.12,0.12,0.13,0.13,0.13,0.14,0.14,0.14,
51 0.14,0.13,0.13,0.12,0.11,0.11,0.11,0.10,0.09,0.08,
52 0.08,0.05,0.04,0.03,0.03
55 static Double_t sysSigK0s[nBins]={//Signal extraction
56 0.00728589, 0.00728589, 0.00728539, 0.0073469, 0.00737846, 0.00741705,
57 0.00750887, 0.00753641, 0.00769012, 0.00789154, 0.00796624, 0.00822856,
58 0.00838203, 0.00864603, 0.00906498, 0.00923208, 0.00931179, 0.0100081,
59 0.0100768, 0.0105292, 0.0112067, 0.0122143, 0.0130162, 0.0139799, 0.0155215,
60 0.0158903, 0.0168517, 0.0189316, 0.0188103, 0.020233, 0.0223704, 0.0260327,
61 0.0260327, 0.0260327, 0.0260327, 0.0260327, 0.0260327
64 static Double_t sysSigK0s[nBins]={//Signal extraction
65 0.03, 0.03, 0.03, 0.03, 0.03, 0.03,
66 0.03, 0.03, 0.03, 0.03, 0.03, 0.03,
67 0.03, 0.03, 0.03, 0.03, 0.03, 0.03,
68 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, 0.03,
69 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, 0.03,
70 0.03, 0.03, 0.03, 0.03, 0.03
74 Double_t sysEffLam[nBins]={//Efficiency, combined over cuts mentioned above
76 0.20,0.12,0.05, //Dominated by cos(PA)+FD
77 0.06,0.06,0.06,0.06,0.06, //Dominated by c*tau
78 0.06,0.06, //Dominated by TPC crossed/findable
79 0.07,0.09,0.09,0.10,0.10,0.11,0.11,0.11,0.10,0.10,0.09,
80 0.08,0.08,0.07,0.07,0.07,0.06,0.07,0.06,0.07,0.05,
83 static Double_t sysSigLam[nBins]={//Signal extraction
84 0.0447214, 0.0447214, 0.0447214, 0.0447214, 0.0447214,
85 0.0447214, 0.0447214, 0.0447214, 0.0447214, 0.0447214,
86 0.0447214, 0.0447214, 0.0447214, 0.0447214, 0.0447214,
87 0.0447214, 0.0447214, 0.0447214, 0.0447214, 0.0447214,
88 0.0447214, 0.0447214, 0.0447214, 0.0447214, 0.0447214,
89 0.0447214, 0.0447214, 0.0447214, 0.0447214, 0.0465862,
90 0.0472600, 0.0488576, 0.0526797, 0.0575355, 0.0651647,
94 const Double_t sysPID=0.02; //PID
95 const Double_t sysArm=0.01; //Armenteros cut
96 const Double_t sysFD=0.05; //Feed down
98 const Double_t sysRatio=0.05;//Efficiency systematics for the L/K ratio
100 const Double_t fdCorr=0.81; //Feed down correction value
103 TH1 *MapHisto(const TH1 *h) {
104 const Double_t eps=0.0001;
106 name = name + h->GetName();
107 TH1F *mh=new TH1F(name.Data(),h->GetTitle(),nBins,xBins);
108 mh->GetXaxis()->SetTitle("p_{t} (GeV/c)");
109 mh->GetYaxis()->SetTitle("1/N_{ev}d^{2}N/dp_{t}/dy (GeV/c)^{-1}");
111 Double_t xh=h->GetBinCenter(1), xmh=0.;
114 for (; n<=nBins; n++) {
115 xmh=mh->GetBinCenter(n);
116 if (TMath::Abs(xh-xmh)<eps) break;
119 Int_t iii=h->GetNbinsX();
121 for (Int_t i=1; i<=iii; i++) {
125 cerr<<"Input number of bins is larger than the output number of bins!\n";
130 xh = h->GetBinCenter(i);
131 xmh=mh->GetBinCenter(ni1);
132 if (TMath::Abs(xh-xmh)>eps) {
133 cerr<<"Wrong binning !\n";
138 Double_t c=h->GetBinContent(i);
139 Double_t e=h->GetBinError(i);
140 mh->SetBinContent(ni1,c);
141 mh->SetBinError(ni1,e);
148 GetHistos(const Char_t *rName[], const Char_t *eName[], TH1 *&raw, TH1 *&eff) {
150 /*TFile *fr=*/TFile::Open(rName[0]);
151 //TList *lst=(TList*)gFile->Get("c1DataYields");
152 TList *lst=(TList*)gFile->Get("cLK0Spectra");
154 raw=(TH1F*)lst->FindObject(rName[1]);
156 cerr<<"No raw yield !"<<eName[0]<<' '<<eName[1]<<endl;
160 ///*TFile *fe=*/TFile::Open(eName[0]);
161 //eff=(TH1F*)gFile->Get(eName[1]);
162 eff=(TH1F*)lst->FindObject(eName[1]);
164 cerr<<"No efficiency ! "<<eName[0]<<' '<<eName[1]<<endl;
170 void SetAttributes(TH1 *h,const Char_t *tit,Int_t col,Int_t mar,Float_t siz,
171 Float_t max=1000., Float_t min=1e-6, Float_t factor=1, Int_t range=nBins) {
173 h->SetLineColor(col);
174 h->SetMarkerColor(col);
175 h->SetMarkerStyle(mar);
176 h->SetMarkerSize(siz);
180 h->GetXaxis()->SetRange(1,range);
184 DrawHisto(TH1 *h, const Option_t *option, Double_t *sysEff, Double_t *sysSig) {
185 TH1F *hh=new TH1F(*((TH1F*)h));
186 Int_t nb=hh->GetNbinsX();
188 for (Int_t i=1; i<=nb; i++) {
189 Double_t c=hh->GetBinContent(i);
190 Double_t e=hh->GetBinError(i);
192 e = sysEff[j]*sysEff[j] + sysSig[j]*sysSig[j];
194 if (sysEff==sysEffLam) {// for Lambda
196 if (i<13) e += sysPID*sysPID;
203 hh->SetBinError(i,e);
205 hh->SetFillColor(17);
206 TString opt("E5"); opt+=option;
207 //TString opt("E2"); opt+=option;
208 hh->Draw(opt.Data());
209 h->Draw("e x0 same");
212 void DrawRatio(TH1 *h, const Option_t *option) {
213 TH1F *hh=new TH1F(*((TH1F*)h));
214 Int_t nb=hh->GetNbinsX();
216 for (Int_t i=1; i<=nb; i++) {
217 Double_t c=hh->GetBinContent(i);
218 Double_t e=hh->GetBinError(i);
220 e = sysSigK0s[j]*sysSigK0s[j] + sysSigLam[j]*sysSigLam[j];
222 e += sysRatio*sysRatio;
226 if (i<13) e += sysPID*sysPID;
230 hh->SetBinError(i,e);
232 hh->SetFillColor(17);
233 TString opt("E5"); opt+=option;
234 hh->Draw(opt.Data());
235 h->Draw("e x0 same");
238 void DrawALICELogo(Float_t x1, Float_t y1, Float_t x2, Float_t y2)
240 // Correct for aspect ratio of figure plus aspect ratio of pad.
241 // Coordinates are NDC!
243 x2 = x1 + (y2 - y1)*0.891*gPad->GetCanvas()->GetWindowHeight()*gPad->GetHNDC() / (gPad->GetWNDC() * gPad->GetCanvas()->GetWindowWidth());
245 TPad *myPadLogo = new TPad("myPadLogo","Pad for ALICE Logo", x1, y1, x2, y2);
246 myPadLogo->SetLeftMargin(0);
247 myPadLogo->SetTopMargin(0);
248 myPadLogo->SetRightMargin(0);
249 myPadLogo->SetBottomMargin(0);
252 TASImage *myAliceLogo =
253 new TASImage("alice_logo_preliminary.eps");
254 myAliceLogo->Draw("same");
257 void DrawFit(const Char_t *nam[], const Float_t *fac, Int_t n){
258 for (Int_t i=0; i<n; i++) {
259 const Char_t *name=nam[i];
260 Float_t factor=fac[i];
261 TF1 *f=(TF1*)gROOT->FindObject(name);
262 TH1 *h=f->GetHistogram();
271 void DrawSpectraAndRatios() {
274 const Int_t nCent1=nCent-1;
276 const Char_t *title[nCent]={
284 const Int_t colour[nCent]={2, 635, 419, 4 , 6, 1 };
285 const Int_t marker[nCent]={22, 34, 21, 23, 33, 20 };
286 const Float_t masize[nCent]={1.6, 1.3, 1.3, 1.6,2, 1.3};
287 const Float_t factor[nCent]={1.0, 1.0, 1.2, 2.0,3.0,0.0}; //scale for drawing
289 const Char_t *rNameL[2*nCent]={ // file name, histo name
290 "LK0Spectra_WeightMean_100712.root", "Data_La_0010",
291 "LK0Spectra_WeightMean_100712.root", "Data_La_1020",
292 "LK0Spectra_WeightMean_100712.root", "Data_La_2040",
293 "LK0Spectra_WeightMean_100712.root", "Data_La_4060",
294 "LK0Spectra_WeightMean_100712.root", "Data_La_6080",
295 "LK0Spectra_WeightMean_100712.root", "Data_La_8090"
297 const Char_t *eNameL[2*nCent]={ // file name, histo name
298 "LK0Spectra_WeightMean_100712.root", "Efficiency_La_0010",
299 "LK0Spectra_WeightMean_100712.root", "Efficiency_La_1020",
300 "LK0Spectra_WeightMean_100712.root", "Efficiency_La_2040",
301 "LK0Spectra_WeightMean_100712.root", "Efficiency_La_4060",
302 "LK0Spectra_WeightMean_100712.root", "Efficiency_La_6080",
303 "LK0Spectra_WeightMean_100712.root", "Efficiency_La_8090"
306 const Char_t *rNameK[2*nCent]={ // file name, histo name
307 "LK0Spectra_WeightMean_100712.root", "Data_K0_0010",
308 "LK0Spectra_WeightMean_100712.root", "Data_K0_1020",
309 "LK0Spectra_WeightMean_100712.root", "Data_K0_2040",
310 "LK0Spectra_WeightMean_100712.root", "Data_K0_4060",
311 "LK0Spectra_WeightMean_100712.root", "Data_K0_6080",
312 "LK0Spectra_WeightMean_100712.root", "Data_K0_8090"
314 const Char_t *eNameK[2*nCent]={ // file name, histo name
315 "LK0Spectra_WeightMean_100712.root", "Efficiency_K0_0010",
316 "LK0Spectra_WeightMean_100712.root", "Efficiency_K0_1020",
317 "LK0Spectra_WeightMean_100712.root", "Efficiency_K0_2040",
318 "LK0Spectra_WeightMean_100712.root", "Efficiency_K0_4060",
319 "LK0Spectra_WeightMean_100712.root", "Efficiency_K0_6080",
320 "LK0Spectra_WeightMean_100712.root", "Efficiency_K0_8090"
323 gStyle->SetOptStat(0);
324 gStyle->SetOptTitle(0);
325 gStyle->SetLegendFillColor(0);
329 TString option(""), ratio("ratio");
331 TCanvas *c1=new TCanvas; c1->SetLogy();
332 c1->SetLeftMargin(0.13); c1->SetBottomMargin(0.13);
333 TCanvas *c1lin=new TCanvas;
334 c1lin->SetLeftMargin(0.13); c1lin->SetBottomMargin(0.13);
336 TCanvas *c2=new TCanvas; c2->SetLogy();
337 c2->SetLeftMargin(0.13); c2->SetBottomMargin(0.13);
338 TCanvas *c2lin=new TCanvas;
339 c2lin->SetLeftMargin(0.13); c2lin->SetBottomMargin(0.13);
341 TCanvas *c3=new TCanvas;
342 c3->SetLeftMargin(0.13); c3->SetBottomMargin(0.13);
344 TH1 *lkRatio[nCent]={0};
346 for (Int_t cent=0; cent<nCent1; cent++) {
347 const Char_t *tit=title[cent];
348 Int_t col=colour[cent];
349 Int_t mar=marker[cent];
350 Float_t siz=masize[cent];
351 Float_t fac=factor[cent];
354 if (!GetHistos(rNameL+2*cent, eNameL+2*cent, raw, eff)) return;
355 TH1 *rawHl=MapHisto(raw);
356 TH1 *effHl=MapHisto(eff);
358 effHl->Scale(1/fdCorr); //Feed down
360 rawHl->Divide(effHl);
361 SetAttributes(rawHl,tit,col,mar,siz);
363 DrawHisto(rawHl, option.Data(), sysEffLam, sysSigLam);
365 TH1 *linHl=(TH1*)rawHl->Clone();
366 SetAttributes(linHl,tit,col,mar,siz,25.0*fdCorr,0.,fac,32);
368 DrawHisto(linHl, option.Data(), sysEffLam, sysSigLam);
371 if (cent==nCent1) gFlag=kTRUE;
372 if (!GetHistos(rNameK+2*cent, eNameK+2*cent, raw, eff)) return;
373 TH1 *rawHk=MapHisto(raw);
374 TH1 *effHk=MapHisto(eff);
375 rawHk->Divide(effHk);
376 SetAttributes(rawHk,tit,col,mar,siz);
378 DrawHisto(rawHk, option.Data(), sysEffK0s, sysSigK0s);
380 TH1 *linHk=(TH1*)rawHk->Clone();
381 SetAttributes(linHk,tit,col,mar,siz,120.,0.,fac,32);
383 DrawHisto(linHk, option.Data(), sysEffK0s, sysSigK0s);
386 TH1 *rawHlk=(TH1*)rawHl->Clone();
387 lkRatio[cent]=rawHlk;
388 TString name=ratio+rawHlk->GetName();
389 rawHlk->SetName(name.Data());
390 rawHlk->SetMaximum(1.7);
391 rawHlk->Divide(rawHk);
392 rawHlk->GetYaxis()->SetTitle("#Lambda/K^{0}_{S}");
395 DrawRatio(rawHlk,option.Data());
399 for (Int_t cent=0; cent<nCent; cent++) {
400 lkRatio[cent]->Draw("same");
403 Float_t offx=0.15, offy=0.16, sizx=0.22, sizy=0.22;
404 TLegend *leg=c1->BuildLegend(0.68,0.46,0.88,0.82,"Centrality:");
405 leg->SetBorderSize(0);
406 leg->SetFillColor(0);
408 TLegendEntry *entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
409 Int_t ci = TColor::GetColor("#cccccc");
410 entry->SetLineColor(ci);
411 entry->SetLineStyle(1);
412 entry->SetLineWidth(10);
413 entry->SetMarkerColor(ci);
416 TLatex * tex = new TLatex(5.5,5.0,"#Lambda");
417 tex->SetTextFont(42);
418 tex->SetTextSize(0.11);
419 tex->SetLineWidth(2);
421 tex = new TLatex(2.18,200.,"Pb-Pb at #sqrt{s_{NN}}=2.76 TeV, |y|<0.5");
422 tex->SetTextFont(42);
423 tex->SetLineWidth(2);
425 DrawALICELogo(offx,offy,offx+sizx,offy+sizy);
427 leg=c1lin->BuildLegend(0.69,0.43,0.88,0.80,"Centrality:");
428 leg->SetBorderSize(0);
429 leg->SetFillColor(0);
431 entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
432 entry->SetLineColor(ci);
433 entry->SetLineStyle(1);
434 entry->SetLineWidth(10);
435 entry->SetMarkerColor(ci);
436 entry=leg->AddEntry("NULL","BGBW fit","l");
437 entry->SetLineColor(1);
438 entry->SetLineStyle(1);
439 entry->SetLineWidth(1);
440 entry->SetMarkerColor(1);
441 entry->SetMarkerStyle(21);
442 entry->SetMarkerSize(1);
445 tex=new TLatex(1.04,22.7*fdCorr,"Pb-Pb at #sqrt{s_{NN}}=2.76 TeV, |y|<0.5");
447 tex = new TLatex(2.38,18.5*fdCorr,"#Lambda");
448 tex->SetTextSize(0.11);
451 TFile::Open("LamFitResults20120711.root");
452 const Char_t *name[nCent]={
453 "fitBWLambda010","fitBWLambda1020","fitBWLambda2040",
454 "fitBWLambda4060","fitBWLambda6080","fitBWLambda8090"
456 Float_t fac[nCent]; for (Int_t i=0; i<nCent; i++) fac[i]=fdCorr*factor[i];
457 DrawFit(name, fac, nCent1);
459 Float_t offx1=0.70, offy1=0.18;
460 DrawALICELogo(offx1,offy1,offx1+sizx,offy1+sizy);
465 leg=c2->BuildLegend(0.68,0.46,0.88,0.82,"Centrality:");
466 leg->SetBorderSize(0);
467 leg->SetFillColor(0);
469 entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
470 entry->SetLineColor(ci);
471 entry->SetLineStyle(1);
472 entry->SetLineWidth(10);
473 entry->SetMarkerColor(ci);
476 tex = new TLatex(5.5,5.0,"K^{0}_{S}");
477 tex->SetTextFont(42);
478 tex->SetTextSize(0.089);
479 tex->SetLineWidth(2);
481 tex = new TLatex(2.18,200.,"Pb-Pb at #sqrt{s_{NN}}=2.76 TeV, |y|<0.5");
482 tex->SetTextFont(42);
483 tex->SetLineWidth(2);
485 DrawALICELogo(offx,offy,offx+sizx,offy+sizy);
487 leg=c2lin->BuildLegend(0.69,0.43,0.88,0.80,"Centrality:");
488 leg->SetBorderSize(0);
489 leg->SetFillColor(0);
491 entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
492 entry->SetLineColor(ci);
493 entry->SetLineStyle(1);
494 entry->SetLineWidth(10);
495 entry->SetMarkerColor(ci);
496 entry=leg->AddEntry("NULL","BGBW fit","l");
497 entry->SetLineColor(1);
498 entry->SetLineStyle(1);
499 entry->SetLineWidth(1);
500 entry->SetMarkerColor(1);
501 entry->SetMarkerStyle(21);
502 entry->SetMarkerSize(1);
505 tex = new TLatex(1.04,109.,"Pb-Pb at #sqrt{s_{NN}}=2.76 TeV, |y|<0.5");
507 tex = new TLatex(2.122705,87.70856,"K^{0}_{S}");
508 tex->SetTextSize(0.089);
511 TFile::Open("K0FitResults20120711.root");
512 const Char_t *name[nCent]={
513 "fitBWK0s0010","fitBWK0s1020","fitBWK0s2040",
514 "fitBWK0s4060","fitBWK0s6080","fitBWK0s8090"
516 DrawFit(name, factor, nCent1);
518 DrawALICELogo(offx1,offy1,offx1+sizx,offy1+sizy);
521 //leg=c3->BuildLegend(0.74,0.62,0.88,0.88,"Centrality:");
522 leg=c3->BuildLegend(0.55,0.55,0.88,0.88,"Centrality:");
523 leg->SetBorderSize(0);
524 leg->SetFillColor(0);
526 entry=leg->AddEntry("NULL","systematic uncertainty","lpf");
527 entry->SetLineColor(ci);
528 entry->SetLineStyle(1);
529 entry->SetLineWidth(10);
530 entry->SetMarkerColor(ci);