1afae8ff |
1 | /* $Id$ */ |
2 | |
3 | void drawPlots() |
4 | //void Track2Particle2D() |
5 | { |
6 | TFile* file = TFile::Open("correction_map.root"); |
7 | |
8 | TH2* corrYX = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_nTrackToNPart_yx")); |
9 | TH2* corrZX = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_nTrackToNPart_zx")); |
10 | TH2* corrZY = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_nTrackToNPart_zy")); |
11 | |
12 | Prepare2DPlot(corrYX); |
13 | Prepare2DPlot(corrZX); |
14 | Prepare2DPlot(corrZY); |
15 | |
16 | SetRanges(corrYX); |
17 | SetRanges(corrZX); |
18 | SetRanges(corrZY); |
19 | |
20 | TCanvas* canvas = new TCanvas("Track2Particle2D", "Track2Particle2D", 1200, 400); |
21 | canvas->Divide(3, 1); |
22 | |
23 | canvas->cd(1); |
24 | InitPadCOLZ(); |
25 | corrYX->Draw("COLZ"); |
26 | |
27 | canvas->cd(2); |
28 | InitPadCOLZ(); |
29 | corrZX->Draw("COLZ"); |
30 | |
31 | canvas->cd(3); |
32 | InitPadCOLZ(); |
33 | corrZY->Draw("COLZ"); |
34 | } |
35 | |
36 | void Track2Particle3D() |
37 | { |
38 | // get left margin proper |
39 | |
40 | TFile* file = TFile::Open("correction_map.root"); |
41 | |
42 | TH3* gene = dynamic_cast<TH3*> (file->Get("dndeta_correction/gene_nTrackToNPart")); |
43 | TH3* meas = dynamic_cast<TH3*> (file->Get("dndeta_correction/meas_nTrackToNPart")); |
44 | TH3* corr = dynamic_cast<TH3*> (file->Get("dndeta_correction/corr_nTrackToNPart")); |
45 | |
46 | gene->SetTitle("Generated Particles"); |
47 | meas->SetTitle("Measured Tracks"); |
48 | corr->SetTitle("Correction Factor"); |
49 | |
50 | Prepare3DPlot(gene); |
51 | Prepare3DPlot(meas); |
52 | Prepare3DPlot(corr); |
53 | |
54 | TCanvas* canvas = new TCanvas("Track2Particle3D", "Track2Particle3D", 1200, 400); |
55 | canvas->Divide(3, 1); |
56 | |
57 | canvas->cd(1); |
58 | InitPad(); |
59 | gene->Draw(); |
60 | |
61 | canvas->cd(2); |
62 | meas->Draw(); |
63 | |
64 | canvas->cd(3); |
65 | corr->Draw(); |
66 | } |
67 | |
68 | void SetRanges(TH1* hist) |
69 | { |
70 | SetRanges(hist->GetXaxis()); |
71 | SetRanges(hist->GetYaxis()); |
72 | SetRanges(hist->GetZaxis()); |
73 | } |
74 | |
75 | void SetRanges(TAxis* axis) |
76 | { |
77 | if (strcmp(axis->GetTitle(), "#eta") == 0) |
78 | axis->SetRangeUser(-0.8, 0.79999); |
79 | if (strcmp(axis->GetTitle(), "p_{T}") == 0) |
80 | axis->SetRangeUser(0, 9.9999); |
81 | if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0) |
82 | axis->SetRangeUser(-10, 9.9999); |
83 | } |
84 | |
85 | void Prepare3DPlot(TH3* hist) |
86 | { |
87 | hist->GetXaxis()->SetTitleOffset(1.5); |
88 | hist->GetYaxis()->SetTitleOffset(1.5); |
89 | hist->GetZaxis()->SetTitleOffset(1.5); |
90 | } |
91 | |
92 | void Prepare2DPlot(TH2* hist) |
93 | { |
94 | hist->SetStats(kFALSE); |
95 | } |
96 | |
97 | void InitPad() |
98 | { |
99 | gPad->Range(0, 0, 1, 1); |
100 | gPad->SetLeftMargin(0); |
101 | gPad->SetRightMargin(0.05); |
102 | gPad->SetTopMargin(0.13); |
103 | gPad->SetBottomMargin(0.1); |
104 | |
105 | gPad->SetGridx(); |
106 | gPad->SetGridy(); |
107 | } |
108 | |
109 | void InitPadCOLZ() |
110 | { |
111 | gPad->Range(0, 0, 1, 1); |
112 | gPad->SetRightMargin(0.15); |
113 | gPad->SetLeftMargin(0.12); |
114 | } |