ROOT logo
// contact: Ilya Selyuzhenkov (ilya.selyuzhenkov@gmail.com)
//
// Macro to reproduce Fig. 2 of the directed flow paper http://arxiv.org/abs/1306.4145
//
#include "STAR_v1_PRL_v101_i25_e252301_y2008.C"

float myMarkerSize=1.8;
const int xRes=600, yRes=800;
int fillStyle = 1001;
float mainFont = 20;
const int nSystOpt = 4;
float rangeYa = 0.99e-3;
float rangeYb = 0.99e-3;
float scale62=0.12;
float scale200=0.37;
int SystlineWidth =6;

TGraphErrors *v1_odd_eta_syst_10_20;
TGraphErrors *v1_odd_eta_syst_30_40;
TGraphErrors *v1_odd_eta_stat_10_20;
TGraphErrors *v1_odd_eta_stat_30_40;

TGraphErrors *px_even_eta_syst_10_60;
TGraphErrors *px_even_eta_stat_10_60;
TGraphErrors *px_odd_eta_syst_10_60;
TGraphErrors *px_odd_eta_stat_10_60;

TGraphErrors *v1_even_eta_syst_10_60;
TGraphErrors *v1_even_eta_stat_10_60;
TGraphErrors *v1_odd_eta_syst_10_60;
TGraphErrors *v1_odd_eta_stat_10_60;

