]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/Compare.C
bug fix
[u/mrichter/AliRoot.git] / FMD / scripts / Compare.C
CommitLineData
bf000c32 1//____________________________________________________________________
d389af40 2//
3// Script to compare the output of GEANT 3.21 to FLUKA 2.
4//
9b48326f 5/** @ingroup simple_script
6 */
d389af40 7void
8Compare()
9{
10 TFile* fluka_file = TFile::Open("fluka/FMD.Hits.root", "READ");
11 TFile* geant_file = TFile::Open("geant321/FMD.Hits.root", "READ");
12 if (!fluka_file || !geant_file) {
13 std::cerr << "Failed to open one or more of the input files"
14 << std::endl;
15 return;
16 }
17
18
19 fluka_file->cd();
20 gDirectory->cd("Event0");
21 TTree* fluka_tree = static_cast<TTree*>(gDirectory->Get("TreeH"));
22
23 geant_file->cd();
24 gDirectory->cd("Event0");
25 TTree* geant_tree = static_cast<TTree*>(gDirectory->Get("TreeH"));
26
27 if (!fluka_tree || !geant_tree) {
28 std::cerr << "Failed to get one or more of the trees"
29 << std::endl;
30 return;
31 }
32
33 gStyle->SetOptStat(0);
34 gStyle->SetOptTitle(0);
35 gStyle->SetLabelFont(132, "XY");
36 gStyle->SetTitleFont(132, "XY");
37 gStyle->SetTextFont(132);
38 gStyle->SetNdivisions(10, "XY");
39
40 TCanvas* c = new TCanvas("c", "c", 600, 600);
41 c->SetBorderMode(0);
42 c->SetBorderSize(0);
43 c->SetFillColor(0);
44 c->SetTopMargin(.05);
45 c->SetRightMargin(.05);
46
47 TH1* fluka_dist = new TH1F("fluka_dist", "FLUKA Energy deposition",
48 100, 0, 1);
49 fluka_dist->SetLineColor(2);
50 fluka_dist->SetFillColor(2);
51 fluka_dist->SetFillStyle(3001);
52 fluka_dist->GetXaxis()->SetTitle("Energy deposited");
53 fluka_dist->GetYaxis()->SetTitle("Frequency");
54 fluka_tree->Draw("FMD.fEdep>>fluka_dist");
55
56 TH1* geant_dist = new TH1F("geant_dist", "GEANT Energy deposition",
57 100, 0, 1);
58 geant_dist->SetLineColor(3);
59 geant_dist->SetFillColor(3);
60 geant_dist->SetFillStyle(3002);
61 geant_tree->Draw("FMD.fEdep>>geant_dist", "", "SAME");
62
63 TLegend* l = new TLegend(.3, .8, .95, .95);
64 l->SetFillColor(0);
65 l->SetBorderSize(1);
66 l->SetTextFont(132);
67 l->AddEntry(fluka_dist, Form("%s - %d counts",
68 fluka_dist->GetTitle(),
69 Int_t(fluka_dist->Integral())), "LF");
70 l->AddEntry(geant_dist, Form("%s - %d counts",
71 geant_dist->GetTitle(),
72 Int_t(geant_dist->Integral())), "LF");
73 l->Draw();
74
75 c->Modified();
76 c->cd();
77 c->Print("fluka_vs_geant321.C");
78}
79
bf000c32 80//____________________________________________________________________
81//
82// EOF
83//