Functions | Variables
drawXsec.C File Reference

Go to the source code of this file.

Functions

void drawXsec (const Char_t *infn="VLExsecNT.root")
 

Variables

TFile * inf
 
TNtuple * nt
 
TCanvas * c1
 
TCanvas * c1l
 
TCanvas * c2
 
TGraph * xsg
 
TGraph * psg
 
TGraph * rsg
 
TGraph * nsg
 
TH2 * h
 
TH2 * rh
 

Function Documentation

void drawXsec ( const Char_t *  infn = "VLExsecNT.root")

Definition at line 7 of file drawXsec.C.

7  {
8 
9  gStyle->SetOptStat(0);
10 
11  inf = TFile::Open(infn);
12  if (inf==0 || inf->IsZombie()) {
13  Error("drawXsec","Could not open [%s]",infn);
14  return;
15  }
16 
17  nt = dynamic_cast<TNtuple*>(inf->Get("nt"));
18  if (nt==0) {
19  Error("drawXsec","Could not get nt from [%s]",infn);
20  return;
21  }
22 
23  // draw the cross sections
24  c1 = new TCanvas("c1", "c1: xsec", 700, 500);
25  c1->cd();
26 
27  h = new TH2F("h","Inverse Beta Decay Cross Section"
28  ";E_{#nu} (MeV);#sigma #times 10^{-41} cm^{2}",
29  110, 0, 220,
30  100, 1e-3, 350);
31  h->GetXaxis()->SetNdivisions(505);
32 
33  const Long64_t xents = nt->Draw("xsec:Ev","","goff");
34  xsg = new TGraph(xents,nt->GetV2(),nt->GetV1());
35  xsg->SetName("xsg");
36  xsg->SetMarkerStyle(24);
37  xsg->SetMarkerSize(0.8);
38 
39  const Long64_t xnents = nt->Draw("xsnun:Ev","","goff");
40  nsg = new TGraph(xnents,nt->GetV2(),nt->GetV1());
41  nsg->SetName("nsg");
42  nsg->SetMarkerStyle(27);
43  nsg->SetMarkerColor(kRed+1);
44 
45  const Long64_t pents = nt->Draw("xspaper:Ev","","goff");
46  psg = new TGraph(pents,nt->GetV2(),nt->GetV1());
47  psg->SetName("psg");
48  psg->SetLineColor(kAzure-8);
49 
50  h->Draw("axis");
51  psg->Draw("c");
52  xsg->Draw("p");
53  nsg->Draw("p");
54 
55  TLegend* xl = new TLegend(.188,.561,.560,.845);
56  xl->SetBorderSize(0);
57  xl->SetFillColor(0);
58  xl->AddEntry(psg,"Strumia (#bar{#nu_{e}}p#rightarrowne^{+})","l");
59  xl->AddEntry(xsg,"VLE GENIE (#bar{#nu_{e}}p#rightarrowne^{+})","p");
60  xl->AddEntry(nsg,"VLE GENIE (#nu_{e}n#rightarrowpe^{-})","p");
61  xl->Draw();
62 
63 
64 
65  // draw the cross sections on log scale
66  c1l = new TCanvas("c1l", "c1l: xsec (logy)", 700, 500);
67  c1l->cd();
68  c1l->SetLogy();
69  h->Draw("axis");
70  psg->Draw("c");
71  xsg->Draw("p");
72  nsg->Draw("p");
73 
74  TLegend* xll = new TLegend(.453,.360,.825,.644);
75  xll->SetBorderSize(0);
76  xll->SetFillColor(0);
77  xll->AddEntry(psg,"Strumia (#bar{#nu_{e}}p#rightarrowne^{+})","l");
78  xll->AddEntry(xsg,"VLE GENIE (#bar{#nu_{e}}p#rightarrowne^{+})","p");
79  xll->AddEntry(nsg,"VLE GENIE (#nu_{e}n#rightarrowpe^{-})","p");
80  xll->Draw();
81 
82  // draw ratio: xsec / strumia for nu_e_bar + p --> n + e+
83  c2 = new TCanvas("c2", "c2: xsec ratio", 700, 500);;
84  c2->cd();
85  c2->SetGridy();
86 
87  rsg = new TGraph(*xsg);
88  rsg->SetName("rsg");
89  rsg->SetMarkerStyle(21);
90  rsg->SetMarkerSize(1);
91  rsg->SetMarkerColor(kAzure-8);
92  const Double_t* py = psg->GetY();
93  Double_t* ry = rsg->GetY();
94  const Int_t np = rsg->GetN();
95  for (Int_t i=0; i<np; i++, ry++, py++) {
96  if (*py > 1e-10) *ry /= *py;
97  }
98 
99  rh = new TH2F("rh","IBD X-sec Ratio: GENIE / Strumia Paper"
100  ";E_{#nu} (MeV);#sigma(GENIE) / #sigma(Strumia Paper)",
101  110, 0, 220,
102  100, 0.85, 1.05);
103  rh->GetXaxis()->SetNdivisions(505);
104  rh->GetYaxis()->SetTitleOffset(1.35);
105 
106  rh->Draw("axis");
107  rsg->Draw("p");
108 
109  TLatex* rl = new TLatex(126,1.023,"#bar{#nu_{e}}p#rightarrowne^{+}");
110  rl->SetTextColor(kAzure-8);
111  rl->Draw();
112 
113 }
TCanvas * c1l
Definition: drawXsec.C:3
TFile * inf
Definition: drawXsec.C:1
TGraph * xsg
Definition: drawXsec.C:4
TGraph * rsg
Definition: drawXsec.C:4
TH2 * rh
Definition: drawXsec.C:5
TCanvas * c2
Definition: drawXsec.C:3
size_t i(0)
TGraph * psg
Definition: drawXsec.C:4
TGraph * nsg
Definition: drawXsec.C:4
const double e
TH2 * h
Definition: drawXsec.C:5
TCanvas * c1
Definition: drawXsec.C:3
TNtuple * nt
Definition: drawXsec.C:2

Variable Documentation

TCanvas* c1

Definition at line 3 of file drawXsec.C.

TCanvas * c1l

Definition at line 3 of file drawXsec.C.

TCanvas * c2

Definition at line 3 of file drawXsec.C.

TH2* h

Definition at line 5 of file drawXsec.C.

TFile* inf

Definition at line 1 of file drawXsec.C.

TGraph * nsg

Definition at line 4 of file drawXsec.C.

TNtuple* nt

Definition at line 2 of file drawXsec.C.

TGraph * psg

Definition at line 4 of file drawXsec.C.

TH2 * rh

Definition at line 5 of file drawXsec.C.

TGraph * rsg

Definition at line 4 of file drawXsec.C.

TGraph* xsg

Definition at line 4 of file drawXsec.C.