void Figure2(bool rWrite = false,TString dataFileName="ALICE_v1_arxiv_1306_4145.root")
{
  TGaxis::SetMaxDigits(3);
  myOptions();
  gROOT->ForceStyle();
  directedFlow_2008_STARdataEta(0.01*scale200, 0.01*scale62);
  
  float minPad[3]={0,0.36,0.665};
  TCanvas *myCan = new TCanvas("myCan","Figure 3",xRes,yRes);
  myCan->cd();
  TPad *myPad1 = new TPad("myPad1","myPad1",0.,minPad[2],1,1);
  myPadSetUp(myPad1,0.11, 0.09, 0.01, 0.00);
  TPad *myPad2 = new TPad("myPad2","myPad2",0.,minPad[1],1,minPad[2]);
  myPadSetUp(myPad2,0.11, 0.0, 0.01, 0.0);
  TPad *myPad3 = new TPad("myPad3","myPad3",0.,minPad[0],1,minPad[1]);
  myPadSetUp(myPad3,0.11, 0.00, 0.01, 0.16);
  myPad1->Draw();
  myPad2->Draw();
  myPad3->Draw();
  
  TH1F *myBlankHisto1 = new TH1F("myBlankHisto1","Blank Histogram",10,-0.85,0.85);
  myHistoSetUp(myBlankHisto1,"#eta","v_{1}",-rangeYb,rangeYb, 1, 2, 505, 305);
  TH1F *myBlankHisto2 = new TH1F("myBlankHisto2","Blank Histogram",10,-0.85,0.85);
  myHistoSetUp(myBlankHisto2,"#eta","#LTp_{x}#GT/#LTp_{T}#GT",-rangeYa,rangeYa, 1, 2, 505, 305);
  TH1F *myBlankHisto3 = new TH1F("myBlankHisto3","Blank Histogram",100,-0.85,0.85);
  myHistoSetUp(myBlankHisto3,"#eta","v_{1}",-rangeYb,rangeYb, 1, 2, 505, 305);
  
  // get graphs
  TFile *dataFile = TFile::Open(dataFileName,"READ");
  
  v1_odd_eta_stat_10_20 = (TGraphErrors*)dataFile->Get("v1_odd_eta_stat_10_20");
  v1_odd_eta_syst_10_20 = (TGraphErrors*)dataFile->Get("v1_odd_eta_syst_10_20");
  v1_odd_eta_stat_30_40 = (TGraphErrors*)dataFile->Get("v1_odd_eta_stat_30_40");
  v1_odd_eta_syst_30_40 = (TGraphErrors*)dataFile->Get("v1_odd_eta_syst_30_40");
  v1_odd_eta_stat_30_60 = (TGraphErrors*)dataFile->Get("v1_odd_eta_stat_30_60");
  v1_odd_eta_syst_30_60 = (TGraphErrors*)dataFile->Get("v1_odd_eta_syst_30_60");
  
  v1_even_eta_stat_10_20 = (TGraphErrors*)dataFile->Get("v1_even_eta_stat_10_20");
  v1_even_eta_syst_10_20 = (TGraphErrors*)dataFile->Get("v1_even_eta_syst_10_20");
  v1_even_eta_stat_30_40 = (TGraphErrors*)dataFile->Get("v1_even_eta_stat_30_40");
  v1_even_eta_syst_30_40 = (TGraphErrors*)dataFile->Get("v1_even_eta_syst_30_40");
  
  v1_odd_eta_stat_10_60 = (TGraphErrors*)dataFile->Get("v1_odd_eta_stat_10_60");
  v1_odd_eta_syst_10_60 = (TGraphErrors*)dataFile->Get("v1_odd_eta_syst_10_60");
  v1_even_eta_stat_10_60 = (TGraphErrors*)dataFile->Get("v1_even_eta_stat_10_60");
  v1_even_eta_syst_10_60 = (TGraphErrors*)dataFile->Get("v1_even_eta_syst_10_60");
  
  px_odd_eta_stat_10_60 = (TGraphErrors*)dataFile->Get("px_odd_eta_stat_10_60");
  px_odd_eta_syst_10_60 = (TGraphErrors*)dataFile->Get("px_odd_eta_syst_10_60");
  px_even_eta_stat_10_60 = (TGraphErrors*)dataFile->Get("px_even_eta_stat_10_60");
  px_even_eta_syst_10_60 = (TGraphErrors*)dataFile->Get("px_even_eta_syst_10_60");
  
  // setup graphs
  int colorStat = kBlue; int colorSyst = kBlue-10;
  
  myTGraphSetUp(v1_odd_eta_syst_30_40,kFullTriangleDown,colorSyst,0,1,colorSyst,SystlineWidth,fillStyle,colorSyst);
  myTGraphSetUp(v1_odd_eta_stat_30_40,kFullTriangleDown,colorStat,myMarkerSize,1,colorStat,2,fillStyle,colorStat);
  
  myTGraphSetUp(v1_even_eta_syst_30_40,kOpenTriangleDown,colorSyst,0,1,colorSyst,SystlineWidth,fillStyle,colorSyst);
  myTGraphSetUp(v1_even_eta_stat_30_40,kOpenTriangleDown,colorStat,myMarkerSize,1,colorStat,2,fillStyle,colorStat);
  
  myTGraphSetUp(px_even_eta_syst_10_60,kOpenSquare,colorSyst,0,1,colorSyst,SystlineWidth,1001,colorSyst);
  myTGraphSetUp(px_even_eta_stat_10_60,kOpenSquare,colorStat,myMarkerSize,1,colorStat,2,1001,colorStat);
  
  colorStat = kGreen+2; colorSyst = kGreen-8;
  
  myTGraphSetUp(v1_odd_eta_syst_10_20,kFullTriangleUp,colorSyst,0,1,colorSyst,SystlineWidth,fillStyle,colorSyst);
  myTGraphSetUp(v1_odd_eta_stat_10_20,kFullTriangleUp,colorStat,myMarkerSize,1,colorStat,2,fillStyle,colorStat);
  
  myTGraphSetUp(v1_even_eta_syst_10_20,kOpenTriangleUp,colorSyst,0,1,colorSyst,SystlineWidth,fillStyle,colorSyst);
  myTGraphSetUp(v1_even_eta_stat_10_20,kOpenTriangleUp,colorStat,myMarkerSize,1,colorStat,2,fillStyle,colorStat);
  
  colorStat = kMagenta+2; colorSyst = kMagenta-8;
  
  myTGraphSetUp(v1_even_eta_syst_10_60,kOpenDiamond,colorSyst,0,1,colorSyst,SystlineWidth,1001,colorSyst);
  myTGraphSetUp(v1_even_eta_stat_10_60,kOpenDiamond,colorStat,myMarkerSize*1.3,1,colorStat,2,1001,colorStat);
  
  myTGraphSetUp(px_odd_eta_syst_10_60,kFullSquare,colorSyst,0,1,colorSyst,SystlineWidth,1001,colorSyst);
  myTGraphSetUp(px_odd_eta_stat_10_60,kFullSquare,colorStat,myMarkerSize,1,colorStat,2,1001,colorStat);
  
  myTGraphSetUp(v1_odd_eta_syst_10_60,kFullDiamond,colorSyst,0,1,colorSyst,SystlineWidth,1001,colorSyst);
  myTGraphSetUp(v1_odd_eta_stat_10_60,kFullDiamond,colorStat,myMarkerSize*1.4,1,colorStat,2,1001,colorStat);
  
  myTGraphSetUp(v1_odd_eta_syst_30_60,kFullCircle,colorSyst,0,1,colorSyst,SystlineWidth,fillStyle,colorSyst);
  myTGraphSetUp(v1_odd_eta_stat_30_60,kFullCircle,colorStat,myMarkerSize,1,colorStat,2,fillStyle,colorStat);
  
  myTGraphSetUp(v1_star_AuAu200_30_60_eta,kOpenCross,kGreen+2,myMarkerSize,1,kGreen+2,2,fillStyle,kGreen+2);
  myTGraphSetUp(v1_star_AuAu62_30_60_eta,kOpenStar,kBlue+2,myMarkerSize*1.3,1,kBlue+2,2,fillStyle,kBlue+2);  
  
  TLatex *myText = new TLatex();
  myText->SetNDC();
  
  // fitting
  TF1*fit_px_odd_eta_stat_10_60 = new TF1("fit_v1eta_pTweight_odd_Stat_10_60", "[0]*x", -0.8,0.8);
  px_odd_eta_stat_10_60->Fit(fit_px_odd_eta_stat_10_60,"0","",-0.78,0.78);
  fit_px_odd_eta_stat_10_60 = (TF1*)px_odd_eta_stat_10_60->GetListOfFunctions()->At(0)->Clone();
  fit_px_odd_eta_stat_10_60->SetLineColor(px_odd_eta_stat_10_60->GetLineColor());
  fit_px_odd_eta_stat_10_60->SetLineStyle(1);
  fit_px_odd_eta_stat_10_60->SetLineWidth(2);
  
  TF1*fit_px_even_eta_stat_10_60 = new TF1("fit_v1eta_pTweight_even_Stat_10_60", "[0]", -0.8,0.8);
  px_even_eta_stat_10_60->Fit(fit_px_even_eta_stat_10_60,"0","",-0.78,0.78);
  fit_px_even_eta_stat_10_60 = (TF1*)px_even_eta_stat_10_60->GetListOfFunctions()->At(0)->Clone();
  fit_px_even_eta_stat_10_60->SetLineColor(px_even_eta_stat_10_60->GetLineColor());
  fit_px_even_eta_stat_10_60->SetLineStyle(2);
  fit_px_even_eta_stat_10_60->SetLineWidth(2);
  
  TF1*fit_v1_odd_eta_stat_10_60 = new TF1("fit_v1eta_odd_Stat_10_60", "[0]*x", -0.8,0.8);
  v1_odd_eta_stat_10_60->Fit(fit_v1_odd_eta_stat_10_60,"0","",-0.78,0.78);
  fit_v1_odd_eta_stat_10_60 = (TF1*)v1_odd_eta_stat_10_60->GetListOfFunctions()->At(0)->Clone();
  fit_v1_odd_eta_stat_10_60->SetLineColor(v1_odd_eta_stat_10_60->GetLineColor());
  fit_v1_odd_eta_stat_10_60->SetLineStyle(1);
  fit_v1_odd_eta_stat_10_60->SetLineWidth(2);
  
  TF1*fit_v1_even_eta_stat_10_60 = new TF1("fit_v1eta_even_Stat_10_60", "[0]", -0.8,0.8);
  v1_even_eta_stat_10_60->Fit(fit_v1_even_eta_stat_10_60,"0","",-0.78,0.78);
  fit_v1_even_eta_stat_10_60 = (TF1*)v1_even_eta_stat_10_60->GetListOfFunctions()->At(0)->Clone();
  fit_v1_even_eta_stat_10_60->SetLineColor(v1_even_eta_stat_10_60->GetLineColor());
  fit_v1_even_eta_stat_10_60->SetLineStyle(2);
  fit_v1_even_eta_stat_10_60->SetLineWidth(2);
  
  TF1*fit_v1_odd_eta_stat_30_60 = new TF1("fit_v1_odd_eta_stat_30_60", "[0]*x", -0.78,0.78);
  v1_odd_eta_stat_30_60->Fit(fit_v1_odd_eta_stat_30_60,"0","",-0.78,0.78);
  fit_v1_odd_eta_stat_30_60 = (TF1*)v1_odd_eta_stat_30_60->GetListOfFunctions()->At(0)->Clone();
  fit_v1_odd_eta_stat_30_60->SetLineColor(v1_odd_eta_stat_30_60->GetLineColor());
  fit_v1_odd_eta_stat_30_60->SetLineStyle(1);
  fit_v1_odd_eta_stat_30_60->SetLineWidth(2);
  
  // clone histos for legend drawing
  TGraphErrors *px_odd_eta_syst_10_60_clone=(TGraphErrors*)px_odd_eta_syst_10_60->Clone("px_odd_eta_syst_10_60_clone"); px_odd_eta_syst_10_60_clone->SetLineWidth(1);
  TGraphErrors *px_even_eta_syst_10_60_clone=(TGraphErrors*)px_even_eta_syst_10_60->Clone("px_even_eta_syst_10_60_clone"); px_even_eta_syst_10_60_clone->SetLineWidth(1);
  TGraphErrors *v1_odd_eta_syst_10_60_clone=(TGraphErrors*)v1_odd_eta_syst_10_60->Clone("v1_odd_eta_syst_10_60_clone"); v1_odd_eta_syst_10_60_clone->SetLineWidth(1);
  TGraphErrors *v1_odd_eta_syst_10_20_clone=(TGraphErrors*)v1_odd_eta_syst_10_20->Clone("v1_odd_eta_syst_10_20_clone"); v1_odd_eta_syst_10_20_clone->SetLineWidth(1);
  TGraphErrors *v1_odd_eta_syst_30_40_clone=(TGraphErrors*)v1_odd_eta_syst_30_40->Clone("v1_odd_eta_syst_30_40_clone"); v1_odd_eta_syst_30_40_clone->SetLineWidth(1);
  TGraphErrors *v1_even_eta_syst_10_60_clone=(TGraphErrors*)v1_even_eta_syst_10_60->Clone("v1_even_eta_syst_10_60_clone"); v1_even_eta_syst_10_60_clone->SetLineWidth(1);
  TGraphErrors *v1_even_eta_syst_10_20_clone=(TGraphErrors*)v1_even_eta_syst_10_20->Clone("v1_even_eta_syst_10_20_clone"); v1_even_eta_syst_10_20_clone->SetLineWidth(1);
  TGraphErrors *v1_even_eta_syst_30_40_clone=(TGraphErrors*)v1_even_eta_syst_30_40->Clone("v1_even_eta_syst_30_40_clone"); v1_even_eta_syst_30_40_clone->SetLineWidth(1);
  TGraphErrors *v1_odd_eta_syst_30_60_clone=(TGraphErrors*)v1_odd_eta_syst_30_60->Clone("v1_odd_eta_syst_30_60_clone"); v1_odd_eta_syst_30_60_clone->SetLineWidth(1);  
  
  // create and fill legends
  TLegend *myLegend1SysA = new TLegend(0.59,0.52,0.86,0.82);
  myLegendSetUp(myLegend1SysA,mainFont);
  myLegend1SysA->AddEntry(v1_odd_eta_syst_10_20_clone," ","F");
  myLegend1SysA->AddEntry(v1_odd_eta_syst_30_40_clone," ","F");
  myLegend1SysA->AddEntry(v1_odd_eta_syst_10_60_clone," ","F");
  
  TLegend *myLegend1a = new TLegend(0.59,0.52,0.86,0.82);
  myLegendSetUp(myLegend1a,mainFont);
  myLegend1a->AddEntry(v1_odd_eta_stat_10_20," ","P");
  myLegend1a->AddEntry(v1_odd_eta_stat_30_40," ","P");
  myLegend1a->AddEntry(v1_odd_eta_stat_10_60," ","P");
  
  TLegend *myLegend1Sys1C = new TLegend(0.59,0.52,0.86,0.82);
  myLegendSetUp(myLegend1Sys1C,mainFont);
  myLegend1Sys1C->AddEntry("NULL"," ","");
  myLegend1Sys1C->AddEntry("NULL"," ","");
  myLegend1Sys1C->AddEntry(fit_v1_odd_eta_stat_10_60," ","L");
  
  TLegend *myLegend1b = new TLegend(0.69,0.52,0.95,0.82);
  myLegendSetUp(myLegend1b,mainFont);
  myLegend1b->AddEntry(v1_even_eta_syst_10_20_clone," ","F");
  myLegend1b->AddEntry(v1_even_eta_syst_30_40_clone," ","F");
  myLegend1b->AddEntry(v1_even_eta_syst_10_60_clone," ","F");
  
  TLegend *myLegend1SysB = new TLegend(0.69,0.52,0.95,0.82);
  myLegendSetUp(myLegend1SysB,mainFont);
  myLegend1SysB->AddEntry(v1_even_eta_stat_10_20,"  10-20%","P");
  myLegend1SysB->AddEntry(v1_even_eta_stat_30_40,"  30-40%","P");
  myLegend1SysB->AddEntry(v1_even_eta_stat_10_60,"  10-60% with fit","P");
  
  TLegend *myLegend1SysC = new TLegend(0.69,0.52,0.95,0.82);
  myLegendSetUp(myLegend1SysC,mainFont);
  myLegend1SysC->AddEntry("NULL"," ","");
  myLegend1SysC->AddEntry("NULL"," ","");
  myLegend1SysC->AddEntry(fit_v1_even_eta_stat_10_60," ","L");
  
  TLegend *myLegend1SysA2 = new TLegend(0.55,0.73,0.82,0.85);
  myLegendSetUp(myLegend1SysA2,mainFont);
  myLegend1SysA2->AddEntry(px_odd_eta_syst_10_60_clone," ","F");
  
  TLegend *myLegend1a2 = new TLegend(0.55,0.73,0.82,0.85);
  myLegendSetUp(myLegend1a2,mainFont);
  myLegend1a2->AddEntry(px_odd_eta_stat_10_60," ","P");
  
  TLegend *myLegend1c2 = new TLegend(0.55,0.73,0.82,0.85);
  myLegendSetUp(myLegend1c2,mainFont);
  myLegend1c2->AddEntry(fit_v1_odd_eta_stat_10_60," ","L");
  
  TLegend *myLegend1b2 = new TLegend(0.64,0.73,0.91,0.85);
  myLegendSetUp(myLegend1b2,mainFont);
  myLegend1b2->AddEntry(px_even_eta_syst_10_60_clone," ","F");
  
  TLegend *myLegend1SysB2 = new TLegend(0.64,0.73,0.91,0.85);
  myLegendSetUp(myLegend1SysB2,mainFont);
  myLegend1SysB2->AddEntry(px_even_eta_stat_10_60,"   10-60% with fit","P");
  
  TLegend *myLegend1SysC2 = new TLegend(0.64,0.73,0.91,0.85);
  myLegendSetUp(myLegend1SysC2,mainFont);
  myLegend1SysC2->AddEntry(fit_px_even_eta_stat_10_60," ","L");
  
  TLegend *myLegend1SysA3 = new TLegend(0.65,0.73,0.91,0.85);
  myLegendSetUp(myLegend1SysA3,mainFont);
  myLegend1SysA3->AddEntry(v1_odd_eta_syst_30_60_clone," ","F");
  
  TLegend *myLegend1a3 = new TLegend(0.65,0.73,0.91,0.85);
  myLegendSetUp(myLegend1a3,mainFont);
  myLegend1a3->AddEntry(v1_odd_eta_stat_30_60," ","P");
  
  TLegend *myLegend1c3 = new TLegend(0.65,0.73,0.91,0.85);
  myLegendSetUp(myLegend1c3,mainFont);
  myLegend1c3->AddEntry(fit_v1_odd_eta_stat_30_60," 30-60% with fit","L");
  
  TLegend *myLegend1Sys = new TLegend(0.78,0.5,1.06,0.8);
  myLegendSetUp(myLegend1Sys,mainFont);
  myLegend1Sys->AddEntry(v1_odd_eta_syst_10_20_clone," ","F");
  myLegend1Sys->AddEntry(v1_odd_eta_syst_30_40_clone," ","F");
  myLegend1Sys->AddEntry(v1_odd_eta_syst_30_60_clone," ","F");
  
  TLegend *myLegend1 = new TLegend(0.78,0.5,1.06,0.8);
  myLegendSetUp(myLegend1,mainFont);
  myLegend1->AddEntry(v1_odd_eta_stat_10_20,"  10-20%","P");
  myLegend1->AddEntry(v1_odd_eta_stat_30_40,"  30-40%","P");
  myLegend1->AddEntry(v1_odd_eta_stat_30_60,"  30-60%","P");
  
  TLegend *myLegend3 = new TLegend(0.135,0.3,0.43,0.5);
  myLegendSetUp(myLegend3,0.95*mainFont);
  myLegend3->AddEntry(v1_star_AuAu200_30_60_eta,"   #times 0.37  200GeV","P");
  myLegend3->AddEntry(v1_star_AuAu62_30_60_eta,"   #times 0.12  62.4GeV","P");
  
  // shift points along x-axis for visibility
  float shift =0.01;
  
  ShiftAlongXaxis(v1_odd_eta_stat_10_20, 4*shift);
  ShiftAlongXaxis(v1_odd_eta_syst_10_20, 4*shift);
  ShiftAlongXaxis(v1_odd_eta_stat_30_40, -4*shift);
  ShiftAlongXaxis(v1_odd_eta_syst_30_40, -4*shift);
  
  ShiftAlongXaxis(v1_even_eta_stat_10_20, 4*shift);
  ShiftAlongXaxis(v1_even_eta_syst_10_20, 4*shift);
  ShiftAlongXaxis(v1_even_eta_stat_30_40, -4*shift);
  ShiftAlongXaxis(v1_even_eta_syst_30_40, -4*shift);  
  
  //pad1
  myPad1->cd();
  myBlankHisto1->Draw();
  myText->SetTextSize(1.5*mainFont);
  myText->DrawLatex(0.93,0.81,"(a)");
  myText->SetTextSize(mainFont);
  myText->DrawLatex(0.6,0.84,"odd    even     v_{1}");
  
  myLegend1SysA->Draw();
  myLegend1a->Draw();
  myLegend1Sys1C->Draw();
  myLegend1b->Draw();
  myLegend1SysB->Draw();
  myLegend1SysC->Draw();
  
  fit_v1_odd_eta_stat_10_60->Draw("same");
  fit_v1_even_eta_stat_10_60->Draw("same");  
  v1_odd_eta_syst_10_20->Draw("eZ");
  v1_odd_eta_syst_30_40->Draw("eZ");
  v1_odd_eta_syst_10_60->Draw("eZ");
  v1_even_eta_syst_10_20->Draw("eZ");
  v1_even_eta_syst_30_40->Draw("eZ");
  v1_even_eta_syst_10_60->Draw("eZ");
  v1_odd_eta_stat_10_20->Draw("P,eZ");
  v1_odd_eta_stat_30_40->Draw("P,eZ");
  v1_odd_eta_stat_10_60->Draw("P,eZ");
  v1_even_eta_stat_10_20->Draw("P,eZ");
  v1_even_eta_stat_30_40->Draw("P,eZ");
  v1_even_eta_stat_10_60->Draw("P,eZ");
  
  //pad2
  myPad2->cd();
  myBlankHisto2->Draw();
  myText->SetTextSize(1.5*mainFont);
  myText->DrawLatex(0.93,0.88,"(b)");
  myText->SetTextSize(mainFont);
  myText->DrawLatex(0.15,0.1,"ALICE Pb-Pb@2.76TeV  p_{T}>0.15 GeV/c");
  myText->SetTextSize(mainFont);
  myText->DrawLatex(0.555,0.89,"odd    even   #LTp_{x}#GT/#LTp_{T}#GT");
  
  myLegend1SysA2->Draw();
  myLegend1a2->Draw();
  myLegend1b2->Draw();
  myLegend1SysB2->Draw();
  myLegend1SysC2->Draw();
  myLegend1c2->Draw();
  
  fit_px_odd_eta_stat_10_60->Draw("same");
  fit_px_even_eta_stat_10_60->Draw("same");  
  px_even_eta_syst_10_60->Draw("eZ");
  px_even_eta_stat_10_60->Draw("P,eZ");
  px_odd_eta_syst_10_60->Draw("eZ");
  px_odd_eta_stat_10_60->Draw("P,eZ");
  
  //pad3
  myPad3->cd();
  myBlankHisto3->Draw();
  myText->SetTextSize(1.5*mainFont);
  myText->DrawLatex(0.93,0.9,"(c)");  
  myText->SetTextSize(mainFont);
  myText->DrawLatex(0.655,0.89,"odd   v_{1}");
  myText->SetTextSize(0.95*mainFont);
  myText->DrawLatex(0.13,0.51,"STAR  (scaled)");
  myText->SetTextSize(0.95*mainFont);
  myText->DrawLatex(0.15,0.23,"Au-Au 30-60% p_{T}>0.15 GeV/c");
  
  myLegend1SysA3->Draw();
  myLegend1a3->Draw();
  myLegend1c3->Draw();
  myLegend3->Draw();
  
  ShiftAlongXaxis(v1_star_AuAu200_30_60_eta, 2*shift);
  ShiftAlongXaxis(v1_star_AuAu62_30_60_eta, -2*shift);
  
  fit_v1_odd_eta_stat_30_60->Draw("same");  
  v1_star_AuAu62_30_60_eta->Draw("P,eZ");
  v1_star_AuAu200_30_60_eta->Draw("P,eZ");
  v1_odd_eta_syst_30_60->Draw("eZ");
  v1_odd_eta_stat_30_60->Draw("P,eZ");
  
  // save output if option rWrite=true
  TString fileName="Figure2";
  myCan->Update();
  if (rWrite)  
  {
    myCan->SaveAs(fileName+".png");
    myCan->SaveAs(fileName+".eps");
    myCan->SaveAs(fileName+".pdf");
  }
}

