]>
Commit | Line | Data |
---|---|---|
970b1a8a | 1 | //____________________________________________________________________ |
cc83fca2 | 2 | /** |
cc83fca2 | 3 | * |
cc83fca2 | 4 | * |
970b1a8a | 5 | * @param fn1 |
6 | * @param fn2 | |
7 | * @param n1 | |
8 | * @param n2 | |
9 | * @param load | |
10 | * | |
bd6f5206 | 11 | * @ingroup pwglf_forward_scripts_corr |
cc83fca2 | 12 | */ |
cc83fca2 | 13 | void |
14 | CompareSecMaps(const char* fn1, const char* fn2, | |
0f84fefb | 15 | const char* n1=0, const char* n2=0, |
16 | bool load=true) | |
cc83fca2 | 17 | { |
18 | ||
0f84fefb | 19 | // --- Load Utilities ---------------------------------------------- |
20 | if (load) { | |
bd6f5206 | 21 | gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C"); |
a7f31ad8 | 22 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/corrs/CompareCorrs.C"); |
cc83fca2 | 23 | } |
24 | ||
0f84fefb | 25 | // --- Get Objects ------------------------------------------------- |
26 | TObject* o1 = 0; | |
27 | TObject* o2 = 0; | |
28 | GetObjects(AliForwardCorrectionManager::kSecondaryMap, fn1, fn2, o1, o2); | |
29 | if (!o1 || !o2) return; | |
30 | AliFMDCorrSecondaryMap* obj1 = static_cast<AliFMDCorrSecondaryMap*>(o1); | |
31 | AliFMDCorrSecondaryMap* obj2 = static_cast<AliFMDCorrSecondaryMap*>(o2); | |
cc83fca2 | 32 | UShort_t nVtx = obj1->GetVertexAxis().GetNbins(); |
33 | ||
34 | // --- Make canvas ------------------------------------------------- | |
0f84fefb | 35 | Canvas* c = new Canvas("secMapComparison", "Ratio of secondary maps", n1, n2); |
36 | c->Open(); | |
cc83fca2 | 37 | |
0f84fefb | 38 | // --- Loop over the data ------------------------------------------ |
cc83fca2 | 39 | for (UShort_t d = 1; d <= 3; d++) { |
40 | UShort_t nR = (d == 1 ? 1 : 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 | ||
0f84fefb | 45 | // --- Make 2D ratios ------------------------------------------ |
46 | c->Clear(nVtx, d, r); | |
cc83fca2 | 47 | TList hists; |
48 | for (UShort_t v=1; v <= nVtx; v++) { | |
0f84fefb | 49 | TVirtualPad* p = c->cd(v); |
cc83fca2 | 50 | |
0f84fefb | 51 | TH2* h1 = obj1->GetCorrection(d, r, v); |
e28f5fc5 | 52 | TH2* h2 = obj2->GetCorrection(d, r, v); |
0f84fefb | 53 | |
54 | if (!h1) { | |
55 | Error("CompareSecMaps", | |
56 | "Map for FMD%d%c, vtxbin %3d not found in first", | |
57 | d, r, v); | |
58 | continue; | |
59 | } | |
60 | if (!h2) { | |
61 | Error("CompareSecMaps", | |
62 | "Map 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 | ||
cc83fca2 | 78 | if (ratio->GetMaximum()-ratio->GetMinimum() > 10) |
79 | p->SetLogz(); | |
80 | ||
81 | ratio->Draw("colz"); | |
82 | hists.AddAt(ratio, v-1); | |
83 | } | |
0f84fefb | 84 | c->Print(d, r); |
cc83fca2 | 85 | |
0f84fefb | 86 | // --- Make 1D profiles ---------------------------------------- |
87 | c->Clear(nVtx, d, r); | |
cc83fca2 | 88 | for (UShort_t v=1; v <= nVtx; v++) { |
0f84fefb | 89 | c->cd(v); |
90 | TH2* hist = static_cast<TH2*>(hists.At(v-1)); | |
91 | TH1* prof = hist->ProjectionX(); | |
cc83fca2 | 92 | prof->Scale(1. / nS); |
93 | prof->SetStats(0); | |
94 | prof->SetMinimum(0.8); | |
95 | prof->SetMaximum(1.2); | |
96 | ||
cc83fca2 | 97 | prof->Draw(); |
98 | prof->Fit("pol0","Q"); | |
99 | ||
100 | TF1* f = prof->GetFunction("pol0"); | |
101 | ||
102 | TLatex* l = new TLatex(0.5, 0.4, Form("A = %f #pm %f", | |
103 | f->GetParameter(0), | |
104 | f->GetParError(0))); | |
105 | l->SetTextAlign(22); | |
106 | l->SetNDC(); | |
107 | l->Draw(); | |
108 | l->DrawLatex(0.5, 0.3, Form("#chi^2/NDF = %f / %d = %f", | |
109 | f->GetChisquare(), | |
110 | f->GetNDF(), | |
111 | f->GetChisquare() / f->GetNDF())); | |
112 | Double_t dist = TMath::Abs(1 - f->GetParameter(0)); | |
113 | l->DrawLatex(0.5, 0.35, Form("|1 - A| = %f %s #deltaA", | |
114 | dist, dist <= f->GetParError(0) ? | |
115 | "#leq" : ">")); | |
116 | ||
117 | TLine* l1 = new TLine(-4, 1, 6, 1); | |
118 | l1->SetLineColor(kRed); | |
119 | l1->SetLineStyle(2); | |
120 | l1->Draw(); | |
121 | } | |
122 | ||
0f84fefb | 123 | c->Print(d, r, "profiles"); |
cc83fca2 | 124 | } |
125 | } | |
126 | ||
0f84fefb | 127 | // --- Close stuff ------------------------------------------------- |
128 | c->Close(); | |
129 | // file1->Close(); | |
130 | // file2->Close(); | |
cc83fca2 | 131 | } |
132 | ||
133 | ||
0f84fefb | 134 | //____________________________________________________________________ |
135 | // | |
136 | // EOF | |
137 | // |