]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/corrs/CompareVtxBias.C
Documentation fixes
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / corrs / CompareVtxBias.C
CommitLineData
970b1a8a 1//____________________________________________________________________
0f84fefb 2/**
0f84fefb 3 *
0f84fefb 4 *
970b1a8a 5 * @param fn1
6 * @param fn2
7 * @param n1
8 * @param n2
9 * @param load
10 *
f0ef1e71 11 * @ingroup pwg2_forward_scripts_corr
0f84fefb 12 */
0f84fefb 13void
14CompareVtxBias(const char* fn1, const char* fn2,
15 const char* n1=0, const char* n2=0,
16 bool load=true)
17{
18
19 // --- Load Utilities ----------------------------------------------
20 if (load) {
21 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
22 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/CompareCorrs.C");
23 }
24
25 // --- Get Objects -------------------------------------------------
26 TObject* o1 = 0;
27 TObject* o2 = 0;
28 GetObjects(AliForwardCorrectionManager::kVertexBias, fn1, fn2, o1, o2);
29 if (!o1 || !o2) return;
30 AliFMDCorrVertexBias* obj1 = static_cast<AliFMDCorrVertexBias*>(o1);
31 AliFMDCorrVertexBias* obj2 = static_cast<AliFMDCorrVertexBias*>(o2);
32 UShort_t nVtx = obj1->GetVertexAxis().GetNbins();
33
34 // --- Make canvas -------------------------------------------------
35 Canvas* c = new Canvas("vtxBiasComparison", "Ratio of vertex bias", n1, n2);
36 c->Open();
37
38 // --- Loop over the data ------------------------------------------
39 UShort_t d = 0;
40 UShort_t nR = 2;
41 for (UShort_t q = 0; q < nR; q++) {
42 Char_t r = (q == 0 ? 'I' : 'O');
43 UShort_t nS = (q == 0 ? 20 : 40);
44
45 // --- Make 2D ratios ------------------------------------------
46 c->Clear(nVtx, d, r);
47 TList hists;
48 for (UShort_t v=1; v <= nVtx; v++) {
49 TVirtualPad* p = c->cd(v);
50
51 TH2* h1 = obj1->GetCorrection(r, v);
52 TH2* h2 = obj2->GetCorrection(r, v);
53
54 if (!h1) {
55 Error("CompareVtxBias",
56 "Bias for FMD%d%c, vtxbin %3d not found in first",
57 d, r, v);
58 continue;
59 }
60 if (!h2) {
61 Error("CompareVtxBias",
62 "Bias for FMD%d%c, vtxbin %3d not found in second",
63 d, r, v);
64 continue;
65 }
66
67 Double_t vl = obj1->GetVertexAxis().GetBinLowEdge(v);
68 Double_t vh = obj1->GetVertexAxis().GetBinUpEdge(v);
69 TH2* ratio =
70 static_cast<TH2*>(h1->Clone(Form("tmpFMD%d%c_%3d",d,r,v)));
71 ratio->SetName(Form("FMD%d%c_vtx%03d_ratio", d, r, v));
72 ratio->SetTitle(Form("%+5.1f<v_{z}<%-+5.1f", vl, vh));
73 ratio->Divide(h2);
74 ratio->SetStats(0);
75 ratio->SetDirectory(0);
76 ratio->SetZTitle("ratio");
77
78 if (ratio->GetMaximum()-ratio->GetMinimum() > 10)
79 p->SetLogz();
80
81 ratio->Draw("colz");
82 // h2->Draw("colz");
83 hists.AddAt(ratio, v-1);
84 }
85 c->Print(d, r);
86
87 // --- Make 1D profiles ----------------------------------------
88 c->Clear(nVtx, d, r);
89 for (UShort_t v=1; v <= nVtx; v++) {
90 c->cd(v);
91 TH2* hist = static_cast<TH2*>(hists.At(v-1));
92 TH1* prof = hist->ProjectionX();
93 prof->Scale(1. / nS);
94 prof->SetStats(0);
95 prof->SetMinimum(0.8);
96 prof->SetMaximum(1.2);
97
98 prof->Draw();
99 prof->Fit("pol0","Q");
100
101 TF1* f = prof->GetFunction("pol0");
102
103 TLatex* l = new TLatex(0.5, 0.4, Form("A = %f #pm %f",
104 f->GetParameter(0),
105 f->GetParError(0)));
106 l->SetTextAlign(22);
107 l->SetNDC();
108 l->Draw();
109 l->DrawLatex(0.5, 0.3, Form("#chi^2/NDF = %f / %d = %f",
110 f->GetChisquare(),
111 f->GetNDF(),
112 f->GetChisquare() / f->GetNDF()));
113 Double_t dist = TMath::Abs(1 - f->GetParameter(0));
114 l->DrawLatex(0.5, 0.35, Form("|1 - A| = %f %s #deltaA",
115 dist, dist <= f->GetParError(0) ?
116 "#leq" : ">"));
117
118 TLine* l1 = new TLine(-4, 1, 6, 1);
119 l1->SetLineColor(kRed);
120 l1->SetLineStyle(2);
121 l1->Draw();
122 }
123
124 c->Print(d, r, "profiles");
125 }
126
127 // --- Close stuff -------------------------------------------------
128 c->Close();
129 // file1->Close();
130 // file2->Close();
131}
132
133
134//____________________________________________________________________
135//
136// EOF
137//