// only helper functions below

void myLegendSetUp(TLegend *currentLegend=0,float currentTextSize=0.07){
  currentLegend->SetBorderSize(0);
  currentLegend->SetFillStyle(0);
  currentLegend->SetFillColor(0);
  currentLegend->SetMargin(0.25);
  currentLegend->SetTextSize(currentTextSize);
  currentLegend->SetEntrySeparation(0.5);
  return;
}

void myPadSetUp(TPad *currentPad, float currentLeft=0.11, float currentTop=0.04, float currentRight=0.04, float currentBottom=0.15){
  currentPad->SetLeftMargin(currentLeft);
  currentPad->SetTopMargin(currentTop);
  currentPad->SetRightMargin(currentRight);
  currentPad->SetBottomMargin(currentBottom);
  return;
}

void myGraphSetUp(TGraphErrors *currentGraph=0, Float_t currentMarkerSize = 1.0,
		  int currentMarkerStyle=20, int currentMarkerColor=0,
		  int currentLineStyle=1, int currentLineColor=0)
{
  currentGraph->SetMarkerSize(currentMarkerSize);
  currentGraph->SetMarkerStyle(currentMarkerStyle);
  currentGraph->SetMarkerColor(currentMarkerColor);
  currentGraph->SetLineStyle(currentLineStyle);
  currentGraph->SetLineColor(currentLineColor);
  return;
}

