]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/Nuclei/B2/macros/DrawRatio.C
cumulative changes for root scripts and code cleanup
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / DrawRatio.C
CommitLineData
2403d402 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 antiparticle/particle ratio
17// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
18
aa54def0 19#if !defined(__CINT__) || defined(__MAKECINT__)
20#include <TStyle.h>
2403d402 21#include <TFile.h>
22#include <TH1D.h>
23#include <TString.h>
24#include <TCanvas.h>
aa54def0 25#endif
2403d402 26
27#include "B2.h"
28
29void DrawRatio(const TString& inputFile="pt.root", const TString& tag="test", const TString& species="Deuteron")
30{
31//
32// Draw antiparticle/particle ratio
33//
34 Double_t xmin = 0;
35 Double_t xmax = 3.5;
36 Double_t ymin = 0.73;
37 Double_t ymax = 1.14;
38
aa54def0 39 gStyle->SetPadTickX(1);
40 gStyle->SetPadTickY(1);
41 gStyle->SetPadGridX(1);
42 gStyle->SetPadGridY(1);
43 gStyle->SetOptTitle(0);
44 gStyle->SetOptStat(0);
45
2403d402 46 TFile* finput = new TFile(inputFile.Data());
47 if (finput->IsZombie()) exit(1);
48
49 // antiparticle/particle ratio
50
51 TString ytitle = "Negative/Positive";
52 if(species=="Proton") ytitle = "#bar{p}/p";
53 else if(species=="Deuteron") ytitle = "#bar{d}/d";
54 else if(species=="Triton") ytitle = "#bar{t}/t";
55 else if(species=="He3") ytitle = "#bar{He3}/He3";
56 else if(species=="Alpha") ytitle = "#bar{#alpha}/#alpha";
57
aa54def0 58 TH1D* hRatioPt = FindObj<TH1D>(finput, tag, Form("Anti%s%s_Ratio_Pt", species.Data(), species.Data()));
2403d402 59
60 TCanvas* c0 = new TCanvas(Form("c0.Ratio%s",species.Data()), Form("Anti%s/%s ratio", species.Data(), species.Data()));
61 c0->cd();
62
63 hRatioPt->SetTitle("");
64 hRatioPt->SetAxisRange(xmin,xmax,"X");
65 hRatioPt->SetAxisRange(ymin,ymax,"Y");
66 hRatioPt->SetLineColor(kRed);
67 hRatioPt->SetMarkerStyle(kFullCircle);
68 hRatioPt->SetMarkerColor(kRed);
69 hRatioPt->SetYTitle(ytitle);
70 hRatioPt->DrawCopy();
71}