ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

// Draw pt corrections for debugging
// author: Eulogio Serradilla <eulogio.serradilla@cern.ch>

#if !defined(__CINT__) || defined(__MAKECINT__)
#include <TStyle.h>
#include <TFile.h>
#include <TH1D.h>
#include <TString.h>
#include <TCanvas.h>
#include <TF1.h>
#endif

#include "B2.h"

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);

void DrawCorr(const TString& species="Deuteron", const TString& inputFile="corrections.root", const TString& tag="")
{
//
// Draw pt corrections for debugging
//
	gStyle->SetPadTickX(1);
	gStyle->SetPadTickY(1);
	gStyle->SetPadGridX(1);
	gStyle->SetPadGridY(1);
	gStyle->SetOptTitle(0);
	gStyle->SetOptStat(0);
	
	Double_t xmin = 0;
	Double_t xmax = 3.5;
	
	const Int_t kNpart = 2;
	
	TFile* finput = new TFile(inputFile.Data());
	if (finput->IsZombie()) exit(1);
	
	const TString kPrefix[] = {"", "Anti"};
	
	// Reconstruction efficiency
	
	TCanvas* c2 = new TCanvas(Form("%s.Efficiency",species.Data()), Form("Reconstruction Efficiency for (Anti)%ss",species.Data()));
	c2->Divide(2,2);
	
	TH1D* hEffTrigPt[kNpart];
	TH1D* hEffVtxPt[kNpart];
	TH1D* hEffAccPt[kNpart];
	TH1D* hEffAccTrkPt[kNpart];
	
	for(Int_t i=0; i<kNpart; ++i)
	{
		hEffTrigPt[i] = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Eff_Trig_Pt");
		hEffVtxPt[i] = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Eff_Vtx_Pt");
		hEffAccPt[i] = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Eff_Acc_Pt");
		hEffAccTrkPt[i] = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Eff_AccTrk_Pt");
	}
	
	c2->cd(1);
	DrawPair(hEffTrigPt[0], hEffTrigPt[1], xmin, xmax, 0, 1.1);
	
	c2->cd(2);
	DrawPair(hEffVtxPt[0], hEffVtxPt[1], xmin, xmax, 0, 1.1);
	
	c2->cd(3);
	DrawPair(hEffAccPt[0], hEffAccPt[1], xmin, xmax, 0, 1.1);
	
	c2->cd(4);
	DrawPair(hEffAccTrkPt[0], hEffAccTrkPt[1], xmin, xmax, 0, 1.1);
	
	// Secondaries
	
	TCanvas* c3 = new TCanvas(Form("%s.Secondaries",species.Data()), Form("Fraction of secondaries for (Anti)%ss",species.Data()));
	
	c3->Divide(2,2);
	
	for(Int_t i=0; i<kNpart; ++i)
	{
		TH1D* hFracFdwnPt = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Frac_Fdwn_Pt");
		TH1D* hFracMatPt  = FindObj<TH1D>(finput, tag, kPrefix[i] + species + "_Frac_Mat_Pt");
		
		TF1* fncFracFdwnPt = FindObj<TF1>(finput, tag, kPrefix[i] + species + "_Frac_Fdwn_Fit_Pt");
		TF1* fncFracMatPt  = FindObj<TF1>(finput, tag, kPrefix[i] + species + "_Frac_Mat_Fit_Pt");
		
		c3->cd(2*i+1);
		hFracFdwnPt->SetAxisRange(xmin, xmax, "X");
		hFracFdwnPt->SetAxisRange(0., 0.6, "Y");
		hFracFdwnPt->GetYaxis()->SetTitleOffset(1.4);
		
		hFracFdwnPt->SetMarkerColor(kBlue);
		hFracFdwnPt->SetLineColor(kBlue);
		hFracFdwnPt->SetMarkerStyle(kFullCircle);
		hFracFdwnPt->DrawCopy("E");
		
		fncFracFdwnPt->SetLineColor(kRed);
		fncFracFdwnPt->SetLineWidth(1);
		fncFracFdwnPt->Draw("same");
		
		c3->cd(2*i+2);
		hFracMatPt->SetAxisRange(xmin, xmax, "X");
		hFracMatPt->SetAxisRange(0.,0.6, "Y");
		hFracMatPt->GetYaxis()->SetTitleOffset(1.4);
		
		hFracMatPt->SetMarkerColor(kBlue);
		hFracMatPt->SetLineColor(kBlue);
		hFracMatPt->SetMarkerStyle(kFullCircle);
		hFracMatPt->DrawCopy("E");
		
		fncFracMatPt->SetLineColor(kRed);
		fncFracMatPt->SetLineWidth(1);
		fncFracMatPt->Draw("same");
	}
}

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)
{
//
// Draw a pair of histograms in the current pad
//
	hX->SetTitle(title.Data());
	hX->SetAxisRange(xmin, xmax, "X");
	hX->SetAxisRange(ymin, ymax, "Y");
	hX->SetMarkerColor(xColor);
	hX->SetLineColor(xColor);
	hX->SetMarkerStyle(xMarker);
	
	hY->SetMarkerColor(yColor);
	hY->SetLineColor(yColor);
	hY->SetMarkerStyle(yMarker);
	
	hX->DrawCopy(option);
	hY->DrawCopy(Form("same%s",option));
}
 DrawCorr.C:1
 DrawCorr.C:2
 DrawCorr.C:3
 DrawCorr.C:4
 DrawCorr.C:5
 DrawCorr.C:6
 DrawCorr.C:7
 DrawCorr.C:8
 DrawCorr.C:9
 DrawCorr.C:10
 DrawCorr.C:11
 DrawCorr.C:12
 DrawCorr.C:13
 DrawCorr.C:14
 DrawCorr.C:15
 DrawCorr.C:16
 DrawCorr.C:17
 DrawCorr.C:18
 DrawCorr.C:19
 DrawCorr.C:20
 DrawCorr.C:21
 DrawCorr.C:22
 DrawCorr.C:23
 DrawCorr.C:24
 DrawCorr.C:25
 DrawCorr.C:26
 DrawCorr.C:27
 DrawCorr.C:28
 DrawCorr.C:29
 DrawCorr.C:30
 DrawCorr.C:31
 DrawCorr.C:32
 DrawCorr.C:33
 DrawCorr.C:34
 DrawCorr.C:35
 DrawCorr.C:36
 DrawCorr.C:37
 DrawCorr.C:38
 DrawCorr.C:39
 DrawCorr.C:40
 DrawCorr.C:41
 DrawCorr.C:42
 DrawCorr.C:43
 DrawCorr.C:44
 DrawCorr.C:45
 DrawCorr.C:46
 DrawCorr.C:47
 DrawCorr.C:48
 DrawCorr.C:49
 DrawCorr.C:50
 DrawCorr.C:51
 DrawCorr.C:52
 DrawCorr.C:53
 DrawCorr.C:54
 DrawCorr.C:55
 DrawCorr.C:56
 DrawCorr.C:57
 DrawCorr.C:58
 DrawCorr.C:59
 DrawCorr.C:60
 DrawCorr.C:61
 DrawCorr.C:62
 DrawCorr.C:63
 DrawCorr.C:64
 DrawCorr.C:65
 DrawCorr.C:66
 DrawCorr.C:67
 DrawCorr.C:68
 DrawCorr.C:69
 DrawCorr.C:70
 DrawCorr.C:71
 DrawCorr.C:72
 DrawCorr.C:73
 DrawCorr.C:74
 DrawCorr.C:75
 DrawCorr.C:76
 DrawCorr.C:77
 DrawCorr.C:78
 DrawCorr.C:79
 DrawCorr.C:80
 DrawCorr.C:81
 DrawCorr.C:82
 DrawCorr.C:83
 DrawCorr.C:84
 DrawCorr.C:85
 DrawCorr.C:86
 DrawCorr.C:87
 DrawCorr.C:88
 DrawCorr.C:89
 DrawCorr.C:90
 DrawCorr.C:91
 DrawCorr.C:92
 DrawCorr.C:93
 DrawCorr.C:94
 DrawCorr.C:95
 DrawCorr.C:96
 DrawCorr.C:97
 DrawCorr.C:98
 DrawCorr.C:99
 DrawCorr.C:100
 DrawCorr.C:101
 DrawCorr.C:102
 DrawCorr.C:103
 DrawCorr.C:104
 DrawCorr.C:105
 DrawCorr.C:106
 DrawCorr.C:107
 DrawCorr.C:108
 DrawCorr.C:109
 DrawCorr.C:110
 DrawCorr.C:111
 DrawCorr.C:112
 DrawCorr.C:113
 DrawCorr.C:114
 DrawCorr.C:115
 DrawCorr.C:116
 DrawCorr.C:117
 DrawCorr.C:118
 DrawCorr.C:119
 DrawCorr.C:120
 DrawCorr.C:121
 DrawCorr.C:122
 DrawCorr.C:123
 DrawCorr.C:124
 DrawCorr.C:125
 DrawCorr.C:126
 DrawCorr.C:127
 DrawCorr.C:128
 DrawCorr.C:129
 DrawCorr.C:130
 DrawCorr.C:131
 DrawCorr.C:132
 DrawCorr.C:133
 DrawCorr.C:134
 DrawCorr.C:135
 DrawCorr.C:136
 DrawCorr.C:137
 DrawCorr.C:138
 DrawCorr.C:139
 DrawCorr.C:140
 DrawCorr.C:141
 DrawCorr.C:142
 DrawCorr.C:143
 DrawCorr.C:144
 DrawCorr.C:145
 DrawCorr.C:146
 DrawCorr.C:147