Fix for coverity (AdC)
[u/mrichter/AliRoot.git] / EVGEN / testPDF.C
CommitLineData
f72b7291 1 void testPDF(Double_t a = 208.)
2{
1fa2e049 3
4 gSystem->Load("liblhapdf.so");
5 StrucFunc_t pdf = kCTEQ6ll;
6
7
f72b7291 8// Dynamically link some shared libs
1fa2e049 9
10
11//
f72b7291 12 char parm[20][20];
13 Double_t val[20];
14//
15// Initialization
16//
17 printf("PDF initialized with: \n \n");
1fa2e049 18 strncpy(parm[0], "DEFAULT ", 20);
19 val[0] = AliStructFuncType::PDFsetIndex(pdf);
f72b7291 20 AliStructFuncType::PdfSet(parm, val);
1fa2e049 21
f72b7291 22//
23// Plots
24//
25// ================================================================
26// Pdf
27//
28 TCanvas *c1 = new TCanvas("c1","Gluon PDF",400,10,600,700);
29 TF1* f_gl_2 = new TF1("f_gl_2", pdf_gl, -6., 0., 2);
30 f_gl_2->SetParameter(0,2);
31 f_gl_2->SetParameter(1,a);
32 f_gl_2->SetMaximum(1000.);
33 f_gl_2->SetLineColor(1);
34 f_gl_2->Draw();
35
36 TF1* f_gl_5 = new TF1("f_gl_5", pdf_gl, -6., 0., 2);
37 f_gl_5->SetParameter(0,5);
38 f_gl_5->SetParameter(1,a);
39 f_gl_5->SetLineColor(2);
40 f_gl_5->Draw("Same");
41
42 TF1* f_gl_10 = new TF1("f_gl_10", pdf_gl, -6., 0., 2);
43 f_gl_10->SetParameter(0,10);
44 f_gl_10->SetParameter(1,a);
45 f_gl_10->SetLineColor(3);
46 f_gl_10->Draw("Same");
47
48 TF1* f_gl_50 = new TF1("f_gl_50", pdf_gl, -6., 0., 2);
49 f_gl_50->SetParameter(0,50);
50 f_gl_50->SetParameter(1,a);
51 f_gl_50->SetLineColor(4);
52 f_gl_50->Draw("Same");
53
54// ================================================================
55// Gluon Modification
56//
57 TCanvas *c2 = new TCanvas("c2","Gluon PDF Nucl. Mod.",400,10,600,700);
58
59 TF1* fmod_gl_2 = new TF1("fmod_gl_2", mod_gl, -6., 0., 2);
60 fmod_gl_2->SetParameter(0,2.);
61 fmod_gl_2->SetParameter(1,a);
62 fmod_gl_2->SetMaximum(1.5);
63 fmod_gl_2->SetLineColor(1);
64 fmod_gl_2->Draw();
65 fmod_gl_2->GetHistogram()->SetXTitle("log(x)");
66 fmod_gl_2->GetHistogram()->SetYTitle("F^{g}_{A}/F^{g}_{p}");
67
68 TF1* fmod_gl_5 = new TF1("fmod_gl_5", mod_gl, -6., 0., 2);
69 fmod_gl_5->SetParameter(0,5.);
70 fmod_gl_5->SetParameter(1,a);
71 fmod_gl_5->SetLineColor(2);
72 fmod_gl_5->Draw("Same");
73
74 TF1* fmod_gl_10 = new TF1("fmod_gl_10", mod_gl, -6., 0., 2);
75 fmod_gl_10->SetParameter(0,10.);
76 fmod_gl_10->SetParameter(1,a);
77 fmod_gl_10->SetLineColor(3);
78 fmod_gl_10->Draw("Same");
79
80 TF1* fmod_gl_50 = new TF1("fmod_gl_50", mod_gl, -6., 0., 2);
81 fmod_gl_50->SetParameter(0,50.);
82 fmod_gl_50->SetParameter(1,a);
83 fmod_gl_50->SetLineColor(4);
84 fmod_gl_50->Draw("Same");
85 label();
86
87
88// =================================================================
89// Sea Quark Modification
90//
91 TCanvas *c3 = new TCanvas("c3","Sea Quark PDF Nucl. Mod.",400,10,600,700);
92 TF1* fmod_sq_2 = new TF1("fmod_sq_2", mod_sq, -6., 0., 2);
93 fmod_sq_2->SetParameter(0,2.);
94 fmod_sq_2->SetParameter(1,a);
95 fmod_sq_2->SetMaximum(1.5);
96 fmod_sq_2->SetLineColor(1);
97 fmod_sq_2->Draw();
98 fmod_sq_2->GetHistogram()->SetXTitle("log(x)");
99 fmod_sq_2->GetHistogram()->SetYTitle("F^{sea q}_{A}/F^{sea q}_{p}");
100
101 TF1* fmod_sq_5 = new TF1("fmod_sq_5", mod_sq, -6., 0., 2);
102 fmod_sq_5->SetParameter(0,5.);
103 fmod_sq_5->SetParameter(1,a);
104 fmod_sq_5->SetLineColor(2);
105 fmod_sq_5->Draw("Same");
106
107 TF1* fmod_sq_10 = new TF1("fmod_sq_10", mod_sq, -6., 0., 2);
108 fmod_sq_10->SetParameter(0,10.);
109 fmod_sq_10->SetParameter(1,a);
110 fmod_sq_10->SetLineColor(3);
111 fmod_sq_10->Draw("Same");
112
113 TF1* fmod_sq_50 = new TF1("fmod_sq_50", mod_sq, -6., 0., 2);
114 fmod_sq_50->SetParameter(0,50.);
115 fmod_sq_50->SetParameter(1,a);
116 fmod_sq_50->SetLineColor(4);
117 fmod_sq_50->Draw("Same");
118 label();
119
120// =================================================================
121// Valence Quark Modification
122//
123 TCanvas *c4 = new TCanvas("c4","Valence Quark PDF Nucl. Mod.",
124 400,10,600,700);
125 TF1* fmod_vq_2 = new TF1("fmod_vq_2", mod_vq, -6., 0., 2);
126 fmod_vq_2->SetParameter(0,2.);
127 fmod_vq_2->SetParameter(1,a);
128 fmod_vq_2->SetMaximum(1.5);
129 fmod_vq_2->SetLineColor(1);
130 fmod_vq_2->Draw();
131 fmod_vq_2->GetHistogram()->SetXTitle("log(x)");
132 fmod_vq_2->GetHistogram()->SetYTitle("F^{val q}_{A}/F^{val q}_{p}");
133
134 TF1* fmod_vq_5 = new TF1("fmod_vq_5", mod_vq, -6., 0., 2);
135 fmod_vq_5->SetParameter(0,5.);
136 fmod_vq_5->SetParameter(1,a);
137 fmod_vq_5->SetLineColor(2);
138 fmod_vq_5->SetMaximum(1.5);
139 fmod_vq_5->Draw("Same");
140
141 TF1* fmod_vq_10 = new TF1("fmod_vq_10", mod_vq, -6., 0., 2);
142 fmod_vq_10->SetParameter(0,10.);
143 fmod_vq_10->SetParameter(1,a);
144 fmod_vq_10->SetLineColor(3);
145 fmod_vq_10->SetMaximum(1.5);
146 fmod_vq_10->Draw("Same");
147
148 TF1* fmod_vq_50 = new TF1("fmod_vq_50", mod_vq, -6., 0., 2);
149 fmod_vq_50->SetParameter(0,50.);
150 fmod_vq_50->SetParameter(1,a);
151 fmod_vq_50->SetLineColor(4);
152 fmod_vq_50->SetMaximum(1.5);
153 fmod_vq_50->Draw("Same");
154 label();
155
156}
157
158
159Double_t pdf_gl(Double_t* x, Double_t* par)
160{
161 Double_t xx = TMath::Power(10.,x[0]);
162 Double_t y;
163 Double_t upv, dnv, usea, dsea, str, chm, bot, top, gl;
164 Double_t q = par[0];
165 Double_t a = par[1];
166
167 AliStructFuncType::StructA(xx, q, a, upv, dnv, usea,
168 dsea, str, chm, bot, top, gl);
169
170 y = gl;
171
172 return y;
173}
174
175Double_t mod_gl(Double_t* x, Double_t* par)
176{
177 Double_t xx = TMath::Power(10.,x[0]);
178 Double_t y;
179 Double_t upv, dnv, usea, dsea, str, chm, bot, top, gl;
180 Double_t q = par[0];
181 Double_t a = par[1];
182
183 AliStructFuncType::StructA(xx, q, a, upv, dnv, usea,
184 dsea, str, chm, bot, top, gl);
185
186 Double_t y1 = gl;
187
188 AliStructFuncType::StructA(xx, q, 1., upv, dnv, usea,
189 dsea, str, chm, bot, top, gl);
190
191 return y1/gl;
192}
193
194Double_t mod_sq(Double_t* x, Double_t* par)
195{
196 Double_t xx = TMath::Power(10.,x[0]);
197 Double_t y;
198 Double_t upv, dnv, usea, dsea, str, chm, bot, top, gl;
199 Double_t q = par[0];
200 Double_t a = par[1];
201
202 AliStructFuncType::StructA(xx, q, a, upv, dnv, usea,
203 dsea, str, chm, bot, top, gl);
204
205 Double_t y1 = usea+dsea;
206
207 AliStructFuncType::StructA(xx, q, 1., upv, dnv, usea,
208 dsea, str, chm, bot, top, gl);
209
210 return y1/(usea+dsea);
211}
212
213
214Double_t mod_vq(Double_t* x, Double_t* par)
215{
216 Double_t xx = TMath::Power(10.,x[0]);
217 Double_t y;
218 Double_t upv, dnv, usea, dsea, str, chm, bot, top, gl;
219 Double_t q = par[0];
220 Double_t a = par[1];
221
222 AliStructFuncType::StructA(xx, q, a, upv, dnv, usea,
223 dsea, str, chm, bot, top, gl);
224
225 Double_t y1 = upv+dnv;
226
227 AliStructFuncType::StructA(xx, q, 1., upv, dnv, usea,
228 dsea, str, chm, bot, top, gl);
229
230 return y1/(upv+dnv);
231}
232
233
234void label()
235{
236 TLine *line = new TLine(-5.7,1.4,-5.2,1.4);
237 line->SetLineColor(1);
238 line->SetLineWidth(3);
239 line->Draw();
240 tex = new TLatex(-5.1, 1.38,"Q = 2 GeV");
241 tex->SetTextSize(0.04);
242 tex->SetLineWidth(2);
243 tex->Draw();
244
245 TLine *line = new TLine(-5.7,1.3,-5.2,1.3);
246 line->SetLineColor(2);
247 line->SetLineWidth(3);
248 line->Draw();
249 tex = new TLatex(-5.1, 1.28,"Q = 5 GeV");
250 tex->SetTextSize(0.04);
251 tex->SetLineWidth(2);
252 tex->Draw();
253
254
255 TLine *line = new TLine(-5.7,1.2,-5.2,1.2);
256 line->SetLineColor(3);
257 line->SetLineWidth(3);
258 line->Draw();
259 tex = new TLatex(-5.1, 1.18,"Q = 10 GeV");
260 tex->SetTextSize(0.04);
261 tex->SetLineWidth(2);
262 tex->Draw();
263
264
265 TLine *line = new TLine(-5.7,1.1,-5.2,1.1);
266 line->SetLineColor(4);
267 line->SetLineWidth(3);
268 line->Draw();
269 tex = new TLatex(-5.1, 1.08,"Q = 50 GeV");
270 tex->SetTextSize(0.04);
271 tex->SetLineWidth(2);
272 tex->Draw();
273}
274
275
276