00001
00002
00003
00004
00007 void
00008 Compare()
00009 {
00010 TFile* fluka_file = TFile::Open("fluka/FMD.Hits.root", "READ");
00011 TFile* geant_file = TFile::Open("geant321/FMD.Hits.root", "READ");
00012 if (!fluka_file || !geant_file) {
00013 std::cerr << "Failed to open one or more of the input files"
00014 << std::endl;
00015 return;
00016 }
00017
00018
00019 fluka_file->cd();
00020 gDirectory->cd("Event0");
00021 TTree* fluka_tree = static_cast<TTree*>(gDirectory->Get("TreeH"));
00022
00023 geant_file->cd();
00024 gDirectory->cd("Event0");
00025 TTree* geant_tree = static_cast<TTree*>(gDirectory->Get("TreeH"));
00026
00027 if (!fluka_tree || !geant_tree) {
00028 std::cerr << "Failed to get one or more of the trees"
00029 << std::endl;
00030 return;
00031 }
00032
00033 gStyle->SetOptStat(0);
00034 gStyle->SetOptTitle(0);
00035 gStyle->SetLabelFont(132, "XY");
00036 gStyle->SetTitleFont(132, "XY");
00037 gStyle->SetTextFont(132);
00038 gStyle->SetNdivisions(10, "XY");
00039
00040 TCanvas* c = new TCanvas("c", "c", 600, 600);
00041 c->SetBorderMode(0);
00042 c->SetBorderSize(0);
00043 c->SetFillColor(0);
00044 c->SetTopMargin(.05);
00045 c->SetRightMargin(.05);
00046
00047 TH1* fluka_dist = new TH1F("fluka_dist", "FLUKA Energy deposition",
00048 100, 0, 1);
00049 fluka_dist->SetLineColor(2);
00050 fluka_dist->SetFillColor(2);
00051 fluka_dist->SetFillStyle(3001);
00052 fluka_dist->GetXaxis()->SetTitle("Energy deposited");
00053 fluka_dist->GetYaxis()->SetTitle("Frequency");
00054 fluka_tree->Draw("FMD.fEdep>>fluka_dist");
00055
00056 TH1* geant_dist = new TH1F("geant_dist", "GEANT Energy deposition",
00057 100, 0, 1);
00058 geant_dist->SetLineColor(3);
00059 geant_dist->SetFillColor(3);
00060 geant_dist->SetFillStyle(3002);
00061 geant_tree->Draw("FMD.fEdep>>geant_dist", "", "SAME");
00062
00063 TLegend* l = new TLegend(.3, .8, .95, .95);
00064 l->SetFillColor(0);
00065 l->SetBorderSize(1);
00066 l->SetTextFont(132);
00067 l->AddEntry(fluka_dist, Form("%s - %d counts",
00068 fluka_dist->GetTitle(),
00069 Int_t(fluka_dist->Integral())), "LF");
00070 l->AddEntry(geant_dist, Form("%s - %d counts",
00071 geant_dist->GetTitle(),
00072 Int_t(geant_dist->Integral())), "LF");
00073 l->Draw();
00074
00075 c->Modified();
00076 c->cd();
00077 c->Print("fluka_vs_geant321.C");
00078 }
00079
00080
00081
00082
00083