2 * Make ratio of two specific maps
6 * @param v Vertex bin (1 based)
7 * @param first First correction
8 * @param second Second correction
10 * @return Ratio of the two, or null
13 //____________________________________________________________________
15 CompareVtxBias(const char* fn1, const char* fn2,
16 const char* n1=0, const char* n2=0,
20 // --- Load Utilities ----------------------------------------------
22 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
23 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/CompareCorrs.C");
26 // --- Get Objects -------------------------------------------------
29 GetObjects(AliForwardCorrectionManager::kVertexBias, fn1, fn2, o1, o2);
30 if (!o1 || !o2) return;
31 AliFMDCorrVertexBias* obj1 = static_cast<AliFMDCorrVertexBias*>(o1);
32 AliFMDCorrVertexBias* obj2 = static_cast<AliFMDCorrVertexBias*>(o2);
33 UShort_t nVtx = obj1->GetVertexAxis().GetNbins();
35 // --- Make canvas -------------------------------------------------
36 Canvas* c = new Canvas("vtxBiasComparison", "Ratio of vertex bias", n1, n2);
39 // --- Loop over the data ------------------------------------------
42 for (UShort_t q = 0; q < nR; q++) {
43 Char_t r = (q == 0 ? 'I' : 'O');
44 UShort_t nS = (q == 0 ? 20 : 40);
46 // --- Make 2D ratios ------------------------------------------
49 for (UShort_t v=1; v <= nVtx; v++) {
50 TVirtualPad* p = c->cd(v);
52 TH2* h1 = obj1->GetCorrection(r, v);
53 TH2* h2 = obj2->GetCorrection(r, v);
56 Error("CompareVtxBias",
57 "Bias for FMD%d%c, vtxbin %3d not found in first",
62 Error("CompareVtxBias",
63 "Bias for FMD%d%c, vtxbin %3d not found in second",
68 Double_t vl = obj1->GetVertexAxis().GetBinLowEdge(v);
69 Double_t vh = obj1->GetVertexAxis().GetBinUpEdge(v);
71 static_cast<TH2*>(h1->Clone(Form("tmpFMD%d%c_%3d",d,r,v)));
72 ratio->SetName(Form("FMD%d%c_vtx%03d_ratio", d, r, v));
73 ratio->SetTitle(Form("%+5.1f<v_{z}<%-+5.1f", vl, vh));
76 ratio->SetDirectory(0);
77 ratio->SetZTitle("ratio");
79 if (ratio->GetMaximum()-ratio->GetMinimum() > 10)
84 hists.AddAt(ratio, v-1);
88 // --- Make 1D profiles ----------------------------------------
90 for (UShort_t v=1; v <= nVtx; v++) {
92 TH2* hist = static_cast<TH2*>(hists.At(v-1));
93 TH1* prof = hist->ProjectionX();
96 prof->SetMinimum(0.8);
97 prof->SetMaximum(1.2);
100 prof->Fit("pol0","Q");
102 TF1* f = prof->GetFunction("pol0");
104 TLatex* l = new TLatex(0.5, 0.4, Form("A = %f #pm %f",
110 l->DrawLatex(0.5, 0.3, Form("#chi^2/NDF = %f / %d = %f",
113 f->GetChisquare() / f->GetNDF()));
114 Double_t dist = TMath::Abs(1 - f->GetParameter(0));
115 l->DrawLatex(0.5, 0.35, Form("|1 - A| = %f %s #deltaA",
116 dist, dist <= f->GetParError(0) ?
119 TLine* l1 = new TLine(-4, 1, 6, 1);
120 l1->SetLineColor(kRed);
125 c->Print(d, r, "profiles");
128 // --- Close stuff -------------------------------------------------
135 //____________________________________________________________________