set of macros to create plots (Michael Knichel)
[u/mrichter/AliRoot.git] / PWG0 / dNdPt / macros / plots / makeCompNSD.C
1 //------------------------------------------------------------------------------
2 // makeCompNSD.C
3 //
4 // create figure with ALICE comparison to CMS and ATLAS
5 //------------------------------------------------------------------------------
6
7
8
9 void makeCompNSD()
10 {
11
12 gROOT->LoadMacro("divide.C");
13  
14 TGraphErrors *graphCms = new TGraphErrors(binsCms,ptCms,nsdCms,errPtCms,err2NsdCms);
15 graphCms->SetMarkerColor(colorCms);
16 graphCms->SetLineColor(colorCms);
17 graphCms->SetMarkerStyle(26);
18  
19 TGraphAsymmErrors *graphAtlas = new TGraphAsymmErrors(binsAtlas,ptAtlas,nsdAtlas,lowErrPtAtlas,highErrPtAtlas,err2NsdAtlas,err2NsdAtlas);
20 graphAtlas->SetMarkerColor(colorAtlas);
21 graphAtlas->SetLineColor(colorAtlas);
22 graphAtlas->SetMarkerStyle(25);
23
24 TGraphErrors *graphAlice     = new TGraphErrors(binsNsdAlice,ptNsdAlice,nsdAlice,0,err2NsdAlice);
25 graphAlice->SetMarkerColor(colorAliceFit);
26 graphAlice->SetLineColor(colorAliceFit);
27 graphAlice->SetMarkerStyle(20);
28
29 TMultiGraph *all = new TMultiGraph("all","");
30
31
32 all->Add(graphAtlas);
33 all->Add(graphCms);
34 //all->Add(graphAlice);
35 all->Add(graphAlice);
36 //all->Draw("AP");
37 //setAttrib(all);
38
39
40 TGraphErrors *ratioAtlasAlice = divide(graphAtlas,graphAlice);
41 ratioAtlasAlice->SetFillColor(colorAtlas);
42 ratioAtlasAlice->SetLineColor(colorAtlas);
43 ratioAtlasAlice->SetFillStyle(3354);
44
45 TGraphErrors *ratioCmsAlice = divide(graphCms,graphAlice);
46 ratioCmsAlice->SetFillColor(colorCms);
47 ratioCmsAlice->SetLineColor(colorCms);
48 ratioCmsAlice->SetFillStyle(3345);
49
50 Double_t one[binsNsdAlice];  
51 for (Int_t i=0; i < binsNsdAlice; i++) { 
52     one[i] = 1.0;
53 }
54
55 TGraphErrors *ratioAliceAlice = new TGraphErrors(binsNsdAlice,ptNsdAlice,one,0,relErr2NsdAlice);
56 ratioAliceAlice->SetFillColor(colorAliceErrors);
57 ratioAliceAlice->SetLineColor(20);
58
59 TCanvas *can3 = new TCanvas("can3","CompNSD",520,700);
60
61 TPad *pad3_1 = new TPad("pad3_1","pad3_1",0.0,0.35,1.0,1.0);
62 setAttrib(pad3_1);
63
64 TPad *pad3_2 = new TPad("pad3_2","pad3_2",0.0,0.0,1.0,0.35);
65 setAttrib(pad3_2);
66 //
67 can3->cd();
68
69 pad3_1->Draw();
70 pad3_1->cd();
71 pad3_1->SetLogx();
72 pad3_1->SetLogy();
73 //all->Draw("AE4");
74 all->Draw("APZ");
75 all->GetXaxis()->SetTitle("p_{T} [GeV/c]");
76 all->GetXaxis()->SetTitleOffset(1.6);
77 all->GetYaxis()->SetTitleOffset(1.6);
78 all->GetYaxis()->SetTitle("1/N_{evt} 1/(2#pi p_{T}) (d^{2}N_{ch})/(d#eta dp_{T}) (GeV/c)^{-2}");
79 all->GetXaxis()->SetLimits(minPt,maxPt);
80 setAttrib(all);
81 /*
82 all->SetTitle("");
83 all->UseCurrentStyle();
84 all->GetXaxis()->SetRangeUser(minPt,maxPt);
85 all->GetXaxis()->SetLabelOffset(0.0);
86 all->GetXaxis()->SetTitleOffset(1.0);
87 all->GetYaxis()->SetTitleOffset(1.5);
88 all->GetYaxis()->SetTitleSize(0.06);
89 all->GetYaxis()->SetLabelSize(0.06);
90 all->GetXaxis()->SetNdivisions(405);
91 all->GetXaxis()->SetLabelSize(0.0);
92 */
93
94
95
96 graphAlice->SetFillColor(2);
97 TLegend *l3_1 = new TLegend(0.2,0.03,0.65,0.261);
98 l3_1->SetHeader("pp, NSD, #sqrt{s} = 900 GeV");
99 l3_1->AddEntry(graphAlice,"ALICE | #eta | < 0.8","LP");
100 l3_1->AddEntry(graphAtlas,"ATLAS | #eta | < 2.5","LP");
101 l3_1->AddEntry(graphCms,"CMS | #eta | < 2.4","LP");
102 //la->AddEntry(graphUA1,"UA1","p");
103 //la->AddEntry(graphCMS,"CMS","p");
104 //la->AddEntry(graphCMSred,"CMS, #eta<0.8","p");
105 //la->AddEntry(graphATLAS,"ATLAS","p");
106 l3_1->SetTextSize(legendTextSize);
107 l3_1->SetFillColor(0);
108 l3_1->SetLineColor(0);
109 l3_1->Draw();
110
111
112 //histo1->GetXaxis()->SetNdivisions(405);
113
114 can3->cd();
115 pad3_2->Draw();
116 pad3_2->cd();
117 pad3_2->SetLogx();
118
119 TMultiGraph *ratios = new TMultiGraph("ratios","");
120
121
122 ratios->Add(ratioAliceAlice);
123 ratios->Add(ratioAtlasAlice);
124 ratios->Add(ratioCmsAlice);
125
126 ;
127 //ratio->SetTitle("ratio ALICE/ATLAS (different #eta)");
128 ratios->Draw("AE3");
129 ratios->GetXaxis()->SetLimits(minPt,maxPt);
130 ratios->GetXaxis()->SetTitle("p_{T} (GeV/c)");
131 ratios->GetXaxis()->SetTitleOffset(1.4);
132 ratios->GetYaxis()->SetTitleOffset(0.9);
133 ratios->GetYaxis()->SetTitle("ratio");
134 ratios->GetYaxis()->SetLabelSize(0.07);
135 ratios->GetXaxis()->SetLabelSize(0.07);
136 ratios->GetXaxis()->SetTitleSize(0.07);
137 ratios->GetYaxis()->SetTitleSize(0.07);
138 ratios->GetYaxis()->CenterTitle();
139 setAttrib(ratios);
140
141 ratios->GetYaxis()->SetLabelOffset(0.023);
142
143 //ratios->GetYaxis()->SetRangeUser(0.2,1.7);
144 //ratios->GetYaxis()->SetLimits(0.2,1.7);
145
146 /*
147 ratios->UseCurrentStyle();
148 ratios->GetXaxis()->SetTitleOffset(1.2);
149 ratios->GetYaxis()->SetTitleOffset(0.6);
150 ratios->GetXaxis()->SetTitleSize(0.135);
151 ratios->GetYaxis()->SetTitleSize(0.135);
152 ratios->GetXaxis()->SetLabelSize(0.135);
153 ratios->GetYaxis()->SetLabelSize(0.135);
154 ratios->GetXaxis()->SetLabelOffset(0.025);
155 ratios->GetYaxis()->SetLabelOffset(0.06);
156 ratios->GetXaxis()->SetTickLength(0.09);
157 ratios->GetYaxis()->SetLabelOffset(0.025);
158 ratios->GetXaxis()->SetNdivisions(405);
159 ratios->GetYaxis()->SetNdivisions(402);
160 ratios->GetXaxis()->SetRangeUser(minPt,maxPt);
161 */
162
163 graphAlice->SetFillColor(2);
164 TLegend *l3_2 = new TLegend(0.2,0.323,0.65,0.637);
165 l3_2->AddEntry(ratioAliceAlice,"ALICE uncertainties","F");
166 l3_2->AddEntry(ratioAtlasAlice,"ATLAS / ALICE","F");
167 l3_2->AddEntry(ratioCmsAlice,"CMS / ALICE","F");
168 l3_2->SetFillColor(0);
169 l3_2->SetLineColor(0);
170 l3_2->SetTextSize(legendTextSize);
171 l3_2->Draw();
172
173
174 //aliceData->Draw("AE4");
175 TF1 *fOne = new TF1("one","1",0.1,20);
176 fOne->SetRange(0.1,20);
177 fOne->SetLineWidth(1);
178 fOne->Draw("SAME");
179 //ratio->GetYaxis()->SetTitle("ratio ALICE/ATLAS");
180 /*
181 histo1c->Draw();
182 histo1c->GetXaxis()->SetLabelSize(0.08);
183 histo1c->GetYaxis()->SetLabelSize(0.08);
184 histo1c->GetXaxis()->SetNdivisions(405);
185 histo1c->GetYaxis()->SetNdivisions(405);
186 */
187
188 ratios->Draw("E3");
189 fOne->Draw("SAME");
190 logoPrelim(can3);
191 }