void myOptions(Int_t lStat=0){
  int font = 43;
  gStyle->SetFrameBorderMode(0);
  gStyle->SetFrameFillColor(0);
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetPadBorderMode(0);
  gStyle->SetPadColor(10);
  gStyle->SetCanvasColor(10);
  gStyle->SetTitleFillColor(10);
  gStyle->SetTitleBorderSize(1);
  gStyle->SetStatColor(10);
  gStyle->SetStatBorderSize(1);
  gStyle->SetLegendBorderSize(1);
  //
  gStyle->SetDrawBorder(0);
  gStyle->SetTextFont(font);
  gStyle->SetStatFont(font);
  gStyle->SetLegendFont(font);
  gStyle->SetStatFontSize(20);
  gStyle->SetStatX(0.97);
  gStyle->SetStatY(0.98);
  gStyle->SetStatH(0.03);
  gStyle->SetStatW(0.3);
  gStyle->SetTickLength(0.02,"y");
  gStyle->SetEndErrorSize(3);
  gStyle->SetLabelSize(20,"xyz");
  gStyle->SetLabelFont(font,"xyz"); 
  gStyle->SetLabelOffset(0.01,"xyz");
  gStyle->SetTitleFont(font,"xyz");
  gStyle->SetTitleOffset(1.7,"y");  
  gStyle->SetTitleOffset(2,"xz");  
  gStyle->SetTitleSize(24,"x");  
  gStyle->SetTitleSize(24,"y");  
  gStyle->SetMarkerSize(1); 
  gStyle->SetPalette(1,0); 
  
  if (lStat){
    gStyle->SetOptTitle(1);
    gStyle->SetOptStat(1111);
    gStyle->SetOptFit(1111);
  }
  else {
    gStyle->SetOptTitle(0);
    gStyle->SetOptStat(0);
    gStyle->SetOptFit(0);
  }
}

