LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
plot_hist.C
Go to the documentation of this file.
1 {
2  gROOT->Reset();
3 
4  // Draw histos filled by Geant4 simulation
5  //
6 
7  double minE = 40;
8  double maxE = 10000;
9  double minY = 1e-2; //c1
10  double maxY = 1e+2; //c1
11  double minY1 = 1e-8; //c2
12  double maxY1 = 1; //c2
13 
14  //file open
15  //
16  TFile f("testem6_0.root");
17 
18  //CrossSectionPerAtom
19  //
20  TH1D* h7 = (TH1D*)f.Get("h7"); //ee to MuMu
21  TH1D* h8 = (TH1D*)f.Get("h8"); //ee to gammagamma
22  TH1D* h9 = (TH1D*)f.Get("h9"); //ee to Hadrons
23  TH1D* h10 = (TH1D*)f.Get("h10"); //ee to gammagamma(theory)
24  TH1D* h11 = (TH1D*)f.Get("h11"); //ee to MuMu(theory)
25  //CrossSectionPerVolume
26  //
27  TH1D* h12 = (TH1D*)f.Get("h12"); //eBrem
28  TH1D* h13 = (TH1D*)f.Get("h13"); //eIoni
29  TH1D* h14 = (TH1D*)f.Get("h14"); //ee to MuMu
30  TH1D* h15 = (TH1D*)f.Get("h15"); //ee to gammagamma
31  TH1D* h16 = (TH1D*)f.Get("h16"); //ee to Hadrons
32  //R ratio
33  //
34  TH1D* h17 = (TH1D*)f.Get("h17"); //R
35 
36  //c1
37  //
38  TCanvas* c1 = new TCanvas("c1", " ");
39  gPad->SetLogy();
40  h7->SetMinimum(minY);
41  h7->SetMaximum(maxY);
42  h7->GetXaxis()->SetLimits(std::log10(minE),std::log10(maxE));
43  h7->SetTitle("Comparison of e+ Annihilation Processes(totcrsPerAtom)");
44  h7->GetXaxis()->SetTickLength(0);
45  h7->GetXaxis()->SetLabelOffset(999);
46  h7->GetYaxis()->SetTitle("microbarn");
47 
48  h7->SetLineColor(kRed);
49  h9->SetLineColor(kBlue);
50  h11->SetMarkerColor(kRed);
51  h11->SetMarkerStyle(22);
52  h10->SetMarkerStyle(22);
53 
54  c1->cd();
55  h7->Draw("HIST");
56  h8->Draw("HIST SAME");
57  h9->Draw("HIST SAME");
58  h10->Draw("HIST P SAME");
59  h11->Draw("HIST P SAME");
60 
61  TGaxis *xaxis = new TGaxis(std::log10(minE),minY,std::log10(maxE),minY,minE,maxE,510,"G");
62  xaxis->SetTitle("GeV");
63  xaxis->Draw();
64 
65  gStyle->SetOptStat(0);
66 
67  TLegend* leg = new TLegend(0.78,0.59,0.98,0.76);
68  leg->AddEntry(h8,"to 2 gammas","l");
69  leg->AddEntry(h7,"to MuPair","l");
70  leg->AddEntry(h9,"to Hadrons","l");
71  leg->Draw();
72 
73  //c2
74  //
75  TCanvas* c2 = new TCanvas("c2", " ");
76  c2->cd();
77 
78  gPad->SetLogy();
79  h15->SetMinimum(minY1);
80  h15->SetMaximum(maxY1);
81  h15->GetXaxis()->SetLimits(std::log10(minE),std::log10(maxE));
82  h15->SetTitle("Comparison of EM Processes(totcrsPerVolume)");
83  h15->GetXaxis()->SetTickLength(0);
84  h15->GetXaxis()->SetLabelOffset(999);
85  h15->GetYaxis()->SetTitle("1/mm");
86 
87  h12->SetLineColor(6);
88  h13->SetLineColor(kGreen);
89  h14->SetLineColor(kRed);
90  h16->SetLineColor(kBlue);
91 
92  c2->cd();
93  h15->Draw("HIST");
94  h13->Draw("HIST SAME");
95  h14->Draw("HIST SAME");
96  h12->Draw("HIST SAME");
97  h16->Draw("HIST SAME");
98 
99  TGaxis *xaxis1 = new TGaxis(std::log10(minE),minY1,std::log10(maxE),minY1,minE,maxE,510,"G");
100  xaxis1->SetTitle("GeV");
101  xaxis1->Draw();
102 
103  gStyle->SetOptStat(0);
104 
105  TLegend* leg1 = new TLegend(0.78,0.59,0.98,0.76);
106  leg1->AddEntry(h15,"to 2 gammas","l");
107  leg1->AddEntry(h14,"to MuPair","l");
108  leg1->AddEntry(h16,"to Hadrons","l");
109  leg1->AddEntry(h12,"Bremsstrahlung","l");
110  leg1->AddEntry(h13,"Ionization","l");
111  leg1->Draw();
112 }
TH1D * h11
Definition: plot_hist.C:24
double minY
Definition: plot_hist.C:9
TH1D * h8
Definition: plot_hist.C:21
double maxY
Definition: plot_hist.C:10
TLegend * leg1
Definition: plot_hist.C:105
double maxY1
Definition: plot_hist.C:12
TH1D * h15
Definition: plot_hist.C:30
TGaxis * xaxis
Definition: plot_hist.C:61
TGaxis * xaxis1
Definition: plot_hist.C:99
TH1D * h14
Definition: plot_hist.C:29
double minY1
Definition: plot_hist.C:11
TCanvas * c2
Definition: plot_hist.C:75
TCanvas * c1
Definition: plot_hist.C:38
TH1D * h10
Definition: plot_hist.C:23
TH1D * h17
Definition: plot_hist.C:34
TH1D * h7
Definition: plot_hist.C:20
TH1D * h9
Definition: plot_hist.C:22
TFile f("testem6_0.root")
TH1D * h13
Definition: plot_hist.C:28
double minE
Definition: plot_hist.C:7
TLegend * leg
Definition: plot_hist.C:67
TH1D * h12
Definition: plot_hist.C:27
double maxE
Definition: plot_hist.C:8
Float_t e
Definition: plot.C:35
TH1D * h16
Definition: plot_hist.C:31