1 //____________________________________________________________________
11 * @ingroup pwglf_forward_scripts_corr
14 CompareVtxBias(const char* fn1, const char* fn2,
15 const char* n1=0, const char* n2=0,
19 // --- Load Utilities ----------------------------------------------
21 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
22 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/CompareCorrs.C");
25 // --- Get Objects -------------------------------------------------
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();
34 // --- Make canvas -------------------------------------------------
35 Canvas* c = new Canvas("vtxBiasComparison", "Ratio of vertex bias", n1, n2);
38 // --- Loop over the data ------------------------------------------
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);
45 // --- Make 2D ratios ------------------------------------------
48 for (UShort_t v=1; v <= nVtx; v++) {
49 TVirtualPad* p = c->cd(v);
51 TH2* h1 = obj1->GetCorrection(r, v);
52 TH2* h2 = obj2->GetCorrection(r, v);
55 Error("CompareVtxBias",
56 "Bias for FMD%d%c, vtxbin %3d not found in first",
61 Error("CompareVtxBias",
62 "Bias for FMD%d%c, vtxbin %3d not found in second",
67 Double_t vl = obj1->GetVertexAxis().GetBinLowEdge(v);
68 Double_t vh = obj1->GetVertexAxis().GetBinUpEdge(v);
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));
75 ratio->SetDirectory(0);
76 ratio->SetZTitle("ratio");
78 if (ratio->GetMaximum()-ratio->GetMinimum() > 10)
83 hists.AddAt(ratio, v-1);
87 // --- Make 1D profiles ----------------------------------------
89 for (UShort_t v=1; v <= nVtx; v++) {
91 TH2* hist = static_cast<TH2*>(hists.At(v-1));
92 TH1* prof = hist->ProjectionX();
95 prof->SetMinimum(0.8);
96 prof->SetMaximum(1.2);
99 prof->Fit("pol0","Q");
101 TF1* f = prof->GetFunction("pol0");
103 TLatex* l = new TLatex(0.5, 0.4, Form("A = %f #pm %f",
109 l->DrawLatex(0.5, 0.3, Form("#chi^2/NDF = %f / %d = %f",
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) ?
118 TLine* l1 = new TLine(-4, 1, 6, 1);
119 l1->SetLineColor(kRed);
124 c->Print(d, r, "profiles");
127 // --- Close stuff -------------------------------------------------
134 //____________________________________________________________________