]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/Nuclei/B2/macros/DrawCorr.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / DrawCorr.C
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 // Draw pt corrections for debugging
17 // author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
18
19 #if !defined(__CINT__) || defined(__MAKECINT__)
20 #include <TStyle.h>
21 #include <TFile.h>
22 #include <TH1D.h>
23 #include <TString.h>
24 #include <TCanvas.h>
25 #include <TF1.h>
26 #endif
27
28 #include "B2.h"
29
30 void DrawPair(TH1* hX, TH1* hY, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, const TString& title="", const char* option="E", Int_t xMarker=kFullCircle, Int_t yMarker=kFullCircle, Int_t xColor=kBlue, Int_t yColor=kRed);
31
32 void DrawCorr(const TString& species="Deuteron", const TString& inputFile="corrections.root", const TString& tag="")
33 {
34 //
35 // Draw pt corrections for debugging
36 //
37         gStyle->SetPadTickX(1);
38         gStyle->SetPadTickY(1);
39         gStyle->SetPadGridX(1);
40         gStyle->SetPadGridY(1);
41         gStyle->SetOptTitle(0);
42         gStyle->SetOptStat(0);
43         
44         Double_t xmin = 0;
45         Double_t xmax = 3.5;
46         
47         const Int_t kNpart = 2;
48         
49         TFile* finput = new TFile(inputFile.Data());
50         if (finput->IsZombie()) exit(1);
51         
52         const TString kPrefix[] = {"", "Anti"};
53         
54         // Reconstruction efficiency
55         
56         TCanvas* c2 = new TCanvas(Form("%s.Efficiency",species.Data()), Form("Reconstruction Efficiency for (Anti)%ss",species.Data()));
57         c2->Divide(2,2);
58         
59         TH1D* hEffTrigPt[kNpart];
60         TH1D* hEffVtxPt[kNpart];
61         TH1D* hEffAccPt[kNpart];
62         TH1D* hEffAccTrkPt[kNpart];
63         
64         for(Int_t i=0; i<kNpart; ++i)
65         {
66                 hEffTrigPt[i] = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Eff_Trig_Pt");
67                 hEffVtxPt[i] = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Eff_Vtx_Pt");
68                 hEffAccPt[i] = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Eff_Acc_Pt");
69                 hEffAccTrkPt[i] = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Eff_AccTrk_Pt");
70         }
71         
72         c2->cd(1);
73         DrawPair(hEffTrigPt[0], hEffTrigPt[1], xmin, xmax, 0, 1.1);
74         
75         c2->cd(2);
76         DrawPair(hEffVtxPt[0], hEffVtxPt[1], xmin, xmax, 0, 1.1);
77         
78         c2->cd(3);
79         DrawPair(hEffAccPt[0], hEffAccPt[1], xmin, xmax, 0, 1.1);
80         
81         c2->cd(4);
82         DrawPair(hEffAccTrkPt[0], hEffAccTrkPt[1], xmin, xmax, 0, 1.1);
83         
84         // Secondaries
85         
86         TCanvas* c3 = new TCanvas(Form("%s.Secondaries",species.Data()), Form("Fraction of secondaries for (Anti)%ss",species.Data()));
87         
88         c3->Divide(2,2);
89         
90         for(Int_t i=0; i<kNpart; ++i)
91         {
92                 TH1D* hFracFdwnPt = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Frac_Fdwn_Pt");
93                 TH1D* hFracMatPt  = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Frac_Mat_Pt");
94                 
95                 TF1* fncFracFdwnPt = FindObj<TF1>(finput, tag, kPrefix[i] + species + "_Frac_Fdwn_Fit_Pt");
96                 TF1* fncFracMatPt  = FindObj<TF1>(finput, tag, kPrefix[i] + species + "_Frac_Mat_Fit_Pt");
97                 
98                 c3->cd(2*i+1);
99                 hFracFdwnPt->SetAxisRange(xmin, xmax, "X");
100                 hFracFdwnPt->SetAxisRange(0., 0.6, "Y");
101                 hFracFdwnPt->GetYaxis()->SetTitleOffset(1.4);
102                 
103                 hFracFdwnPt->SetMarkerColor(kBlue);
104                 hFracFdwnPt->SetLineColor(kBlue);
105                 hFracFdwnPt->SetMarkerStyle(kFullCircle);
106                 hFracFdwnPt->DrawCopy("E");
107                 
108                 fncFracFdwnPt->SetLineColor(kRed);
109                 fncFracFdwnPt->SetLineWidth(1);
110                 fncFracFdwnPt->Draw("same");
111                 
112                 c3->cd(2*i+2);
113                 hFracMatPt->SetAxisRange(xmin, xmax, "X");
114                 hFracMatPt->SetAxisRange(0.,0.6, "Y");
115                 hFracMatPt->GetYaxis()->SetTitleOffset(1.4);
116                 
117                 hFracMatPt->SetMarkerColor(kBlue);
118                 hFracMatPt->SetLineColor(kBlue);
119                 hFracMatPt->SetMarkerStyle(kFullCircle);
120                 hFracMatPt->DrawCopy("E");
121                 
122                 fncFracMatPt->SetLineColor(kRed);
123                 fncFracMatPt->SetLineWidth(1);
124                 fncFracMatPt->Draw("same");
125         }
126 }
127
128 void DrawPair(TH1* hX, TH1* hY, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, const TString& title, const char* option, Int_t xMarker, Int_t yMarker, Int_t xColor, Int_t yColor)
129 {
130 //
131 // Draw a pair of histograms in the current pad
132 //
133         hX->SetTitle(title.Data());
134         hX->SetAxisRange(xmin, xmax, "X");
135         hX->SetAxisRange(ymin, ymax, "Y");
136         hX->SetMarkerColor(xColor);
137         hX->SetLineColor(xColor);
138         hX->SetMarkerStyle(xMarker);
139         
140         hY->SetMarkerColor(yColor);
141         hY->SetLineColor(yColor);
142         hY->SetMarkerStyle(yMarker);
143         
144         hX->DrawCopy(option);
145         hY->DrawCopy(Form("same%s",option));
146 }