TGraphErrors* makeGraphH1(TH1* hist, TString name="")
{
  name.ReplaceAll(" ","");
  Int_t nbins = hist->GetNbinsX();
  Double_t* x = new Double_t[nbins];
  Double_t* y = new Double_t[nbins];
  Double_t* xerr = new Double_t[nbins]; 
  Double_t* yerr = new Double_t[nbins];
  Int_t n=0;
  for (Int_t i=0; i<nbins; i++)
  {
    x[n] = hist->GetXaxis()->GetBinCenter(i+1);
    y[n] = hist->GetBinContent(i+1);
    xerr[n] = 0.0;
    yerr[n] = hist->GetBinError(i+1);
    n++;
  }
  TGraphErrors* gr = new TGraphErrors(n,x,y,xerr,yerr);
  delete [] x;
  delete [] y;
  delete [] xerr;
  delete [] yerr;
  return gr;
}

TGraphErrors* makeGraphPr(TProfile* hist, TString name="")
{
  name.ReplaceAll(" ","");
  TString title = name;
  title.ReplaceAll("_"," ");
  Int_t nbins = hist->GetNbinsX();
  Double_t* x = new Double_t[nbins];
  Double_t* y = new Double_t[nbins];
  Double_t* xerr = new Double_t[nbins]; 
  Double_t* yerr = new Double_t[nbins];
  Int_t n=0;
  for (Int_t i=0; i<nbins; i++)
  {
    x[n] = hist->GetXaxis()->GetBinCenter(i+1);
    y[n] = hist->GetBinContent(i+1);
    xerr[n] = 0.0;
    yerr[n] = hist->GetBinError(i+1);
    n++;
  }
  TGraphErrors* gr = new TGraphErrors(n,x,y,xerr,yerr);
  gr->SetName(name);
  gr->SetTitle(title);
  delete [] x;
  delete [] y;
  delete [] xerr;
  delete [] yerr;
  return gr;
}

