]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/SPECTRA/Nuclei/B2/macros/DrawSpectra.C
cumulative changes for root scripts and code cleanup
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / Nuclei / B2 / macros / DrawSpectra.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 differential yields
17// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>
18
aa54def0 19#if !defined(__CINT__) || defined(__MAKECINT__)
2403d402 20#include <TStyle.h>
21#include <TFile.h>
22#include <TString.h>
23#include <TCanvas.h>
24#include <TGraphErrors.h>
aa54def0 25#endif
2403d402 26
27#include "B2.h"
28
29void DrawSpectra(const TString& inputFile="spectra.root", const TString& tag="lhc10d", const TString& particle="Deuteron")
30{
31//
32// Draw differential yields
33//
aa54def0 34 gStyle->SetPadTickX(1);
35 gStyle->SetPadTickY(1);
36 gStyle->SetPadGridX(1);
37 gStyle->SetPadGridY(1);
2403d402 38 gStyle->SetOptLogy(1);
39
40 TFile* finput = new TFile(inputFile.Data());
41 if (finput->IsZombie()) exit(1);
42
43 TCanvas* c0 = new TCanvas(Form("%s.Spectra", particle.Data()), Form("Spectra for %ss", particle.Data()));
aa54def0 44 c0->Divide(2,1);
2403d402 45
aa54def0 46 // differential yield
2403d402 47
48 c0->cd(1);
49
aa54def0 50 TGraphErrors* grDYieldPt = FindObj<TGraphErrors>(finput, tag, particle + "_DiffYield_Pt");
2403d402 51
52 grDYieldPt->SetMarkerStyle(kFullCircle);
53 grDYieldPt->SetMarkerColor(kRed);
54 grDYieldPt->SetLineColor(kRed);
aa54def0 55 grDYieldPt->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
56 grDYieldPt->GetYaxis()->SetTitle("1/#it{N}_{ev} d^{2}#it{N}/(d#it{p}_{T}d#it{y}) (GeV^{-1}#it{c}^{2})");
57 grDYieldPt->GetYaxis()->SetTitleOffset(1.30);
58 grDYieldPt->Draw("zAP");
2403d402 59
aa54def0 60 // invariant differential yield
2403d402 61
62 c0->cd(2);
63
aa54def0 64 TGraphErrors* grInvDYieldPt = FindObj<TGraphErrors>(finput, tag, particle + "_InvDiffYield_Pt");
2403d402 65
66 grInvDYieldPt->SetMarkerStyle(kFullCircle);
67 grInvDYieldPt->SetMarkerColor(kRed);
68 grInvDYieldPt->SetLineColor(kRed);
aa54def0 69 grInvDYieldPt->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
70 grInvDYieldPt->GetYaxis()->SetTitle("1/(2#pi#it{N}_{ev}) d^{2}#it{N}/(#it{p}_{T}d#it{p}_{T}d#it{y}) (GeV^{-2}#it{c}^{3})");
71 grInvDYieldPt->GetYaxis()->SetTitleOffset(1.30);
72 grInvDYieldPt->Draw("zAP");
2403d402 73}