87 const unsigned int nm = 4;
88 int col [nm] = { kBlack, kRed+1, kBlue-3, kGreen+2 };
89 int sty [nm] = { kSolid, kDashed, kDashed, kDashed };
90 int mrk [nm] = { 20, 20, 20, 20 };
91 double msz [nm] = { 0.7, 0.7, 0.7, 0.7 };
92 const char * opt [nm] = {
"ap",
"l",
"l",
"l" };
93 const char * lgopt [nm] = {
"P",
"L",
"L",
"L" };
96 const unsigned int nQ2 = 20;
97 const double Q2min = 1E-1;
98 const double Q2max = 1E+3;
99 const double log10Q2min = TMath::Log10(Q2min);
100 const double log10Q2max = TMath::Log10(Q2max);
101 const double dlog10Q2 = (log10Q2max-log10Q2min)/(nQ2-1);
103 for(
unsigned int iq2 = 0; iq2 < nQ2; iq2++) {
104 double Q2 = TMath::Power(10, log10Q2min + iq2*dlog10Q2);
109 const unsigned int nx = 22;
110 double x_arr [nx] = {
111 0.0001, 0.0010, 0.0100, 0.0250, 0.0500,
112 0.0750, 0.1000, 0.1500, 0.2000, 0.2500,
113 0.3500, 0.4000, 0.4500, 0.5000, 0.5500,
114 0.6000, 0.7000, 0.7500, 0.8000, 0.8500,
119 const unsigned int nQ2_2d = 50;
120 const double Q2min_2d = 1E-1;
121 const double Q2max_2d = 1E+3;
122 const double log10Q2min_2d = TMath::Log10(Q2min_2d);
123 const double log10Q2max_2d = TMath::Log10(Q2max_2d);
124 const double dlog10Q2_2d = (log10Q2max_2d-log10Q2min_2d)/(nQ2_2d-1);
125 double Q2_bin_edges_2d [nQ2_2d];
126 for(
unsigned int iq2 = 0; iq2 < nQ2_2d; iq2++) {
127 double Q2 = TMath::Power(10, log10Q2min_2d + iq2*dlog10Q2_2d);
128 Q2_bin_edges_2d[iq2] = Q2;
132 const unsigned int nx_2d = 50;
133 const double xmin_2d = 1E-4;
134 const double xmax_2d = 0.95;
135 const double log10xmin_2d = TMath::Log10(xmin_2d);
136 const double log10xmax_2d = TMath::Log10(xmax_2d);
137 const double dlog10x_2d = (log10xmax_2d-log10xmin_2d)/(nx_2d-1);
138 double x_bin_edges_2d [nx_2d];
139 for(
unsigned int ix = 0; ix < nx_2d; ix++) {
140 double x = TMath::Power(10, log10xmin_2d + ix*dlog10x_2d);
141 x_bin_edges_2d[ix] = x;
145 TNtuple * ntpl =
new TNtuple(
"nt",
"structure functions",
"i:F1:F2:F3:F4:F5:F6:x:Q2");
148 TCanvas * cnv =
new TCanvas(
"c",
"",20,20,500,650);
149 cnv->SetBorderMode(0);
150 cnv->SetFillColor(0);
154 TPostScript * ps =
new TPostScript(ps_filename.c_str(), 111);
158 cnv->Range(0,0,100,100);
159 TPavesText hdr(10,40,90,70,3,
"tr");
160 hdr.AddText(
"GENIE structure function comparisons");
165 hdr.AddText(
"Models used:");
167 for(
unsigned int im=0; im <
gSFAlgList.size(); im++) {
168 const char * label =
gSFAlgList[im]->Id().Key().c_str();
177 TLatex * tex =
new TLatex;
185 TGraph * gr_F1_Q2 [nm] = { 0 };
186 TGraph * gr_F2_Q2 [nm] = { 0 };
187 TGraph * gr_F3_Q2 [nm] = { 0 };
188 TGraph * gr_F4_Q2 [nm] = { 0 };
189 TGraph * gr_F5_Q2 [nm] = { 0 };
190 TGraph * gr_F6_Q2 [nm] = { 0 };
193 TH2D * h2_F1 [nm] = { 0 };
194 TH2D * h2_F2 [nm] = { 0 };
195 TH2D * h2_F3 [nm] = { 0 };
196 TH2D * h2_F4 [nm] = { 0 };
197 TH2D * h2_F5 [nm] = { 0 };
198 TH2D * h2_F6 [nm] = { 0 };
201 TH2D * h2_F1_r [nm] = { 0 };
202 TH2D * h2_F2_r [nm] = { 0 };
203 TH2D * h2_F3_r [nm] = { 0 };
204 TH2D * h2_F4_r [nm] = { 0 };
205 TH2D * h2_F5_r [nm] = { 0 };
206 TH2D * h2_F6_r [nm] = { 0 };
212 for(
unsigned int ix=0; ix < nx; ix++) {
213 double x = x_arr[ix];
214 double F1_arr [nm][nQ2];
215 double F2_arr [nm][nQ2];
216 double F3_arr [nm][nQ2];
217 double F4_arr [nm][nQ2];
218 double F5_arr [nm][nQ2];
219 double F6_arr [nm][nQ2];
220 for(
unsigned int im=0; im <
gSFAlgList.size(); im++) {
223 for(
unsigned int iq2 = 0; iq2 < nQ2; iq2++) {
224 double Q2 = Q2_arr[iq2];
236 F1_arr [im][iq2] = F1;
237 F2_arr [im][iq2] = F2;
238 F3_arr [im][iq2] = F3;
239 F4_arr [im][iq2] = F4;
240 F5_arr [im][iq2] = F5;
241 F6_arr [im][iq2] = F6;
242 ntpl->Fill(im,F1,F2,F3,F4,F5,F6,x,Q2);
246 gr_F1_Q2 [im] =
new TGraph (nQ2, Q2_arr, F1_arr [im]);
247 gr_F2_Q2 [im] =
new TGraph (nQ2, Q2_arr, F2_arr [im]);
248 gr_F3_Q2 [im] =
new TGraph (nQ2, Q2_arr, F3_arr [im]);
249 gr_F4_Q2 [im] =
new TGraph (nQ2, Q2_arr, F4_arr [im]);
250 gr_F5_Q2 [im] =
new TGraph (nQ2, Q2_arr, F5_arr [im]);
251 gr_F6_Q2 [im] =
new TGraph (nQ2, Q2_arr, F6_arr [im]);
260 gr_F1_Q2 [im] -> GetXaxis() -> SetTitle(
"Q^{2} (GeV^{2}/c^{2})");
261 gr_F2_Q2 [im] -> GetXaxis() -> SetTitle(
"Q^{2} (GeV^{2}/c^{2})");
262 gr_F3_Q2 [im] -> GetXaxis() -> SetTitle(
"Q^{2} (GeV^{2}/c^{2})");
263 gr_F4_Q2 [im] -> GetXaxis() -> SetTitle(
"Q^{2} (GeV^{2}/c^{2})");
264 gr_F5_Q2 [im] -> GetXaxis() -> SetTitle(
"Q^{2} (GeV^{2}/c^{2})");
265 gr_F6_Q2 [im] -> GetXaxis() -> SetTitle(
"Q^{2} (GeV^{2}/c^{2})");
267 gr_F1_Q2 [im] -> GetYaxis() -> SetTitle(
"F1(x,Q^{2})");
268 gr_F2_Q2 [im] -> GetYaxis() -> SetTitle(
"F2(x,Q^{2})");
269 gr_F3_Q2 [im] -> GetYaxis() -> SetTitle(
"F3(x,Q^{2})");
270 gr_F4_Q2 [im] -> GetYaxis() -> SetTitle(
"F4(x,Q^{2})");
271 gr_F5_Q2 [im] -> GetYaxis() -> SetTitle(
"F5(x,Q^{2})");
272 gr_F6_Q2 [im] -> GetYaxis() -> SetTitle(
"F6(x,Q^{2})");
279 lgnd =
new TLegend(0.20, 0.55, 0.50, 0.85);
281 lgnd =
new TLegend(0.60, 0.55, 0.80, 0.85);
283 lgnd -> SetFillColor(0);
284 lgnd -> SetFillStyle(0);
285 lgnd -> SetBorderSize(0);
288 for(
unsigned int im=0; im <
gSFAlgList.size(); im++) {
289 const char * label =
gSFAlgList[im]->Id().Key().c_str();
290 lgnd->AddEntry(gr_F1_Q2 [im], Form(
"%s",label), lgopt[im]);
295 cnv->cd(1); gPad->SetLogx();
296 cnv->cd(2); gPad->SetLogx();
297 cnv->cd(3); gPad->SetLogx();
298 cnv->cd(4); gPad->SetLogx();
299 cnv->cd(5); gPad->SetLogx();
300 cnv->cd(6); gPad->SetLogx();
302 for(
unsigned int im=0; im <
gSFAlgList.size(); im++) {
303 cnv->cd(1); gr_F1_Q2 [im]->Draw(opt[im]);
304 cnv->cd(2); gr_F2_Q2 [im]->Draw(opt[im]);
305 cnv->cd(3); gr_F3_Q2 [im]->Draw(opt[im]);
306 cnv->cd(4); gr_F4_Q2 [im]->Draw(opt[im]);
307 cnv->cd(5); gr_F5_Q2 [im]->Draw(opt[im]);
308 cnv->cd(6); gr_F6_Q2 [im]->Draw(opt[im]);
311 cnv->cd(1); lgnd->Draw(); tex->DrawTextNDC(0.4, 0.95, Form(
"x = %.3e",x));
312 cnv->cd(2); lgnd->Draw(); tex->DrawTextNDC(0.4, 0.95, Form(
"x = %.3e",x));
313 cnv->cd(3); lgnd->Draw(); tex->DrawTextNDC(0.4, 0.95, Form(
"x = %.3e",x));
314 cnv->cd(4); lgnd->Draw(); tex->DrawTextNDC(0.4, 0.95, Form(
"x = %.3e",x));
315 cnv->cd(5); lgnd->Draw(); tex->DrawTextNDC(0.4, 0.95, Form(
"x = %.3e",x));
316 cnv->cd(6); lgnd->Draw(); tex->DrawTextNDC(0.4, 0.95, Form(
"x = %.3e",x));
325 for(
unsigned int im=0; im <
gSFAlgList.size(); im++) {
326 h2_F1 [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
327 h2_F2 [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
328 h2_F3 [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
329 h2_F4 [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
330 h2_F5 [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
331 h2_F6 [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
335 ibinx <= h2_F1[im]->GetXaxis()->GetNbins(); ibinx++) {
336 double x = h2_F1[im]->GetXaxis()->GetBinCenter(ibinx);
338 ibinq2 <= h2_F1[im]->GetYaxis()->GetNbins(); ibinq2++) {
339 double Q2 = h2_F1[im]->GetYaxis()->GetBinCenter(ibinq2);
351 h2_F1 [im] -> SetBinContent(ibinx, ibinq2, F1);
352 h2_F2 [im] -> SetBinContent(ibinx, ibinq2, F2);
353 h2_F3 [im] -> SetBinContent(ibinx, ibinq2, F3);
354 h2_F4 [im] -> SetBinContent(ibinx, ibinq2, F4);
355 h2_F5 [im] -> SetBinContent(ibinx, ibinq2, F5);
356 h2_F6 [im] -> SetBinContent(ibinx, ibinq2, F6);
363 h2_F1 [im] -> GetXaxis() -> SetTitle(
"x");
364 h2_F2 [im] -> GetXaxis() -> SetTitle(
"x");
365 h2_F3 [im] -> GetXaxis() -> SetTitle(
"x");
366 h2_F4 [im] -> GetXaxis() -> SetTitle(
"x");
367 h2_F5 [im] -> GetXaxis() -> SetTitle(
"x");
368 h2_F6 [im] -> GetXaxis() -> SetTitle(
"x");
370 h2_F1 [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
371 h2_F2 [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
372 h2_F3 [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
373 h2_F4 [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
374 h2_F5 [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
375 h2_F6 [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
379 TPaletteAxis * palette = 0;
380 tex->SetTextSize(0.03);
382 cnv->cd(1); gPad->SetLogx(); gPad->SetLogy();
383 h2_F1 [im] ->
Draw(
"colz");
385 palette = (TPaletteAxis*)h2_F1[im]->GetListOfFunctions()->FindObject(
"palette");
387 palette->SetX1NDC(0.8);
388 palette->SetX2NDC(0.85);
389 palette->SetY1NDC(0.4);
390 palette->SetY2NDC(0.8);
392 tex->DrawTextNDC(0.30, 0.95, Form(
"F1: %s",
gSFAlgList[im]->Id().Key().c_str()) );
394 cnv->cd(2); gPad->SetLogx(); gPad->SetLogy();
395 h2_F2 [im] ->
Draw(
"colz");
397 palette = (TPaletteAxis*)h2_F2[im]->GetListOfFunctions()->FindObject(
"palette");
399 palette->SetX1NDC(0.8);
400 palette->SetX2NDC(0.85);
401 palette->SetY1NDC(0.4);
402 palette->SetY2NDC(0.8);
404 tex->DrawTextNDC(0.30, 0.95, Form(
"F2: %s",
gSFAlgList[im]->Id().Key().c_str()) );
406 cnv->cd(3); gPad->SetLogx(); gPad->SetLogy();
407 h2_F3 [im] ->
Draw(
"colz");
409 palette = (TPaletteAxis*)h2_F3[im]->GetListOfFunctions()->FindObject(
"palette");
411 palette->SetX1NDC(0.8);
412 palette->SetX2NDC(0.85);
413 palette->SetY1NDC(0.4);
414 palette->SetY2NDC(0.8);
416 tex->DrawTextNDC(0.30, 0.95, Form(
"F3: %s",
gSFAlgList[im]->Id().Key().c_str()) );
418 cnv->cd(4); gPad->SetLogx(); gPad->SetLogy();
419 h2_F4 [im] ->
Draw(
"colz");
421 palette = (TPaletteAxis*)h2_F4[im]->GetListOfFunctions()->FindObject(
"palette");
423 palette->SetX1NDC(0.8);
424 palette->SetX2NDC(0.85);
425 palette->SetY1NDC(0.4);
426 palette->SetY2NDC(0.8);
428 tex->DrawTextNDC(0.30, 0.95, Form(
"F4: %s",
gSFAlgList[im]->Id().Key().c_str()) );
430 cnv->cd(5); gPad->SetLogx(); gPad->SetLogy();
431 h2_F5[im] ->
Draw(
"colz");
433 palette = (TPaletteAxis*)h2_F5[im]->GetListOfFunctions()->FindObject(
"palette");
435 palette->SetX1NDC(0.8);
436 palette->SetX2NDC(0.85);
437 palette->SetY1NDC(0.4);
438 palette->SetY2NDC(0.8);
440 tex->DrawTextNDC(0.30, 0.95, Form(
"F5: %s",
gSFAlgList[im]->Id().Key().c_str()) );
442 cnv->cd(6); gPad->SetLogx(); gPad->SetLogy();
443 h2_F6[im] ->
Draw(
"colz");
445 palette = (TPaletteAxis*)h2_F6[im]->GetListOfFunctions()->FindObject(
"palette");
447 palette->SetX1NDC(0.8);
448 palette->SetX2NDC(0.85);
449 palette->SetY1NDC(0.4);
450 palette->SetY2NDC(0.8);
452 tex->DrawTextNDC(0.30, 0.95, Form(
"F6: %s",
gSFAlgList[im]->Id().Key().c_str()) );
462 for(
unsigned int im=1; im <
gSFAlgList.size(); im++) {
463 h2_F1_r [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
464 h2_F2_r [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
465 h2_F3_r [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
466 h2_F4_r [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
467 h2_F5_r [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
468 h2_F6_r [im] =
new TH2D(
"",
"", nx_2d-1, x_bin_edges_2d, nQ2_2d-1, Q2_bin_edges_2d);
470 ibinx <= h2_F1[im]->GetXaxis()->GetNbins(); ibinx++) {
472 ibinq2 <= h2_F1[im]->GetYaxis()->GetNbins(); ibinq2++) {
474 double F1 = h2_F1 [im] -> GetBinContent(ibinx, ibinq2);
475 double F2 = h2_F2 [im] -> GetBinContent(ibinx, ibinq2);
476 double F3 = h2_F3 [im] -> GetBinContent(ibinx, ibinq2);
477 double F4 = h2_F4 [im] -> GetBinContent(ibinx, ibinq2);
478 double F5 = h2_F5 [im] -> GetBinContent(ibinx, ibinq2);
479 double F6 = h2_F6 [im] -> GetBinContent(ibinx, ibinq2);
481 double F10 = h2_F1 [0] -> GetBinContent(ibinx, ibinq2);
482 double F20 = h2_F2 [0] -> GetBinContent(ibinx, ibinq2);
483 double F30 = h2_F3 [0] -> GetBinContent(ibinx, ibinq2);
484 double F40 = h2_F4 [0] -> GetBinContent(ibinx, ibinq2);
485 double F50 = h2_F5 [0] -> GetBinContent(ibinx, ibinq2);
486 double F60 = h2_F6 [0] -> GetBinContent(ibinx, ibinq2);
488 double F1r = ((F10 > 0.) ? (F1-F10)/F10 : 0.);
489 double F2r = ((F20 > 0.) ? (F2-F20)/F20 : 0.);
490 double F3r = ((F30 > 0.) ? (F3-F30)/F30 : 0.);
491 double F4r = ((F40 > 0.) ? (F4-F40)/F40 : 0.);
492 double F5r = ((F50 > 0.) ? (F5-F50)/F50 : 0.);
493 double F6r = ((F60 > 0.) ? (F6-F60)/F60 : 0.);
495 h2_F1_r [im] -> SetBinContent(ibinx, ibinq2, F1r);
496 h2_F2_r [im] -> SetBinContent(ibinx, ibinq2, F2r);
497 h2_F3_r [im] -> SetBinContent(ibinx, ibinq2, F3r);
498 h2_F4_r [im] -> SetBinContent(ibinx, ibinq2, F4r);
499 h2_F5_r [im] -> SetBinContent(ibinx, ibinq2, F5r);
500 h2_F6_r [im] -> SetBinContent(ibinx, ibinq2, F6r);
506 h2_F1_r [im] -> GetXaxis() -> SetTitle(
"x");
507 h2_F2_r [im] -> GetXaxis() -> SetTitle(
"x");
508 h2_F3_r [im] -> GetXaxis() -> SetTitle(
"x");
509 h2_F4_r [im] -> GetXaxis() -> SetTitle(
"x");
510 h2_F5_r [im] -> GetXaxis() -> SetTitle(
"x");
511 h2_F6_r [im] -> GetXaxis() -> SetTitle(
"x");
513 h2_F1_r [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
514 h2_F2_r [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
515 h2_F3_r [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
516 h2_F4_r [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
517 h2_F5_r [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
518 h2_F6_r [im] -> GetXaxis() -> SetTitle(
"Q^2 (GeV^2/c^2)");
522 TPaletteAxis * palette = 0;
524 cnv->cd(1); gPad->SetLogx(); gPad->SetLogy();
525 h2_F1_r [im] ->
Draw(
"colz");
527 palette = (TPaletteAxis*)h2_F1_r[im]->GetListOfFunctions()->FindObject(
"palette");
529 palette->SetX1NDC(0.8);
530 palette->SetX2NDC(0.85);
531 palette->SetY1NDC(0.4);
532 palette->SetY2NDC(0.8);
534 tex->DrawTextNDC(0.1, 0.95, Form(
"F1: (%s-%s)/(%s)",
537 cnv->cd(2); gPad->SetLogx(); gPad->SetLogy();
538 h2_F2_r [im] ->
Draw(
"colz");
540 palette = (TPaletteAxis*)h2_F2_r[im]->GetListOfFunctions()->FindObject(
"palette");
542 palette->SetX1NDC(0.8);
543 palette->SetX2NDC(0.85);
544 palette->SetY1NDC(0.4);
545 palette->SetY2NDC(0.8);
547 tex->DrawTextNDC(0.1, 0.95, Form(
"F2: (%s-%s)/(%s)",
550 cnv->cd(3); gPad->SetLogx(); gPad->SetLogy();
551 h2_F3_r [im] ->
Draw(
"colz");
553 palette = (TPaletteAxis*)h2_F3_r[im]->GetListOfFunctions()->FindObject(
"palette");
555 palette->SetX1NDC(0.8);
556 palette->SetX2NDC(0.85);
557 palette->SetY1NDC(0.4);
558 palette->SetY2NDC(0.8);
560 tex->DrawTextNDC(0.1, 0.95, Form(
"F3: (%s-%s)/(%s)",
563 cnv->cd(4); gPad->SetLogx(); gPad->SetLogy();
564 h2_F4_r [im] ->
Draw(
"colz");
566 palette = (TPaletteAxis*)h2_F4_r[im]->GetListOfFunctions()->FindObject(
"palette");
568 palette->SetX1NDC(0.8);
569 palette->SetX2NDC(0.85);
570 palette->SetY1NDC(0.4);
571 palette->SetY2NDC(0.8);
573 tex->DrawTextNDC(0.1, 0.95, Form(
"F4: (%s-%s)/(%s)",
576 cnv->cd(5); gPad->SetLogx(); gPad->SetLogy();
577 h2_F5_r[im] ->
Draw(
"colz");
579 palette = (TPaletteAxis*)h2_F5_r[im]->GetListOfFunctions()->FindObject(
"palette");
581 palette->SetX1NDC(0.8);
582 palette->SetX2NDC(0.85);
583 palette->SetY1NDC(0.4);
584 palette->SetY2NDC(0.8);
586 tex->DrawTextNDC(0.1, 0.95, Form(
"F5: (%s-%s)/(%s)",
589 cnv->cd(6); gPad->SetLogx(); gPad->SetLogy();
590 h2_F6_r[im] ->
Draw(
"colz");
592 palette = (TPaletteAxis*)h2_F6_r[im]->GetListOfFunctions()->FindObject(
"palette");
594 palette->SetX1NDC(0.8);
595 palette->SetX2NDC(0.85);
596 palette->SetY1NDC(0.4);
597 palette->SetY2NDC(0.8);
599 tex->DrawTextNDC(0.1, 0.95, Form(
"F6: (%s-%s)/(%s)",
612 TFile f(root_filename.c_str(),
"recreate");
613 ntpl->Write(
"sfntp");