Geant4 Cross Reference |
1 { 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 gamm 22 TH1D* h9 = (TH1D*)f.Get("h9"); //ee to Hadr 23 TH1D* h10 = (TH1D*)f.Get("h10"); //ee to gam 24 TH1D* h11 = (TH1D*)f.Get("h11"); //ee to MuM 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 MuM 30 TH1D* h15 = (TH1D*)f.Get("h15"); //ee to gam 31 TH1D* h16 = (TH1D*)f.Get("h16"); //ee to Had 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),s 43 h7->SetTitle("Comparison of e+ Annihilation 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), 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. 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), 82 h15->SetTitle("Comparison of EM Processes(to 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) 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 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 } 113