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 CompareCentralSecMaps(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 -------------------------------------------------
32 AliCentralMultiplicityTask task("tmp");
34 o1 = file1.Get(task.GetManager().GetSecMapName());
35 o2 = file2.Get(task.GetManager().GetSecMapName());
36 if (!o1 || !o2) return;
37 AliCentralCorrSecondaryMap* obj1 = static_cast<AliCentralCorrSecondaryMap*>(o1);
38 AliCentralCorrSecondaryMap* obj2 = static_cast<AliCentralCorrSecondaryMap*>(o2);
39 UShort_t nVtx = obj1->GetVertexAxis().GetNbins();
41 // --- Make canvas -------------------------------------------------
42 // Canvas* c = new Canvas("CentralSecMapComparison", "Ratio of central secondary maps", n1, n2);
45 // --- Loop over the data ------------------------------------------
46 //for (UShort_t d = 1; d <= 3; d++) {
47 // UShort_t nR = (d == 1 ? 1 : 2);
48 // for (UShort_t q = 0; q < nR; q++) {
49 // Char_t r = (q == 0 ? 'I' : 'O');
50 // UShort_t nS = (q == 0 ? 20 : 40);
52 // --- Make 2D ratios ------------------------------------------
53 //c->Clear(nVtx, d, r);
54 TCanvas* c2D = new TCanvas("2Dcomparison","2Dcomparison",800,1000);
55 TCanvas* c1D = new TCanvas("1Dcomparison","1Dcomparison",800,1000);
61 for (UShort_t v=1; v <= nVtx; v++) {
62 // TVirtualPad* p = c->cd(v);
64 TH2* h1 = obj1->GetCorrection( v);
65 TH2* h2 = obj2->GetCorrection( v);
66 //std::cout<<h1<<" "<<h2<<std::endl;
68 Error("CompareSecMaps",
69 "Map for SPD, vtxbin %3d not found in first",
74 Error("CompareSecMaps",
75 "Map for SPD, vtxbin %3d not found in second",
80 Double_t vl = obj1->GetVertexAxis().GetBinLowEdge(v);
81 Double_t vh = obj1->GetVertexAxis().GetBinUpEdge(v);
83 static_cast<TH2*>(h1->Clone(Form("tmpSPD_%3d",v)));
84 ratio->SetName(Form("SPD_vtx%03d_ratio", v));
85 ratio->SetTitle(Form("%+5.1f<v_{z}<%-+5.1f", vl, vh));
88 ratio->SetDirectory(0);
89 ratio->SetZTitle("ratio");
91 //if (ratio->GetMaximum()-ratio->GetMinimum() > 10)
94 ratio->DrawCopy("colz");
95 hists.AddAt(ratio, v-1);
100 // --- Make 1D profiles ----------------------------------------
101 //c->Clear(nVtx, d, r);
104 for (UShort_t v=1; v <= nVtx; v++) {
107 TH2* hist = static_cast<TH2*>(hists.At(v-1));
108 TH1D* prof = hist->ProjectionX();
110 for(Int_t i=1; i<=hist->GetNbinsX();i++) {
115 for(Int_t j=1; j<=hist->GetNbinsY();j++) {
116 if(hist->GetBinContent(i,j) > 0) {
117 sum = sum+hist->GetBinContent(i,j);
118 error = error + TMath::Power(hist->GetBinError(i,j),2);
124 sum = sum/(Float_t)n;
125 error = TMath::Sqrt(error) / (Float_t)n;
126 prof->SetBinContent(i,sum);
127 prof->SetBinError(i,error);
131 // prof->Scale(0.05);
133 prof->SetMinimum(0.8);
134 prof->SetMaximum(1.2);
137 prof->Fit("pol0","Q");
140 TF1* f = prof->GetFunction("pol0");
142 TLatex* l = new TLatex(0.5, 0.4, Form("A = %f #pm %f",
148 l->DrawLatex(0.5, 0.3, Form("#chi^2/NDF = %f / %d = %f",
151 f->GetChisquare() / f->GetNDF()));
152 Double_t dist = TMath::Abs(1 - f->GetParameter(0));
153 l->DrawLatex(0.5, 0.35, Form("|1 - A| = %f %s #deltaA",
154 dist, dist <= f->GetParError(0) ?
157 TLine* l1 = new TLine(-4, 1, 6, 1);
158 l1->SetLineColor(kRed);
164 //c->Print(d, r, "profiles");
165 c2D->Print("comparisonSPD.pdf(");
166 c1D->Print("comparisonSPD.pdf)");
169 // --- Close stuff -------------------------------------------------
176 //____________________________________________________________________