void myHistoSetUp
(
  TH1F *hist=0, TString xTitle="xTitle", TString yTitle="yTitle", float minY=-1, float maxY=1, int lineColor=1, int lineStyle=2,
 int nDivisionsX=305,int nDivisionsY=305
)
{
  hist->GetXaxis()->SetTitle(xTitle);
  hist->GetYaxis()->SetTitle(yTitle);
  hist->SetMinimum(minY);
  hist->SetMaximum(maxY);
  hist->SetLineColor(lineColor);
  hist->SetLineStyle(lineStyle);
  hist->SetNdivisions(nDivisionsX,"x");
  hist->SetNdivisions(nDivisionsY,"y");
  return;
}

void ShiftAlongXaxis(TGraphErrors *ge, Double_t shift)
{
  if(!ge)
  {
    printf("\n WARNING: ge is NULL in ShiftAlongXaxis() !!!! \n\n");
    return;
  }
  Int_t nPoints = ge->GetN();
  Double_t x = 0.;
  Double_t y = 0.;
  for(Int_t p=0;p<nPoints;p++)
  {
    ge->GetPoint(p,x,y);
    x+=shift;
    ge->SetPoint(p,x,y);
  }
}

void ScaleXaxis(TGraphErrors *ge, Double_t scale)
{
  if(!ge)
  {
    printf("\n WARNING: ge is NULL in ShiftAlongXaxis() !!!! \n\n");
    return;
  }
  Int_t nPoints = ge->GetN();
  Double_t x = 0.;
  Double_t y = 0.;
  for(Int_t p=0;p<nPoints;p++)
  {
    ge->GetPoint(p,x,y);
    x*=scale;
    ge->SetPoint(p,x,y);
  }
}


