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