AliPhysics  608b256 (608b256)
DrawDeltas.C
Go to the documentation of this file.
1 void
3 {
4  TFile* file0 = TFile::Open("dt_middle_none/trdt.root");
5  TFile* file1 = TFile::Open("mc_middle_PtPidStr/trmc.root");
6  TFile* file2 = TFile::Open("mc_middle_none/trmc.root");
7  TList* l0 = (TList*)file0->Get("clist");
8  TH1* data = (TH1*) l0->FindObject("b0_TrData_WDist");
9  TList* l1 = (TList*)file1->Get("clist");
10  TH1* reweigh = (TH1*) l1->FindObject("b0_TrData_WDist");
11  TList* l2 = (TList*)file2->Get("clist");
12  TH1* none = (TH1*) l2->FindObject("b0_TrData_WDist");
13 
14  data->Scale(1./data->Integral());
15  data->SetMarkerColor(kRed+2);
16  data->SetLineColor(kRed+2);
17  data->SetMarkerStyle(20);
18  data->SetTitle("Real data");
19 
20  reweigh->Scale(1./reweigh->Integral());
21  reweigh->SetMarkerColor(kBlue+2);
22  reweigh->SetLineColor(kBlue+2);
23  reweigh->SetMarkerStyle(25);
24  reweigh->SetTitle("Simulated data, reweighed");
25 
26  none->Scale(1./none->Integral());
27  none->SetLineColor(kGreen+2);
28  none->SetMarkerColor(kGreen+2);
29  none->SetMarkerStyle(24);
30  none->SetTitle("Simulated data");
31 
32  THStack* stack = new THStack("stack","");
33  stack->Add(data);
34  stack->Add(none);
35  stack->Add(reweigh);
36 
37  TH1* rnone = none ->Clone("rnone"); rnone ->Divide(data);
38  TH1* rreweigh = reweigh->Clone("rreweigh"); rreweigh->Divide(data);
39  rnone ->SetTitle("Simulated/Real data");
40  rreweigh->SetTitle("Simulated (reweighed)/Real data");
41  THStack* ratios = new THStack("ratios","");
42  ratios->Add(rnone);
43  ratios->Add(rreweigh);
44 
45  TCanvas* c= new TCanvas("c","c",900,1000);
46  c->SetTopMargin(0.01);
47  c->SetRightMargin(0.01);
48  c->Divide(1,2,0,0);
49 
50  c->cd(1); stack ->Draw("nostack");
51  c->cd(2); ratios->Draw("nostack");
52  c->GetPad(1)->SetLogy();
53  // c->GetPad(1)->SetLogx();
54  // c->GetPad(2)->SetLogx();
55  c->GetPad(1)->SetRightMargin(0.01);
56  c->GetPad(2)->SetRightMargin(0.01);
57 
58  stack->GetHistogram()->SetXTitle("\\Delta");
59  stack->GetHistogram()->SetYTitle("P(\\Delta) \\hbox{ Norm. to }"
60  "\\int \\mathrm{d}\\Delta");
61 
62  ratios->GetHistogram()->SetXTitle("\\Delta");
63  ratios->GetHistogram()->SetYTitle("Ratio to real data");
64 
65  TLegend* l = c->GetPad(1)->BuildLegend(.6,.6,.98,.98);
66  l->SetFillStyle(0);
67  l->SetBorderSize(0);
68 
69  l = c->GetPad(2)->BuildLegend(.6,.12,.98,.6);
70  l->SetFillStyle(0);
71  l->SetBorderSize(0);
72  TLine* ll = new TLine(data->GetXaxis()->GetXmin(), 1,
73  data->GetXaxis()->GetXmax(), 1);
74  ll->SetLineColor(data->GetLineColor());
75  ll->SetLineStyle(7);
76  ll->SetLineWidth(2);
77  ll->Draw();
78 
79  c->SaveAs("deltas.png");
80 }
TCanvas * c
Definition: TestFitELoss.C:172
AliStack * stack
void DrawDeltas()
Definition: DrawDeltas.C:2
Definition: External.C:196