void myTGraphSetUp
(
  TGraphErrors *currentGraph=0,
 int myMarkerStyle=8,
 int myMarkerColor=1,
 float myMarkerSize=1,
 int myLineStyle=1,
 int myLineColor=1,
 float myLineWidth=1,
 int myFillStyle =fillStyle,
 int myFillColor =1 
)
{
  currentGraph->SetMarkerStyle(myMarkerStyle);
  currentGraph->SetMarkerColor(myMarkerColor);
  currentGraph->SetMarkerSize(myMarkerSize);
  currentGraph->SetLineColor(myLineColor);
  currentGraph->SetLineStyle(myLineStyle);
  currentGraph->SetLineWidth(myLineWidth);
  currentGraph->SetFillStyle(myFillStyle);
  currentGraph->SetFillColor(myFillColor);
}
 Figure2.C:1
 Figure2.C:2
 Figure2.C:3
 Figure2.C:4
 Figure2.C:5
 Figure2.C:6
 Figure2.C:7
 Figure2.C:8
 Figure2.C:9
 Figure2.C:10
 Figure2.C:11
 Figure2.C:12
 Figure2.C:13
 Figure2.C:14
 Figure2.C:15
 Figure2.C:16
 Figure2.C:17
 Figure2.C:18
 Figure2.C:19
 Figure2.C:20
 Figure2.C:21
 Figure2.C:22
 Figure2.C:23
 Figure2.C:24
 Figure2.C:25
 Figure2.C:26
 Figure2.C:27
 Figure2.C:28
 Figure2.C:29
 Figure2.C:30
 Figure2.C:31
 Figure2.C:32
 Figure2.C:33
 Figure2.C:34
 Figure2.C:35
 Figure2.C:36
 Figure2.C:37
 Figure2.C:38
 Figure2.C:39
 Figure2.C:40
 Figure2.C:41
 Figure2.C:42
 Figure2.C:43
 Figure2.C:44
 Figure2.C:45
 Figure2.C:46
 Figure2.C:47
 Figure2.C:48
 Figure2.C:49
 Figure2.C:50
 Figure2.C:51
 Figure2.C:52
 Figure2.C:53
 Figure2.C:54
 Figure2.C:55
 Figure2.C:56
 Figure2.C:57
 Figure2.C:58
 Figure2.C:59
 Figure2.C:60
 Figure2.C:61
 Figure2.C:62
 Figure2.C:63
 Figure2.C:64
 Figure2.C:65
 Figure2.C:66
 Figure2.C:67
 Figure2.C:68
 Figure2.C:69
 Figure2.C:70
 Figure2.C:71
 Figure2.C:72
 Figure2.C:73
 Figure2.C:74
 Figure2.C:75
 Figure2.C:76
 Figure2.C:77
 Figure2.C:78
 Figure2.C:79
 Figure2.C:80
 Figure2.C:81
 Figure2.C:82
 Figure2.C:83
 Figure2.C:84
 Figure2.C:85
 Figure2.C:86
 Figure2.C:87
 Figure2.C:88
 Figure2.C:89
 Figure2.C:90
 Figure2.C:91
 Figure2.C:92
 Figure2.C:93
 Figure2.C:94
 Figure2.C:95
 Figure2.C:96
 Figure2.C:97
 Figure2.C:98
 Figure2.C:99
 Figure2.C:100
 Figure2.C:101
 Figure2.C:102
 Figure2.C:103
 Figure2.C:104
 Figure2.C:105
 Figure2.C:106
 Figure2.C:107
 Figure2.C:108
 Figure2.C:109
 Figure2.C:110
 Figure2.C:111
 Figure2.C:112
 Figure2.C:113
 Figure2.C:114
 Figure2.C:115
 Figure2.C:116
 Figure2.C:117
 Figure2.C:118
 Figure2.C:119
 Figure2.C:120
 Figure2.C:121
 Figure2.C:122
 Figure2.C:123
 Figure2.C:124
 Figure2.C:125
 Figure2.C:126
 Figure2.C:127
 Figure2.C:128
 Figure2.C:129
 Figure2.C:130
 Figure2.C:131
 Figure2.C:132
 Figure2.C:133
 Figure2.C:134
 Figure2.C:135
 Figure2.C:136
 Figure2.C:137
 Figure2.C:138
 Figure2.C:139
 Figure2.C:140
 Figure2.C:141
 Figure2.C:142
 Figure2.C:143
 Figure2.C:144
 Figure2.C:145
 Figure2.C:146
 Figure2.C:147
 Figure2.C:148
 Figure2.C:149
 Figure2.C:150
 Figure2.C:151
 Figure2.C:152
 Figure2.C:153
 Figure2.C:154
 Figure2.C:155
 Figure2.C:156
 Figure2.C:157
 Figure2.C:158
 Figure2.C:159
 Figure2.C:160
 Figure2.C:161
 Figure2.C:162
 Figure2.C:163
 Figure2.C:164
 Figure2.C:165
 Figure2.C:166
 Figure2.C:167
 Figure2.C:168
 Figure2.C:169
 Figure2.C:170
 Figure2.C:171
 Figure2.C:172
 Figure2.C:173
 Figure2.C:174
 Figure2.C:175
 Figure2.C:176
 Figure2.C:177
 Figure2.C:178
 Figure2.C:179
 Figure2.C:180
 Figure2.C:181
 Figure2.C:182
 Figure2.C:183
 Figure2.C:184
 Figure2.C:185
 Figure2.C:186
 Figure2.C:187
 Figure2.C:188
 Figure2.C:189
 Figure2.C:190
 Figure2.C:191
 Figure2.C:192
 Figure2.C:193
 Figure2.C:194
 Figure2.C:195
 Figure2.C:196
 Figure2.C:197
 Figure2.C:198
 Figure2.C:199
 Figure2.C:200
 Figure2.C:201
 Figure2.C:202
 Figure2.C:203
 Figure2.C:204
 Figure2.C:205
 Figure2.C:206
 Figure2.C:207
 Figure2.C:208
 Figure2.C:209
 Figure2.C:210
 Figure2.C:211
 Figure2.C:212
 Figure2.C:213
 Figure2.C:214
 Figure2.C:215
 Figure2.C:216
 Figure2.C:217
 Figure2.C:218
 Figure2.C:219
 Figure2.C:220
 Figure2.C:221
 Figure2.C:222
 Figure2.C:223
 Figure2.C:224
 Figure2.C:225
 Figure2.C:226
 Figure2.C:227
 Figure2.C:228
 Figure2.C:229
 Figure2.C:230
 Figure2.C:231
 Figure2.C:232
 Figure2.C:233
 Figure2.C:234
 Figure2.C:235
 Figure2.C:236
 Figure2.C:237
 Figure2.C:238
 Figure2.C:239
 Figure2.C:240
 Figure2.C:241
 Figure2.C:242
 Figure2.C:243
 Figure2.C:244
 Figure2.C:245
 Figure2.C:246
 Figure2.C:247
 Figure2.C:248
 Figure2.C:249
 Figure2.C:250
 Figure2.C:251
 Figure2.C:252
 Figure2.C:253
 Figure2.C:254
 Figure2.C:255
 Figure2.C:256
 Figure2.C:257
 Figure2.C:258
 Figure2.C:259
 Figure2.C:260
 Figure2.C:261
 Figure2.C:262
 Figure2.C:263
 Figure2.C:264
 Figure2.C:265
 Figure2.C:266
 Figure2.C:267
 Figure2.C:268
 Figure2.C:269
 Figure2.C:270
 Figure2.C:271
 Figure2.C:272
 Figure2.C:273
 Figure2.C:274
 Figure2.C:275
 Figure2.C:276
 Figure2.C:277
 Figure2.C:278
 Figure2.C:279
 Figure2.C:280
 Figure2.C:281
 Figure2.C:282
 Figure2.C:283
 Figure2.C:284
 Figure2.C:285
 Figure2.C:286
 Figure2.C:287
 Figure2.C:288
 Figure2.C:289
 Figure2.C:290
 Figure2.C:291
 Figure2.C:292
 Figure2.C:293
 Figure2.C:294
 Figure2.C:295
 Figure2.C:296
 Figure2.C:297
 Figure2.C:298
 Figure2.C:299
 Figure2.C:300
 Figure2.C:301
 Figure2.C:302
 Figure2.C:303
 Figure2.C:304
 Figure2.C:305
 Figure2.C:306
 Figure2.C:307
 Figure2.C:308
 Figure2.C:309
 Figure2.C:310
 Figure2.C:311
 Figure2.C:312
 Figure2.C:313
 Figure2.C:314
 Figure2.C:315
 Figure2.C:316
 Figure2.C:317
 Figure2.C:318
 Figure2.C:319
 Figure2.C:320
 Figure2.C:321
 Figure2.C:322
 Figure2.C:323
 Figure2.C:324
 Figure2.C:325
 Figure2.C:326
 Figure2.C:327
 Figure2.C:328
 Figure2.C:329
 Figure2.C:330
 Figure2.C:331
 Figure2.C:332
 Figure2.C:333
 Figure2.C:334
 Figure2.C:335
 Figure2.C:336
 Figure2.C:337
 Figure2.C:338
 Figure2.C:339
 Figure2.C:340
 Figure2.C:341
 Figure2.C:342
 Figure2.C:343
 Figure2.C:344
 Figure2.C:345
 Figure2.C:346
 Figure2.C:347
 Figure2.C:348
 Figure2.C:349
 Figure2.C:350
 Figure2.C:351
 Figure2.C:352
 Figure2.C:353
 Figure2.C:354
 Figure2.C:355
 Figure2.C:356
 Figure2.C:357
 Figure2.C:358
 Figure2.C:359
 Figure2.C:360
 Figure2.C:361
 Figure2.C:362
 Figure2.C:363
 Figure2.C:364
 Figure2.C:365
 Figure2.C:366
 Figure2.C:367
 Figure2.C:368
 Figure2.C:369
 Figure2.C:370
 Figure2.C:371
 Figure2.C:372
 Figure2.C:373
 Figure2.C:374
 Figure2.C:375
 Figure2.C:376
 Figure2.C:377
 Figure2.C:378
 Figure2.C:379
 Figure2.C:380
 Figure2.C:381
 Figure2.C:382
 Figure2.C:383
 Figure2.C:384
 Figure2.C:385
 Figure2.C:386
 Figure2.C:387
 Figure2.C:388
 Figure2.C:389
 Figure2.C:390
 Figure2.C:391
 Figure2.C:392
 Figure2.C:393
 Figure2.C:394
 Figure2.C:395
 Figure2.C:396
 Figure2.C:397
 Figure2.C:398
 Figure2.C:399
 Figure2.C:400
 Figure2.C:401
 Figure2.C:402
 Figure2.C:403
 Figure2.C:404
 Figure2.C:405
 Figure2.C:406
 Figure2.C:407
 Figure2.C:408
 Figure2.C:409
 Figure2.C:410
 Figure2.C:411
 Figure2.C:412
 Figure2.C:413
 Figure2.C:414
 Figure2.C:415
 Figure2.C:416
 Figure2.C:417
 Figure2.C:418
 Figure2.C:419
 Figure2.C:420
 Figure2.C:421
 Figure2.C:422
 Figure2.C:423
 Figure2.C:424
 Figure2.C:425
 Figure2.C:426
 Figure2.C:427
 Figure2.C:428
 Figure2.C:429
 Figure2.C:430
 Figure2.C:431
 Figure2.C:432
 Figure2.C:433
 Figure2.C:434
 Figure2.C:435
 Figure2.C:436
 Figure2.C:437
 Figure2.C:438
 Figure2.C:439
 Figure2.C:440
 Figure2.C:441
 Figure2.C:442
 Figure2.C:443
 Figure2.C:444
 Figure2.C:445
 Figure2.C:446
 Figure2.C:447
 Figure2.C:448
 Figure2.C:449
 Figure2.C:450
 Figure2.C:451
 Figure2.C:452
 Figure2.C:453
 Figure2.C:454
 Figure2.C:455
 Figure2.C:456
 Figure2.C:457
 Figure2.C:458
 Figure2.C:459
 Figure2.C:460
 Figure2.C:461
 Figure2.C:462
 Figure2.C:463
 Figure2.C:464
 Figure2.C:465
 Figure2.C:466
 Figure2.C:467
 Figure2.C:468
 Figure2.C:469
 Figure2.C:470
 Figure2.C:471
 Figure2.C:472
 Figure2.C:473
 Figure2.C:474
 Figure2.C:475
 Figure2.C:476
 Figure2.C:477
 Figure2.C:478
 Figure2.C:479
 Figure2.C:480
 Figure2.C:481
 Figure2.C:482
 Figure2.C:483
 Figure2.C:484
 Figure2.C:485
 Figure2.C:486
 Figure2.C:487
 Figure2.C:488
 Figure2.C:489
 Figure2.C:490
 Figure2.C:491
 Figure2.C:492
 Figure2.C:493
 Figure2.C:494
 Figure2.C:495
 Figure2.C:496
 Figure2.C:497
 Figure2.C:498
 Figure2.C:499
 Figure2.C:500
 Figure2.C:501
 Figure2.C:502
 Figure2.C:503
 Figure2.C:504
 Figure2.C:505
 Figure2.C:506
 Figure2.C:507
 Figure2.C:508
 Figure2.C:509
 Figure2.C:510
 Figure2.C:511
 Figure2.C:512
 Figure2.C:513
 Figure2.C:514
 Figure2.C:515
 Figure2.C:516
 Figure2.C:517
 Figure2.C:518
 Figure2.C:519
 Figure2.C:520
 Figure2.C:521
 Figure2.C:522
 Figure2.C:523
 Figure2.C:524
 Figure2.C:525
 Figure2.C:526
 Figure2.C:527
 Figure2.C:528
 Figure2.C:529
 Figure2.C:530
 Figure2.C:531
 Figure2.C:532
 Figure2.C:533
 Figure2.C:534
 Figure2.C:535
 Figure2.C:536
 Figure2.C:537
 Figure2.C:538
 Figure2.C:539
 Figure2.C:540
 Figure2.C:541
 Figure2.C:542
 Figure2.C:543
 Figure2.C:544
 Figure2.C:545
 Figure2.C:546
 Figure2.C:547
 Figure2.C:548
 Figure2.C:549
 Figure2.C:550
 Figure2.C:551
 Figure2.C:552
 Figure2.C:553
 Figure2.C:554
 Figure2.C:555
 Figure2.C:556
 Figure2.C:557
 Figure2.C:558
 Figure2.C:559
 Figure2.C:560
 Figure2.C:561
 Figure2.C:562
 Figure2.C:563
 Figure2.C:564
 Figure2.C:565
 Figure2.C:566
 Figure2.C:567
 Figure2.C:568
 Figure2.C:569
 Figure2.C:570
 Figure2.C:571
 Figure2.C:572
 Figure2.C:573
 Figure2.C:574
 Figure2.C:575
 Figure2.C:576