1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 // particle ratios as a function of multiplicity
17 // author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
22 #include <TGraphErrors.h>
31 void GetRatio(Double_t x, Double_t y, Double_t errx, Double_t erry, Double_t& r, Double_t& rerr);
32 void Draw(TGraph* gr, Int_t marker, Int_t color, const TString& xtitle, const TString& ytitle);
34 void RatioMult(const TString& pSpectra = "~/alice/output/Proton-lhc10d-Mult-Spectra.root",
35 const TString& ptag = "lhc10d",
36 const TString& dSpectra = "~/alice/output/Deuteron-lhc10d-Mult-Spectra.root",
37 const TString& dtag = "lhc10d")
40 // particle ratios as a function of multiplicity (from fitting distributions)
42 using namespace B2mult;
44 const Int_t kNpart = 2;
46 const TString kProton[kNpart] = { "Proton", "AntiProton" };
47 const TString kDeuteron[kNpart] = { "Deuteron", "AntiDeuteron" };
51 TFile* fproton = new TFile(pSpectra.Data());
52 if(fproton->IsZombie()) exit(1);
54 TFile* fdeuteron = new TFile(dSpectra.Data());
55 if(fdeuteron->IsZombie()) exit(1);
58 TGraphErrors* grRatio[kNpart] = { new TGraphErrors(), new TGraphErrors() };
59 TGraphErrors* grMixRatio[kNpart] = { new TGraphErrors(), new TGraphErrors() };
62 TGraphErrors* grProtondNdy[kNpart] = { new TGraphErrors(), new TGraphErrors() };
63 TGraphErrors* grProtonN[kNpart] = { new TGraphErrors(), new TGraphErrors() };
64 TGraphErrors* grProtonC[kNpart] = { new TGraphErrors(), new TGraphErrors() };
65 TGraphErrors* grProtonChi2Ndf[kNpart] = { new TGraphErrors(), new TGraphErrors() };
66 //TGraphErrors* grProtonProb[kNpart] = { new TGraphErrors(), new TGraphErrors() };
68 TGraphErrors* grDeuterondNdy[kNpart] = { new TGraphErrors(), new TGraphErrors() };
69 TGraphErrors* grDeuteronN[kNpart] = { new TGraphErrors(), new TGraphErrors() };
70 TGraphErrors* grDeuteronC[kNpart] = { new TGraphErrors(), new TGraphErrors() };
71 TGraphErrors* grDeuteronChi2Ndf[kNpart] = { new TGraphErrors(), new TGraphErrors() };
72 //TGraphErrors* grDeuteronProb[kNpart] = { new TGraphErrors(), new TGraphErrors() };
74 for(Int_t i=0; i<kNmult; ++i)
76 TF1* fncProton[kNpart];
77 TF1* fncDeuteron[kNpart];
79 for(Int_t j=0; j<kNpart; ++j)
81 fncProton[j] = (TF1*)FindObj(fproton, ptag + "-" + kMultClass[i], kProton[j] + "_Fit_InvDiffYield_Pt");
82 fncDeuteron[j] = (TF1*)FindObj(fdeuteron, dtag + "-" + kMultClass[i], kDeuteron[j] + "_Fit_InvDiffYield_Pt");
87 Double_t dNdy[kNpart] = {fncProton[0]->GetParameter(0), fncDeuteron[0]->GetParameter(0)};
88 Double_t dNdyErr[kNpart] = {fncProton[0]->GetParError(0), fncDeuteron[0]->GetParError(0)};
90 Double_t dNdyBar[kNpart] = {fncProton[1]->GetParameter(0), fncDeuteron[1]->GetParameter(0)};
91 Double_t dNdyBarErr[kNpart] = {fncProton[1]->GetParError(0), fncDeuteron[1]->GetParError(0)};
94 Double_t ratio[kNpart], ratioErr[kNpart];
95 for(Int_t j=0; j<kNpart; ++j)
97 GetRatio(dNdyBar[j], dNdy[j], dNdyBarErr[j], dNdyErr[j], ratio[j], ratioErr[j]);
98 grRatio[j]->SetPoint(i, kKNOmult[i], ratio[j]);
99 grRatio[j]->SetPointError(i, 0, ratioErr[j]);
103 Double_t mixRatio[kNpart], mixRatioErr[kNpart];
105 GetRatio(dNdy[1], dNdy[0], dNdyErr[1], dNdyErr[0], mixRatio[0], mixRatioErr[0]);
106 GetRatio(dNdyBar[1], dNdyBar[0], dNdyBarErr[1], dNdyBarErr[0], mixRatio[1], mixRatioErr[1]);
108 for(Int_t j=0; j<kNpart; ++j)
110 grMixRatio[j]->SetPoint(i, kKNOmult[i], mixRatio[j]);
111 grMixRatio[j]->SetPointError(i, 0, mixRatioErr[j]);
115 for(Int_t j=0; j<kNpart; ++j)
117 grProtondNdy[j]->SetPoint(i, kKNOmult[i], fncProton[j]->GetParameter(0));
118 grProtondNdy[j]->SetPointError(i, 0, fncProton[j]->GetParError(0));
120 grProtonN[j]->SetPoint(i, kKNOmult[i], fncProton[j]->GetParameter(1));
121 grProtonN[j]->SetPointError(i, 0, fncProton[j]->GetParError(1));
123 grProtonC[j]->SetPoint(i, kKNOmult[i], fncProton[j]->GetParameter(2));
124 grProtonC[j]->SetPointError(i, 0, fncProton[j]->GetParError(2));
126 grProtonChi2Ndf[j]->SetPoint(i, kKNOmult[i], fncProton[j]->GetChisquare()/fncProton[j]->GetNDF());
127 //grProtonProb[j]->SetPoint(i, kKNOmult[i], fncProton[j]->GetProb());
130 grDeuterondNdy[j]->SetPoint(i, kKNOmult[i], fncDeuteron[j]->GetParameter(0));
131 grDeuterondNdy[j]->SetPointError(i, 0, fncDeuteron[j]->GetParError(0));
133 grDeuteronN[j]->SetPoint(i, kKNOmult[i], fncDeuteron[j]->GetParameter(1));
134 grDeuteronN[j]->SetPointError(i, 0, fncDeuteron[j]->GetParError(1));
136 grDeuteronC[j]->SetPoint(i, kKNOmult[i], fncDeuteron[j]->GetParameter(2));
137 grDeuteronC[j]->SetPointError(i, 0, fncDeuteron[j]->GetParError(2));
139 grDeuteronChi2Ndf[j]->SetPoint(i, kKNOmult[i], fncDeuteron[j]->GetChisquare()/fncDeuteron[j]->GetNDF());
140 //grDeuteronProb[j]->SetPoint(i, kKNOmult[i], fncDeuteron[j]->GetProb());
149 TStyle* st = new TStyle();
155 st->SetCanvasColor(0);
156 st->SetFrameBorderMode(0);
157 st->SetFrameFillColor(0);
158 st->SetLabelFont(62,"XYZ");
159 st->SetTitleFont(62,"XYZ");
164 const Int_t kNCol = 4;
166 TCanvas* c0 = new TCanvas("c0", "proton model parameters");
169 for(Int_t j=0; j<kNpart; ++j)
172 Draw(grProtondNdy[j], kFullCircle, kBlue, "z", "dN/dy");
175 Draw(grProtonN[j], kFullCircle, kBlue, "z", "n");
178 Draw(grProtonC[j], kFullCircle, kBlue, "z", "C");
181 Draw(grProtonChi2Ndf[j], kFullCircle, kBlue, "z", "#chi^{2}/ndf");
183 /* c0->cd(kNCol*j+5);
184 Draw(grProtonProb[j], kFullCircle, kBlue, "z", "Prob");
188 TCanvas* c1 = new TCanvas("c1", "deuteron model parameters");
191 for(Int_t j=0; j<kNpart; ++j)
194 Draw(grDeuterondNdy[j], kFullCircle, kBlue, "z", "dN/dy");
197 Draw(grDeuteronN[j], kFullCircle, kBlue, "z", "n");
200 Draw(grDeuteronC[j], kFullCircle, kBlue, "z", "C");
203 Draw(grDeuteronChi2Ndf[j], kFullCircle, kBlue, "z", "#chi^{2}/ndf");
205 /* c1->cd(kNCol*j+5);
206 Draw(grDeuteronProb[j], kFullCircle, kBlue, "z", "Prob");
210 TCanvas* c2 = new TCanvas("c2","particle ratios");
214 Draw(grRatio[0], kFullCircle, kRed, "z", "#bar{p}/p");
217 Draw(grRatio[1], kFullCircle, kRed, "z", "#bar{d}/d");
220 Draw(grMixRatio[0], kFullCircle, kRed, "z", "d/p");
223 Draw(grMixRatio[1], kFullCircle, kRed, "z", "#bar{d}/#bar{p}");
226 void GetRatio(Double_t x, Double_t y, Double_t errx, Double_t erry, Double_t& r, Double_t& rerr)
229 // get the ratio of x/y, its error and save in r and rerr
240 rerr = r*TMath::Sqrt(TMath::Power(errx/x,2)+TMath::Power(erry/y,2));
243 void Draw(TGraph* gr, Int_t marker, Int_t color, const TString& xtitle, const TString& ytitle)
246 // draw a graph in current canvas
248 gr->SetMarkerStyle(marker);
249 gr->SetMarkerColor(color);
250 gr->SetLineColor(color);
251 gr->GetXaxis()->SetTitle(xtitle.Data());
252 gr->GetYaxis()->SetTitle(ytitle.Data());