ROOT logo
/* $Id$ */

#if !defined(__CINT__) || defined(__MAKECINT__)

#include "AliPWG0Helper.h"
#include "dNdEtaAnalysis.h"
#include "AlidNdEtaCorrection.h"

#include <TCanvas.h>
#include <TFile.h>
#include <TH1.h>
#include <TH2F.h>
#include <TH3F.h>
#include <TLine.h>
#include <TSystem.h>

#endif

Int_t gMax = 5;

extern TSystem* gSystem;

void loadlibs()
{
  gSystem->Load("libVMC");
  gSystem->Load("libTree");
  gSystem->Load("libSTEERBase");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libPWG0base");
}

void SetRanges(TAxis* axis)
{
  if (strcmp(axis->GetTitle(), "#eta") == 0)
    axis->SetRangeUser(-1.4999, 1.4999);
  if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0 || strcmp(axis->GetTitle(), "p_{T} (GeV/c)") == 0)
  {
    axis->SetRangeUser(0, 4.9999);
    axis->SetTitle("p_{T} (GeV/c)");
  }
  if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0 || strcmp(axis->GetTitle(), "vtx z (cm)") == 0 || strcmp(axis->GetTitle(), "vtx-z [cm]") == 0 || strcmp(axis->GetTitle(), "vtx-z (cm)") == 0)
  {
    axis->SetRangeUser(-15, 14.9999);
    axis->SetTitle("vtx-z (cm)");
  }
  if (strcmp(axis->GetTitle(), "Ntracks") == 0)
    axis->SetRangeUser(0, 99.9999);
}

void SetRanges(TH1* hist)
{
  SetRanges(hist->GetXaxis());
  SetRanges(hist->GetYaxis());
  SetRanges(hist->GetZaxis());
}


void Prepare3DPlot(TH3* hist)
{
  hist->GetXaxis()->SetTitleOffset(1.5);
  hist->GetYaxis()->SetTitleOffset(1.5);
  hist->GetZaxis()->SetTitleOffset(1.5);

  hist->SetStats(kFALSE);
}

void Prepare2DPlot(TH2* hist)
{
  hist->SetStats(kFALSE);
  hist->GetYaxis()->SetTitleOffset(1.4);

  hist->SetMinimum(0);
  hist->SetMaximum(gMax);

  SetRanges(hist);
}

void Prepare1DPlot(TH1* hist)
{
  hist->SetLineWidth(2);
  hist->SetStats(kFALSE);

  hist->GetXaxis()->SetLabelOffset(0.02);
  hist->GetXaxis()->SetTitleOffset(1.3);
  hist->GetYaxis()->SetTitleOffset(1.3);

  SetRanges(hist);
}

void InitPad()
{
  gPad->Range(0, 0, 1, 1);
  gPad->SetLeftMargin(0.15);
  //gPad->SetRightMargin(0.05);
  //gPad->SetTopMargin(0.13);
  gPad->SetBottomMargin(0.12);

  gPad->SetGridx();
  gPad->SetGridy();
}

void InitPadCOLZ()
{
  gPad->Range(0, 0, 1, 1);
  gPad->SetRightMargin(0.15);
  gPad->SetLeftMargin(0.12);
  gPad->SetTopMargin(0.05);

  gPad->SetGridx();
  gPad->SetGridy();
}

// --- end of helpers --- begin functions ---

void DrawOverview(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction")
{
  loadlibs();
  if (!TFile::Open(fileName))
    return;

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dirName, dirName);
  if (!dNdEtaCorrection->LoadHistograms())
    return;

  dNdEtaCorrection->Finish();

  dNdEtaCorrection->DrawOverview();
}

void PrintInfo(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction")
{
  loadlibs();
  if (!TFile::Open(fileName))
    return;

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dirName, dirName);
  if (!dNdEtaCorrection->LoadHistograms())
    return;

  dNdEtaCorrection->Finish();

  for (Int_t i=AlidNdEtaCorrection::kTrack2Particle; i<=AlidNdEtaCorrection::kND; i++)
  {
    Printf("Correction %d", i);
    dNdEtaCorrection->GetCorrection(i)->PrintInfo(0.2);
  }
}

void PrintAllInfos()
{
  PrintInfo();

  Printf("RAW ESD");
  TFile::Open("analysis_esd_raw.root");
  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
  fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
  fdNdEtaAnalysis->GetData()->PrintInfo(0.3);

  const Int_t num = 3;
  const char* results[] = { "dndeta", "dndetaTr", "dndetaTrVtx" };

  TFile::Open("analysis_esd.root");
  for (Int_t i=0; i<num; i++)
  {
    Printf("CORRECTED %s", results[i]);
    dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
    fdNdEtaAnalysis->LoadHistograms(results[i]);
    fdNdEtaAnalysis->GetData()->PrintInfo(0.3);
  }
}  

void ComparedNdEta(const char* ESDfolder = "dndeta", const char* MCfolder = "dndeta", const char* esdFile = "analysis_esd.root", const char* mcFile = "analysis_mc.root")
{
  gSystem->Load("libPWG0base");

  TFile::Open(esdFile);
  dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis(ESDfolder, ESDfolder);
  fdNdEtaAnalysisESD->LoadHistograms();

  TFile::Open(mcFile);
  dNdEtaAnalysis* fdNdEtaAnalysisMC = new dNdEtaAnalysis(MCfolder, MCfolder);
  fdNdEtaAnalysisMC->LoadHistograms();
  //fdNdEtaAnalysisMC->Finish(0, 0.3, AlidNdEtaCorrection::kNone);

  for (Int_t i=0; i<dNdEtaAnalysis::kVertexBinning; ++i)
    fdNdEtaAnalysisESD->GetdNdEtaPtCutOffCorrectedHistogram(i)->Divide(fdNdEtaAnalysisMC->GetdNdEtaPtCutOffCorrectedHistogram(i));

  fdNdEtaAnalysisESD->DrawHistograms();
}

void CompareVertexDist(Int_t plot = 0, const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
{
  gSystem->Load("libPWG0base");

  const char* ESDfolder = 0;

  if (plot == 0) // all
    ESDfolder = "dndeta";
  else if (plot == 1) // mb
    ESDfolder = "dndeta_mb";
  else if (plot == 2) // mb vtx
    ESDfolder = "dndeta_mbvtx";

  TFile::Open("analysis_esd.root");
  dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis(ESDfolder, ESDfolder);
  fdNdEtaAnalysisESD->LoadHistograms();

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
  dNdEtaCorrection->LoadHistograms(correctionMapFile, correctionMapFolder);

  TH2F* hist = 0;

  if (plot == 0) // all
    hist = dNdEtaCorrection->GetTriggerBiasCorrection()->GetGeneratedHistogram();
  else if (plot == 1) // mb
    hist = dNdEtaCorrection->GetTriggerBiasCorrection()->GetMeasuredHistogram();
  else if (plot == 2) // mb vtx
    hist = dNdEtaCorrection->GetVertexRecoCorrection()->GetMeasuredHistogram();

  TH1* proj = hist->ProjectionX();

  TH1* vertex = fdNdEtaAnalysisESD->GetVtxHistogram();
  for (Int_t i=1; i<=vertex->GetNbinsX(); ++i)
  {
    Float_t value = proj->GetBinContent(proj->FindBin(vertex->GetBinCenter(i)));
    if (value != 0)
    {
      printf("vtx = %f, esd = %f, corr = %f, ratio = %f\n", vertex->GetBinCenter(i), vertex->GetBinContent(i), value, vertex->GetBinContent(i) / value);
      vertex->SetBinContent(i, vertex->GetBinContent(i) / value);
    }
  }

  new TCanvas;
  vertex->DrawCopy();
}

void CompareTrack2ParticleWithAnalysisData(const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
{
  loadlibs();

  TFile::Open("analysis_esd.root");
  dNdEtaAnalysis* fdNdEtaAnalysisESD = new dNdEtaAnalysis("dndeta_mbvtx", "dndeta_mbvtx");
  fdNdEtaAnalysisESD->LoadHistograms();

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
  dNdEtaCorrection->LoadHistograms(correctionMapFile, correctionMapFolder);

  //TH1* histESD = fdNdEtaAnalysisESD->GetUncorrectedHistogram();
  //TH1* histCorr = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram();

  TH1* histESD = fdNdEtaAnalysisESD->GetHistogram();
  TH1* histCorr = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram();

  TH1F* diff = new TH1F("diff", "diff", 100, 0.98, 1.02);

  new TCanvas;
  histESD->Draw();

  new TCanvas;
  histCorr->Draw();

  for (Int_t x=1; x<=histESD->GetNbinsX(); ++x)
    for (Int_t y=1; y<=histESD->GetNbinsY(); ++y)
      for (Int_t z=1; z<=histESD->GetNbinsZ(); ++z)
      {
        Float_t value1 = histESD->GetBinContent(x, y, z);
        Float_t value2 = histCorr->GetBinContent(histCorr->FindBin(histESD->GetXaxis()->GetBinCenter(x), histESD->GetYaxis()->GetBinCenter(y), histESD->GetZaxis()->GetBinCenter(z)));

        if (value2 > 0 && value1 > 0)
        {
          printf("%f %f %f\n", value1, value2, value1 / value2);
          diff->Fill(value1 / value2);
        }
      }

  new TCanvas;
  diff->Draw();
}

Double_t PrintIntegratedDeviation(TH1* histMC, TH1* histESD, const char* desc = "")
{
  Double_t avgMC = 0;
  Double_t avgESD = 0;
  for (Int_t bin = histMC->FindBin(-0.7999); bin <= histMC->FindBin(0.7999); bin++)
  {
    avgMC += histMC->GetBinContent(bin);
    avgESD += histESD->GetBinContent(bin);
  }
  Int_t nBins = histMC->FindBin(0.7999) - histMC->FindBin(-0.7999) + 1;

  avgMC /= nBins;
  avgESD /= nBins;

  // deviation when integrate in |eta| < 0.8 between mc and esd
  Double_t diffFullRange = (avgMC - avgESD) / avgMC;

  Printf("%s: Integrated deviation in |eta| < 0.8 is %.2f %%", desc, diffFullRange * 100);

  return diffFullRange;
}

void dNdEtaNoResolution()
{
  loadlibs();

  TFile::Open("correction_map.root");

  const char* correctionMapFolder = "dndeta_correction";
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
  dNdEtaCorrection->LoadHistograms();
  dNdEtaCorrection->GetTrack2ParticleCorrection()->PrintInfo(0.3);

  TFile::Open("analysis_mc.root");
  fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTracks", "dndetaTracks");
  fdNdEtaAnalysis->LoadHistograms();
  fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.3, AlidNdEtaCorrection::kTrack2Particle, "ESD (no resolution effect) -> MB with vertex");
  fdNdEtaAnalysis->GetdNdEtaPtCutOffCorrectedHistogram(0)->SetMarkerStyle(21);

  TFile::Open("analysis_mc.root");
  dNdEtaAnalysis* fdNdEtaAnalysisMC = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx");
  fdNdEtaAnalysisMC->LoadHistograms();
  fdNdEtaAnalysisMC->Finish(0, 0, AlidNdEtaCorrection::kNone, "MC: MB with vertex");

  DrawdNdEtaRatio(fdNdEtaAnalysis->GetdNdEtaPtCutOffCorrectedHistogram(0), fdNdEtaAnalysisMC->GetdNdEtaPtCutOffCorrectedHistogram(0), "MB with vertex (no resolution effect)", 3);
}

TH1* GetMCHist(const char* folder, Float_t ptCut, const char* tag)
{
  loadlibs();
  
  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis(folder, folder);
  fdNdEtaAnalysis->LoadHistograms();
  fdNdEtaAnalysis->Finish(0, ptCut, AlidNdEtaCorrection::kNone, tag);
  return fdNdEtaAnalysis->GetdNdEtaHistogram(0);
}

void dNdEtaFinal(Bool_t spd = kTRUE)
{
  TFile* file = TFile::Open("analysis_esd.root");
  TH1* histESD = (TH1*) file->Get("dndeta/dNdEta_corrected");
  TH1* histESDnsd = (TH1*) file->Get("dndetaNSD/dNdEta_corrected");
  Prepare1DPlot(histESD);
  Prepare1DPlot(histESDnsd);
  
  TCanvas* canvas = new TCanvas("dNdEtaFinal", "dNdEtaFinal", 600, 600);
  gPad->SetTopMargin(0.05);
  gPad->SetRightMargin(0.05);
  gPad->SetLeftMargin(0.12);
  gPad->SetBottomMargin(0.12);
  gPad->SetGridx();
  gPad->SetGridy();
  
  Float_t etaMax = 1.9;
  Float_t histMax = 1.39;
  Float_t systErrorValue = 0.023;
  Float_t systErrorNSDValue = 0.081;
  if (!spd)
  {
    //etaMax = 1.5;
    histMax = 0.99;
    systErrorValue = 0.043;
    systErrorNSDValue = 0.088;
  }
  
  dummy = new TH2F("dummy", ";#eta;dN_{ch}/d#eta", 100, -etaMax, etaMax, 100, 3, 8);
  dummy->SetStats(0);
  dummy->GetYaxis()->SetTitleOffset(1.3);
  
  histESD->SetMarkerStyle(20);
  histESDnsd->SetMarkerStyle(21);
  histESDnsd->SetMarkerColor(4);
  histESDnsd->SetLineColor(4);
  histESD->SetMarkerSize(1.5);
  histESDnsd->SetMarkerSize(1.5);
  
  histESD->GetXaxis()->SetRangeUser(-histMax, histMax);
  histESDnsd->GetXaxis()->SetRangeUser(-histMax, histMax);
  
  legend = new TLegend(0.3, 0.2, 0.78, 0.4);
  legend->SetFillColor(0);
  legend->SetTextSize(0.04);
  legend->AddEntry(histESD, "Inelastic events", "P");
  legend->AddEntry(histESDnsd, "NSD events", "P");
  
  dummy->Draw();
  
  // syst errors.
  TH1* systError = (TH1*) histESD->Clone("systError");
  for (Int_t i=1; i<=systError->GetNbinsX(); ++i)
    systError->SetBinError(i, systError->GetBinContent(i) * systErrorValue);
  // change error drawing style
  systError->SetFillColor(15);    
  systError->DrawCopy("SAME E2 ][");
  
  // syst error NSD
  for (Int_t i=1; i<=systError->GetNbinsX(); ++i)
  {
    systError->SetBinContent(i, histESDnsd->GetBinContent(i));
    systError->SetBinError(i, systError->GetBinContent(i) * systErrorNSDValue);
  }
  systError->DrawCopy("SAME E2 ][");
  
  histESD->Draw("SAME");
  histESDnsd->Draw("SAME");
  legend->Draw();  
  
  canvas->SaveAs(Form("%s_dndeta_final.eps", (spd) ? "spd" : "tpc"));
}

void dNdEtaPythiaPhojet()
{
  // evtl. deactivate acceptance maps in dNdEtaAnalysis.cxx

  loadlibs();

  TH1* hist[4];
  
  TFile::Open("LHC08c11_10TeV_0.5T/mb1/spd/analysis_mc.root");
  hist[0] =         (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMC");
  hist[1] =         (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsd");

  TFile::Open("LHC08c15_10TeV_0.5T_Phojet/mb1/spd/analysis_mc.root");
  hist[2] =         (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMCPhojet");
  hist[3] =         (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsdPhojet");
  
  file = TFile::Open("pythia_phojet_dndeta.root", "RECREATE");
  for (Int_t i=0; i<4; i++)
    hist[i]->Write();
  file->Close();
}
 
void dNdEta(Bool_t onlyESD = kFALSE, Bool_t save = kTRUE)
{
  loadlibs();

  TFile* file = TFile::Open("analysis_esd.root");
  
  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
  fdNdEtaAnalysis->LoadHistograms("dndeta");
  
  TH1* histESD = (TH1*) file->Get("dndeta/dNdEta_corrected");
  TH1* histESD1 = (TH1*) file->Get("dndeta/dNdEta_corrected_1");
  TH1* histESD2 = (TH1*) file->Get("dndeta/dNdEta_corrected_2");
  TH1* histESDnsd = (TH1*) file->Get("dndetaNSD/dNdEta_corrected");
  TH1* histESDnsdNoPt = (TH1*) file->Get("dndetaNSD/dNdEta");
  TH1* histESDonePart = (TH1*) file->Get("dndetaOnePart/dNdEta_corrected");
  if (!histESDonePart)
    histESDonePart = new TH1F;
  TH1* histESDNoPt = (TH1*) file->Get("dndeta/dNdEta");
  TH1* histESDMB = (TH1*) file->Get("dndetaTr/dNdEta_corrected");
  TH1* histESDMBNoPt = (TH1*) file->Get("dndetaTr/dNdEta");
  TH1* histESDMBVtx = (TH1*) file->Get("dndetaTrVtx/dNdEta_corrected");
  TH1* histESDMBVtxNoPt = (TH1*) file->Get("dndetaTrVtx/dNdEta");
  TH1* histESDMBTracksNoPt = (TH1*) file->Get("dndetaTracks/dNdEta");

  Prepare1DPlot(histESD);
  Prepare1DPlot(histESD1);
  Prepare1DPlot(histESD2);
  Prepare1DPlot(histESDnsd);
  Prepare1DPlot(histESDonePart);
  Prepare1DPlot(histESDMB);
  Prepare1DPlot(histESDMBVtx);

  Prepare1DPlot(histESDNoPt);
  Prepare1DPlot(histESDMBNoPt);
  Prepare1DPlot(histESDMBVtxNoPt);
  Prepare1DPlot(histESDMBTracksNoPt);

  histESD->SetLineWidth(0);
  histESDnsd->SetLineWidth(0);
  histESDonePart->SetLineWidth(0);
  histESDMB->SetLineWidth(0);
  histESDMBVtx->SetLineWidth(0);

  histESDNoPt->SetLineWidth(0);
  histESDMBNoPt->SetLineWidth(0);
  histESDMBVtxNoPt->SetLineWidth(0);

  histESD->SetMarkerColor(1);
  histESDnsd->SetMarkerColor(6);
  histESDonePart->SetMarkerColor(3);
  histESDMB->SetMarkerColor(2);
  histESDMBVtx->SetMarkerColor(4);

  histESD->SetLineColor(1);
  histESDnsd->SetLineColor(6);
  histESDonePart->SetLineColor(3);
  histESDMB->SetLineColor(2);
  histESDMBVtx->SetLineColor(4);

  histESDNoPt->SetMarkerColor(1);
  histESDMBNoPt->SetMarkerColor(2);
  histESDMBVtxNoPt->SetMarkerColor(4);
  histESDMBTracksNoPt->SetMarkerColor(3);

  histESD->SetMarkerStyle(20);
  histESDnsd->SetMarkerStyle(29);
  histESDonePart->SetMarkerStyle(24);
  histESDMB->SetMarkerStyle(21);
  histESDMBVtx->SetMarkerStyle(22);

  histESDNoPt->SetMarkerStyle(20);
  histESDMBNoPt->SetMarkerStyle(21);
  histESDMBVtxNoPt->SetMarkerStyle(22);
  histESDMBTracksNoPt->SetMarkerStyle(23);
  
  Float_t etaLimit = (fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPC) ? 0.89 : 1.99;
  Float_t etaPlotLimit = (fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPC) ? 1.2 : 2.3;
  //Float_t etaLimit = (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC) ? 0.89 : 1.39;
  //Float_t etaPlotLimit = (fdNdEtaAnalysis->GetAnalysisMode() == AliPWG0Helper::kTPC) ? 1.2 : 1.9;

  histESDMBVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histESDMB->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histESD->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histESDnsd->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histESDonePart->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);

  histESDNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histESDMBNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histESDMBVtxNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histESDMBTracksNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);

  Float_t max = TMath::Max(histESDMBVtx->GetMaximum(), histESDMB->GetMaximum());
  max = TMath::Max(max, histESD->GetMaximum());
  max = TMath::Max(max, histESDMBTracksNoPt->GetMaximum());

  TLegend* legend = new TLegend(0.35, 0.05, 0.75, 0.4);
  legend->SetFillColor(0);
  legend->AddEntry(histESDMBVtx, "Triggered, vertex");
  legend->AddEntry(histESDMB, "Triggered");
  legend->AddEntry(histESD, "All INEL events");
  legend->AddEntry(histESDnsd, "All NSD events");
  legend->AddEntry(histESDonePart, "One Particle");

  TH2F* dummy = new TH2F("dummy", "", 100, -etaPlotLimit, etaPlotLimit, 1000, 0, max * 1.1);
  dummy->GetYaxis()->SetRangeUser(2.1, max * 1.1);
  Prepare1DPlot(dummy);
  dummy->SetStats(kFALSE);
  dummy->SetXTitle("#eta");
  dummy->SetYTitle("dN_{ch}/d#eta");
  dummy->GetYaxis()->SetTitleOffset(1);

  TCanvas* canvas = new TCanvas("dNdEta1", "dNdEta1", 500, 500);

  dummy->DrawCopy();
  histESDMBVtx->Draw("SAME");
  histESDMB->Draw("SAME");
  histESD->Draw("SAME");
  histESDnsd->Draw("SAME");
  histESDonePart->Draw("SAME");
  legend->Draw();
  
  if (save)
  {
    canvas->SaveAs("dNdEta1.png");
    //canvas->SaveAs("dNdEta1.eps");
  }
  
  histESD->Fit("pol0", "0", "", -0.49, 0.49);
  histESDnsd->Fit("pol0", "0", "", -0.49, 0.49);
  histESDonePart->Fit("pol0", "0", "", -0.49, 0.49);
  histESDonePart->Fit("pol0", "0", "", -0.99, 0.99);

  canvas = new TCanvas("dNdEta1_mirrored", "dNdEta1_mirrored", 500, 500);
  canvas->SetGridx();
  canvas->SetGridy();

  dummy->DrawCopy()->GetXaxis()->SetRangeUser(0, 100);
  histESD->DrawCopy("SAME")->SetMarkerStyle(24);
  histESDnsd->DrawCopy("SAME")->SetMarkerStyle(24);
  
  graph = new TGraphErrors(histESD);
  for (Int_t i=0; i<graph->GetN(); i++)
    graph->GetX()[i] *= -1;
  graph->SetMarkerStyle(5);
  graph->Draw("P SAME");

  graph = new TGraphErrors(histESDnsd);
  for (Int_t i=0; i<graph->GetN(); i++)
    graph->GetX()[i] *= -1;
  graph->SetMarkerStyle(5);
  graph->SetMarkerColor(histESDnsd->GetMarkerColor());
  graph->Draw("P SAME");
  
  canvas = new TCanvas("dNdEta1_ratio", "dNdEta1_ratio", 500, 500);
  canvas->SetGridx();
  canvas->SetGridy();
  
  dummy_clone = dummy->DrawCopy();
  dummy_clone->GetXaxis()->SetRangeUser(0, 100);
  dummy_clone->GetYaxis()->SetRangeUser(0.5, 1.5);
  
  graph = new TGraphErrors(histESD);
  for (Int_t i=0; i<graph->GetN(); i++)
  {
    Int_t bin = histESD->GetXaxis()->FindBin(-graph->GetX()[i]);
    if (histESD->GetBinContent(bin) > 0 && graph->GetY()[i] > 0)
    {
      graph->GetEY()[i] = sqrt(graph->GetEY()[i] * graph->GetEY()[i] / graph->GetY()[i] / graph->GetY()[i] 
        + histESD->GetBinError(bin) * histESD->GetBinError(bin) / histESD->GetBinContent(bin) / histESD->GetBinContent(bin));
      graph->GetY()[i] /= histESD->GetBinContent(bin);
      graph->GetEY()[i] *= graph->GetY()[i];
    }
    else
      graph->GetY()[i] = 0;
  }
  graph->SetMarkerStyle(5);
  graph->Draw("P SAME");
  
  graph = new TGraphErrors(histESDnsd);
  for (Int_t i=0; i<graph->GetN(); i++)
  {
    Int_t bin = histESDnsd->GetXaxis()->FindBin(-graph->GetX()[i]);
    if (histESDnsd->GetBinContent(bin) > 0 && graph->GetY()[i] > 0)
    {
      graph->GetEY()[i] = sqrt(graph->GetEY()[i] * graph->GetEY()[i] / graph->GetY()[i] / graph->GetY()[i] 
        + histESDnsd->GetBinError(bin) * histESDnsd->GetBinError(bin) / histESDnsd->GetBinContent(bin) / histESDnsd->GetBinContent(bin));
      graph->GetY()[i] /= histESDnsd->GetBinContent(bin);
      graph->GetEY()[i] *= graph->GetY()[i];
      graph->GetY()[i] += 0.2;
    }
  }
  graph->SetMarkerStyle(5);
  graph->SetMarkerColor(histESDnsd->GetMarkerColor());
  graph->Draw("P SAME");
  
  canvas = new TCanvas("dNdEta1_vertex", "dNdEta1_vertex", 500, 500);
  dummy->DrawCopy();
  histESD->DrawCopy("SAME");
  histESD1->SetLineColor(2);
  histESD1->DrawCopy("SAME");
  histESD2->SetLineColor(4);
  histESD2->DrawCopy("SAME");
  
  PrintIntegratedDeviation(histESDnsd, histESDMB, "factor MB / NSD");
  
  if (onlyESD)
    return;

  loadlibs();

  TFile* file2 = TFile::Open("analysis_mc.root");

  TH1* histMCTrVtx =       (TH1*) GetMCHist("dndetaTrVtx", -1, "MC: MB with vertex")->Clone("histMCTrVtx");
  TH1* ratioTrVtx = (TH1*) DrawdNdEtaRatio(histESDMBVtx, histMCTrVtx, "triggered_vertex", etaPlotLimit)->Clone();
  
  TH1* histMC =            (TH1*) GetMCHist("dndeta", -1, "MC: full inelastic")->Clone("histMC");
  TH1* histMCTr =          (TH1*) GetMCHist("dndetaTr", -1, "MC: minimum bias")->Clone("histMCTr");
  TH1* histMCnsd =         (TH1*) GetMCHist("dndetaNSD", -1, "MC: NSD")->Clone("histMCnsd");
  TH1* histMConePart =     (TH1*) GetMCHist("dndetaOnePart", -1, "MC: OnePart")->Clone("histMConePart");

  TH1* histMCPtCut =       (TH1*) GetMCHist("dndeta", 0.151, "MC: full inelastic, pt cut")->Clone("histMCPtCut");
  TH1* histMCTrPtCut =     (TH1*) GetMCHist("dndetaTr", 0.151, "MC: minimum bias, pt cut")->Clone("histMCTrPtCut");
  TH1* histMCTrVtxPtCut =  (TH1*) GetMCHist("dndetaTrVtx", 0.151, "MC: MB with vertex, pt cut")->Clone("histMCTrVtxPtCut");
  TH1* histMCnsdNoPt =     (TH1*) GetMCHist("dndetaNSD", 0.151, "MC: NSD, put cut")->Clone("histMCnsdNoPt");
  TH1* histMCTracksPtCut = (TH1*) GetMCHist("dndetaTracks", 0.151, "MC: Tracks w/o resolution effect, pt cut")->Clone("histMCTracksPtCut");

  Prepare1DPlot(histMC);
  Prepare1DPlot(histMCnsd);
  Prepare1DPlot(histMCTr);
  Prepare1DPlot(histMCTrVtx);

  Prepare1DPlot(histMCPtCut);
  Prepare1DPlot(histMCTrPtCut);
  Prepare1DPlot(histMCTrVtxPtCut);
  Prepare1DPlot(histMCTracksPtCut);

  histMC->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histMCnsd->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histMCTr->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histMCTrVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);

  histMCPtCut->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histMCTrPtCut->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histMCTrVtxPtCut->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  histMCTracksPtCut->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);

  histMC->SetLineColor(1);
  histMCnsd->SetLineColor(6);
  histMCTr->SetLineColor(2);
  histMCTrVtx->SetLineColor(4);

  histMCPtCut->SetLineColor(1);
  histMCTrPtCut->SetLineColor(2);
  histMCTrVtxPtCut->SetLineColor(4);
  if (histMCTracksPtCut)
    histMCTracksPtCut->SetLineColor(3);

  TCanvas* canvas2 = new TCanvas("dNdEta2", "dNdEta2", 500, 500);

  TH2* dummy2 = (TH2F*) dummy->Clone("dummy2");
  dummy2->GetYaxis()->SetRangeUser(0, max * 1.1);

  dummy2->DrawCopy();
  histMC->Draw("SAME");
  histMCnsd->Draw("SAME");
  histMCTr->Draw("SAME");
  histMCTrVtx->Draw("SAME");
  histESD->Draw("SAME");
  histESDnsd->Draw("SAME");
  histESDMB->Draw("SAME");
  histESDMBVtx->Draw("SAME");
  histESDNoPt->Draw("SAME");
  histESDMBNoPt->Draw("SAME");
  histESDMBVtxNoPt->Draw("SAME");
  histESDMBTracksNoPt->Draw("SAME");
  histMCPtCut->Draw("SAME");
  histMCTrPtCut->Draw("SAME");
  histMCTrVtxPtCut->Draw("SAME");
  if (histMCTracksPtCut)
    histMCTracksPtCut->Draw("SAME");

  if (save)
  {
    canvas2->SaveAs("dNdEta2.gif");
    canvas2->SaveAs("dNdEta2.eps");
  }

  TH1* ratio = (TH1*) DrawdNdEtaRatio(histESD, histMC, "full_inelastic", etaPlotLimit)->Clone();
  TH1* ratioTr = (TH1*) DrawdNdEtaRatio(histESDMB, histMCTr, "triggered", etaPlotLimit)->Clone();
  TH1* ratioTrVtx = (TH1*) DrawdNdEtaRatio(histESDMBVtx, histMCTrVtx, "triggered_vertex", etaPlotLimit)->Clone();
  TH1* ratioTrVtxNoPt = (TH1*) DrawdNdEtaRatio(histESDMBVtxNoPt, histMCTrVtxPtCut, "triggered_vertex_nopt", etaPlotLimit)->Clone();
  TH1* ratioNSD = (TH1*) DrawdNdEtaRatio(histESDnsd, histMCnsd, "NSD", etaPlotLimit)->Clone();
  TH1* ratioOnePart = (TH1*) DrawdNdEtaRatio(histESDonePart, histMConePart, "OnePart", etaPlotLimit)->Clone();

  // draw ratios of single steps
  c7 = new TCanvas("all_ratios", "all_ratios", 600, 600);
  c7->SetRightMargin(0.05);
  c7->SetTopMargin(0.05);
  c7->SetGridx();
  c7->SetGridy();
  
  ratioTrVtxNoPt->SetMarkerStyle(20);
  ratioTrVtx->SetMarkerStyle(21);
  ratioTr->SetMarkerStyle(23);
  ratio->SetMarkerStyle(22);
  ratioNSD->SetMarkerStyle(26);
  
  ratioTrVtxNoPt->SetMarkerSize(2);
  ratioTrVtx->SetMarkerSize(2);
  ratioTr->SetMarkerSize(2);
  ratio->SetMarkerSize(2);
  ratioNSD->SetMarkerSize(2);
  
  ratioTrVtxNoPt->SetMarkerColor(1);
  ratioTrVtx->SetMarkerColor(2);
  ratioTr->SetMarkerColor(4);
  ratio->SetMarkerColor(2);
  ratioNSD->SetMarkerColor(1);
  
  ratioTrVtxNoPt->SetLineColor(1);
  ratioTrVtx->SetLineColor(2);
  ratioTr->SetLineColor(4);
  ratio->SetLineColor(2);
  ratioNSD->SetLineColor(1);
  
  legend7 = new TLegend(0.13, 0.7, 0.94, 0.9);
  legend7->SetFillColor(0);
  legend7->SetTextSize(0.035);
  legend7->SetNColumns(2);
  
  flat = new TF1("flat", "-1", -5, 5);
  ratioTrVtxNoPt->Add(flat);
  ratioTrVtx->Add(flat);
  ratioTr->Add(flat);
  ratio->Add(flat);
  ratioNSD->Add(flat);
  
  ratioTrVtxNoPt->Scale(100);
  ratioTrVtx->Scale(100);
  ratioTr->Scale(100);
  ratio->Scale(100);
  ratioNSD->Scale(100);
  
  ratio->Add(ratioTr, -1);
  ratioNSD->Add(ratioTr, -1);
  ratioTr->Add(ratioTrVtx, -1);
  ratioTrVtx->Add(ratioTrVtxNoPt, -1);
  
  legend7->AddEntry(ratioTrVtxNoPt, "Track-to-particle", "P");
  legend7->AddEntry(ratio, "Trigger-bias INEL", "P");
  legend7->AddEntry(ratioTr, "Vertex-reconstruction", "P");
  legend7->AddEntry(ratioNSD, "Trigger-bias NSD", "P");
  if ((fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kFieldOn) && (fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPC || fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPCITS))
    legend7->AddEntry(ratioTrVtx, "p_{T} cut-off", "P");
  
  TH1* dummy7 = new TH2F("dummy7", ";#eta;Deviation in %", 100, -etaPlotLimit, etaPlotLimit, 100, -5, 7);
  dummy7->SetStats(0);
  dummy7->Draw();
  
  ratio->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  ratioTr->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  ratioTrVtx->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  ratioTrVtxNoPt->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  ratioNSD->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);
  
  ratio->Draw("HIST EP SAME");
  ratioTr->Draw("HIST EP SAME");
  if ((fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kFieldOn) && (fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPC || fdNdEtaAnalysis->GetAnalysisMode() & AliPWG0Helper::kTPCITS))
    ratioTrVtx->Draw("HIST EP SAME");
  ratioTrVtxNoPt->Draw("HIST EP SAME");
  ratioNSD->Draw("HIST EP SAME");
  legend7->Draw();
  
  //c7->SaveAs("ratios.eps");

  new TCanvas;
  dummy2->DrawCopy();
  histMCnsd->Draw("SAME");
  histESDnsd->Draw("SAME");

  ratio = (TH1*) histMC->Clone("ratio");
  TH1* ratioNoPt = (TH1*) histMCPtCut->Clone("ratioNoPt");

  ratio->Divide(histESD);
  ratioNoPt->Divide(histESDNoPt);

  ratio->GetXaxis()->SetRangeUser(-etaLimit, etaLimit);

  ratio->SetLineColor(1);
  ratioNoPt->SetLineColor(2);

  Double_t average = 0;       // average deviation from 1 in ratio (depends on the number of bins if statistical)
  for (Int_t bin = ratio->FindBin(-0.7999); bin <= ratio->FindBin(0.7999); bin++)
    average += TMath::Abs(ratio->GetBinContent(bin) - 1);
  Int_t nBins = ratio->FindBin(0.7999) - ratio->FindBin(-0.7999) + 1;
  average /= nBins;
  Printf("Average deviation in |eta| < 0.8 is %.2f %%", average * 100);

  PrintIntegratedDeviation(histMC, histESD, "all events");
  PrintIntegratedDeviation(histMCnsd, histESDnsd, "all events (NSD)");
  PrintIntegratedDeviation(histMConePart, histESDonePart, "all events (INEL>0)");
  PrintIntegratedDeviation(histMCTr, histESDMB, "triggered");
  PrintIntegratedDeviation(histMCTrVtx, histESDMBVtx, "trigger, vertex");
  PrintIntegratedDeviation(histMCPtCut, histESDNoPt, "all events (no pt corr)");
  PrintIntegratedDeviation(histMCnsdNoPt, histESDnsdNoPt, "all events (NSD) (no pt corr)");
  PrintIntegratedDeviation(histMCTrPtCut, histESDMBNoPt, "triggered (no pt corr)");
  PrintIntegratedDeviation(histMCTrVtxPtCut, histESDMBVtxNoPt, "trigger, vertex (no pt corr)");
  PrintIntegratedDeviation(histESD, histESDNoPt, "pt cut off correction");

  TCanvas* canvas3 = new TCanvas("dNdEta", "dNdEta", 600, 600);
  canvas3->Range(0, 0, 1, 1);
  //canvas3->Divide(1, 2, 0, 0);

  //canvas3->cd(1);
  TPad* pad1 = new TPad("dNdEta_1", "", 0, 0.5, 0.98, 0.98);
  pad1->SetTopMargin(0.05);
  pad1->SetLeftMargin(0.13);
  pad1->Draw();

  TPad* pad2 = new TPad("dNdEta_2", "", 0, 0.02, 0.98, 0.5);
  pad2->SetLeftMargin(0.13);
  pad2->Draw();

  pad1->SetRightMargin(0.01);
  pad2->SetRightMargin(0.01);

  // no border between them
  pad1->SetBottomMargin(0);
  pad2->SetTopMargin(0);

  pad1->cd();
  pad1->SetGridx();
  pad1->SetGridy();

  legend->AddEntry(histMC, "MC prediction");

  dummy->GetXaxis()->SetLabelSize(0.08);
  dummy->GetYaxis()->SetLabelSize(0.08);
  dummy->GetXaxis()->SetTitleSize(0.08);
  dummy->GetYaxis()->SetTitleSize(0.08);
  dummy->GetYaxis()->SetTitleOffset(0.8);
  dummy->DrawCopy();
  histESDMBVtx->Draw("SAME");
  histESDMB->Draw("SAME");
  histESD->Draw("SAME");
  histMC->Draw("SAME");

  legend->SetTextSize(0.08);
  legend->Draw();

  pad2->cd();
  pad2->SetBottomMargin(0.15);
  //pad2->SetGridx();
  //pad2->SetGridy();

  Float_t minR = 0.91; //TMath::Min(0.961, ratio->GetMinimum() * 0.95);
  Float_t maxR = 1.09; //TMath::Max(1.049, ratio->GetMaximum() * 1.05);

  TH1F dummy3("dummy3", ";#eta;Ratio: MC / corr", 100, -etaPlotLimit, etaPlotLimit);
  dummy3.SetStats(kFALSE);
  for (Int_t i=1; i<=100; ++i)
    dummy3.SetBinContent(i, 1);
  dummy3.GetYaxis()->SetRangeUser(minR, maxR);
  dummy3.SetLineWidth(2);
  dummy3.GetXaxis()->SetLabelSize(0.08);
  dummy3.GetYaxis()->SetLabelSize(0.08);
  dummy3.GetXaxis()->SetTitleSize(0.08);
  dummy3.GetYaxis()->SetTitleSize(0.08);
  dummy3.GetYaxis()->SetTitleOffset(0.8);
  dummy3.DrawCopy();

  ratio->Draw("SAME");

  //pad2->Draw();

  canvas3->Modified();

  if (save)
  {
    canvas3->SaveAs("dNdEta.gif");
    canvas3->SaveAs("dNdEta.eps");
  }

  TCanvas* canvas4 = new TCanvas("ratio", "ratio", 700, 500);

  ratio->Draw();
  ratioNoPt->Draw("SAME");

  TLegend* legend = new TLegend(0.6, 0.7, 0.95, 0.9);
  legend->SetFillColor(0);
  legend->AddEntry(ratio, "mc/esd");
  legend->AddEntry(ratioNoPt, "mc/esd, not pt cut off corrected");
  legend->Draw();
}

void CompareTwodNdEta(const char* fileName1, const char* fileName2, Bool_t errorsCorrelated = kFALSE)
{
  c = new TCanvas;
  
  c->SetGridx();
  c->SetGridy();

  hist = new TH2F("dummy", ";#eta;dN_{ch}/d#eta", 100, -2.5, 2.5, 100, 0, 8);
  hist->SetStats(0);
  hist->DrawCopy();//->GetYaxis()->SetRangeUser(2, 4.5);
  
  l = new TLegend(0.2, 0.13, 0.8, 0.35);
  l->SetNColumns(2);
  l->SetFillColor(0);
  
  TH1* histESD[2];
  TH1* histESDnsd[2];
  
  for (Int_t i=0; i<2; i++)
  {
    if (i == 0)
      file = TFile::Open(fileName1);
    if (i == 1)
    {
      if (fileName2 == 0)
        break;
      file = TFile::Open(fileName2);
    }
  
    histESD[i] = (TH1*) file->Get("dndeta/dNdEta_corrected");
    histESDnsd[i] = (TH1*) file->Get("dndetaNSD/dNdEta_corrected");
    
    histESD[i]->SetMarkerStyle(20 + i*4);
    histESDnsd[i]->SetMarkerStyle(21 + i*4);
    
    histESD[i]->SetMarkerColor(i+1);
    histESD[i]->SetLineColor(i+1);
    histESDnsd[i]->SetMarkerColor(i+1);
    histESDnsd[i]->SetLineColor(i+1);
    
    histESD[i]->DrawCopy("SAME");
    histESDnsd[i]->DrawCopy("SAME");
    
    l->AddEntry(histESD[i], Form("Data %d INEL", i), "P");
    l->AddEntry(histESDnsd[i], Form("Data %d NSD", i), "P");
  }

  if (0)
  {
    TGraphErrors *gre = new TGraphErrors(16);
    gre->SetFillColor(4);
    gre->SetMarkerColor(4);
    gre->SetMarkerStyle(26);
    gre->SetPoint(0,0.125,3.14);
    gre->SetPointError(0,0,0.07);
    gre->SetPoint(1,0.375,3.04);
    gre->SetPointError(1,0,0.07);
    gre->SetPoint(2,0.625,3.17);
    gre->SetPointError(2,0,0.07);
    gre->SetPoint(3,0.875,3.33);
    gre->SetPointError(3,0,0.07);
    gre->SetPoint(4,1.125,3.33);
    gre->SetPointError(4,0,0.07);
    gre->SetPoint(5,1.375,3.53);
    gre->SetPointError(5,0,0.07);
    gre->SetPoint(6,1.625,3.46);
    gre->SetPointError(6,0,0.07);
    gre->SetPoint(7,1.875,3.41);
    gre->SetPointError(7,0,0.07);
    gre->SetPoint(8,-0.125,3.14);
    gre->SetPointError(8,0,0.07);
    gre->SetPoint(9,-0.375,3.04);
    gre->SetPointError(9,0,0.07);
    gre->SetPoint(10,-0.625,3.17);
    gre->SetPointError(10,0,0.07);
    gre->SetPoint(11,-0.875,3.33);
    gre->SetPointError(11,0,0.07);
    gre->SetPoint(12,-1.125,3.33);
    gre->SetPointError(12,0,0.07);
    gre->SetPoint(13,-1.375,3.53);
    gre->SetPointError(13,0,0.07);
    gre->SetPoint(14,-1.625,3.46);
    gre->SetPointError(14,0,0.07);
    gre->SetPoint(15,-1.875,3.41);
    gre->SetPointError(15,0,0.07);
    gre->Draw("p");
    
    l->AddEntry(gre, "UA5 INEL", "P");
    
    gre = new TGraphErrors(16);
    gre->SetMarkerColor(4);
    gre->SetFillColor(4);
    gre->SetMarkerStyle(22);
    gre->SetPoint(0,0.125,3.48);
    gre->SetPointError(0,0,0.07);
    gre->SetPoint(1,0.375,3.38);
    gre->SetPointError(1,0,0.07);
    gre->SetPoint(2,0.625,3.52);
    gre->SetPointError(2,0,0.07);
    gre->SetPoint(3,0.875,3.68);
    gre->SetPointError(3,0,0.07);
    gre->SetPoint(4,1.125,3.71);
    gre->SetPointError(4,0,0.07);
    gre->SetPoint(5,1.375,3.86);
    gre->SetPointError(5,0,0.07);
    gre->SetPoint(6,1.625,3.76);
    gre->SetPointError(6,0,0.07);
    gre->SetPoint(7,1.875,3.66);
    gre->SetPointError(7,0,0.07);
    gre->SetPoint(8,-0.125,3.48);
    gre->SetPointError(8,0,0.07);
    gre->SetPoint(9,-0.375,3.38);
    gre->SetPointError(9,0,0.07);
    gre->SetPoint(10,-0.625,3.52);
    gre->SetPointError(10,0,0.07);
    gre->SetPoint(11,-0.875,3.68);
    gre->SetPointError(11,0,0.07);
    gre->SetPoint(12,-1.125,3.71);
    gre->SetPointError(12,0,0.07);
    gre->SetPoint(13,-1.375,3.86);
    gre->SetPointError(13,0,0.07);
    gre->SetPoint(14,-1.625,3.76);
    gre->SetPointError(14,0,0.07);
    gre->SetPoint(15,-1.875,3.66);
    gre->SetPointError(15,0,0.07);
    gre->Draw("p");
    
    l->AddEntry(gre, "UA5 NSD", "P");
  }

  l->Draw();
  
  if (fileName2 == 0)
    return;
  
  new TCanvas;
  gPad->SetGridx();
  gPad->SetGridy();
  
  if (errorsCorrelated)
  {
    for (Int_t i=1; i<=histESD[1]->GetNbinsX(); i++)
    {
      histESD[1]->SetBinError(i, 0);
      histESDnsd[1]->SetBinError(i, 0);
    }
  }
  
  histESD[0]->Divide(histESD[0], histESD[1]);
  histESDnsd[0]->Divide(histESDnsd[0], histESDnsd[1]);
  
  for (Int_t i=1; i<=histESD[1]->GetNbinsX(); i++)
    histESDnsd[0]->SetBinContent(i, histESDnsd[0]->GetBinContent(i) + 0.2);
  
  hist->DrawCopy()->GetYaxis()->SetRangeUser(0.8, 1.4);
  histESD[0]->Draw("SAME");
  histESDnsd[0]->Draw("SAME");
}

TH1* DrawdNdEtaRatio(TH1* corr, TH1* mc, const char* name, Float_t etaPlotLimit)
{
  TCanvas* canvas3 = new TCanvas(name, name, 600, 600);
  canvas3->Range(0, 0, 1, 1);

  TPad* pad1 = new TPad(Form("%s_1", name), "", 0, 0.5, 0.98, 0.98);
  pad1->Draw();

  TPad* pad2 = new TPad(Form("%s_2", name), "", 0, 0.02, 0.98, 0.5);
  pad2->Draw();

  pad1->SetRightMargin(0.01);
  pad2->SetRightMargin(0.01);
  pad1->SetTopMargin(0.05);
  pad1->SetLeftMargin(0.13);
  pad2->SetLeftMargin(0.13);
  pad2->SetBottomMargin(0.15);
  
  // no border between them
  pad1->SetBottomMargin(0);
  pad2->SetTopMargin(0);

  pad1->cd();
  pad1->SetGridx();
  pad1->SetGridy();

  TLegend* legend = new TLegend(0.35, 0.05, 0.75, 0.3);
  legend->SetFillColor(0);
  legend->AddEntry(corr, "Corrected");
  legend->AddEntry(mc, "MC prediction");
  legend->SetTextSize(0.08);

  TH2F* dummy = new TH2F("dummy", "", 100, -etaPlotLimit, etaPlotLimit, 1000, 2.7, corr->GetMaximum() * 1.1);
  Prepare1DPlot(dummy);
  dummy->SetStats(kFALSE);
  dummy->SetXTitle("#eta");
  dummy->SetYTitle("dN_{ch}/d#eta");
  dummy->GetYaxis()->SetTitleOffset(1);

  dummy->GetXaxis()->SetLabelSize(0.08);
  dummy->GetYaxis()->SetLabelSize(0.08);
  dummy->GetXaxis()->SetTitleSize(0.08);
  dummy->GetYaxis()->SetTitleSize(0.08);
  dummy->GetYaxis()->SetTitleOffset(0.8);
  dummy->DrawCopy();

  corr->Draw("SAME");
  mc->Draw("SAME");

  legend->Draw();

  pad2->cd();
  pad2->SetBottomMargin(0.15);
  //pad2->SetGridx();
  //pad2->SetGridy();

  TH1* ratio = (TH1*) mc->Clone("ratio");
  ratio->Divide(corr);

  Float_t minR = TMath::Min(0.91, ratio->GetMinimum() * 0.95);
  Float_t maxR = TMath::Max(1.09, ratio->GetMaximum() * 1.05);

  TH1F dummy3("dummy3", ";#eta;Ratio: MC / corr", 100, -etaPlotLimit, etaPlotLimit);
  dummy3.SetStats(kFALSE);
  for (Int_t i=1; i<=100; ++i)
  	dummy3.SetBinContent(i, 1);
  dummy3.GetYaxis()->SetRangeUser(minR, maxR);
  dummy3.SetLineWidth(2);
  dummy3.GetXaxis()->SetLabelSize(0.08);
  dummy3.GetYaxis()->SetLabelSize(0.08);
  dummy3.GetXaxis()->SetTitleSize(0.08);
  dummy3.GetYaxis()->SetTitleSize(0.08);
  dummy3.GetYaxis()->SetTitleOffset(0.8);
  dummy3.DrawCopy();

  ratio->Draw("SAME");

  canvas3->Modified();

  return ratio;
}

void ptSpectrum()
{
  TFile* file = TFile::Open("analysis_esd.root");
  TH1* histESD = (TH1*) file->Get("dndeta/dndeta_pt");

  TFile* file2 = TFile::Open("analysis_mc.root");
  TH1* histMC = (TH1*) file2->Get("dndeta/dndeta_pt");

  TCanvas* canvas = new TCanvas("ptSpectrum", "ptSpectrum", 500, 500);
  InitPad();
  gPad->SetLogy();

  Prepare1DPlot(histMC);
  Prepare1DPlot(histESD);

  histESD->SetTitle("");
  histESD->GetXaxis()->SetTitle("p_{T} [GeV/c]");
  histESD->GetYaxis()->SetTitle("#frac{dN}{d#eta dp_{T}} [c/GeV]");

  histMC->SetLineColor(kBlue);
  histESD->SetLineColor(kRed);

  histESD->GetYaxis()->SetTitleOffset(1.5);
  histESD->GetXaxis()->SetRangeUser(0, 4.9999);

  histESD->SetMaximum(TMath::Max(histESD->GetMaximum(), histMC->GetMaximum()) * 2);

  histESD->Draw();
  histMC->Draw("SAME");

  canvas->SaveAs("ptSpectrum.gif");
  canvas->SaveAs("ptSpectrum.eps");
}

void TriggerBiasVtxRecon(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction")
{
  gSystem->Load("libPWG0base");

  TFile::Open(fileName);
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
  dNdEtaCorrection->LoadHistograms();

  TH2* corrTrigger = dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetCorrectionHistogram();
  TH2* corrVtx = dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->GetCorrectionHistogram();

  Prepare2DPlot(corrTrigger);
  corrTrigger->SetTitle("b) Trigger bias correction");

  Prepare2DPlot(corrVtx);
  corrVtx->SetTitle("a) Vertex reconstruction correction");

  corrTrigger->GetYaxis()->SetTitle("Multiplicity");
  corrVtx->GetYaxis()->SetTitle("Multiplicity");

  TCanvas* canvas = new TCanvas("TriggerBiasVtxRecon", "TriggerBiasVtxRecon", 1000, 500);
  canvas->Divide(2, 1);

  canvas->cd(1);
  InitPadCOLZ();
  corrVtx->DrawCopy("COLZ");

  canvas->cd(2);
  InitPadCOLZ();
  corrTrigger->DrawCopy("COLZ");

  canvas->SaveAs(Form("TriggerBiasVtxRecon_%d.gif", gMax));
  canvas->SaveAs(Form("TriggerBiasVtxRecon_%d.eps", gMax));

  canvas = new TCanvas("TriggerBiasVtxReconZoom", "TriggerBiasVtxReconZoom", 1000, 500);
  canvas->Divide(2, 1);

  corrTrigger->GetYaxis()->SetRangeUser(0, 5);
  corrVtx->GetYaxis()->SetRangeUser(0, 5);

  canvas->cd(1);
  InitPadCOLZ();
  corrVtx->DrawCopy("COLZ");

  canvas->cd(2);
  InitPadCOLZ();
  corrTrigger->DrawCopy("COLZ");

  canvas->SaveAs(Form("TriggerBiasVtxReconZoom_%d.gif", gMax));
  canvas->SaveAs(Form("TriggerBiasVtxReconZoom_%d.eps", gMax));
}

void TriggerBias(const char* fileName = "correction_map.root")
{
  TFile* file = TFile::Open(fileName);

  TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_dndeta_correction_trigger"));

  Prepare2DPlot(corr);
  corr->SetTitle("Trigger bias correction");

  TCanvas* canvas = new TCanvas("TriggerBias", "TriggerBias", 500, 500);
  InitPadCOLZ();
  corr->DrawCopy("COLZ");

  canvas->SaveAs(Form("TriggerBias_%d.gif", gMax));
  canvas->SaveAs(Form("TriggerBias_%d.eps", gMax));

  corr->GetYaxis()->SetRangeUser(0, 5);

  canvas = new TCanvas("TriggerBiasZoom", "TriggerBiasZoom", 500, 500);
  InitPadCOLZ();
  corr->DrawCopy("COLZ");

  canvas->SaveAs(Form("TriggerBiasZoom_%d.gif", gMax));
  canvas->SaveAs(Form("TriggerBiasZoom_%d.eps", gMax));
}

void TriggerBias1D(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction")
{
  gSystem->Load("libPWG0base");

  TFile* file = TFile::Open(fileName);
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName);
  dNdEtaCorrection->LoadHistograms();

  TH1* hist = dNdEtaCorrection->GetTriggerBiasCorrectionOnePart()->GetEventCorrection()->Get1DCorrection("x");
  TH1* hist2 = dNdEtaCorrection->GetTriggerBiasCorrectionOnePart()->GetEventCorrection()->Get1DCorrection("y", -5, 5);

  TCanvas* canvas = new TCanvas("TriggerBias1D", "TriggerBias1D", 1000, 500);
  canvas->Divide(2, 1);

  canvas->cd(1);
  InitPad();

  Prepare1DPlot(hist);
  hist->SetTitle("");
  hist->GetYaxis()->SetTitle("correction factor");
  hist->GetYaxis()->SetRangeUser(1, 1.5);
  hist->GetYaxis()->SetTitleOffset(1.6);
  hist->Draw();

  canvas->cd(2);
  InitPad();

  Prepare1DPlot(hist2);
  hist2->SetTitle("");
  hist2->GetYaxis()->SetTitle("correction factor");
  hist2->GetXaxis()->SetRangeUser(0, 5);
  hist2->GetYaxis()->SetTitleOffset(1.6);
  hist2->GetXaxis()->SetTitle("multiplicity");
  hist2->Draw();

  TPaveText* pave = new TPaveText(0.6, 0.8, 0.8, 0.85, "NDC");
  pave->SetFillColor(0);
  pave->AddText("|z| < 5 cm");
  pave->Draw();
  
  Float_t triggerEff = 100.0 / hist2->GetBinContent(1);
  Printf("trigger eff in 0 bin is: %.2f %%", triggerEff);
  
  return;

  TH1* hist2 = dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->Get1DCorrection("y", -10, 10);
  //new TCanvas;
  //hist2->Draw();

  Printf("vertex reco eff in 0 bin is: %.2f %%", 100.0 / hist2->GetBinContent(1));
  
  Printf("combined efficiency is %.2f %%", triggerEff / hist2->GetBinContent(1));
}

void VtxRecon()
{
  TFile* file = TFile::Open("correction_map.root");

  TH2* corr = dynamic_cast<TH2*> (file->Get("dndeta_correction/corr_dndeta_correction_vtxReco"));

  Prepare2DPlot(corr);
  corr->SetTitle("Vertex reconstruction correction");

  TCanvas* canvas = new TCanvas("VtxRecon", "VtxRecon", 500, 500);
  InitPadCOLZ();
  corr->DrawCopy("COLZ");

  canvas->SaveAs(Form("VtxRecon_%d.eps", gMax));
  canvas->SaveAs(Form("VtxRecon_%d.eps", gMax));

  corr->GetYaxis()->SetRangeUser(0, 5);

  canvas = new TCanvas("VtxReconZoom", "VtxReconZoom", 500, 500);
  InitPadCOLZ();
  corr->DrawCopy("COLZ");

  canvas->SaveAs(Form("VtxReconZoom_%d.gif", gMax));
  canvas->SaveAs(Form("VtxReconZoom_%d.eps", gMax));
}

void VtxRecon1D(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction")
{
  gSystem->Load("libPWG0base");

  TFile* file = TFile::Open(fileName);
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName);
  dNdEtaCorrection->LoadHistograms();

  TH1* hist = dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->Get1DCorrection("x");
  TH1* hist2 = dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->Get1DCorrection("y", -10, 10);

  TCanvas* canvas = new TCanvas("VtxRecon1D", "VtxRecon1D", 1000, 500);
  canvas->Divide(2, 1);

  canvas->cd(1);
  InitPad();

  Prepare1DPlot(hist);
  hist->SetTitle("");
  hist->GetYaxis()->SetTitle("correction factor");
  hist->GetYaxis()->SetRangeUser(1, 1.8);
  hist->GetYaxis()->SetTitleOffset(1.6);
  hist->DrawCopy();

  canvas->cd(2);
  InitPad();

  Prepare1DPlot(hist2);
  hist2->SetTitle("");
  hist2->GetYaxis()->SetTitle("correction factor");
  hist2->GetXaxis()->SetRangeUser(0, 20);
  hist2->GetYaxis()->SetTitleOffset(1.6);
  hist2->GetXaxis()->SetTitle("multiplicity");
  hist2->Draw();

  TPaveText* pave = new TPaveText(0.6, 0.8, 0.8, 0.85, "NDC");
  pave->SetFillColor(0);
  pave->AddText("|z| < 10 cm");
  pave->Draw();

  canvas->SaveAs("VtxRecon1D.eps");

  Correction1DCreatePlots(fileName, folderName, 9.9, 2);

  TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject("generated_x_div_measured_x"));
  TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject("generated_z_div_measured_z"));

  Prepare1DPlot(corrX);
  Prepare1DPlot(corrZ);

  corrX->GetYaxis()->SetTitleOffset(1.5);
  corrZ->GetYaxis()->SetTitleOffset(1.5);

  corrX->SetTitle("a) z projection");
  corrZ->SetTitle("b) p_{T} projection");

  corrX->GetYaxis()->SetTitle("Correction factor");
  corrZ->GetYaxis()->SetTitle("Correction factor");

  corrZ->GetXaxis()->SetRangeUser(0.11, 9.9);

  TString canvasName;
  canvasName.Form("VtxRecon1D_Track");
  TCanvas* canvas = new TCanvas(canvasName, canvasName, 800, 400);
  canvas->Divide(2, 1);

  canvas->cd(1);
  InitPad();
  corrX->DrawCopy();

  canvas->cd(2);
  InitPad();
  gPad->SetLogx();
  corrZ->Draw();

  canvas->SaveAs("VtxRecon1D_Track.eps");
  canvas->SaveAs("VtxRecon1D_Track.gif");
}

void Track2ParticleAsNumber(const char* fileName = "correction_map.root")
{
  gSystem->Load("libPWG0base");

  TFile::Open(fileName);
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
  dNdEtaCorrection->LoadHistograms(fileName, "dndeta_correction");

  TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram();
  TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram();

  TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetGeneratedHistogram();
  TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetMeasuredHistogram();

  gene->GetYaxis()->SetRangeUser(-0.8, 0.8);
  meas->GetYaxis()->SetRangeUser(-0.8, 0.8);
  gene->GetXaxis()->SetRangeUser(-10, 10);
  meas->GetXaxis()->SetRangeUser(-10, 10);

  Float_t eff1 = gene->Integral() / meas->Integral();
  Float_t error1 = TMath::Sqrt(gene->Integral()) / meas->Integral();

  printf("Correction without pT cut: %f +- %f\n", eff1, error1);

  gene->GetZaxis()->SetRangeUser(0.3, 10);
  meas->GetZaxis()->SetRangeUser(0.3, 10);

  Float_t eff2 = gene->Integral() / meas->Integral();
  Float_t error2 = TMath::Sqrt(gene->Integral()) / meas->Integral();

  printf("Correction with pT cut: %f +- %f\n", eff2, error2);

  gene->GetZaxis()->SetRangeUser(0.3, 1);
  meas->GetZaxis()->SetRangeUser(0.3, 1);

  Float_t eff3 = gene->Integral() / meas->Integral();
  Float_t error3 = TMath::Sqrt(gene->Integral()) / meas->Integral();

  printf("Correction with 0.3 < pT < 0.5: %f +- %f\n", eff3, error3);
}

void Correction1DCreatePlots(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction", Float_t upperPtLimit = 9.9, Int_t correctionType = 0, Int_t correctionType2 = -1)
{
  if (correctionType2 == -1)
    correctionType2 = correctionType;

  TFile::Open(fileName);
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderName, folderName);
  dNdEtaCorrection->LoadHistograms();

  TH3F* gene = dNdEtaCorrection->GetCorrection(correctionType)->GetTrackCorrection()->GetGeneratedHistogram();
  TH3F* meas = dNdEtaCorrection->GetCorrection(correctionType2)->GetTrackCorrection()->GetMeasuredHistogram();

  gene->GetZaxis()->SetRangeUser(0.3, upperPtLimit);
  meas->GetZaxis()->SetRangeUser(0.3, upperPtLimit);
  gene->GetYaxis()->SetRangeUser(-0.8, 0.8);
  meas->GetYaxis()->SetRangeUser(-0.8, 0.8);
  AliPWG0Helper::CreateDividedProjections(gene, meas, "x", kFALSE);
  gene->GetYaxis()->SetRange(0, 0);
  meas->GetYaxis()->SetRange(0, 0);

  gene->GetXaxis()->SetRangeUser(-9.9, 9.9);
  meas->GetXaxis()->SetRangeUser(-9.9, 9.9);
  AliPWG0Helper::CreateDividedProjections(gene, meas, "y", kFALSE);
  gene->GetZaxis()->SetRange(0, 0);
  meas->GetZaxis()->SetRange(0, 0);

  gene->GetYaxis()->SetRangeUser(-0.8, 0.8);
  meas->GetYaxis()->SetRangeUser(-0.8, 0.8);
  AliPWG0Helper::CreateDividedProjections(gene, meas, "z", kFALSE);
}

TCanvas* Correction1D(Int_t correctionType = 0, const char* fileName = "correction_map.root", const char* folder = "dndeta_correction", Float_t upperPtLimit = 9.9, Int_t correctionType2 = -1)
{
  gSystem->Load("libPWG0base");

  Correction1DCreatePlots(fileName, folder, upperPtLimit, correctionType, correctionType2);

  TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_x_div_measured_x", folder, folder)));
  TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_y_div_measured_y", folder, folder)));
  TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_z_div_measured_z", folder, folder)));

  Prepare1DPlot(corrX);
  Prepare1DPlot(corrY);
  Prepare1DPlot(corrZ);

  /*
  corrX->SetTitle("a) z projection");
  corrY->SetTitle("b) #eta projection");
  corrZ->SetTitle("c) p_{T} projection");
  */
  
  corrX->SetTitle("");
  corrY->SetTitle("");
  corrZ->SetTitle("");

  corrX->SetTitleSize(0.06, "xyz");
  corrX->SetLabelSize(0.06, "xyz");
  corrY->SetTitleSize(0.06, "xyz");
  corrY->SetLabelSize(0.06, "xyz");
  corrZ->SetTitleSize(0.06, "xyz");
  corrZ->SetLabelSize(0.06, "xyz");

  corrX->GetYaxis()->SetTitle("Correction factor");
  corrY->GetYaxis()->SetTitle("Correction factor");
  corrZ->GetYaxis()->SetTitle("Correction factor");
  //corrX->GetYaxis()->SetTitleOffset(1.7);
  //corrY->GetYaxis()->SetTitleOffset(1.7);
  //corrZ->GetYaxis()->SetTitleOffset(1.7);
  corrX->GetYaxis()->SetRangeUser(0.8, 1.5);
  corrY->GetYaxis()->SetRangeUser(0.8, 1.5);
  corrZ->GetYaxis()->SetRangeUser(0.8, 1.5);

  corrZ->GetXaxis()->SetRangeUser(0.11, upperPtLimit);

  TString canvasName;
  canvasName.Form(Form("Correction1D_%d_%s_%f", correctionType, fileName, upperPtLimit));
  TCanvas* canvas = new TCanvas(canvasName, canvasName, 1200, 400);
  canvas->Divide(3, 1);

  TLatex* Tl = new TLatex;
  Tl->SetTextSize(0.06);
  Tl->SetBit(TLatex::kTextNDC);

  canvas->cd(1);
  InitPad();
  gPad->SetTopMargin(0.05);
  gPad->SetBottomMargin(0.15);
  corrX->DrawCopy();
  Tl->DrawLatex(0.5, 0.88, "0.3 < p_{T} < 10");
  Tl->DrawLatex(0.5, 0.8, "|#eta| < 0.8");

  canvas->cd(2);
  InitPad();
  gPad->SetTopMargin(0.05);
  gPad->SetBottomMargin(0.15);
  corrY->Draw();
  Tl->DrawLatex(0.5, 0.88, "0.3 < p_{T} < 10");
  Tl->DrawLatex(0.5, 0.8, "|vtx-z| < 10 cm");

  canvas->cd(3);
  InitPad();
  gPad->SetTopMargin(0.05);
  gPad->SetBottomMargin(0.15);
  gPad->SetLogx();
  corrZ->Draw();
  corrZ->GetXaxis()->SetLabelOffset(0.005);
  corrZ->GetXaxis()->SetTitleOffset(1.2);
  Tl->DrawLatex(0.5, 0.88, "|vtx-z| < 10 cm");
  Tl->DrawLatex(0.5, 0.8, "|#eta| < 0.8");

  return canvas;
}

void Track2Particle1D(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction", Float_t upperPtLimit = 9.9)
{
  gSystem->Load("libPWG0base");

  Correction1DCreatePlots(fileName, folder, upperPtLimit, AlidNdEtaCorrection::kTrack2Particle);

  TH1* corrX = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_x_div_measured_x", folder, folder)));
  TH1* corrY = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_y_div_measured_y", folder, folder)));
  TH1* corrZ = dynamic_cast<TH1*> (gROOT->FindObject(Form("generated_z_div_measured_z", folder, folder)));

  Prepare1DPlot(corrX);
  Prepare1DPlot(corrY);
  Prepare1DPlot(corrZ);

  corrX->SetTitle("a) z projection");
  corrY->SetTitle("a) #eta projection");
  corrZ->SetTitle("b) p_{T} projection");

  corrY->GetYaxis()->SetTitle("correction factor");
  corrZ->GetYaxis()->SetTitle("correction factor");

  corrZ->GetXaxis()->SetRangeUser(0, upperPtLimit);

  TString canvasName;
  canvasName.Form("Track2Particle1D_%s", folder);
  TCanvas* canvas = new TCanvas(canvasName, canvasName, 1200, 400);
  canvas->Divide(3, 1);

  canvas->cd(1);
  InitPad();
  corrX->DrawCopy();

  canvas->cd(2);
  InitPad();
  corrY->Draw();

  canvas->cd(3);
  InitPad();
  corrZ->Draw();

  canvas->SaveAs(Form("Track2Particle1D_%s_%f.gif", fileName, upperPtLimit));
  canvas->SaveAs(Form("Track2Particle1D_%s_%f.eps", fileName, upperPtLimit));

  //TPaveText* pave = new TPaveText(-0.4, 1.35, 0.4, 1.45);

  canvasName.Form("Track2Particle1D_%s_etapt", folder);
  TCanvas* canvas = new TCanvas(canvasName, canvasName, 1000, 500);
  canvas->Divide(2, 1);

  canvas->cd(1);
  InitPad();
  corrY->GetXaxis()->SetRangeUser(-0.99, 0.99);
  corrY->GetYaxis()->SetRangeUser(1, 1.5);
  corrY->GetYaxis()->SetTitleOffset(1.5);
  corrY->DrawCopy();
  TPaveText* pave = new TPaveText(0.3, 0.7, 0.7, 0.8, "NDC");
  pave->AddText("|z| < 10 cm");
  pave->AddText("0.3 GeV/c < p_{T} < 10 GeV/c");
  pave->Draw();

  canvas->cd(2);
  InitPad();
  gPad->SetLogx();
  corrZ->GetYaxis()->SetRangeUser(1, 2.5);
  corrZ->GetXaxis()->SetRangeUser(0.101, upperPtLimit);
  corrZ->GetYaxis()->SetTitleOffset(1.5);
  corrZ->DrawCopy();
  pave = new TPaveText(0.5, 0.7, 0.8, 0.8, "NDC");
  pave->AddText("|z| < 10 cm");
  pave->AddText("|#eta| < 0.8");
  pave->Draw();

  canvas->SaveAs(Form("Track2Particle1D_etapt_%s_%f.eps", fileName, upperPtLimit));
  canvas->SaveAs(Form("Track2Particle1D_etapt_%s_%f.gif", fileName, upperPtLimit));
}

/*
void CompareTrack2Particle1D(Float_t upperPtLimit = 9.9)
{
  gSystem->Load("libPWG0base");

  // particle type
  for (Int_t particle=0; particle<4; ++particle)
  {
    TString dirName;
    dirName.Form("correction_%d", particle);
    Track2Particle1DCreatePlots("systematics-detail-only-positive.root", dirName, upperPtLimit);

    TString tmpx, tmpy, tmpz;
    tmpx.Form("gene_%s_nTrackToNPart_x_div_meas_%s_nTrackToNPart_x", dirName.Data(), dirName.Data());
    tmpy.Form("gene_%s_nTrackToNPart_y_div_meas_%s_nTrackToNPart_y", dirName.Data(), dirName.Data());
    tmpz.Form("gene_%s_nTrackToNPart_z_div_meas_%s_nTrackToNPart_z", dirName.Data(), dirName.Data());

    TH1* posX = dynamic_cast<TH1*> (gROOT->FindObject(tmpx)->Clone("pos_x"));
    TH1* posY = dynamic_cast<TH1*> (gROOT->FindObject(tmpy)->Clone("pos_y"));
    TH1* posZ = dynamic_cast<TH1*> (gROOT->FindObject(tmpz)->Clone("pos_z"));

    Track2Particle1DCreatePlots("systematics-detail-only-negative.root", dirName, upperPtLimit);

    TH1* negX = dynamic_cast<TH1*> (gROOT->FindObject(tmpx)->Clone("neg_x"));
    TH1* negY = dynamic_cast<TH1*> (gROOT->FindObject(tmpy)->Clone("neg_y"));
    TH1* negZ = dynamic_cast<TH1*> (gROOT->FindObject(tmpz)->Clone("neg_z"));

    posX->Divide(negX);
    posY->Divide(negY);
    posZ->Divide(negZ);

    Prepare1DPlot(posX);
    Prepare1DPlot(posY);
    Prepare1DPlot(posZ);

    Float_t min = 0.8;
    Float_t max = 1.2;

    posX->SetMinimum(min);
    posX->SetMaximum(max);
    posY->SetMinimum(min);
    posY->SetMaximum(max);
    posZ->SetMinimum(min);
    posZ->SetMaximum(max);

    posZ->GetXaxis()->SetRangeUser(0, upperPtLimit);

    posX->GetYaxis()->SetTitleOffset(1.7);
    posX->GetYaxis()->SetTitle("C_{+} / C_{-}");
    posY->GetYaxis()->SetTitleOffset(1.7);
    posY->GetYaxis()->SetTitle("C_{+} / C_{-}");
    posZ->GetYaxis()->SetTitleOffset(1.7);
    posZ->GetYaxis()->SetTitle("C_{+} / C_{-}");

    posZ->GetXaxis()->SetRangeUser(0, 1);

    TString canvasName;
    canvasName.Form("PosNegRatios_%s_%f", ((particle == 0) ? "Pi" : ((particle == 1) ? "K" : ((particle == 2) ? "p" : "other"))), upperPtLimit);

    TCanvas* canvas = new TCanvas(canvasName, canvasName, 1200, 400);
    canvas->Divide(3, 1);

    canvas->cd(1);
    InitPad();
    posX->DrawCopy();

    canvas->cd(2);
    InitPad();
    posY->DrawCopy();

    canvas->cd(3);
    InitPad();
    posZ->DrawCopy();

    canvas->SaveAs(Form("%s.gif", canvas->GetName()));
    canvas->SaveAs(Form("%s.eps", canvas->GetName()));
  }
}
*/

void CompareTrack2Particle1D(const char* file1, const char* file2, Float_t upperPtLimit = 9.9)
{
  loadlibs();

  const char* folderName = "dndeta_correction";

  c = new TCanvas("CompareTrack2Particle1D", "CompareTrack2Particle1D", 1200, 400);
  c->Divide(3, 1);

  for (Int_t fileId = 0; fileId < 2; fileId++)
  {
    const char* file = ((fileId == 0) ? file1 : file2);
    Correction1DCreatePlots(file, folderName, upperPtLimit, 1);

    TH1* corr[3];
    corr[0] = dynamic_cast<TH1*> (gROOT->FindObject("generated_x_div_measured_x"));
    corr[1] = dynamic_cast<TH1*> (gROOT->FindObject("generated_y_div_measured_y"));
    corr[2] = dynamic_cast<TH1*> (gROOT->FindObject("generated_z_div_measured_z"));
    /*corr[0] = dynamic_cast<TH1*> (gROOT->FindObject("generated_x"))->Clone(Form("hist_x_%d", fileId));
    corr[1] = dynamic_cast<TH1*> (gROOT->FindObject("generated_y"))->Clone(Form("hist_y_%d", fileId));
    corr[2] = dynamic_cast<TH1*> (gROOT->FindObject("generated_z"))->Clone(Form("hist_z_%d", fileId));*/

    for (Int_t i=0; i<3; i++)
    {
      c->cd(i+1);
      InitPad();
      corr[i]->GetYaxis()->SetRangeUser(0.8, 2);
      corr[i]->SetLineColor(fileId+1);
      corr[i]->DrawCopy((fileId == 0) ? "" : "SAME");
    }
  }

  return;

  c->SaveAs(Form("%s.gif", canvas->GetName()));
  c->SaveAs(Form("%s.eps", canvas->GetName()));
}

void Track2Particle2DCreatePlots(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction")
{
  TFile::Open(fileName);
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folder, folder);
  dNdEtaCorrection->LoadHistograms();

  TH3F* gene = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram();
  TH3F* meas = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram();

  gene->GetZaxis()->SetRangeUser(0.2, 10);
  meas->GetZaxis()->SetRangeUser(0.2, 10);
  AliPWG0Helper::CreateDividedProjections(gene, meas, "yx");
  gene->GetZaxis()->SetRange(0, 0);
  meas->GetZaxis()->SetRange(0, 0);

  gene->GetYaxis()->SetRangeUser(-0.8, 0.8);
  meas->GetYaxis()->SetRangeUser(-0.8, 0.8);
  AliPWG0Helper::CreateDividedProjections(gene, meas, "zx");
  gene->GetYaxis()->SetRange(0, 0);
  meas->GetYaxis()->SetRange(0, 0);

  gene->GetXaxis()->SetRangeUser(-10, 10);
  meas->GetXaxis()->SetRangeUser(-10, 10);
  AliPWG0Helper::CreateDividedProjections(gene, meas, "zy");
  gene->GetXaxis()->SetRange(0, 0);
  meas->GetXaxis()->SetRange(0, 0);
}

TCanvas* Track2Particle2D(const char* fileName = "correction_map.root", const char* folder = "dndeta_correction")
{
  gSystem->Load("libPWG0base");

  Track2Particle2DCreatePlots(fileName, folder);

  TH2* corrYX = dynamic_cast<TH2*> (gROOT->FindObject("generated_yx_div_measured_yx"));
  TH2* corrZX = dynamic_cast<TH2*> (gROOT->FindObject("generated_zx_div_measured_zx"));
  TH2* corrZY = dynamic_cast<TH2*> (gROOT->FindObject("generated_zy_div_measured_zy"));

  Prepare2DPlot(corrYX);
  Prepare2DPlot(corrZX);
  Prepare2DPlot(corrZY);

  const char* title = "";
  corrYX->SetTitle(title);
  corrZX->SetTitle(title);
  corrZY->SetTitle(title);

  TCanvas* canvas = new TCanvas("Track2Particle2D", "Track2Particle2D", 1200, 400);
  canvas->Divide(3, 1);

  canvas->cd(1);
  InitPadCOLZ();
  corrYX->Draw("COLZ");

  canvas->cd(2);
  InitPadCOLZ();
  corrZX->Draw("COLZ");

  canvas->cd(3);
  InitPadCOLZ();
  corrZY->Draw("COLZ");

  canvas->SaveAs(Form("corr_track2particle_%d.gif", gMax));
  canvas->SaveAs(Form("corr_track2particle_%d.eps", gMax));

  return canvas;
}

void CompareTrack2Particle2D()
{
  gSystem->Load("libPWG0base");

  Track2Particle2DCreatePlots("correction_maponly-positive.root");

  TH2* posYX = dynamic_cast<TH2*> (gROOT->FindObject("generated_yx_div_measured_yx")->Clone("pos_yx"));
  TH2* posZX = dynamic_cast<TH2*> (gROOT->FindObject("generated_zx_div_measured_zx")->Clone("pos_zx"));
  TH2* posZY = dynamic_cast<TH2*> (gROOT->FindObject("generated_zy_div_measured_zy")->Clone("pos_zy"));

  Track2Particle2DCreatePlots("correction_maponly-negative.root");

  TH2* negYX = dynamic_cast<TH2*> (gROOT->FindObject("generated_yx_div_measured_yx")->Clone("neg_yx"));
  TH2* negZX = dynamic_cast<TH2*> (gROOT->FindObject("generated_zx_div_measured_zx")->Clone("neg_zx"));
  TH2* negZY = dynamic_cast<TH2*> (gROOT->FindObject("generated_zy_div_measured_zy")->Clone("neg_zy"));

  posYX->Divide(negYX);
  posZX->Divide(negZX);
  posZY->Divide(negZY);

  Prepare2DPlot(posYX);
  Prepare2DPlot(posZX);
  Prepare2DPlot(posZY);

  Float_t min = 0.8;
  Float_t max = 1.2;

  posYX->SetMinimum(min);
  posYX->SetMaximum(max);
  posZX->SetMinimum(min);
  posZX->SetMaximum(max);
  posZY->SetMinimum(min);
  posZY->SetMaximum(max);

  TCanvas* canvas = new TCanvas("CompareTrack2Particle2D", "CompareTrack2Particle2D", 1200, 400);
  canvas->Divide(3, 1);

  canvas->cd(1);
  InitPadCOLZ();
  posYX->Draw("COLZ");

  canvas->cd(2);
  InitPadCOLZ();
  posZX->Draw("COLZ");

  canvas->cd(3);
  InitPadCOLZ();
  posZY->Draw("COLZ");

  canvas->SaveAs("CompareTrack2Particle2D.gif");
  canvas->SaveAs("CompareTrack2Particle2D.eps");
}

void Track2Particle3D()
{
  // get left margin proper

  TFile* file = TFile::Open("correction_map.root");

  TH3* corr = dynamic_cast<TH3*> (file->Get("dndeta_correction/corr_nTrackToNPart"));

  corr->SetTitle("Correction Factor");
  SetRanges(corr->GetZaxis());

  Prepare3DPlot(corr);

  TCanvas* canvas = new TCanvas("Track2Particle3D", "Track2Particle3D", 500, 500);
  canvas->SetTheta(29.428);
  canvas->SetPhi(16.5726);

  corr->Draw();

  canvas->SaveAs("Track2Particle3D.gif");
  canvas->SaveAs("Track2Particle3D.eps");
}

void Track2Particle3DAll()
{
  TFile* file = TFile::Open("correction_map.root");

  TH3* gene = dynamic_cast<TH3*> (file->Get("dndeta_correction/gene_nTrackToNPart"));
  TH3* meas = dynamic_cast<TH3*> (file->Get("dndeta_correction/meas_nTrackToNPart"));
  TH3* corr = dynamic_cast<TH3*> (file->Get("dndeta_correction/corr_nTrackToNPart"));

  gene->SetTitle("Generated Particles");
  meas->SetTitle("Measured Tracks");
  corr->SetTitle("Correction Factor");

  Prepare3DPlot(gene);
  Prepare3DPlot(meas);
  Prepare3DPlot(corr);

  TCanvas* canvas = new TCanvas("Track2Particle3DAll", "Track2Particle3DAll", 1200, 400);
  canvas->Divide(3, 1);

  canvas->cd(1);
  InitPad();
  gene->Draw();

  canvas->cd(2);
  meas->Draw();

  canvas->cd(3);
  corr->Draw();

  canvas->SaveAs("Track2Particle3DAll.gif");
  canvas->SaveAs("Track2Particle3DAll.eps");
}

void MultiplicityMC(Int_t xRangeMax = 50)
{
  TFile* file = TFile::Open("multiplicityMC.root");

  if (!file)
  {
    printf("multiplicityMC.root could not be opened.\n");
    return;
  }

  TH1F* fMultiplicityESD = dynamic_cast<TH1F*> (file->Get("fMultiplicityESD"));
  TH1F* fMultiplicityMC = dynamic_cast<TH1F*> (file->Get("fMultiplicityMC"));
  TH2F* fCorrelation = dynamic_cast<TH2F*> (file->Get("fCorrelation"));

  TH1F* correction = new TH1F("MultiplicityMC_correction", "MultiplicityMC_correction;Ntracks;Npart", 76, -0.5, 75.5);
  TH1F* correctionWidth = new TH1F("MultiplicityMC_correctionwidth", "MultiplicityMC_correctionwidth;Ntracks;Npart", 76, -0.5, 75.5);
  //fMultiplicityMC->GetNbinsX(), fMultiplicityMC->GetXaxis()->GetXmin(), fMultiplicityMC->GetXaxis()->GetXmax());
  for (Int_t i=1; i<=correction->GetNbinsX(); ++i)
  {
    TH1D* proj = fCorrelation->ProjectionX("_px", i, i+1);
    proj->Fit("gaus", "0");
    correction->SetBinContent(i, proj->GetFunction("gaus")->GetParameter(1));
    correctionWidth->SetBinContent(i, proj->GetFunction("gaus")->GetParameter(2));

    continue;

    // draw for debugging
    new TCanvas;
    proj->DrawCopy();
    proj->GetFunction("gaus")->DrawCopy("SAME");
  }

  TH1F* fMultiplicityESDCorrected = new TH1F("fMultiplicityESDCorrected", "fMultiplicityESDCorrected", 2010, -0.5, 200.5);

  for (Int_t i=1; i<=correction->GetNbinsX(); ++i)
  {
    Float_t mean = correction->GetBinContent(i);
    Float_t width = correctionWidth->GetBinContent(i);

    Int_t fillBegin = fMultiplicityESDCorrected->FindBin(mean - width * 3);
    Int_t fillEnd   = fMultiplicityESDCorrected->FindBin(mean + width * 3);
    printf("bin %d mean %f width %f, filling from %d to %d\n", i, mean, width, fillBegin, fillEnd);

    for (Int_t j=fillBegin; j <= fillEnd; ++j)
    {
      fMultiplicityESDCorrected->AddBinContent(j, TMath::Gaus(fMultiplicityESDCorrected->GetXaxis()->GetBinCenter(j), mean, width, kTRUE) * fMultiplicityESD->GetBinContent(i));
    }
  }

  TH1F* fMultiplicityESDCorrectedRebinned = dynamic_cast<TH1F*> (fMultiplicityESDCorrected->Clone("fMultiplicityESDCorrectedRebinned"));
  fMultiplicityESDCorrectedRebinned->Rebin(10);
  fMultiplicityESDCorrectedRebinned->Scale(0.1);

  TH1F* ratio = dynamic_cast<TH1F*> (fMultiplicityESD->Clone("multiplicity_ratio"));
  ratio->SetTitle("ratio;Ntracks;Nreco/Ngene");
  ratio->Divide(fMultiplicityMC);

  TH1F* ratio2 = dynamic_cast<TH1F*> (fMultiplicityESDCorrectedRebinned->Clone("multiplicity_ratio_corrected"));
  ratio2->Divide(fMultiplicityMC);

  TCanvas* canvas = new TCanvas("MultiplicityMC", "MultiplicityMC", 1500, 1000);
  canvas->Divide(3, 2);

  fMultiplicityESD->GetXaxis()->SetRangeUser(0, xRangeMax);
  ratio->GetXaxis()->SetRangeUser(0, xRangeMax);
  fCorrelation->GetXaxis()->SetRangeUser(0, xRangeMax);
  fCorrelation->GetYaxis()->SetRangeUser(0, xRangeMax);
  correction->GetXaxis()->SetRangeUser(0, xRangeMax);
  fMultiplicityESDCorrected->GetXaxis()->SetRangeUser(0, xRangeMax);
  fMultiplicityESDCorrectedRebinned->GetXaxis()->SetRangeUser(0, xRangeMax);

  canvas->cd(1); //InitPad();
  fMultiplicityESD->Draw();
  fMultiplicityMC->SetLineColor(2);
  fMultiplicityMC->Draw("SAME");

  TLegend* legend = new TLegend(0.6, 0.7, 0.85, 0.85);
  legend->AddEntry(fMultiplicityESD, "ESD");
  legend->AddEntry(fMultiplicityMC, "MC");
  legend->Draw();

  canvas->cd(2);
  fCorrelation->Draw("COLZ");

  canvas->cd(3);
  correction->Draw();
  //correction->Fit("pol1");
  correctionWidth->SetLineColor(2);
  correctionWidth->Draw("SAME");

  legend = new TLegend(0.2, 0.7, 0.45, 0.85);
  legend->AddEntry(correction, "#bar{x}");
  legend->AddEntry(correctionWidth, "#sigma");
  legend->Draw();

  canvas->cd(4);
  ratio->Draw();

  ratio2->SetLineColor(2);
  ratio2->Draw("SAME");

  legend = new TLegend(0.6, 0.7, 0.85, 0.85);
  legend->AddEntry(ratio, "uncorrected");
  legend->AddEntry(ratio2, "corrected");
  legend->Draw();

  canvas->cd(5);
  fMultiplicityESDCorrected->SetLineColor(kBlue);
  fMultiplicityESDCorrected->Draw();
  fMultiplicityMC->Draw("SAME");
  fMultiplicityESD->Draw("SAME");

  legend = new TLegend(0.6, 0.7, 0.85, 0.85);
  legend->AddEntry(fMultiplicityESDCorrected, "ESD corrected");
  legend->AddEntry(fMultiplicityMC, "MC");
  legend->AddEntry(fMultiplicityESD, "ESD");
  legend->Draw();

  canvas->cd(6);
  fMultiplicityESDCorrectedRebinned->SetLineColor(kBlue);
  fMultiplicityESDCorrectedRebinned->Draw();
  fMultiplicityMC->Draw("SAME");

  legend = new TLegend(0.6, 0.7, 0.85, 0.85);
  legend->AddEntry(fMultiplicityESDCorrectedRebinned, "ESD corrected");
  legend->AddEntry(fMultiplicityMC, "MC");
  legend->Draw();

  canvas->SaveAs("MultiplicityMC.gif");
}

void MultiplicityESD()
{
  TFile* file = TFile::Open("multiplicityESD.root");

  if (!file)
  {
    printf("multiplicityESD.root could not be opened.\n");
    return;
  }

  TH1F* fMultiplicityESD = dynamic_cast<TH1F*> (file->Get("fMultiplicity"));

  TCanvas* canvas = new TCanvas("MultiplicityESD", "MultiplicityESD", 500, 500);

  fMultiplicityESD->Draw();
}

void CompareCorrection2Measured(Float_t ptMin = 0.301, const char* dataInput = "analysis_esd_raw.root", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
{
  loadlibs();

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
  TFile::Open(correctionMapFile);
  dNdEtaCorrection->LoadHistograms();

  TFile* file = TFile::Open(dataInput);

  if (!file)
  {
    cout << "Error. File not found" << endl;
    return;
  }

  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
  fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");

  gROOT->cd();
  
  TH3* hist1 = (TH3*) dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("mc");
  hist1->SetTitle("mc");
  Printf("mc contains %f entries", hist1->Integral());
  Printf("mc contains %f entries in |vtx-z| < 10, |eta| < 1, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), hist1->GetYaxis()->FindBin(-0.99), hist1->GetYaxis()->FindBin(0.99), hist1->GetZaxis()->FindBin(ptMin), hist1->GetNbinsZ()));

  TH3* hist2 = (TH3*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("esd");
  hist2->SetTitle("esd");
  Printf("esd contains %f entries", hist2->Integral());
  Printf("esd contains %f entries in |vtx-z| < 10, |eta| < 1, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), hist2->GetYaxis()->FindBin(-0.99), hist2->GetYaxis()->FindBin(0.99), hist2->GetZaxis()->FindBin(ptMin), hist2->GetNbinsZ()));

  AliPWG0Helper::CreateDividedProjections(hist1, hist2);
  AliPWG0Helper::CreateDividedProjections(hist1, hist2, "x");

  hist1->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10));
  hist2->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10));
  AliPWG0Helper::CreateDividedProjections(hist1, hist2, "y");

  new TCanvas; gROOT->FindObject("mc_yx_div_esd_yx")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("mc_zx_div_esd_zx")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("mc_zy_div_esd_zy")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("mc_x_div_esd_x")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("mc_y_div_esd_y")->Draw("COLZ");

  TH2* hist3 = (TH2*) dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->GetMeasuredHistogram()->Clone("mc2");
  hist3->SetTitle("mc2");
  Printf("mc event contains %f entries", hist3->Integral());
  Printf("mc event contains %f entries in |vtx-z| < 10", hist3->Integral(hist3->GetXaxis()->FindBin(-9.9), hist3->GetXaxis()->FindBin(9.9), 1, hist3->GetNbinsY()));

  TH2* hist4 = (TH2*) fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram()->Clone("esd2");
  hist4->SetTitle("esd2");
  Printf("esd event contains %f entries", hist4->Integral());
  Printf("esd event contains %f entries in |vtx-z| < 10", hist4->Integral(hist4->GetXaxis()->FindBin(-9.9), hist4->GetXaxis()->FindBin(9.9), 1, hist4->GetNbinsY()));
  
  ratio = (TH2*) hist3->Clone("ratio");
  ratio->Divide(hist4);
  
  new TCanvas; ratio->Draw("COLZ");
}

void CompareCorrection2Generated(Float_t ptMin = 0.301, const char* dataInput = "analysis_mc.root", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
{
  loadlibs();

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
  TFile::Open(correctionMapFile);
  dNdEtaCorrection->LoadHistograms();

  TFile* file = TFile::Open(dataInput);

  if (!file)
  {
    cout << "Error. File not found" << endl;
    return;
  }

  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx");
  fdNdEtaAnalysis->LoadHistograms("dndetaTrVtx");

  gROOT->cd();
  
  TH3* hist1 = (TH3*) dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram()->Clone("mc");
  hist1->SetTitle("mc");
  Printf("mc contains %f entries", hist1->Integral());
  Printf("mc contains %f entries in |vtx-z| < 10, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), hist1->GetYaxis()->FindBin(-0.99), hist1->GetYaxis()->FindBin(0.99), hist1->GetZaxis()->FindBin(ptMin), hist1->GetNbinsZ()));

  TH3* hist2 = (TH3*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram()->Clone("esd");
  hist2->SetTitle("esd");
  Printf("esd contains %f entries", hist2->Integral());
  Printf("esd contains %f entries in |vtx-z| < 10, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), hist2->GetYaxis()->FindBin(-0.99), hist2->GetYaxis()->FindBin(0.99), hist2->GetZaxis()->FindBin(ptMin), hist2->GetNbinsZ()));

  AliPWG0Helper::CreateDividedProjections(hist1, hist2);
  AliPWG0Helper::CreateDividedProjections(hist1, hist2, "x");

  hist1->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10));
  hist2->GetXaxis()->SetRange(hist1->GetXaxis()->FindBin(-10), hist2->GetXaxis()->FindBin(10));
  AliPWG0Helper::CreateDividedProjections(hist1, hist2, "y");

  new TCanvas; gROOT->FindObject("mc_yx_div_esd_yx")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("mc_zx_div_esd_zx")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("mc_zy_div_esd_zy")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("mc_x_div_esd_x")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("mc_y_div_esd_y")->Draw("COLZ");
}

void CompareMeasured2Measured(const char* dataInput = "analysis_esd_raw.root", const char* dataInput2 = "analysis_esd_raw.root")
{
  loadlibs();

  TFile* file = TFile::Open(dataInput);

  if (!file)
  {
    cout << "Error. File not found" << endl;
    return;
  }

  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
  fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");

  TFile* file = TFile::Open(dataInput2);

  if (!file)
  {
    cout << "Error. File not found" << endl;
    return;
  }

  dNdEtaAnalysis* fdNdEtaAnalysis2 = new dNdEtaAnalysis("dndeta2", "dndeta2");
  fdNdEtaAnalysis2->LoadHistograms("fdNdEtaAnalysisESD");

  gROOT->cd();

  TH3* hist1 = (TH3*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("esd1");
  hist1->SetTitle("esd1");
  Printf("esd1 contains %f entries", hist1->GetEntries());
  Printf("esd1 contains %f entries in |vtx-z| < 10, pt > 0.3", hist1->Integral(hist1->GetXaxis()->FindBin(-9.9), hist1->GetXaxis()->FindBin(9.9), 1, hist1->GetNbinsY(), hist1->GetZaxis()->FindBin(0.301), hist1->GetNbinsZ()));

  TH3* hist2 = (TH3*) fdNdEtaAnalysis2->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Clone("esd2");
  hist2->SetTitle("esd2");
  Printf("esd2 contains %f entries", hist2->GetEntries());
  Printf("esd2 contains %f entries in |vtx-z| < 10, pt > 0.3", hist2->Integral(hist2->GetXaxis()->FindBin(-9.9), hist2->GetXaxis()->FindBin(9.9), 1, hist2->GetNbinsY(), hist2->GetZaxis()->FindBin(0.301), hist2->GetNbinsZ()));

  AliPWG0Helper::CreateDividedProjections(hist1, hist2);

  new TCanvas; gROOT->FindObject("esd1_yx_div_esd2_yx")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("esd1_zx_div_esd2_zx")->Draw("COLZ");
  new TCanvas; gROOT->FindObject("esd1_zy_div_esd2_zy")->Draw("COLZ");

  TH2* event1 = (TH2*) fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram()->Clone("event1");
  TH2* event2 = (TH2*) fdNdEtaAnalysis2->GetData()->GetEventCorrection()->GetMeasuredHistogram()->Clone("event2");

  Printf("event1 contains %f entries", event1->GetEntries());
  Printf("event2 contains %f entries", event2->GetEntries());
  Printf("event1 integral is %f", event1->Integral());
  Printf("event2 integral is %f", event2->Integral());
  Printf("event1 contains %f entries in |vtx-z| < 10", event1->Integral(event1->GetXaxis()->FindBin(-9.9), event1->GetXaxis()->FindBin(9.9), 1, event1->GetNbinsY()));
  Printf("event2 contains %f entries in |vtx-z| < 10", event2->Integral(event2->GetXaxis()->FindBin(-9.9), event2->GetXaxis()->FindBin(9.9), 1, event2->GetNbinsY()));

  projx1 = event1->ProjectionX();
  projx2 = event2->ProjectionX();

  new TCanvas; projx1->DrawCopy(); projx2->SetLineColor(2); projx2->DrawCopy("SAME");

  projx1->Divide(projx2);
  new TCanvas; projx1->Draw();

  event1->Divide(event2);
  new TCanvas; event1->Draw("COLZ");

}

void DrawTrackletOrigin(const char* fileName = "correction_map.root", Bool_t myFile = kTRUE)
{
  TFile::Open(fileName);

  Int_t maxHists = 8;
  TH1* hist[8];
  
  const Int_t kRebin = 8;

  const char* titles[] = { "PP", "SS", "PP'", "PS'", "PS", "SP'", "SS'", "" };

  if (myFile)
  {
    for (Int_t i=0; i<maxHists; i++)
    {
      hist[i] = (TH1*) gFile->Get(Form("fDeltaPhi_%d", i));
      if (hist[i]->GetDimension() == 2)
        hist[i] = ((TH2*) hist[i])->ProjectionX(Form("fDeltaPhi_clone_%d", i));
    }
  }
  else
  {
    maxHists = 6;
    const char* names[] = { "DePhiPPTracklets", "DePhiSecTracklets", "DePhiPpTracklets", "DePhiPSTracklets", "DePhiPSdaugTracklets", "DePhiSPTracklets" }; 
    for (Int_t i=0; i<maxHists; i++)
      hist[i] = (TH1*) gFile->Get(names[i]);
  }
  
  // clone before rebinning
  good = (TH1*) hist[0]->Clone("good");
  good->Add(hist[4]);
  
  bad = (TH1*) hist[1]->Clone("bad");
  bad->Add(hist[2]);
  bad->Add(hist[3]);
  bad->Add(hist[5]);
  if (myFile)
    bad->Add(hist[6]);
  
  c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c");
  TH1* ref = 0;
  Bool_t nw = kFALSE;
  if (!c)
  {
    c = new TCanvas("c", "c", 600, 600);
    nw = kTRUE;
    ref = (TH1*) c->GetListOfPrimitives()->At(1);
  }  
  c->cd();
  c->SetRightMargin(0.05);
  c->SetTopMargin(0.05);
  c->SetLogy();
  c->SetGridx();
  c->SetGridy();
  
  Int_t order[] = { 0, 4, 1, 2, 3, 5, 6, 7 };
  //Int_t colors[]  = {1,2,4,1,2,4,1,2,4};
  Int_t colors[]  = {1,2,3,4,6,7,8,102};
  Int_t markers[]  = {20, 21, 22, 23, 24, 25, 26, 27, 28};
  
  TLegend* legend = new TLegend(0.75, 0.6, 0.93, 0.93);
  legend->SetFillColor(0);
  legend->SetTextSize(0.04);

  Int_t total = 0;
  for (Int_t ii=0; ii<maxHists; ii++)
  {
    i = order[ii];
    
    hist[i]->Rebin(kRebin);
    hist[i]->SetStats(kFALSE);
    hist[i]->SetLineColor(colors[i]);
    hist[i]->SetLineWidth(2);
    //hist[i]->SetMarkerStyle(markers[i]);
    //hist[i]->SetMarkerColor(colors[i]);
    //hist[i]->SetLineStyle(ii+1);
    hist[i]->GetXaxis()->SetRangeUser(-0.09, 0.09);
    hist[i]->GetYaxis()->SetRangeUser(5, hist[i]->GetMaximum() * 2);
    hist[i]->GetYaxis()->SetTitleOffset(1.3);
    hist[i]->GetXaxis()->SetTitle("#Delta#varphi (rad.)");
    
    if (i == 0 && ref)
      hist[i]->Scale(1.0 / hist[i]->GetMaximum() * ref->GetMaximum());
    
    hist[i]->DrawCopy(((i == 0 && nw) ? "" : "SAME"));

    total += hist[i]->GetEntries();

    if (i != 7)
      legend->AddEntry(hist[i], titles[i], "L");
  }

  legend->Draw();
  c->SaveAs("spd_tracklets_deltaphi_detailed.eps");

  Printf("Total: %d", total);
  for (Int_t i=0; i<maxHists; i++)
    Printf("Histogram %d (%s) contains %.2f %% of the entries", i, titles[i], 100.0 * hist[i]->GetEntries() / total);

  printf("|  Delta phi  |  Acc. %%  |  ");
  for (Int_t i=0; i<maxHists; i++)
    printf("%3s %%   |  ", titles[i]);
  Printf("");

  for (Float_t f = 0.01; f < 0.09; f += 0.01)
  {
    Int_t integralBegin = hist[0]->GetXaxis()->FindBin(-f);
    Int_t integralEnd = hist[0]->GetXaxis()->FindBin(f);

    Int_t total2 = 0;
    for (Int_t i=0; i<maxHists; i++)
      total2 += (Int_t) hist[i]->Integral(integralBegin, integralEnd);

    printf("|    %.2f     |  %6.2f  |  ", f, 100.0 * total2 / total);

    for (Int_t i=0; i<maxHists; i++)
      printf("%6.2f  |  ", (hist[i]->GetEntries() > 0) ? (100.0 * hist[i]->Integral(integralBegin, integralEnd) / hist[i]->GetEntries()) : -1.0);
    Printf("");
  }
  
  eff = new TH1F("eff", ";#Delta#varphi cut (rad.)", 101,-0.0005, 0.1005);
  cont = new TH1F("cont", "cont", 101,-0.0005, 0.1005);
  signalOverBg = new TH1F("signalOverBg", "signalOverBg", 101,-0.0005, 0.1005);
  for (Float_t cut=0.000; cut<0.10; cut += 0.001)
  {
    Float_t accGood = good->Integral(good->GetXaxis()->FindBin(-cut), good->GetXaxis()->FindBin(cut));
    Float_t accBad = bad->Integral(bad->GetXaxis()->FindBin(-cut), bad->GetXaxis()->FindBin(cut));
    Float_t sB = accGood / accBad;
    eff->Fill(cut, 100.0 * accGood / good->Integral());
    cont->Fill(cut, 100.0 * accBad / (accGood + accBad));
    signalOverBg->Fill(cut, sB);
  }
  
  //new TCanvas; signalOverBg->Draw();
  
  c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c2");
  Bool_t nw = kFALSE;
  if (!c)
  {
    c = new TCanvas("c2", "c2", 600, 600);
    nw = kTRUE;
  }
  c->cd();
  c->SetRightMargin(0.05);
  c->SetTopMargin(0.05);
  c->SetGridx();
  c->SetGridy();
  gPad->SetLogy();
  good->Rebin(kRebin);
  bad->Rebin(kRebin);
  good->GetXaxis()->SetRangeUser(-0.09, 0.09);
  good->GetYaxis()->SetTitleOffset(1.3);
  good->SetStats(0);
  good->GetXaxis()->SetTitle("#Delta#varphi (rad.)");  
  good->DrawCopy((nw) ? "" : "SAME");
  
  bad->SetLineColor(2);
  bad->SetLineStyle(2);
  bad->SetLineWidth(2);
  //bad->SetMarkerColor(2);
  //bad->SetMarkerStyle(7);
  bad->DrawCopy("SAME");
  
  TLegend* legend = new TLegend(0.2, 0.13, 0.85, 0.25);
  legend->SetFillColor(0);
  legend->SetTextSize(0.04);
  legend->AddEntry(good, "Primaries", "L");
  legend->AddEntry(bad, "Secondaries + Background", "L");
  legend->Draw();
  
  c->SaveAs("spd_tracklets_deltaphi.eps");
  
  c = (TCanvas*) gROOT->GetListOfCanvases()->FindObject("c3");
  Bool_t nw = kFALSE;
  if (!c)
  {
    c = new TCanvas("c3", "c3", 600, 600);
    nw = kTRUE;
  }
  c->cd();
  c->SetRightMargin(0.05);
  c->SetTopMargin(0.05);
  c->SetGridx();
  c->SetGridy();
  
  TLegend* legend = new TLegend(0.5, 0.6, 0.93, 0.75);
  legend->SetFillColor(0);
  legend->SetTextSize(0.04);
  legend->AddEntry(eff, "Efficiency (%)", "L");
  legend->AddEntry(cont, "Contamination (%)", "L");
  
  eff->SetStats(0);
  eff->GetXaxis()->SetRangeUser(0, 0.08);
  eff->GetYaxis()->SetRangeUser(1e-3, 105);
  eff->SetLineWidth(2);
  eff->DrawCopy((nw) ? "" : "SAME");
  cont->SetLineStyle(2);
  cont->SetLineWidth(2);
  cont->SetLineColor(2);
  cont->DrawCopy("SAME");
  legend->Draw();
  
  c->SaveAs("spd_tracklets_efficiency.eps");
}

void DrawTrackletOrigin_Compare(const char* file1, const char* file2)
{
  DrawTrackletOrigin(file1);
  good1 = (TH1*) gROOT->FindObject("good")->Clone("good1");
  bad1 = (TH1*) gROOT->FindObject("bad")->Clone("bad1");

  DrawTrackletOrigin(file2);
  good2 = (TH1*) gROOT->FindObject("good")->Clone("good2");
  bad2 = (TH1*) gROOT->FindObject("bad")->Clone("bad2");
     
  c = new TCanvas("c4", "c4", 600, 600);
  c->SetRightMargin(0.05);
  c->SetTopMargin(0.05);
  c->SetGridx();
  c->SetGridy();
  gPad->SetLogy();
  
  good1->Draw();
  bad1->SetLineColor(1);
  bad1->SetMarkerColor(1);
  bad1->Draw("SAME");
  
  Float_t factor = (good1->Integral() + bad1->Integral()) / (good2->Integral() + bad2->Integral());
  
  good2->Scale(factor);
  bad2->Scale(factor);
  
  good2->SetLineColor(2);
  bad2->SetMarkerColor(2);
  
  good2->Draw("SAME");
  bad2->Draw("SAME");
  
  good1->GetYaxis()->SetRangeUser(1, TMath::Max(good1->GetMaximum(), good2->GetMaximum()) * 1.1);
}
  
void Tracklets_Asymmetry()
{
  TFile::Open("correction_map.root");

  Int_t maxHists = 7;
  TH1* hist[8];

  Int_t colors[]  = {1,2,3,4,6,7,8,102};
  const char* titles[] = { "PP", "SS", "PP'", "PS'", "PS", "SP'", "SS'", "" };

  TLegend* legend = new TLegend(0.75, 0.6, 0.93, 0.93);
  
  for (Int_t i=0; i<maxHists; i++)
  {
    hist[i] = (TH1*) gFile->Get(Form("fDeltaPhi_%d", i));
    hist[i]->Rebin(10);
    
    for (Int_t j=hist[i]->GetNbinsX()/2; j<=hist[i]->GetNbinsX(); j++)
      if (hist[i]->GetBinContent(j) > 0)
        hist[i]->SetBinContent(j, (hist[i]->GetBinContent(j) -  hist[i]->GetBinContent(hist[i]->GetXaxis()->FindBin(-hist[i]->GetXaxis()->GetBinCenter(j)))) / hist[i]->GetBinContent(j));
      
    hist[i]->SetStats(kFALSE);
    hist[i]->SetLineColor(colors[i]);
    hist[i]->GetXaxis()->SetRangeUser(0.001, 0.09);
    //hist[i]->GetYaxis()->SetRangeUser(5, hist[i]->GetMaximum() * 2);
    hist[i]->GetYaxis()->SetTitleOffset(1.3);
    hist[i]->GetXaxis()->SetTitle("#Delta#varphi (rad.)");
    hist[i]->Draw(((i == 0) ? "" : "SAME"));
    
    legend->AddEntry(hist[i], titles[i], "L");
  }
  
  legend->Draw();
}

TH2* GetCorrection(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction", Double_t ptmin=0.2)
{
  // returns the correction factor with pt integrated out

  loadlibs();

  TFile::Open(fileName);

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dirName, dirName);
  if (!dNdEtaCorrection->LoadHistograms())
    return;

  //  hist = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetCorrectionHistogram();

  gener = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram();
  measu = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram();

  gener->GetZaxis()->SetRange(gener->GetZaxis()->FindBin(ptmin), gener->GetNbinsZ()+1);
  TH2D *gener_xy = gener->Project3D("yx");

  measu->GetZaxis()->SetRange(measu->GetZaxis()->FindBin(ptmin), measu->GetNbinsZ()+1);
  TH2D *measu_xy = measu->Project3D("yx");

  cout << measu->GetZaxis()->FindBin(ptmin) << " " << measu->GetNbinsZ()+1 << endl;

  TCanvas *canp = new TCanvas("canp","canp",600,1000);
  canp->Divide(1,2,0.0001,0.0001);
  canp->cd(1);
  gener_xy->Draw("COLZ");
  canp->cd(2);
  measu_xy->Draw("COLZ");


  TCanvas *canpr = new TCanvas("canpr","canpr",700,500);
  canpr->cd();
  TH2D *proj = new TH2D(*gener_xy);
  proj->Divide(measu_xy);

//   proj = hist->Project3D("yx");
  proj->Draw("COLZ");

  return proj;
}

void DetermineAcceptance(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction", Double_t ptmin=0.2)
{
  TH2* proj = GetCorrection(fileName, dirName, ptmin);

  const Float_t limit = 5;

  TString array = "{";
  TString arrayEnd = "}";

  for (Int_t y=1; y<=proj->GetNbinsY(); ++y)
  {
    Int_t begin = -1;
    Int_t end = -1;
    for (Int_t x=1; x<=proj->GetNbinsX(); ++x)
    {
      if (begin == -1 && proj->GetBinContent(x, y) > 0 && proj->GetBinContent(x, y) < limit)
        begin = x;
      if (begin != -1 && proj->GetBinContent(x, y) > 0 && proj->GetBinContent(x, y) < limit)
        end = x;
    }
    Printf("Limits for y = %d are %d to %d", y, begin, end);

    if (y > 1)
      array += ", ";
    array += Form("%d", begin);

    if (y > 1)
      arrayEnd.Prepend(", ");
    arrayEnd.Prepend(Form("%d", (end == -1) ? -1 : proj->GetNbinsX() + 1 - end));
  }
  array += "}";
  arrayEnd.Prepend("{");

  Printf("Begin array:");
  Printf("%s", array.Data());

  Printf("End array (mirrored) (should be the same):");
  Printf("%s", arrayEnd.Data());
}

void AverageMultiplicity(const char* fileName = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
{
  loadlibs();

  TFile::Open(fileName);

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
  dNdEtaCorrection->LoadHistograms();
  TH2* events = dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram();
  TH3* tracks = dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetTrackCorrection()->GetGeneratedHistogram();

  Float_t nEvents = events->Integral(events->GetXaxis()->FindBin(-1), events->GetXaxis()->FindBin(1), 0, events->GetNbinsY()+1);
  Float_t nTracks = tracks->Integral(tracks->GetXaxis()->FindBin(-1), tracks->GetXaxis()->FindBin(1), tracks->GetYaxis()->FindBin(-0.39), tracks->GetYaxis()->FindBin(0.59), 0, tracks->GetNbinsZ()+1);

  Printf("%f %f --> %f", nEvents, nTracks, nTracks / nEvents);
}

void GetAverageCorrectionFactor(Float_t etaRange = 1.5, Float_t vertexRange = 9.9, const char* rawFile = "analysis_esd_raw.root", const char* mcFile = "analysis_mc.root")
{
  loadlibs();

  TFile::Open(rawFile);
  dNdEtaAnalysis* raw = new dNdEtaAnalysis("dndeta", "dndeta");
  raw->LoadHistograms("fdNdEtaAnalysisESD");
  raw->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->GetXaxis()->SetRangeUser(-vertexRange, vertexRange);
  tracks = raw->GetData()->GetTrackCorrection()->GetMeasuredHistogram()->Project3D("y");
  events = raw->GetData()->GetEventCorrection()->GetMeasuredHistogram()->ProjectionX("events", 0, raw->GetData()->GetEventCorrection()->GetMeasuredHistogram()->GetNbinsY() + 1);
  Float_t nEvents = events->Integral(events->FindBin(-vertexRange), events->FindBin(vertexRange));
  tracks->Scale(1.0 / nEvents / tracks->GetBinWidth(1));

  TFile::Open(mcFile);
  dNdEtaAnalysis* mc = new dNdEtaAnalysis("dndeta", "dndeta");
  mc->LoadHistograms("dndetaTrVtx");
  mcH = mc->GetdNdEtaPtCutOffCorrectedHistogram(0);

  new TCanvas;
  mcH->SetLineColor(2);
  mcH->DrawCopy();
  tracks->DrawCopy("SAME");

  new TCanvas;
  mcH->GetYaxis()->SetRangeUser(0, 5);
  mcH->Divide(tracks);
  mcH->DrawCopy();
  mcH->Fit("pol0", "", "", -etaRange, etaRange);
}

void TrackCuts_Comparison_MC(char* histName, Int_t plotWhich = 0, const char* fileName = "correction_map.root", Bool_t mirror = kFALSE)
{
  // for the nsigmaplot it is needed to run with all cuts except the nsigmatovertex
  //    --> manually disable it in the run.C
  //
  // plotWhich: 0 = only before
  //            1 = both
  //            2 = only after
  //
  // mirror: kTRUE --> project negative values on the positive side
  

  file = TFile::Open(fileName);

  Int_t count = 0;
  Int_t colors[] = { 1, 2, 3, 4, 5, 6 };

  TLegend* legend = new TLegend(0.5, 0.7, 1, 1);
  TLegend* legend2 = new TLegend(0.4, 0.6, 1, 1);
  TLegend* legend3 = new TLegend(0.6, 0.5, 1, 0.7);

  TCanvas* c1 = new TCanvas(histName, histName, 800, 1200);
  c1->Divide(1, 2);
  //TCanvas* c2 = new TCanvas("c2", "c2", 800, 600);
  //TCanvas* c3 = new TCanvas("c3", "c3", 800, 600);

  const char* folders2[] = { "before_cuts", "after_cuts" };
  Bool_t first = kTRUE;
  for (Int_t j = ((plotWhich < 2) ? 0 : 1); j < ((plotWhich > 0) ? 2 : 1); j++)
  {
    const char* folders1[] = { "esd_track_cuts", "esd_track_cuts_primaries", "esd_track_cuts_secondaries" };
    const char* names[] =    { "all", "primaries", "secondaries" };
    TH1* base = 0;
    TH1* prim = 0;
    TH1* sec = 0;
    for (Int_t i = 0; i < 3; i++)
    {
      TString folder;
      folder.Form("%s/%s/%s", folders1[i], folders2[j], histName);
      TH1* hist = (TH1*) file->Get(folder);
      
      if (mirror)
      {
        for (Int_t bin=1; bin<=hist->GetXaxis()->FindBin(-0.0001); bin++)
        {
          Int_t newBin = hist->GetXaxis()->FindBin(-hist->GetXaxis()->GetBinCenter(bin));
          if (bin != newBin)
          {
            hist->Fill(-hist->GetXaxis()->GetBinCenter(bin), hist->GetBinContent(bin));
            hist->SetBinContent(bin, 0);
          }
        }
      }
      
      legend->AddEntry(hist, Form("%s %s", names[i], folders2[j]));

      c1->cd(1);
      hist->SetLineColor(colors[count]);
      hist->DrawCopy((count == 0) ? "" : "SAME");

      switch (i)
      {
        case 0: base = hist; break;
        case 1: prim = hist; break;
        case 2: sec = hist; break;
      }

      count++;
    }

    TH1* eff    = (TH1*) prim->Clone("eff"); eff->Reset();
    TH1* purity = (TH1*) prim->Clone("purity"); purity->Reset();

    for (Int_t bin = 1; bin <= prim->GetNbinsX(); bin++)
    {
      eff->SetBinContent(bin, prim->Integral(1, bin) / prim->Integral(1, prim->GetNbinsX() + 1));
      if (prim->Integral(1, bin) + sec->Integral(1, bin) > 0)
        purity->SetBinContent(bin, sec->Integral(1, bin) / (prim->Integral(1, bin) + sec->Integral(1, bin)));
    }

    eff->GetYaxis()->SetRangeUser(0, 1);
    eff->SetLineColor(colors[0+j*2]);
    eff->SetStats(kFALSE);
    purity->SetLineColor(colors[1+j*2]);

    legend3->AddEntry(eff, Form("%s: efficiency", folders2[j]));
    legend3->AddEntry(purity, Form("%s: contamination", folders2[j]));

    c1->cd(2);
    eff->DrawCopy((first) ? "" : "SAME");
    first = kFALSE;
    purity->DrawCopy("SAME");
  }

  c1->cd(1)->SetLogy();
  c1->cd(1)->SetGridx();
  c1->cd(1)->SetGridy();
  legend->Draw();

  //c2->cd();
 // c2->SetGridx();
 // c2->SetGridy();
  //legend2->Draw();

  c1->cd(2)->SetGridx();
  c1->cd(2)->SetGridy();
  legend3->Draw();

  //c1->SaveAs(Form("%s.png", histName));
}

void TrackCuts_Comparison_Data(char* histName, Int_t plotWhich, const char* fileName1, const char* fileName2, Bool_t mirror = kFALSE, const char* label1 = "file1", const char* label2 = "file2")
{
  // for the nsigmaplot it is needed to run with all cuts except the nsigmatovertex
  //    --> manually disable it in the run.C
  //
  // plotWhich: 0 = only before
  //            1 = both
  //            2 = only after
  //
  // mirror: kTRUE --> project negative values on the positive side
  

  Int_t count = 0;
  Int_t colors[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

  TLegend* legend = new TLegend(0.5, 0.7, 1, 1);
  legend->SetFillColor(0);
  TLegend* legend2 = new TLegend(0.4, 0.6, 1, 1);
  TLegend* legend3 = new TLegend(0.6, 0.5, 1, 0.7);

  TCanvas* c1 = new TCanvas(histName, histName, 600, 600);
  //TCanvas* c2 = new TCanvas("c2", "c2", 800, 600);
  //TCanvas* c3 = new TCanvas("c3", "c3", 800, 600);

  const char* folders2[] = { "before_cuts", "after_cuts" };
  Bool_t first = kTRUE;
  for (Int_t j = ((plotWhich < 2) ? 0 : 1); j < ((plotWhich > 0) ? 2 : 1); j++)
  {
    const char* folders1[] = { "esd_track_cuts", "esd_track_cuts_primaries", "esd_track_cuts_secondaries" };
    const char* names[] =    { "all", "primaries", "secondaries" };
    
    Float_t normalize[3];
    
    for (Int_t i = 0; i < 2; i++)
    {
      file = TFile::Open((i == 0) ? fileName1 : fileName2);
      
      for (Int_t k = 1; k < 3; k++)
      {
        TString folder;
        folder.Form("%s/%s/%s", folders1[k], folders2[j], histName);
        Printf("%s", folder.Data());
        TH1* hist = (TH1*) file->Get(folder);
        
        if (mirror)
        {
          for (Int_t bin=1; bin<=hist->GetXaxis()->FindBin(-0.0001); bin++)
          {
            Int_t newBin = hist->GetXaxis()->FindBin(-hist->GetXaxis()->GetBinCenter(bin));
            if (bin != newBin)
            {
              hist->Fill(-hist->GetXaxis()->GetBinCenter(bin), hist->GetBinContent(bin));
              hist->SetBinContent(bin, 0);
            }
          }
        }
      
        if (i == 0)
        {
          normalize[k] = hist->Integral();
        }
        else
          hist->Scale(normalize[k] / hist->Integral());
        
        legend->AddEntry(hist, Form("%s %s %s", (i == 0) ? label1 : label2, (k == 1) ? "primaries" : "secondaries", folders2[j]));
  
        c1->cd();
        hist->SetStats(0);
        hist->SetLineColor(colors[count]);
        hist->DrawCopy((count == 0) ? "" : "SAME");
  
        count++;
      }
    }

  }

  //c1->SetLogy();
  c1->SetGridx();
  c1->SetGridy();
  legend->Draw();
}

void TrackCuts_DCA()
{
  file = TFile::Open("correction_map.root");
  hist = (TH2*) file->Get("esd_track_cuts/before_cuts/dXYvsDZ");

  TCanvas* c1 = new TCanvas("c1", "c1", 600, 600);
  c1->SetLogz();
  c1->SetRightMargin(0.12);
  c1->SetBottomMargin(0.12);

  hist->SetStats(kFALSE);
  hist->Draw("COLZ");

  ellipse = new TEllipse(0, 0, 4);
  ellipse->SetLineWidth(2);
  ellipse->SetLineStyle(2);
  ellipse->SetFillStyle(0);
  ellipse->Draw();

  c1->SaveAs("trackcuts_dca_2d.eps");
}

void FindNSigma(TH2* hist, Int_t nSigma = 1)
{
  TH1* proj = hist->ProjectionY();
  proj->Reset();

  for (Int_t bin=1; bin<=proj->GetNbinsX(); bin++)
  {
    if (hist->Integral(1, hist->GetNbinsX(), bin, bin) == 0)
      continue;

    Int_t limit = -1;
    for (limit = 1; limit<=hist->GetNbinsX(); limit++)
  }
}

void ShowOnlyAccepted(TH2* input, const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction", Double_t ptmin=0.2)
{
  TH2* proj = GetCorrection(fileName, dirName, ptmin);

  for (Int_t y=1; y<=proj->GetNbinsY(); ++y)
    for (Int_t x=1; x<=proj->GetNbinsX(); ++x)
      if (proj->GetBinContent(x, y) > 5 || proj->GetBinContent(x, y) == 0)
      {
        proj->SetBinContent(x, y, 0);
      }
      else
        proj->SetBinContent(x, y, 1);


  input->Multiply(proj);
}

void MakeGaussianProfile(const char* histName = "fVertexCorrelation", Bool_t subtractMean = kFALSE)
{
    TFile::Open("correction_map.root");

    TH2* hist2d = (TH2*) gFile->Get(histName);
    hist2d->Sumw2();

    TH1* result = hist2d->ProjectionX("result");
    result->GetYaxis()->SetTitle(hist2d->GetYaxis()->GetTitle());
    result->Reset();

    for (Int_t x=1; x<hist2d->GetNbinsX(); ++x)
    {
        hist = hist2d->ProjectionY(Form("temp_%d", x), x, x);
        if (hist->GetEntries() == 0)
            continue;
        if (hist->Fit("gaus") == 0)
        {
            func = hist->GetFunction("gaus");
            mean = func->GetParameter(1);
            error = func->GetParError(1);

            if (subtractMean)
                mean = hist2d->GetXaxis()->GetBinCenter(x) - mean;

            result->SetBinContent(x, mean);
            result->SetBinError(x, error);

            if (x % 10 == 0)
            {
                new TCanvas;
                ((TH1*) hist->Clone())->DrawCopy();
            }
        }
        //break;
    }

    new TCanvas;
    result->GetYaxis()->SetRangeUser(-0.2, 0.2);
    result->Draw();
}

TH2* GetAcceptance(void* corr2d_void)
{
        corr2d = (AliCorrectionMatrix2D*) corr2d_void;
        corr_xy = (TH2*) corr2d->GetCorrectionHistogram()->Clone("acceptance");

        // fold in acceptance
        for (Int_t x=1; x<=corr_xy->GetNbinsX(); ++x)
                for (Int_t y=1; y<=corr_xy->GetNbinsY(); ++y)
                {
                        if (corr_xy->GetBinContent(x, y) > 1.5)
                                corr_xy->SetBinContent(x, y, 0);

                        if (corr_xy->GetBinContent(x, y) > 0)
                                corr_xy->SetBinContent(x, y, 1);

                        corr_xy->SetBinError(x, y, 0);
                }

        return corr_xy;
}

void ZeroOutsideAcceptance(TH2* acc, TH3* hist)
{
  for (Int_t x=0; x<=acc->GetNbinsX()+1; ++x)
    for (Int_t y=0; y<=acc->GetNbinsY()+1; ++y)
    {
      if (acc->GetBinContent(x, y) > 2 || acc->GetBinContent(x, y) == 0)
      {
        for (Int_t z=0; z<=hist->GetNbinsZ()+1; ++z)
        {
          hist->SetBinContent(x, y, z, 0);
          hist->SetBinError(x, y, z, 0);
        }
      }
    }
}

void DrawPhi()
{
  loadlibs();

  TFile::Open("correction_map.root");
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
  if (!dNdEtaCorrection->LoadHistograms())
    return 0;

  TFile::Open("analysis_esd.root");
  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx");
  fdNdEtaAnalysis->LoadHistograms();

  // acc. map!
  //acc = GetAcceptance(dNdEtaCorrection->GetCorrection(1)->GetTrackCorrection()->Get2DCorrection("yx", 0, 1000));
  acc = dNdEtaCorrection->GetCorrection(1)->GetTrackCorrection()->Get2DCorrection("yx", 0, 1000)->GetCorrectionHistogram();
  //new TCanvas; acc->Draw("COLZ");

  histG = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram();
  ZeroOutsideAcceptance(acc, histG);
  //new TCanvas; histG->Project3D("yx")->Draw("COLZ");
  //histG->GetYaxis()->SetRangeUser(-0.9, 0.9);

  histM = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram();
  ZeroOutsideAcceptance(acc, histM);
  //histM->GetYaxis()->SetRangeUser(-0.9, 0.9);

  TFile::Open("analysis_mc.root");
  dNdEtaAnalysis* fdNdEtaAnalysis2 = new dNdEtaAnalysis("dndetaTrVtxMC", "dndetaTrVtxMC");
  fdNdEtaAnalysis2->LoadHistograms("dndetaTrVtx");

  histMC = fdNdEtaAnalysis2->GetData()->GetTrackCorrection()->GetMeasuredHistogram();
  ZeroOutsideAcceptance(acc, histMC);
  //new TCanvas; histMC->Project3D("yx2")->Draw("COLZ");

  //histG->GetZaxis()->SetRangeUser(1,2); histMC->GetZaxis()->SetRangeUser(1,2);
  new TCanvas; a = histG->Project3D("yx3"); a->Add(histMC->Project3D("yx4"), -1); a->Draw("COLZ");

  //histMC->GetYaxis()->SetRangeUser(-0.9, 0.9);

  c = new TCanvas;

  histG->GetXaxis()->SetRangeUser(-9.9, 9.9);
  histG->Project3D("z")->DrawCopy();

  histM->GetXaxis()->SetRangeUser(-9.9, 9.9);
  proj = histM->Project3D("z2");
  proj->SetLineColor(2);
  proj->DrawCopy("SAME");

  histMC->GetXaxis()->SetRangeUser(-9.9, 9.9);
  projMC = histMC->Project3D("z3");
  projMC->SetLineColor(4);
  projMC->DrawCopy("SAME");
}

void PrintEventStats(Int_t corrID = 3, const char* fileName = "correction_map.root", const char* dir = "dndeta_correction")
{
  loadlibs();

  /*
  TFile::Open("analysis_mc.root");
  fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaNSD", "dndetaNSD");
  fdNdEtaAnalysis->LoadHistograms();
  trackHist = fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetGeneratedHistogram();
  eventHist = fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetGeneratedHistogram();
  */

  TFile::Open(fileName);
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dir, dir);
  if (!dNdEtaCorrection->LoadHistograms())
    return;
  trackHist = dNdEtaCorrection->GetCorrection(corrID)->GetTrackCorrection()->GetGeneratedHistogram();
  eventHist = dNdEtaCorrection->GetCorrection(corrID)->GetEventCorrection()->GetGeneratedHistogram();

  trackHist->GetXaxis()->SetRange(0, trackHist->GetNbinsX()+1);
  trackHist->GetZaxis()->SetRange(0, trackHist->GetNbinsZ()+1);
  eta = trackHist->Project3D("y");

  events = eventHist->Integral(0, eventHist->GetNbinsX()+1, 0, eventHist->GetNbinsY()+1);

  eta->Scale(1.0 / events);

  Float_t avgN = eta->Integral(0, eta->GetNbinsX()+1);
  Printf("<N> = %f", avgN);

  eta->Scale(1.0 / eta->GetXaxis()->GetBinWidth(1));

  Printf("dndeta | eta = 0 is %f", (eta->GetBinContent(eta->FindBin(0.01)) + eta->GetBinContent(eta->FindBin(-0.01))) / 2);
  Printf("dndeta in |eta| < 0.5 is %f", eta->Integral(eta->FindBin(-0.49), eta->FindBin(0.49)) / (eta->FindBin(0.49) - eta->FindBin(-0.49) + 1));
  Printf("dndeta in |eta| < 1 is %f", eta->Integral(eta->FindBin(-0.99), eta->FindBin(0.99)) / (eta->FindBin(0.99) - eta->FindBin(-0.99) + 1));
  Printf("dndeta in |eta| < 1.5 is %f", eta->Integral(eta->FindBin(-1.49), eta->FindBin(1.49)) / (eta->FindBin(1.49) - eta->FindBin(-1.49) + 1));

  stats = (TH2*) gFile->Get("fEventStats");
  proj = stats->ProjectionX();
  gROOT->ProcessLine(".L PrintHist.C");
  PrintHist2D(stats);
  PrintHist(proj);
  
  Float_t ua5_SD = 0.153;
  Float_t ua5_DD = 0.080;
  Float_t ua5_ND = 0.767;
  
  Printf("+++ FRACTIONS +++");
  
  Printf("ND: %f", proj->GetBinContent(3) / proj->GetBinContent(1));
  Printf("SD: %f", proj->GetBinContent(4) / proj->GetBinContent(1));
  Printf("DD: %f", proj->GetBinContent(5) / proj->GetBinContent(1));
  
  Printf("+++ TRIGGER EFFICIENCIES +++");
  
  Printf("INEL = %.1f", 100. * (proj->GetBinContent(1) - stats->GetBinContent(1, 1) - stats->GetBinContent(1, 3)) / proj->GetBinContent(1));
  Printf("NSD  = %.1f", 100. * (proj->GetBinContent(2) - stats->GetBinContent(2, 1) - stats->GetBinContent(2, 3)) / proj->GetBinContent(2));
  
  
  Float_t trigND = 100. * (proj->GetBinContent(3) - stats->GetBinContent(3, 1) - stats->GetBinContent(3, 3)) / proj->GetBinContent(3);
  Float_t trigSD = 100. * (proj->GetBinContent(4) - stats->GetBinContent(4, 1) - stats->GetBinContent(4, 3)) / proj->GetBinContent(4);
  Float_t trigDD = 100. * (proj->GetBinContent(5) - stats->GetBinContent(5, 1) - stats->GetBinContent(5, 3)) / proj->GetBinContent(5);
  
  Printf("ND  = %.1f", trigND);
  Printf("SD  = %.1f", trigSD);
  Printf("DD  = %.1f", trigDD);
  
  Float_t trigINELUA5 = ua5_SD * trigSD + ua5_DD * trigDD + ua5_ND * trigND;
  Float_t trigNSDUA5  = (ua5_DD * trigDD + ua5_ND * trigND) / (ua5_DD + ua5_ND);
  Printf("INEL (UA5)  = %.1f", trigINELUA5);
  Printf("NSD (UA5)  = %.1f", trigNSDUA5);
  
  Printf("+++ VERTEX EFFICIENCIES +++");
  
  Printf("INEL = %.1f", 100. * (stats->GetBinContent(1, 3) + stats->GetBinContent(1, 4)) / proj->GetBinContent(1));
  Printf("NSD  = %.1f", 100. * (stats->GetBinContent(2, 3) + stats->GetBinContent(2, 4)) / proj->GetBinContent(2));
  
  Float_t vtxND = 100. * (stats->GetBinContent(3, 3) + stats->GetBinContent(3, 4)) / proj->GetBinContent(3);
  Float_t vtxSD = 100. * (stats->GetBinContent(4, 3) + stats->GetBinContent(4, 4)) / proj->GetBinContent(4);
  Float_t vtxDD = 100. * (stats->GetBinContent(5, 3) + stats->GetBinContent(5, 4)) / proj->GetBinContent(5);
  Printf("ND  = %.1f", vtxND);
  Printf("SD  = %.1f", vtxSD);
  Printf("DD  = %.1f", vtxDD);
  
  Float_t vtxINELUA5 = ua5_SD * vtxSD + ua5_DD * vtxDD + ua5_ND * vtxND;
  Float_t vtxNSDUA5  = (ua5_DD * vtxDD + ua5_ND * vtxND) / (ua5_DD + ua5_ND);
  Printf("INEL (UA5)  = %.1f", vtxINELUA5);
  Printf("NSD (UA5)  = %.1f", vtxNSDUA5);
  
  Printf("+++ TRIGGER + VERTEX EFFICIENCIES +++");
  
  Printf("INEL = %.1f", 100. * stats->GetBinContent(1, 4) / proj->GetBinContent(1));
  Printf("NSD  = %.1f", 100. * stats->GetBinContent(2, 4) / proj->GetBinContent(2));
  Printf("ND  = %.1f",  100. * stats->GetBinContent(3, 4) / proj->GetBinContent(3));
  Printf("SD  = %.1f",  100. * stats->GetBinContent(4, 4) / proj->GetBinContent(4));
  Printf("DD  = %.1f",  100. * stats->GetBinContent(5, 4) / proj->GetBinContent(5));
  
  
  
  for (Int_t i=7; i<=proj->GetNbinsX(); i++)
    if (proj->GetBinContent(i) > 0)
      Printf("bin %d (process type %d) = %.2f", i, (Int_t) proj->GetXaxis()->GetBinCenter(i), 100.0 * (proj->GetBinContent(i) - stats->GetBinContent(i, 1)) / proj->GetBinContent(i));
  
  //eta->Draw();
}

void TestAsymmetry()
{
  loadlibs();

  TFile* file2 = TFile::Open("analysis_mc.root");
  
  dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
  fdNdEtaAnalysis->LoadHistograms();
  fdNdEtaAnalysis->Finish(0, 0, AlidNdEtaCorrection::kNone, "...");
  
  fdNdEtaAnalysis->GetdNdEtaHistogram(0)->DrawCopy();
  
  hist = (TH1*) fdNdEtaAnalysis->GetData()->GetTrackCorrection()->GetMeasuredHistogram();
  hist2 = (TH1*) hist->Clone("hist2");
  for (Int_t x=1; x<=hist->GetNbinsX(); x++)
    for (Int_t y=1; y<=hist->GetNbinsY(); y++)
      for (Int_t z=1; z<=hist->GetNbinsZ(); z++)
      {
        Printf("%d %d %d %d", x, y, z, hist->GetNbinsY() + 1 - y);
        hist->SetBinContent(x, y, z, hist2->GetBinContent(hist->GetNbinsX() / 2, TMath::Min(y, hist->GetNbinsY() + 1 - y), z));
      }
  
  hist = fdNdEtaAnalysis->GetData()->GetEventCorrection()->GetMeasuredHistogram();
  for (Int_t x=1; x<=hist->GetNbinsX(); x++)
    for (Int_t y=1; y<=hist->GetNbinsY(); y++)
      {
        //Printf("%d %d %d %d", x, y, z, hist->GetNbinsY() + 1 - y);
        hist->SetBinContent(x, y, hist->GetBinContent(hist->GetNbinsX() / 2, y));
      }
  
  fdNdEtaAnalysis->Finish(0, 0, AlidNdEtaCorrection::kNone, "...");
  fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetMarkerColor(2);
  fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetLineColor(2);
  fdNdEtaAnalysis->GetdNdEtaHistogram(0)->SetMarkerStyle(5);
  fdNdEtaAnalysis->GetdNdEtaHistogram(0)->DrawCopy("SAMEP");
}

void DeltaPhiFromPt(Float_t smearing = 0.005)
{
  loadlibs();

  TFile::Open("analysis_mc.root");
  hist = (TH1*) gFile->Get("dndeta_check_pt");
  
  dPhiHist = new TH1F("dPhiHist", ";#Delta phi", 400, -0.1, 0.1);
  dPhiHist2 = new TH1F("dPhiHist2", ";#Delta phi", 400, -0.1, 0.1);
  
  for (Int_t i=1; i<=hist->GetNbinsX(); i++)
  {
    Float_t pt = hist->GetBinCenter(i);
    Float_t deltaPhi = (0.076 - 0.039) / 2 / (pt / 0.15);
    
    if (smearing > 0)
    {
      gaus = new TF1("mygaus", "gaus(0)", -0.1, 0.1);
      gaus->SetParameters(1, -deltaPhi, smearing);
    
      dPhiHist->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000);
    
      dPhiHist2->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000);
      gaus->SetParameters(1, deltaPhi, smearing);
      dPhiHist2->FillRandom("mygaus", hist->GetBinContent(i) / 2 * 1000);
    }
    else
{
dPhiHist->Fill(deltaPhi, hist->GetBinContent(i) / 2);
dPhiHist2->Fill(deltaPhi, hist->GetBinContent(i) / 2);
dPhiHist2->Fill(-deltaPhi, hist->GetBinContent(i) / 2);
}
  }
  
  new TCanvas;
  dPhiHist->Draw();
  dPhiHist2->SetLineColor(2);
  dPhiHist2->Draw("SAME");
  gPad->SetLogy();
  
  TFile::Open("trackletsDePhi.root");
  //TFile::Open("tmp/correction_maponly-positive.root");
  //TFile::Open("tmp/correction_map.root");
  //tracklets = (TH1*) gFile->Get(Form("fDeltaPhi_%d", 0));
  tracklets = (TH1*) gFile->Get("DePhiPPTracklets");
  tracklets->Scale(1.0 / tracklets->GetMaximum() * dPhiHist->GetMaximum());
  tracklets->SetLineColor(4);
  tracklets->Draw("SAME");
}

void VertexDistributions()
{
  loadlibs();
  
  TFile::Open("correction_map.root");
  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
  if (!dNdEtaCorrection->LoadHistograms())
    return;
  
  all = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetGeneratedHistogram()->ProjectionX("all");
  trigger = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetMeasuredHistogram()->ProjectionX("trigger");
  vtx = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kVertexReco)->GetEventCorrection()->GetMeasuredHistogram()->ProjectionX("vtx");
 
  nottriggered = (TH1*) all->Clone("nottriggered");
  nottriggered->Add(trigger, -1);

  novertex = (TH1*) trigger->Clone("novertex");
  novertex->Add(vtx, -1);
  
  temphist = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kVertexReco)->GetEventCorrection()->GetMeasuredHistogram();
  highmult = temphist->ProjectionX("highmult", temphist->GetYaxis()->FindBin(10), temphist->GetNbinsY());
  //all = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetGeneratedHistogram()->ProjectionX("all", temphist->GetYaxis()->FindBin(10), temphist->GetNbinsY());
 
  for (Int_t i=1; i<=trigger->GetNbinsX(); i++)
  {
    all->SetBinContent(i, all->GetBinContent(i) / all->GetBinWidth(i));
    trigger->SetBinContent(i, trigger->GetBinContent(i) / trigger->GetBinWidth(i));
    vtx->SetBinContent(i, vtx->GetBinContent(i) / vtx->GetBinWidth(i));
    nottriggered->SetBinContent(i, nottriggered->GetBinContent(i) / nottriggered->GetBinWidth(i));
    novertex->SetBinContent(i, novertex->GetBinContent(i) / novertex->GetBinWidth(i));
    highmult->SetBinContent(i, highmult->GetBinContent(i) / highmult->GetBinWidth(i));
  }

  new TCanvas;
  vtx->SetTitle("");
  vtx->SetStats(0);
  vtx->DrawCopy("HIST");

  all->Scale(1.0 / all->Integral());
  nottriggered->Scale(1.0 / nottriggered->Integral());
  novertex->Scale(1.0 / novertex->Integral());
  highmult->Scale(1.0 / highmult->Integral());

  new TCanvas;
  all->Draw("HIST");
  novertex->SetLineColor(2);
  novertex->Draw("HISTSAME");
  highmult->SetLineColor(3);
  highmult->Draw("HISTSAME");

  legend = new TLegend(0.5, 0.5, 0.8, 0.8);
  legend->SetFillColor(0);
  legend->AddEntry(all, "all");
  legend->AddEntry(novertex, "no vertex");
  legend->AddEntry(highmult, "mult > 10");
  legend->Draw();
  
  new TCanvas;
  trigger->Scale(1.0 / trigger->Integral());
  vtx->Scale(1.0 / vtx->Integral());
  
  trigger->Divide(vtx);
  
  trigger->Draw();
  //vtx->SetLineColor(2);
  //vtx->Draw("SAME");

  //temphist = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kVertexReco)->GetEventCorrection()->GetMeasuredHistogram();
  temphist = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetGeneratedHistogram();
  //temphist = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kINEL)->GetEventCorrection()->GetMeasuredHistogram();
  
  temphist = (TH2*) gFile->Get("fTemp1");
  
  new TCanvas;
  legend = new TLegend(0.7, 0.7, 0.99, 0.99);
  legend->SetFillColor(0);
 
  Bool_t first = kTRUE; 
  for (Int_t i=0; i<20; i+=5)
  {
    highmult = temphist->ProjectionX("highmult", i+1, i+1+4);
    highmult->Rebin(10);
    Printf("%f", highmult->Integral());
    if (highmult->Integral() <= 0)
      continue;
  
    for (Int_t j=1; j<=trigger->GetNbinsX(); j++)
      highmult->SetBinContent(j, highmult->GetBinContent(j) / highmult->GetBinWidth(j));

    highmult->Scale(1.0 / highmult->Integral());
    highmult->SetLineColor((i/5)+1);
    highmult->GetYaxis()->SetRangeUser(0, 0.15);
    if (first)
    {
      highmult->DrawCopy();
      first = kFALSE;
    }
    else
      highmult->DrawCopy("SAME");
    legend->AddEntry(highmult->Clone(), Form("%d <= N <= %d", i, i+4));
  }
  legend->Draw();
 
}

void PlotPt1DCorrection()
{
  const char* files[] = { "field.root", "field_onlyprim.root", "nofield.root", "nofield_onlyprim.root" };
  const char* names[] = { "B: all", "B: primaries", "No B: all", "No B: primaries" };
  Int_t colors[] = { 1, 2, 3, 4 };
  
  loadlibs();
  
  dummy = new TH2F("dummy", ";p_{T};correction", 100, 0, 1.4, 100, 0.5, 3);
  dummy->SetStats(0);
  //dummy->GetYaxis()->SetTitleOffset(1.3);
  dummy->Draw();
  
  legend = new TLegend(0.48, 0.57, 0.88, 0.88);
  legend->SetFillColor(0);
  
  for (Int_t i=0; i<4; i++)
  {
    TFile::Open(files[i]);
    AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction");
    if (!dNdEtaCorrection->LoadHistograms())
      return;
      
    hist = dNdEtaCorrection->GetTrack2ParticleCorrection()->GetTrackCorrection()->Get1DCorrectionHistogram("z", -9.9, 9.9, -0.79, 0.79);
    hist->SetLineColor(colors[i]);
    hist->SetLineWidth(2);
    hist->SetMarkerColor(colors[i]);
    hist->Draw("SAME");
    
    legend->AddEntry(hist, names[i], "L");
  }
  
  legend->Draw();
}

void FitDiamond()
{
  TFile::Open("analysis_esd_raw.root");
  
  hist = (TH3*) gFile->Get("vertex_check");
  
  gStyle->SetOptFit(1);
  
  TH1* proj[3];
  proj[0] = hist->ProjectionX();
  proj[1] = hist->ProjectionY();
  proj[2] = hist->ProjectionZ();
  
  for (Int_t i=0; i<3; i++)
  {
    c = new TCanvas;
    proj[i]->Draw();
    proj[i]->Fit("gaus");
    
    c->SaveAs(Form("FitDiamond_%d.png", i));
  }
}

void CompareDiamond(const char* mc, const char* data)
{
  TFile::Open(mc);
  
  hist = (TH3*) gFile->Get("vertex_check");
  
  gStyle->SetOptFit(1);
  
  TH1* proj[3];
  proj[0] = hist->ProjectionX("vertex_check_px");
  proj[1] = hist->ProjectionY("vertex_check_py");
  proj[2] = hist->ProjectionZ("vertex_check_pz");
  
  TFile::Open(data);
  
  hist = (TH3*) gFile->Get("vertex_check");
  
  TH1* proj2[3];
  proj2[0] = hist->ProjectionX("vertex_check_px2");
  proj2[1] = hist->ProjectionY("vertex_check_py2");
  proj2[2] = hist->ProjectionZ("vertex_check_pz2");

  for (Int_t i=0; i<3; i++)
  {
    CompareQualityHists(proj[i], proj2[i], 1, 1);
  }
}

void FitDiamondVsMult()
{
  TFile::Open("analysis_esd_raw.root");
  
  fVertexVsMult = (TH3*) gFile->Get("fVertexVsMult");
  fVertexVsMult->GetZaxis()->SetTitle("multiplicity");
  
  TH2* proj[2];
  proj[0] = (TH2*) fVertexVsMult->Project3D("xz");
  proj[1] = (TH2*) fVertexVsMult->Project3D("yz");
  
  gStyle->SetPadGridX(kTRUE);
  gStyle->SetPadGridY(kTRUE);
  
  Int_t max = 40;
  
  for (Int_t i=0; i<2; i++)
  {
    proj[i]->Rebin2D(4, 1);
    proj[i]->FitSlicesY();
    
    c = new TCanvas(Form("c_%d", i), Form("c_%d", i), 800, 400);
    c->Divide(2, 1);
    
    c->cd(1);
    hist = (TH1*) gROOT->FindObject(Form("fVertexVsMult_%sz_1", (i == 0) ? "x" : "y"));
    hist->GetXaxis()->SetRangeUser(0, max);
    hist->GetYaxis()->SetRangeUser(-0.4, 0.4);
    hist->Draw();
    
    c->cd(2);
    hist = (TH1*) gROOT->FindObject(Form("fVertexVsMult_%sz_2", (i == 0) ? "x" : "y"));
    hist->GetXaxis()->SetRangeUser(0, max);
    hist->GetYaxis()->SetRangeUser(0, 0.2);
    hist->Draw();
    
    c->SaveAs(Form("FitDiamondVsMult_%d.png", i));
  }
}

void CompareQualityHists(const char* fileName1, const char* fileName2, const char* plotName, Int_t rebin1 = 1, Int_t rebin2 = 1, const char* exec = 0)
{
  file1 = TFile::Open(fileName1);
  hist1 = (TH1*) file1->Get(plotName);
  
  file2 = TFile::Open(fileName2);
  hist2 = (TH1*) file2->Get(plotName);
  
  hist1->SetStats(0);
  
  Printf("Entries in histograms: %f %f", hist1->Integral(), hist2->Integral());
  
  if (exec)
  {
    hist1 = (TH1*) gROOT->ProcessLine(Form(exec, hist1, "hist1a"));
    hist2 = (TH1*) gROOT->ProcessLine(Form(exec, hist2, "hist2a"));
    hist1->Sumw2();
    hist2->Sumw2();
    Printf("Entries in histograms: %f %f", hist1->Integral(), hist2->Integral());
  }
  
  CompareQualityHists(hist1, hist2, rebin1, rebin2);
}

void CompareQualityHists(TH1* hist1, TH1* hist2, Int_t rebin1 = 1, Int_t rebin2 = 1)
{
  hist1->SetLineColor(1);
  hist2->SetLineColor(2);
 
  if (rebin1 != 0 && rebin2 != 0)
  { 
    hist1->Rebin(TMath::Abs(rebin1));
    hist2->Rebin(TMath::Abs(rebin2));
  }
  
  //hist2 = hist2->Rebin(hist1->GetNbinsX(), Form("%s_rebinned", hist2->GetName()), hist1->GetXaxis()->GetXbins()->GetArray());
      
      //hist1->Scale(1.0 / 0.83);

//hist1->GetXaxis()->SetRangeUser(0, 50);
/*  hist1->GetYaxis()->SetRangeUser(0.9, 1.2);
  hist1->Scale(1.0 / 0.808751);*/
  
  //hist1->Scale(1.0 / 1.24632);
  //hist1->Scale(1.0 / 1.23821);
  //hist1->Scale(1.0 / 1.26213);
  
  if (rebin1 > 0 && rebin2 > 0)
  {
    hist1->Scale(hist2->Integral() / hist1->Integral() * hist2->GetXaxis()->GetBinWidth(1) / hist1->GetXaxis()->GetBinWidth(1) / rebin1 * rebin2);
    
    //hist1->Scale(0.5);
    //hist2->Scale(0.5);
  }

  c = new TCanvas;
  if (strcmp(hist1->GetName(), "fDeltaTheta") == 0 || strcmp(hist1->GetName(), "fDeltaPhi") == 0 || strcmp(hist1->GetName(), "fMultVtx") == 0 || TString(hist1->GetName()).BeginsWith("vertex_check"))
    c->SetLogy();
  
  if (TString(hist1->GetName()).BeginsWith("fMultiplicityESD"))
  {
    c->SetLogy();
    loadlibs();
    AliPWG0Helper::NormalizeToBinWidth(hist1);
    AliPWG0Helper::NormalizeToBinWidth(hist2);
  }
  
  Printf("Means: %f %f %e", hist1->GetMean(), hist2->GetMean(), 1.0 - hist2->GetMean() / hist1->GetMean());
  
  //hist1->GetYaxis()->SetRangeUser(0.01, hist1->GetMaximum() * 1.3);
  hist1->DrawCopy("HISTE");
  hist2->DrawCopy("HISTE SAME");
  gPad->SetGridx();
  gPad->SetGridy();
  //gPad->SetLogy();
  c->SaveAs(Form("%s_1.png", hist1->GetName()));
  
  if (rebin1 == rebin2)
  {
    for (Int_t i=1; i<=hist1->GetNbinsX(); i++)
      if (hist1->GetBinContent(i) == 0 && hist2->GetBinContent(i) > 0 || hist1->GetBinContent(i) > 0 && hist2->GetBinContent(i) == 0)
        Printf("Inconsistent bin %d: %f %f", i, hist1->GetBinContent(i), hist2->GetBinContent(i));
  
    c2 = new TCanvas;
    hist1->GetYaxis()->SetRangeUser(0.5, 1.5);
    hist1->Divide(hist2);
    hist1->DrawCopy("HIST");
    gPad->SetGridx();
    gPad->SetGridy();
    c2->SaveAs(Form("%s_2.png", hist1->GetName()));
    
    /*
    for (Int_t i=1; i<=hist1->GetNbinsX(); i++)
      if (hist1->GetBinContent(i) > 0.9 && hist1->GetBinContent(i) < 1.1)
        hist1->SetBinContent(i, 0);
        
    new TCanvas;
    hist1->SetMarkerStyle(20);
    hist1->DrawCopy("P");
    */
  }
}

void DrawClustersVsTracklets()
{
  TFile::Open("analysis_esd_raw.root");
  
  hist = (TH2*) gFile->Get("fTrackletsVsClusters");
  
  c = new TCanvas("c", "c", 600, 600);
  c->SetRightMargin(0.05);
  c->SetTopMargin(0.05);
  
  hist->SetStats(0);
  hist->GetYaxis()->SetRangeUser(0, 400);
  hist->GetYaxis()->SetTitleOffset(1.3);
  hist->GetXaxis()->SetRangeUser(0, 30);
  hist->Draw("BOX");
  
  func = new TF1("func", "80 + x * 11", 0, 30);
  func->Draw("SAME");
  
  c->SaveAs("clusters_vs_tracklets.eps");
}

void VertexPlotBackgroundNote()
{
  TFile::Open("all.root");
  
  hist = (TH3*) gFile->Get("vertex_check");
  proj = (TH1*) hist->ProjectionZ()->Clone("all");
  proj->Rebin(2);
  
  proj->Draw();
  
  TFile::Open("analysis_esd_raw.root");
  hist = (TH3*) gFile->Get("vertex_check");
  proj = (TH1*) hist->ProjectionZ()->Clone("afterbg");
  proj->Rebin(2);
  
  proj->SetLineColor(2);
  proj->Draw("SAME");
}

void BackgroundAnalysis(const char* signal, const char* background)
{
  TFile::Open(signal);
  signalHist = (TH2*) gFile->Get("fTrackletsVsClusters");
  
  TFile::Open(background);
  backgroundHist = (TH2*) gFile->Get("fTrackletsVsClusters");
  
  Printf("For events with >= 1 tracklet:");
  
  func = new TF1("func", "[0] + x * 11", 0, 30);
  for (Int_t a = 50; a <= 100; a += 10)
  {
    func->SetParameter(0, a);
    
    Float_t signalCount = 0;
    Float_t backgroundCount = 0;
    for (Int_t x = 2; x <= signalHist->GetNbinsX(); x++)
    {
      signalCount += signalHist->Integral(x, x, signalHist->GetYaxis()->FindBin(func->Eval(signalHist->GetXaxis()->GetBinCenter(x))), signalHist->GetNbinsY());
      backgroundCount += backgroundHist->Integral(x, x, signalHist->GetYaxis()->FindBin(func->Eval(signalHist->GetXaxis()->GetBinCenter(x))), signalHist->GetNbinsY());
    }
    
    Float_t signalFraction = 100.0 * signalCount / signalHist->Integral(2, signalHist->GetNbinsX(), 1, signalHist->GetNbinsY());
    Float_t backgroundFraction = 100.0 * backgroundCount / backgroundHist->Integral(2, signalHist->GetNbinsX(), 1, signalHist->GetNbinsY());
    
    Printf("Cut at a = %d; Removed %.2f %% of the background (%.0f events); Removed %.2f %% of the signal", a, backgroundFraction, backgroundCount, signalFraction);
  }
}

void ZPhiPlots()
{
  TFile::Open("analysis_esd_raw.root");
  
  for (Int_t i=0; i<2; i++)
  {  
    hist = (TH2*) gFile->Get(Form("fZPhi_%d", i));
    
    c = new TCanvas;
    hist->SetStats(0);
    hist->Draw("COLZ");
    c->SaveAs(Form("ZPhi_%d.png", i));
  }
}

void DrawStats(Bool_t all = kFALSE)
{
  if (all)
  {
    Int_t count = 4;
    const char* list[] = { "CINT1B-ABCE-NOPF-ALL/spd", "CINT1A-ABCE-NOPF-ALL/spd", "CINT1C-ABCE-NOPF-ALL/spd", "CINT1-E-NOPF-ALL/spd" };
  }
  else
  {
    Int_t count = 1;
    const char* list[] = { "." };
  }
  
  for (Int_t i=0; i<count; i++)
  {
    TFile::Open(Form("%s/analysis_esd_raw.root", list[i]));
  
    hist = (TH2*) gFile->Get("fStats2");
    
    c = new TCanvas(list[i], list[i], 800, 600);
    gPad->SetBottomMargin(0.2);
    gPad->SetLeftMargin(0.2);
    gPad->SetRightMargin(0.2);
    hist->Draw("TEXT");
    hist->SetMarkerSize(2);
    //hist->GetYaxis()->SetRangeUser(0, 0);
    
    gROOT->Macro("increaseFonts.C");
  
    c->SaveAs(Form("%s/stats.png", list[i]));
  }
}

void CompareMCDataTrigger(const char* mcFile, const char* dataFile)
{
  TH1* stat[2];

  TFile::Open(mcFile);
  mc = (TH1*) gFile->Get("trigger_histograms_/fHistFiredBitsSPD");
  stat[0] = (TH1*) gFile->Get("fHistStatistics");
  
  TFile::Open(dataFile);
  data = (TH1*) gFile->Get("trigger_histograms_+CINT1B-ABCE-NOPF-ALL/fHistFiredBitsSPD");
  if (!data)
    data = (TH1*) gFile->Get("trigger_histograms_+CSMBB-ABCE-NOPF-ALL/fHistFiredBitsSPD");

  stat[1] = (TH1*) gFile->Get("fHistStatistics");
  
  CompareQualityHists(mc, data);
  
  for (Int_t i=0; i<2; i++)
  {
    Float_t total = stat[i]->GetBinContent(stat[i]->GetXaxis()->FindBin("Trigger class"), 1);
    Float_t spd = stat[i]->GetBinContent(stat[i]->GetXaxis()->FindBin("FO >= 2"), 1);
    Float_t v0A = stat[i]->GetBinContent(stat[i]->GetXaxis()->FindBin("V0A"), 1);
    Float_t v0C = stat[i]->GetBinContent(stat[i]->GetXaxis()->FindBin("V0C"), 1);
    
    Printf("%s:\nSPD / V0A: %.3f\nSPD / V0C: %.3f\nV0A / V0C: %.3f", (i == 0) ? "MC  " : "Data", spd / v0A, spd / v0C, v0A / v0C);
    Printf("SPD / Total: %.3f\nV0A / Total: %.3f\nV0C / Total: %.3f\n", spd / total, v0A / total, v0C / total);
  }
}

void CompareMCDatadNdEta(const char* mcFile, const char* dataFile)
{
  //CompareQualityHists(mcFile, dataFile, "fEtaPhi", 4, 4, "((TH2*)%p)->ProjectionY(\"%s\", 1, 40)");
  //CompareQualityHists(mcFile, dataFile, "fEtaPhi", 4, 4, "((TH2*)%p)->ProjectionY(\"%s\", 41, 80)");

  CompareQualityHists(mcFile, dataFile, "fEtaPhi", 1, 1, "((TH2*)%p)->ProjectionX(\"%s\", 271, 360)");
}

void TrigVsTrigVtx(const char* fileName = "correction_map.root", const char* dirName = "dndeta_correction")
{
  loadlibs();
  if (!TFile::Open(fileName))
    return;

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(dirName, dirName);
  if (!dNdEtaCorrection->LoadHistograms())
    return;
  
  TH2* eTrig =    dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->GetGeneratedHistogram();
  TH2* eTrigVtx = dNdEtaCorrection->GetVertexRecoCorrection()->GetEventCorrection()->GetMeasuredHistogram();
  
  eTrig_proj = eTrig->ProjectionY("y1", eTrig->GetYaxis()->FindBin(-9.9), eTrig->GetYaxis()->FindBin(9.9));
  eTrigVtx_proj = eTrigVtx->ProjectionY("y2", eTrig->GetYaxis()->FindBin(-9.9), eTrig->GetYaxis()->FindBin(9.9));
  
  new TCanvas;
  eTrig_proj->Draw();
  eTrig_proj->GetXaxis()->SetRangeUser(0, 20);
  eTrigVtx_proj->SetLineColor(2);
  eTrigVtx_proj->Draw("SAME");
  
  gPad->SetLogy();
}

void PrintAverageNSDCorrectionFactors()
{
  // factors estimated from MC, can be slighly different with data b/c correction is applies as function of measured multiplicity

  loadlibs();

  if (!TFile::Open("correction_mapprocess-types.root"))
    return;

  AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction_ND", "dndeta_correction_ND");
  if (!dNdEtaCorrection->LoadHistograms())
    return;

  AlidNdEtaCorrection* dNdEtaCorrection2 = new AlidNdEtaCorrection("dndeta_correction_DD", "dndeta_correction_DD");
  if (!dNdEtaCorrection2->LoadHistograms())
    return;
    
  // for scaling factors see drawSystematics.C; GetRelativeFractions()
  // 900 GeV
  //dNdEtaCorrection->Scale(1.06);
  //dNdEtaCorrection->Add(dNdEtaCorrection2, 9.5 / 12.3);
  // 2.36 TeV
  dNdEtaCorrection->Scale(1.036);
  dNdEtaCorrection->Add(dNdEtaCorrection2, 0.075 * 1.43 / 0.127);
  
  Printf("event adding: %f", dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral() / dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral());
  
  Printf("track adding: %f", dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetTrackCorrection()->GetGeneratedHistogram()->Integral() / dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetTrackCorrection()->GetMeasuredHistogram()->Integral());
  
  AlidNdEtaCorrection* dNdEtaCorrection3 = new AlidNdEtaCorrection("dndeta_correction_SD", "dndeta_correction_SD");
  if (!dNdEtaCorrection3->LoadHistograms())
    return;

  // 900 GeV
  //dNdEtaCorrection3->Scale(0.153 / 0.189);
  // 2.36 TeV
  dNdEtaCorrection3->Scale(0.159 / 0.166);
  dNdEtaCorrection->Add(dNdEtaCorrection3);

  Printf("event subtraction: %f", dNdEtaCorrection3->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral() / dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral());
  
  Printf("track subtraction: %f", dNdEtaCorrection3->GetTriggerBiasCorrectionINEL()->GetTrackCorrection()->GetMeasuredHistogram()->Integral() / dNdEtaCorrection->GetTriggerBiasCorrectionINEL()->GetTrackCorrection()->GetMeasuredHistogram()->Integral());
  
  dNdEtaCorrection->GetTriggerBiasCorrectionNSD()->PrintInfo(0.0);
}
    
 drawPlots.C:1
 drawPlots.C:2
 drawPlots.C:3
 drawPlots.C:4
 drawPlots.C:5
 drawPlots.C:6
 drawPlots.C:7
 drawPlots.C:8
 drawPlots.C:9
 drawPlots.C:10
 drawPlots.C:11
 drawPlots.C:12
 drawPlots.C:13
 drawPlots.C:14
 drawPlots.C:15
 drawPlots.C:16
 drawPlots.C:17
 drawPlots.C:18
 drawPlots.C:19
 drawPlots.C:20
 drawPlots.C:21
 drawPlots.C:22
 drawPlots.C:23
 drawPlots.C:24
 drawPlots.C:25
 drawPlots.C:26
 drawPlots.C:27
 drawPlots.C:28
 drawPlots.C:29
 drawPlots.C:30
 drawPlots.C:31
 drawPlots.C:32
 drawPlots.C:33
 drawPlots.C:34
 drawPlots.C:35
 drawPlots.C:36
 drawPlots.C:37
 drawPlots.C:38
 drawPlots.C:39
 drawPlots.C:40
 drawPlots.C:41
 drawPlots.C:42
 drawPlots.C:43
 drawPlots.C:44
 drawPlots.C:45
 drawPlots.C:46
 drawPlots.C:47
 drawPlots.C:48
 drawPlots.C:49
 drawPlots.C:50
 drawPlots.C:51
 drawPlots.C:52
 drawPlots.C:53
 drawPlots.C:54
 drawPlots.C:55
 drawPlots.C:56
 drawPlots.C:57
 drawPlots.C:58
 drawPlots.C:59
 drawPlots.C:60
 drawPlots.C:61
 drawPlots.C:62
 drawPlots.C:63
 drawPlots.C:64
 drawPlots.C:65
 drawPlots.C:66
 drawPlots.C:67
 drawPlots.C:68
 drawPlots.C:69
 drawPlots.C:70
 drawPlots.C:71
 drawPlots.C:72
 drawPlots.C:73
 drawPlots.C:74
 drawPlots.C:75
 drawPlots.C:76
 drawPlots.C:77
 drawPlots.C:78
 drawPlots.C:79
 drawPlots.C:80
 drawPlots.C:81
 drawPlots.C:82
 drawPlots.C:83
 drawPlots.C:84
 drawPlots.C:85
 drawPlots.C:86
 drawPlots.C:87
 drawPlots.C:88
 drawPlots.C:89
 drawPlots.C:90
 drawPlots.C:91
 drawPlots.C:92
 drawPlots.C:93
 drawPlots.C:94
 drawPlots.C:95
 drawPlots.C:96
 drawPlots.C:97
 drawPlots.C:98
 drawPlots.C:99
 drawPlots.C:100
 drawPlots.C:101
 drawPlots.C:102
 drawPlots.C:103
 drawPlots.C:104
 drawPlots.C:105
 drawPlots.C:106
 drawPlots.C:107
 drawPlots.C:108
 drawPlots.C:109
 drawPlots.C:110
 drawPlots.C:111
 drawPlots.C:112
 drawPlots.C:113
 drawPlots.C:114
 drawPlots.C:115
 drawPlots.C:116
 drawPlots.C:117
 drawPlots.C:118
 drawPlots.C:119
 drawPlots.C:120
 drawPlots.C:121
 drawPlots.C:122
 drawPlots.C:123
 drawPlots.C:124
 drawPlots.C:125
 drawPlots.C:126
 drawPlots.C:127
 drawPlots.C:128
 drawPlots.C:129
 drawPlots.C:130
 drawPlots.C:131
 drawPlots.C:132
 drawPlots.C:133
 drawPlots.C:134
 drawPlots.C:135
 drawPlots.C:136
 drawPlots.C:137
 drawPlots.C:138
 drawPlots.C:139
 drawPlots.C:140
 drawPlots.C:141
 drawPlots.C:142
 drawPlots.C:143
 drawPlots.C:144
 drawPlots.C:145
 drawPlots.C:146
 drawPlots.C:147
 drawPlots.C:148
 drawPlots.C:149
 drawPlots.C:150
 drawPlots.C:151
 drawPlots.C:152
 drawPlots.C:153
 drawPlots.C:154
 drawPlots.C:155
 drawPlots.C:156
 drawPlots.C:157
 drawPlots.C:158
 drawPlots.C:159
 drawPlots.C:160
 drawPlots.C:161
 drawPlots.C:162
 drawPlots.C:163
 drawPlots.C:164
 drawPlots.C:165
 drawPlots.C:166
 drawPlots.C:167
 drawPlots.C:168
 drawPlots.C:169
 drawPlots.C:170
 drawPlots.C:171
 drawPlots.C:172
 drawPlots.C:173
 drawPlots.C:174
 drawPlots.C:175
 drawPlots.C:176
 drawPlots.C:177
 drawPlots.C:178
 drawPlots.C:179
 drawPlots.C:180
 drawPlots.C:181
 drawPlots.C:182
 drawPlots.C:183
 drawPlots.C:184
 drawPlots.C:185
 drawPlots.C:186
 drawPlots.C:187
 drawPlots.C:188
 drawPlots.C:189
 drawPlots.C:190
 drawPlots.C:191
 drawPlots.C:192
 drawPlots.C:193
 drawPlots.C:194
 drawPlots.C:195
 drawPlots.C:196
 drawPlots.C:197
 drawPlots.C:198
 drawPlots.C:199
 drawPlots.C:200
 drawPlots.C:201
 drawPlots.C:202
 drawPlots.C:203
 drawPlots.C:204
 drawPlots.C:205
 drawPlots.C:206
 drawPlots.C:207
 drawPlots.C:208
 drawPlots.C:209
 drawPlots.C:210
 drawPlots.C:211
 drawPlots.C:212
 drawPlots.C:213
 drawPlots.C:214
 drawPlots.C:215
 drawPlots.C:216
 drawPlots.C:217
 drawPlots.C:218
 drawPlots.C:219
 drawPlots.C:220
 drawPlots.C:221
 drawPlots.C:222
 drawPlots.C:223
 drawPlots.C:224
 drawPlots.C:225
 drawPlots.C:226
 drawPlots.C:227
 drawPlots.C:228
 drawPlots.C:229
 drawPlots.C:230
 drawPlots.C:231
 drawPlots.C:232
 drawPlots.C:233
 drawPlots.C:234
 drawPlots.C:235
 drawPlots.C:236
 drawPlots.C:237
 drawPlots.C:238
 drawPlots.C:239
 drawPlots.C:240
 drawPlots.C:241
 drawPlots.C:242
 drawPlots.C:243
 drawPlots.C:244
 drawPlots.C:245
 drawPlots.C:246
 drawPlots.C:247
 drawPlots.C:248
 drawPlots.C:249
 drawPlots.C:250
 drawPlots.C:251
 drawPlots.C:252
 drawPlots.C:253
 drawPlots.C:254
 drawPlots.C:255
 drawPlots.C:256
 drawPlots.C:257
 drawPlots.C:258
 drawPlots.C:259
 drawPlots.C:260
 drawPlots.C:261
 drawPlots.C:262
 drawPlots.C:263
 drawPlots.C:264
 drawPlots.C:265
 drawPlots.C:266
 drawPlots.C:267
 drawPlots.C:268
 drawPlots.C:269
 drawPlots.C:270
 drawPlots.C:271
 drawPlots.C:272
 drawPlots.C:273
 drawPlots.C:274
 drawPlots.C:275
 drawPlots.C:276
 drawPlots.C:277
 drawPlots.C:278
 drawPlots.C:279
 drawPlots.C:280
 drawPlots.C:281
 drawPlots.C:282
 drawPlots.C:283
 drawPlots.C:284
 drawPlots.C:285
 drawPlots.C:286
 drawPlots.C:287
 drawPlots.C:288
 drawPlots.C:289
 drawPlots.C:290
 drawPlots.C:291
 drawPlots.C:292
 drawPlots.C:293
 drawPlots.C:294
 drawPlots.C:295
 drawPlots.C:296
 drawPlots.C:297
 drawPlots.C:298
 drawPlots.C:299
 drawPlots.C:300
 drawPlots.C:301
 drawPlots.C:302
 drawPlots.C:303
 drawPlots.C:304
 drawPlots.C:305
 drawPlots.C:306
 drawPlots.C:307
 drawPlots.C:308
 drawPlots.C:309
 drawPlots.C:310
 drawPlots.C:311
 drawPlots.C:312
 drawPlots.C:313
 drawPlots.C:314
 drawPlots.C:315
 drawPlots.C:316
 drawPlots.C:317
 drawPlots.C:318
 drawPlots.C:319
 drawPlots.C:320
 drawPlots.C:321
 drawPlots.C:322
 drawPlots.C:323
 drawPlots.C:324
 drawPlots.C:325
 drawPlots.C:326
 drawPlots.C:327
 drawPlots.C:328
 drawPlots.C:329
 drawPlots.C:330
 drawPlots.C:331
 drawPlots.C:332
 drawPlots.C:333
 drawPlots.C:334
 drawPlots.C:335
 drawPlots.C:336
 drawPlots.C:337
 drawPlots.C:338
 drawPlots.C:339
 drawPlots.C:340
 drawPlots.C:341
 drawPlots.C:342
 drawPlots.C:343
 drawPlots.C:344
 drawPlots.C:345
 drawPlots.C:346
 drawPlots.C:347
 drawPlots.C:348
 drawPlots.C:349
 drawPlots.C:350
 drawPlots.C:351
 drawPlots.C:352
 drawPlots.C:353
 drawPlots.C:354
 drawPlots.C:355
 drawPlots.C:356
 drawPlots.C:357
 drawPlots.C:358
 drawPlots.C:359
 drawPlots.C:360
 drawPlots.C:361
 drawPlots.C:362
 drawPlots.C:363
 drawPlots.C:364
 drawPlots.C:365
 drawPlots.C:366
 drawPlots.C:367
 drawPlots.C:368
 drawPlots.C:369
 drawPlots.C:370
 drawPlots.C:371
 drawPlots.C:372
 drawPlots.C:373
 drawPlots.C:374
 drawPlots.C:375
 drawPlots.C:376
 drawPlots.C:377
 drawPlots.C:378
 drawPlots.C:379
 drawPlots.C:380
 drawPlots.C:381
 drawPlots.C:382
 drawPlots.C:383
 drawPlots.C:384
 drawPlots.C:385
 drawPlots.C:386
 drawPlots.C:387
 drawPlots.C:388
 drawPlots.C:389
 drawPlots.C:390
 drawPlots.C:391
 drawPlots.C:392
 drawPlots.C:393
 drawPlots.C:394
 drawPlots.C:395
 drawPlots.C:396
 drawPlots.C:397
 drawPlots.C:398
 drawPlots.C:399
 drawPlots.C:400
 drawPlots.C:401
 drawPlots.C:402
 drawPlots.C:403
 drawPlots.C:404
 drawPlots.C:405
 drawPlots.C:406
 drawPlots.C:407
 drawPlots.C:408
 drawPlots.C:409
 drawPlots.C:410
 drawPlots.C:411
 drawPlots.C:412
 drawPlots.C:413
 drawPlots.C:414
 drawPlots.C:415
 drawPlots.C:416
 drawPlots.C:417
 drawPlots.C:418
 drawPlots.C:419
 drawPlots.C:420
 drawPlots.C:421
 drawPlots.C:422
 drawPlots.C:423
 drawPlots.C:424
 drawPlots.C:425
 drawPlots.C:426
 drawPlots.C:427
 drawPlots.C:428
 drawPlots.C:429
 drawPlots.C:430
 drawPlots.C:431
 drawPlots.C:432
 drawPlots.C:433
 drawPlots.C:434
 drawPlots.C:435
 drawPlots.C:436
 drawPlots.C:437
 drawPlots.C:438
 drawPlots.C:439
 drawPlots.C:440
 drawPlots.C:441
 drawPlots.C:442
 drawPlots.C:443
 drawPlots.C:444
 drawPlots.C:445
 drawPlots.C:446
 drawPlots.C:447
 drawPlots.C:448
 drawPlots.C:449
 drawPlots.C:450
 drawPlots.C:451
 drawPlots.C:452
 drawPlots.C:453
 drawPlots.C:454
 drawPlots.C:455
 drawPlots.C:456
 drawPlots.C:457
 drawPlots.C:458
 drawPlots.C:459
 drawPlots.C:460
 drawPlots.C:461
 drawPlots.C:462
 drawPlots.C:463
 drawPlots.C:464
 drawPlots.C:465
 drawPlots.C:466
 drawPlots.C:467
 drawPlots.C:468
 drawPlots.C:469
 drawPlots.C:470
 drawPlots.C:471
 drawPlots.C:472
 drawPlots.C:473
 drawPlots.C:474
 drawPlots.C:475
 drawPlots.C:476
 drawPlots.C:477
 drawPlots.C:478
 drawPlots.C:479
 drawPlots.C:480
 drawPlots.C:481
 drawPlots.C:482
 drawPlots.C:483
 drawPlots.C:484
 drawPlots.C:485
 drawPlots.C:486
 drawPlots.C:487
 drawPlots.C:488
 drawPlots.C:489
 drawPlots.C:490
 drawPlots.C:491
 drawPlots.C:492
 drawPlots.C:493
 drawPlots.C:494
 drawPlots.C:495
 drawPlots.C:496
 drawPlots.C:497
 drawPlots.C:498
 drawPlots.C:499
 drawPlots.C:500
 drawPlots.C:501
 drawPlots.C:502
 drawPlots.C:503
 drawPlots.C:504
 drawPlots.C:505
 drawPlots.C:506
 drawPlots.C:507
 drawPlots.C:508
 drawPlots.C:509
 drawPlots.C:510
 drawPlots.C:511
 drawPlots.C:512
 drawPlots.C:513
 drawPlots.C:514
 drawPlots.C:515
 drawPlots.C:516
 drawPlots.C:517
 drawPlots.C:518
 drawPlots.C:519
 drawPlots.C:520
 drawPlots.C:521
 drawPlots.C:522
 drawPlots.C:523
 drawPlots.C:524
 drawPlots.C:525
 drawPlots.C:526
 drawPlots.C:527
 drawPlots.C:528
 drawPlots.C:529
 drawPlots.C:530
 drawPlots.C:531
 drawPlots.C:532
 drawPlots.C:533
 drawPlots.C:534
 drawPlots.C:535
 drawPlots.C:536
 drawPlots.C:537
 drawPlots.C:538
 drawPlots.C:539
 drawPlots.C:540
 drawPlots.C:541
 drawPlots.C:542
 drawPlots.C:543
 drawPlots.C:544
 drawPlots.C:545
 drawPlots.C:546
 drawPlots.C:547
 drawPlots.C:548
 drawPlots.C:549
 drawPlots.C:550
 drawPlots.C:551
 drawPlots.C:552
 drawPlots.C:553
 drawPlots.C:554
 drawPlots.C:555
 drawPlots.C:556
 drawPlots.C:557
 drawPlots.C:558
 drawPlots.C:559
 drawPlots.C:560
 drawPlots.C:561
 drawPlots.C:562
 drawPlots.C:563
 drawPlots.C:564
 drawPlots.C:565
 drawPlots.C:566
 drawPlots.C:567
 drawPlots.C:568
 drawPlots.C:569
 drawPlots.C:570
 drawPlots.C:571
 drawPlots.C:572
 drawPlots.C:573
 drawPlots.C:574
 drawPlots.C:575
 drawPlots.C:576
 drawPlots.C:577
 drawPlots.C:578
 drawPlots.C:579
 drawPlots.C:580
 drawPlots.C:581
 drawPlots.C:582
 drawPlots.C:583
 drawPlots.C:584
 drawPlots.C:585
 drawPlots.C:586
 drawPlots.C:587
 drawPlots.C:588
 drawPlots.C:589
 drawPlots.C:590
 drawPlots.C:591
 drawPlots.C:592
 drawPlots.C:593
 drawPlots.C:594
 drawPlots.C:595
 drawPlots.C:596
 drawPlots.C:597
 drawPlots.C:598
 drawPlots.C:599
 drawPlots.C:600
 drawPlots.C:601
 drawPlots.C:602
 drawPlots.C:603
 drawPlots.C:604
 drawPlots.C:605
 drawPlots.C:606
 drawPlots.C:607
 drawPlots.C:608
 drawPlots.C:609
 drawPlots.C:610
 drawPlots.C:611
 drawPlots.C:612
 drawPlots.C:613
 drawPlots.C:614
 drawPlots.C:615
 drawPlots.C:616
 drawPlots.C:617
 drawPlots.C:618
 drawPlots.C:619
 drawPlots.C:620
 drawPlots.C:621
 drawPlots.C:622
 drawPlots.C:623
 drawPlots.C:624
 drawPlots.C:625
 drawPlots.C:626
 drawPlots.C:627
 drawPlots.C:628
 drawPlots.C:629
 drawPlots.C:630
 drawPlots.C:631
 drawPlots.C:632
 drawPlots.C:633
 drawPlots.C:634
 drawPlots.C:635
 drawPlots.C:636
 drawPlots.C:637
 drawPlots.C:638
 drawPlots.C:639
 drawPlots.C:640
 drawPlots.C:641
 drawPlots.C:642
 drawPlots.C:643
 drawPlots.C:644
 drawPlots.C:645
 drawPlots.C:646
 drawPlots.C:647
 drawPlots.C:648
 drawPlots.C:649
 drawPlots.C:650
 drawPlots.C:651
 drawPlots.C:652
 drawPlots.C:653
 drawPlots.C:654
 drawPlots.C:655
 drawPlots.C:656
 drawPlots.C:657
 drawPlots.C:658
 drawPlots.C:659
 drawPlots.C:660
 drawPlots.C:661
 drawPlots.C:662
 drawPlots.C:663
 drawPlots.C:664
 drawPlots.C:665
 drawPlots.C:666
 drawPlots.C:667
 drawPlots.C:668
 drawPlots.C:669
 drawPlots.C:670
 drawPlots.C:671
 drawPlots.C:672
 drawPlots.C:673
 drawPlots.C:674
 drawPlots.C:675
 drawPlots.C:676
 drawPlots.C:677
 drawPlots.C:678
 drawPlots.C:679
 drawPlots.C:680
 drawPlots.C:681
 drawPlots.C:682
 drawPlots.C:683
 drawPlots.C:684
 drawPlots.C:685
 drawPlots.C:686
 drawPlots.C:687
 drawPlots.C:688
 drawPlots.C:689
 drawPlots.C:690
 drawPlots.C:691
 drawPlots.C:692
 drawPlots.C:693
 drawPlots.C:694
 drawPlots.C:695
 drawPlots.C:696
 drawPlots.C:697
 drawPlots.C:698
 drawPlots.C:699
 drawPlots.C:700
 drawPlots.C:701
 drawPlots.C:702
 drawPlots.C:703
 drawPlots.C:704
 drawPlots.C:705
 drawPlots.C:706
 drawPlots.C:707
 drawPlots.C:708
 drawPlots.C:709
 drawPlots.C:710
 drawPlots.C:711
 drawPlots.C:712
 drawPlots.C:713
 drawPlots.C:714
 drawPlots.C:715
 drawPlots.C:716
 drawPlots.C:717
 drawPlots.C:718
 drawPlots.C:719
 drawPlots.C:720
 drawPlots.C:721
 drawPlots.C:722
 drawPlots.C:723
 drawPlots.C:724
 drawPlots.C:725
 drawPlots.C:726
 drawPlots.C:727
 drawPlots.C:728
 drawPlots.C:729
 drawPlots.C:730
 drawPlots.C:731
 drawPlots.C:732
 drawPlots.C:733
 drawPlots.C:734
 drawPlots.C:735
 drawPlots.C:736
 drawPlots.C:737
 drawPlots.C:738
 drawPlots.C:739
 drawPlots.C:740
 drawPlots.C:741
 drawPlots.C:742
 drawPlots.C:743
 drawPlots.C:744
 drawPlots.C:745
 drawPlots.C:746
 drawPlots.C:747
 drawPlots.C:748
 drawPlots.C:749
 drawPlots.C:750
 drawPlots.C:751
 drawPlots.C:752
 drawPlots.C:753
 drawPlots.C:754
 drawPlots.C:755
 drawPlots.C:756
 drawPlots.C:757
 drawPlots.C:758
 drawPlots.C:759
 drawPlots.C:760
 drawPlots.C:761
 drawPlots.C:762
 drawPlots.C:763
 drawPlots.C:764
 drawPlots.C:765
 drawPlots.C:766
 drawPlots.C:767
 drawPlots.C:768
 drawPlots.C:769
 drawPlots.C:770
 drawPlots.C:771
 drawPlots.C:772
 drawPlots.C:773
 drawPlots.C:774
 drawPlots.C:775
 drawPlots.C:776
 drawPlots.C:777
 drawPlots.C:778
 drawPlots.C:779
 drawPlots.C:780
 drawPlots.C:781
 drawPlots.C:782
 drawPlots.C:783
 drawPlots.C:784
 drawPlots.C:785
 drawPlots.C:786
 drawPlots.C:787
 drawPlots.C:788
 drawPlots.C:789
 drawPlots.C:790
 drawPlots.C:791
 drawPlots.C:792
 drawPlots.C:793
 drawPlots.C:794
 drawPlots.C:795
 drawPlots.C:796
 drawPlots.C:797
 drawPlots.C:798
 drawPlots.C:799
 drawPlots.C:800
 drawPlots.C:801
 drawPlots.C:802
 drawPlots.C:803
 drawPlots.C:804
 drawPlots.C:805
 drawPlots.C:806
 drawPlots.C:807
 drawPlots.C:808
 drawPlots.C:809
 drawPlots.C:810
 drawPlots.C:811
 drawPlots.C:812
 drawPlots.C:813
 drawPlots.C:814
 drawPlots.C:815
 drawPlots.C:816
 drawPlots.C:817
 drawPlots.C:818
 drawPlots.C:819
 drawPlots.C:820
 drawPlots.C:821
 drawPlots.C:822
 drawPlots.C:823
 drawPlots.C:824
 drawPlots.C:825
 drawPlots.C:826
 drawPlots.C:827
 drawPlots.C:828
 drawPlots.C:829
 drawPlots.C:830
 drawPlots.C:831
 drawPlots.C:832
 drawPlots.C:833
 drawPlots.C:834
 drawPlots.C:835
 drawPlots.C:836
 drawPlots.C:837
 drawPlots.C:838
 drawPlots.C:839
 drawPlots.C:840
 drawPlots.C:841
 drawPlots.C:842
 drawPlots.C:843
 drawPlots.C:844
 drawPlots.C:845
 drawPlots.C:846
 drawPlots.C:847
 drawPlots.C:848
 drawPlots.C:849
 drawPlots.C:850
 drawPlots.C:851
 drawPlots.C:852
 drawPlots.C:853
 drawPlots.C:854
 drawPlots.C:855
 drawPlots.C:856
 drawPlots.C:857
 drawPlots.C:858
 drawPlots.C:859
 drawPlots.C:860
 drawPlots.C:861
 drawPlots.C:862
 drawPlots.C:863
 drawPlots.C:864
 drawPlots.C:865
 drawPlots.C:866
 drawPlots.C:867
 drawPlots.C:868
 drawPlots.C:869
 drawPlots.C:870
 drawPlots.C:871
 drawPlots.C:872
 drawPlots.C:873
 drawPlots.C:874
 drawPlots.C:875
 drawPlots.C:876
 drawPlots.C:877
 drawPlots.C:878
 drawPlots.C:879
 drawPlots.C:880
 drawPlots.C:881
 drawPlots.C:882
 drawPlots.C:883
 drawPlots.C:884
 drawPlots.C:885
 drawPlots.C:886
 drawPlots.C:887
 drawPlots.C:888
 drawPlots.C:889
 drawPlots.C:890
 drawPlots.C:891
 drawPlots.C:892
 drawPlots.C:893
 drawPlots.C:894
 drawPlots.C:895
 drawPlots.C:896
 drawPlots.C:897
 drawPlots.C:898
 drawPlots.C:899
 drawPlots.C:900
 drawPlots.C:901
 drawPlots.C:902
 drawPlots.C:903
 drawPlots.C:904
 drawPlots.C:905
 drawPlots.C:906
 drawPlots.C:907
 drawPlots.C:908
 drawPlots.C:909
 drawPlots.C:910
 drawPlots.C:911
 drawPlots.C:912
 drawPlots.C:913
 drawPlots.C:914
 drawPlots.C:915
 drawPlots.C:916
 drawPlots.C:917
 drawPlots.C:918
 drawPlots.C:919
 drawPlots.C:920
 drawPlots.C:921
 drawPlots.C:922
 drawPlots.C:923
 drawPlots.C:924
 drawPlots.C:925
 drawPlots.C:926
 drawPlots.C:927
 drawPlots.C:928
 drawPlots.C:929
 drawPlots.C:930
 drawPlots.C:931
 drawPlots.C:932
 drawPlots.C:933
 drawPlots.C:934
 drawPlots.C:935
 drawPlots.C:936
 drawPlots.C:937
 drawPlots.C:938
 drawPlots.C:939
 drawPlots.C:940
 drawPlots.C:941
 drawPlots.C:942
 drawPlots.C:943
 drawPlots.C:944
 drawPlots.C:945
 drawPlots.C:946
 drawPlots.C:947
 drawPlots.C:948
 drawPlots.C:949
 drawPlots.C:950
 drawPlots.C:951
 drawPlots.C:952
 drawPlots.C:953
 drawPlots.C:954
 drawPlots.C:955
 drawPlots.C:956
 drawPlots.C:957
 drawPlots.C:958
 drawPlots.C:959
 drawPlots.C:960
 drawPlots.C:961
 drawPlots.C:962
 drawPlots.C:963
 drawPlots.C:964
 drawPlots.C:965
 drawPlots.C:966
 drawPlots.C:967
 drawPlots.C:968
 drawPlots.C:969
 drawPlots.C:970
 drawPlots.C:971
 drawPlots.C:972
 drawPlots.C:973
 drawPlots.C:974
 drawPlots.C:975
 drawPlots.C:976
 drawPlots.C:977
 drawPlots.C:978
 drawPlots.C:979
 drawPlots.C:980
 drawPlots.C:981
 drawPlots.C:982
 drawPlots.C:983
 drawPlots.C:984
 drawPlots.C:985
 drawPlots.C:986
 drawPlots.C:987
 drawPlots.C:988
 drawPlots.C:989
 drawPlots.C:990
 drawPlots.C:991
 drawPlots.C:992
 drawPlots.C:993
 drawPlots.C:994
 drawPlots.C:995
 drawPlots.C:996
 drawPlots.C:997
 drawPlots.C:998
 drawPlots.C:999
 drawPlots.C:1000
 drawPlots.C:1001
 drawPlots.C:1002
 drawPlots.C:1003
 drawPlots.C:1004
 drawPlots.C:1005
 drawPlots.C:1006
 drawPlots.C:1007
 drawPlots.C:1008
 drawPlots.C:1009
 drawPlots.C:1010
 drawPlots.C:1011
 drawPlots.C:1012
 drawPlots.C:1013
 drawPlots.C:1014
 drawPlots.C:1015
 drawPlots.C:1016
 drawPlots.C:1017
 drawPlots.C:1018
 drawPlots.C:1019
 drawPlots.C:1020
 drawPlots.C:1021
 drawPlots.C:1022
 drawPlots.C:1023
 drawPlots.C:1024
 drawPlots.C:1025
 drawPlots.C:1026
 drawPlots.C:1027
 drawPlots.C:1028
 drawPlots.C:1029
 drawPlots.C:1030
 drawPlots.C:1031
 drawPlots.C:1032
 drawPlots.C:1033
 drawPlots.C:1034
 drawPlots.C:1035
 drawPlots.C:1036
 drawPlots.C:1037
 drawPlots.C:1038
 drawPlots.C:1039
 drawPlots.C:1040
 drawPlots.C:1041
 drawPlots.C:1042
 drawPlots.C:1043
 drawPlots.C:1044
 drawPlots.C:1045
 drawPlots.C:1046
 drawPlots.C:1047
 drawPlots.C:1048
 drawPlots.C:1049
 drawPlots.C:1050
 drawPlots.C:1051
 drawPlots.C:1052
 drawPlots.C:1053
 drawPlots.C:1054
 drawPlots.C:1055
 drawPlots.C:1056
 drawPlots.C:1057
 drawPlots.C:1058
 drawPlots.C:1059
 drawPlots.C:1060
 drawPlots.C:1061
 drawPlots.C:1062
 drawPlots.C:1063
 drawPlots.C:1064
 drawPlots.C:1065
 drawPlots.C:1066
 drawPlots.C:1067
 drawPlots.C:1068
 drawPlots.C:1069
 drawPlots.C:1070
 drawPlots.C:1071
 drawPlots.C:1072
 drawPlots.C:1073
 drawPlots.C:1074
 drawPlots.C:1075
 drawPlots.C:1076
 drawPlots.C:1077
 drawPlots.C:1078
 drawPlots.C:1079
 drawPlots.C:1080
 drawPlots.C:1081
 drawPlots.C:1082
 drawPlots.C:1083
 drawPlots.C:1084
 drawPlots.C:1085
 drawPlots.C:1086
 drawPlots.C:1087
 drawPlots.C:1088
 drawPlots.C:1089
 drawPlots.C:1090
 drawPlots.C:1091
 drawPlots.C:1092
 drawPlots.C:1093
 drawPlots.C:1094
 drawPlots.C:1095
 drawPlots.C:1096
 drawPlots.C:1097
 drawPlots.C:1098
 drawPlots.C:1099
 drawPlots.C:1100
 drawPlots.C:1101
 drawPlots.C:1102
 drawPlots.C:1103
 drawPlots.C:1104
 drawPlots.C:1105
 drawPlots.C:1106
 drawPlots.C:1107
 drawPlots.C:1108
 drawPlots.C:1109
 drawPlots.C:1110
 drawPlots.C:1111
 drawPlots.C:1112
 drawPlots.C:1113
 drawPlots.C:1114
 drawPlots.C:1115
 drawPlots.C:1116
 drawPlots.C:1117
 drawPlots.C:1118
 drawPlots.C:1119
 drawPlots.C:1120
 drawPlots.C:1121
 drawPlots.C:1122
 drawPlots.C:1123
 drawPlots.C:1124
 drawPlots.C:1125
 drawPlots.C:1126
 drawPlots.C:1127
 drawPlots.C:1128
 drawPlots.C:1129
 drawPlots.C:1130
 drawPlots.C:1131
 drawPlots.C:1132
 drawPlots.C:1133
 drawPlots.C:1134
 drawPlots.C:1135
 drawPlots.C:1136
 drawPlots.C:1137
 drawPlots.C:1138
 drawPlots.C:1139
 drawPlots.C:1140
 drawPlots.C:1141
 drawPlots.C:1142
 drawPlots.C:1143
 drawPlots.C:1144
 drawPlots.C:1145
 drawPlots.C:1146
 drawPlots.C:1147
 drawPlots.C:1148
 drawPlots.C:1149
 drawPlots.C:1150
 drawPlots.C:1151
 drawPlots.C:1152
 drawPlots.C:1153
 drawPlots.C:1154
 drawPlots.C:1155
 drawPlots.C:1156
 drawPlots.C:1157
 drawPlots.C:1158
 drawPlots.C:1159
 drawPlots.C:1160
 drawPlots.C:1161
 drawPlots.C:1162
 drawPlots.C:1163
 drawPlots.C:1164
 drawPlots.C:1165
 drawPlots.C:1166
 drawPlots.C:1167
 drawPlots.C:1168
 drawPlots.C:1169
 drawPlots.C:1170
 drawPlots.C:1171
 drawPlots.C:1172
 drawPlots.C:1173
 drawPlots.C:1174
 drawPlots.C:1175
 drawPlots.C:1176
 drawPlots.C:1177
 drawPlots.C:1178
 drawPlots.C:1179
 drawPlots.C:1180
 drawPlots.C:1181
 drawPlots.C:1182
 drawPlots.C:1183
 drawPlots.C:1184
 drawPlots.C:1185
 drawPlots.C:1186
 drawPlots.C:1187
 drawPlots.C:1188
 drawPlots.C:1189
 drawPlots.C:1190
 drawPlots.C:1191
 drawPlots.C:1192
 drawPlots.C:1193
 drawPlots.C:1194
 drawPlots.C:1195
 drawPlots.C:1196
 drawPlots.C:1197
 drawPlots.C:1198
 drawPlots.C:1199
 drawPlots.C:1200
 drawPlots.C:1201
 drawPlots.C:1202
 drawPlots.C:1203
 drawPlots.C:1204
 drawPlots.C:1205
 drawPlots.C:1206
 drawPlots.C:1207
 drawPlots.C:1208
 drawPlots.C:1209
 drawPlots.C:1210
 drawPlots.C:1211
 drawPlots.C:1212
 drawPlots.C:1213
 drawPlots.C:1214
 drawPlots.C:1215
 drawPlots.C:1216
 drawPlots.C:1217
 drawPlots.C:1218
 drawPlots.C:1219
 drawPlots.C:1220
 drawPlots.C:1221
 drawPlots.C:1222
 drawPlots.C:1223
 drawPlots.C:1224
 drawPlots.C:1225
 drawPlots.C:1226
 drawPlots.C:1227
 drawPlots.C:1228
 drawPlots.C:1229
 drawPlots.C:1230
 drawPlots.C:1231
 drawPlots.C:1232
 drawPlots.C:1233
 drawPlots.C:1234
 drawPlots.C:1235
 drawPlots.C:1236
 drawPlots.C:1237
 drawPlots.C:1238
 drawPlots.C:1239
 drawPlots.C:1240
 drawPlots.C:1241
 drawPlots.C:1242
 drawPlots.C:1243
 drawPlots.C:1244
 drawPlots.C:1245
 drawPlots.C:1246
 drawPlots.C:1247
 drawPlots.C:1248
 drawPlots.C:1249
 drawPlots.C:1250
 drawPlots.C:1251
 drawPlots.C:1252
 drawPlots.C:1253
 drawPlots.C:1254
 drawPlots.C:1255
 drawPlots.C:1256
 drawPlots.C:1257
 drawPlots.C:1258
 drawPlots.C:1259
 drawPlots.C:1260
 drawPlots.C:1261
 drawPlots.C:1262
 drawPlots.C:1263
 drawPlots.C:1264
 drawPlots.C:1265
 drawPlots.C:1266
 drawPlots.C:1267
 drawPlots.C:1268
 drawPlots.C:1269
 drawPlots.C:1270
 drawPlots.C:1271
 drawPlots.C:1272
 drawPlots.C:1273
 drawPlots.C:1274
 drawPlots.C:1275
 drawPlots.C:1276
 drawPlots.C:1277
 drawPlots.C:1278
 drawPlots.C:1279
 drawPlots.C:1280
 drawPlots.C:1281
 drawPlots.C:1282
 drawPlots.C:1283
 drawPlots.C:1284
 drawPlots.C:1285
 drawPlots.C:1286
 drawPlots.C:1287
 drawPlots.C:1288
 drawPlots.C:1289
 drawPlots.C:1290
 drawPlots.C:1291
 drawPlots.C:1292
 drawPlots.C:1293
 drawPlots.C:1294
 drawPlots.C:1295
 drawPlots.C:1296
 drawPlots.C:1297
 drawPlots.C:1298
 drawPlots.C:1299
 drawPlots.C:1300
 drawPlots.C:1301
 drawPlots.C:1302
 drawPlots.C:1303
 drawPlots.C:1304
 drawPlots.C:1305
 drawPlots.C:1306
 drawPlots.C:1307
 drawPlots.C:1308
 drawPlots.C:1309
 drawPlots.C:1310
 drawPlots.C:1311
 drawPlots.C:1312
 drawPlots.C:1313
 drawPlots.C:1314
 drawPlots.C:1315
 drawPlots.C:1316
 drawPlots.C:1317
 drawPlots.C:1318
 drawPlots.C:1319
 drawPlots.C:1320
 drawPlots.C:1321
 drawPlots.C:1322
 drawPlots.C:1323
 drawPlots.C:1324
 drawPlots.C:1325
 drawPlots.C:1326
 drawPlots.C:1327
 drawPlots.C:1328
 drawPlots.C:1329
 drawPlots.C:1330
 drawPlots.C:1331
 drawPlots.C:1332
 drawPlots.C:1333
 drawPlots.C:1334
 drawPlots.C:1335
 drawPlots.C:1336
 drawPlots.C:1337
 drawPlots.C:1338
 drawPlots.C:1339
 drawPlots.C:1340
 drawPlots.C:1341
 drawPlots.C:1342
 drawPlots.C:1343
 drawPlots.C:1344
 drawPlots.C:1345
 drawPlots.C:1346
 drawPlots.C:1347
 drawPlots.C:1348
 drawPlots.C:1349
 drawPlots.C:1350
 drawPlots.C:1351
 drawPlots.C:1352
 drawPlots.C:1353
 drawPlots.C:1354
 drawPlots.C:1355
 drawPlots.C:1356
 drawPlots.C:1357
 drawPlots.C:1358
 drawPlots.C:1359
 drawPlots.C:1360
 drawPlots.C:1361
 drawPlots.C:1362
 drawPlots.C:1363
 drawPlots.C:1364
 drawPlots.C:1365
 drawPlots.C:1366
 drawPlots.C:1367
 drawPlots.C:1368
 drawPlots.C:1369
 drawPlots.C:1370
 drawPlots.C:1371
 drawPlots.C:1372
 drawPlots.C:1373
 drawPlots.C:1374
 drawPlots.C:1375
 drawPlots.C:1376
 drawPlots.C:1377
 drawPlots.C:1378
 drawPlots.C:1379
 drawPlots.C:1380
 drawPlots.C:1381
 drawPlots.C:1382
 drawPlots.C:1383
 drawPlots.C:1384
 drawPlots.C:1385
 drawPlots.C:1386
 drawPlots.C:1387
 drawPlots.C:1388
 drawPlots.C:1389
 drawPlots.C:1390
 drawPlots.C:1391
 drawPlots.C:1392
 drawPlots.C:1393
 drawPlots.C:1394
 drawPlots.C:1395
 drawPlots.C:1396
 drawPlots.C:1397
 drawPlots.C:1398
 drawPlots.C:1399
 drawPlots.C:1400
 drawPlots.C:1401
 drawPlots.C:1402
 drawPlots.C:1403
 drawPlots.C:1404
 drawPlots.C:1405
 drawPlots.C:1406
 drawPlots.C:1407
 drawPlots.C:1408
 drawPlots.C:1409
 drawPlots.C:1410
 drawPlots.C:1411
 drawPlots.C:1412
 drawPlots.C:1413
 drawPlots.C:1414
 drawPlots.C:1415
 drawPlots.C:1416
 drawPlots.C:1417
 drawPlots.C:1418
 drawPlots.C:1419
 drawPlots.C:1420
 drawPlots.C:1421
 drawPlots.C:1422
 drawPlots.C:1423
 drawPlots.C:1424
 drawPlots.C:1425
 drawPlots.C:1426
 drawPlots.C:1427
 drawPlots.C:1428
 drawPlots.C:1429
 drawPlots.C:1430
 drawPlots.C:1431
 drawPlots.C:1432
 drawPlots.C:1433
 drawPlots.C:1434
 drawPlots.C:1435
 drawPlots.C:1436
 drawPlots.C:1437
 drawPlots.C:1438
 drawPlots.C:1439
 drawPlots.C:1440
 drawPlots.C:1441
 drawPlots.C:1442
 drawPlots.C:1443
 drawPlots.C:1444
 drawPlots.C:1445
 drawPlots.C:1446
 drawPlots.C:1447
 drawPlots.C:1448
 drawPlots.C:1449
 drawPlots.C:1450
 drawPlots.C:1451
 drawPlots.C:1452
 drawPlots.C:1453
 drawPlots.C:1454
 drawPlots.C:1455
 drawPlots.C:1456
 drawPlots.C:1457
 drawPlots.C:1458
 drawPlots.C:1459
 drawPlots.C:1460
 drawPlots.C:1461
 drawPlots.C:1462
 drawPlots.C:1463
 drawPlots.C:1464
 drawPlots.C:1465
 drawPlots.C:1466
 drawPlots.C:1467
 drawPlots.C:1468
 drawPlots.C:1469
 drawPlots.C:1470
 drawPlots.C:1471
 drawPlots.C:1472
 drawPlots.C:1473
 drawPlots.C:1474
 drawPlots.C:1475
 drawPlots.C:1476
 drawPlots.C:1477
 drawPlots.C:1478
 drawPlots.C:1479
 drawPlots.C:1480
 drawPlots.C:1481
 drawPlots.C:1482
 drawPlots.C:1483
 drawPlots.C:1484
 drawPlots.C:1485
 drawPlots.C:1486
 drawPlots.C:1487
 drawPlots.C:1488
 drawPlots.C:1489
 drawPlots.C:1490
 drawPlots.C:1491
 drawPlots.C:1492
 drawPlots.C:1493
 drawPlots.C:1494
 drawPlots.C:1495
 drawPlots.C:1496
 drawPlots.C:1497
 drawPlots.C:1498
 drawPlots.C:1499
 drawPlots.C:1500
 drawPlots.C:1501
 drawPlots.C:1502
 drawPlots.C:1503
 drawPlots.C:1504
 drawPlots.C:1505
 drawPlots.C:1506
 drawPlots.C:1507
 drawPlots.C:1508
 drawPlots.C:1509
 drawPlots.C:1510
 drawPlots.C:1511
 drawPlots.C:1512
 drawPlots.C:1513
 drawPlots.C:1514
 drawPlots.C:1515
 drawPlots.C:1516
 drawPlots.C:1517
 drawPlots.C:1518
 drawPlots.C:1519
 drawPlots.C:1520
 drawPlots.C:1521
 drawPlots.C:1522
 drawPlots.C:1523
 drawPlots.C:1524
 drawPlots.C:1525
 drawPlots.C:1526
 drawPlots.C:1527
 drawPlots.C:1528
 drawPlots.C:1529
 drawPlots.C:1530
 drawPlots.C:1531
 drawPlots.C:1532
 drawPlots.C:1533
 drawPlots.C:1534
 drawPlots.C:1535
 drawPlots.C:1536
 drawPlots.C:1537
 drawPlots.C:1538
 drawPlots.C:1539
 drawPlots.C:1540
 drawPlots.C:1541
 drawPlots.C:1542
 drawPlots.C:1543
 drawPlots.C:1544
 drawPlots.C:1545
 drawPlots.C:1546
 drawPlots.C:1547
 drawPlots.C:1548
 drawPlots.C:1549
 drawPlots.C:1550
 drawPlots.C:1551
 drawPlots.C:1552
 drawPlots.C:1553
 drawPlots.C:1554
 drawPlots.C:1555
 drawPlots.C:1556
 drawPlots.C:1557
 drawPlots.C:1558
 drawPlots.C:1559
 drawPlots.C:1560
 drawPlots.C:1561
 drawPlots.C:1562
 drawPlots.C:1563
 drawPlots.C:1564
 drawPlots.C:1565
 drawPlots.C:1566
 drawPlots.C:1567
 drawPlots.C:1568
 drawPlots.C:1569
 drawPlots.C:1570
 drawPlots.C:1571
 drawPlots.C:1572
 drawPlots.C:1573
 drawPlots.C:1574
 drawPlots.C:1575
 drawPlots.C:1576
 drawPlots.C:1577
 drawPlots.C:1578
 drawPlots.C:1579
 drawPlots.C:1580
 drawPlots.C:1581
 drawPlots.C:1582
 drawPlots.C:1583
 drawPlots.C:1584
 drawPlots.C:1585
 drawPlots.C:1586
 drawPlots.C:1587
 drawPlots.C:1588
 drawPlots.C:1589
 drawPlots.C:1590
 drawPlots.C:1591
 drawPlots.C:1592
 drawPlots.C:1593
 drawPlots.C:1594
 drawPlots.C:1595
 drawPlots.C:1596
 drawPlots.C:1597
 drawPlots.C:1598
 drawPlots.C:1599
 drawPlots.C:1600
 drawPlots.C:1601
 drawPlots.C:1602
 drawPlots.C:1603
 drawPlots.C:1604
 drawPlots.C:1605
 drawPlots.C:1606
 drawPlots.C:1607
 drawPlots.C:1608
 drawPlots.C:1609
 drawPlots.C:1610
 drawPlots.C:1611
 drawPlots.C:1612
 drawPlots.C:1613
 drawPlots.C:1614
 drawPlots.C:1615
 drawPlots.C:1616
 drawPlots.C:1617
 drawPlots.C:1618
 drawPlots.C:1619
 drawPlots.C:1620
 drawPlots.C:1621
 drawPlots.C:1622
 drawPlots.C:1623
 drawPlots.C:1624
 drawPlots.C:1625
 drawPlots.C:1626
 drawPlots.C:1627
 drawPlots.C:1628
 drawPlots.C:1629
 drawPlots.C:1630
 drawPlots.C:1631
 drawPlots.C:1632
 drawPlots.C:1633
 drawPlots.C:1634
 drawPlots.C:1635
 drawPlots.C:1636
 drawPlots.C:1637
 drawPlots.C:1638
 drawPlots.C:1639
 drawPlots.C:1640
 drawPlots.C:1641
 drawPlots.C:1642
 drawPlots.C:1643
 drawPlots.C:1644
 drawPlots.C:1645
 drawPlots.C:1646
 drawPlots.C:1647
 drawPlots.C:1648
 drawPlots.C:1649
 drawPlots.C:1650
 drawPlots.C:1651
 drawPlots.C:1652
 drawPlots.C:1653
 drawPlots.C:1654
 drawPlots.C:1655
 drawPlots.C:1656
 drawPlots.C:1657
 drawPlots.C:1658
 drawPlots.C:1659
 drawPlots.C:1660
 drawPlots.C:1661
 drawPlots.C:1662
 drawPlots.C:1663
 drawPlots.C:1664
 drawPlots.C:1665
 drawPlots.C:1666
 drawPlots.C:1667
 drawPlots.C:1668
 drawPlots.C:1669
 drawPlots.C:1670
 drawPlots.C:1671
 drawPlots.C:1672
 drawPlots.C:1673
 drawPlots.C:1674
 drawPlots.C:1675
 drawPlots.C:1676
 drawPlots.C:1677
 drawPlots.C:1678
 drawPlots.C:1679
 drawPlots.C:1680
 drawPlots.C:1681
 drawPlots.C:1682
 drawPlots.C:1683
 drawPlots.C:1684
 drawPlots.C:1685
 drawPlots.C:1686
 drawPlots.C:1687
 drawPlots.C:1688
 drawPlots.C:1689
 drawPlots.C:1690
 drawPlots.C:1691
 drawPlots.C:1692
 drawPlots.C:1693
 drawPlots.C:1694
 drawPlots.C:1695
 drawPlots.C:1696
 drawPlots.C:1697
 drawPlots.C:1698
 drawPlots.C:1699
 drawPlots.C:1700
 drawPlots.C:1701
 drawPlots.C:1702
 drawPlots.C:1703
 drawPlots.C:1704
 drawPlots.C:1705
 drawPlots.C:1706
 drawPlots.C:1707
 drawPlots.C:1708
 drawPlots.C:1709
 drawPlots.C:1710
 drawPlots.C:1711
 drawPlots.C:1712
 drawPlots.C:1713
 drawPlots.C:1714
 drawPlots.C:1715
 drawPlots.C:1716
 drawPlots.C:1717
 drawPlots.C:1718
 drawPlots.C:1719
 drawPlots.C:1720
 drawPlots.C:1721
 drawPlots.C:1722
 drawPlots.C:1723
 drawPlots.C:1724
 drawPlots.C:1725
 drawPlots.C:1726
 drawPlots.C:1727
 drawPlots.C:1728
 drawPlots.C:1729
 drawPlots.C:1730
 drawPlots.C:1731
 drawPlots.C:1732
 drawPlots.C:1733
 drawPlots.C:1734
 drawPlots.C:1735
 drawPlots.C:1736
 drawPlots.C:1737
 drawPlots.C:1738
 drawPlots.C:1739
 drawPlots.C:1740
 drawPlots.C:1741
 drawPlots.C:1742
 drawPlots.C:1743
 drawPlots.C:1744
 drawPlots.C:1745
 drawPlots.C:1746
 drawPlots.C:1747
 drawPlots.C:1748
 drawPlots.C:1749
 drawPlots.C:1750
 drawPlots.C:1751
 drawPlots.C:1752
 drawPlots.C:1753
 drawPlots.C:1754
 drawPlots.C:1755
 drawPlots.C:1756
 drawPlots.C:1757
 drawPlots.C:1758
 drawPlots.C:1759
 drawPlots.C:1760
 drawPlots.C:1761
 drawPlots.C:1762
 drawPlots.C:1763
 drawPlots.C:1764
 drawPlots.C:1765
 drawPlots.C:1766
 drawPlots.C:1767
 drawPlots.C:1768
 drawPlots.C:1769
 drawPlots.C:1770
 drawPlots.C:1771
 drawPlots.C:1772
 drawPlots.C:1773
 drawPlots.C:1774
 drawPlots.C:1775
 drawPlots.C:1776
 drawPlots.C:1777
 drawPlots.C:1778
 drawPlots.C:1779
 drawPlots.C:1780
 drawPlots.C:1781
 drawPlots.C:1782
 drawPlots.C:1783
 drawPlots.C:1784
 drawPlots.C:1785
 drawPlots.C:1786
 drawPlots.C:1787
 drawPlots.C:1788
 drawPlots.C:1789
 drawPlots.C:1790
 drawPlots.C:1791
 drawPlots.C:1792
 drawPlots.C:1793
 drawPlots.C:1794
 drawPlots.C:1795
 drawPlots.C:1796
 drawPlots.C:1797
 drawPlots.C:1798
 drawPlots.C:1799
 drawPlots.C:1800
 drawPlots.C:1801
 drawPlots.C:1802
 drawPlots.C:1803
 drawPlots.C:1804
 drawPlots.C:1805
 drawPlots.C:1806
 drawPlots.C:1807
 drawPlots.C:1808
 drawPlots.C:1809
 drawPlots.C:1810
 drawPlots.C:1811
 drawPlots.C:1812
 drawPlots.C:1813
 drawPlots.C:1814
 drawPlots.C:1815
 drawPlots.C:1816
 drawPlots.C:1817
 drawPlots.C:1818
 drawPlots.C:1819
 drawPlots.C:1820
 drawPlots.C:1821
 drawPlots.C:1822
 drawPlots.C:1823
 drawPlots.C:1824
 drawPlots.C:1825
 drawPlots.C:1826
 drawPlots.C:1827
 drawPlots.C:1828
 drawPlots.C:1829
 drawPlots.C:1830
 drawPlots.C:1831
 drawPlots.C:1832
 drawPlots.C:1833
 drawPlots.C:1834
 drawPlots.C:1835
 drawPlots.C:1836
 drawPlots.C:1837
 drawPlots.C:1838
 drawPlots.C:1839
 drawPlots.C:1840
 drawPlots.C:1841
 drawPlots.C:1842
 drawPlots.C:1843
 drawPlots.C:1844
 drawPlots.C:1845
 drawPlots.C:1846
 drawPlots.C:1847
 drawPlots.C:1848
 drawPlots.C:1849
 drawPlots.C:1850
 drawPlots.C:1851
 drawPlots.C:1852
 drawPlots.C:1853
 drawPlots.C:1854
 drawPlots.C:1855
 drawPlots.C:1856
 drawPlots.C:1857
 drawPlots.C:1858
 drawPlots.C:1859
 drawPlots.C:1860
 drawPlots.C:1861
 drawPlots.C:1862
 drawPlots.C:1863
 drawPlots.C:1864
 drawPlots.C:1865
 drawPlots.C:1866
 drawPlots.C:1867
 drawPlots.C:1868
 drawPlots.C:1869
 drawPlots.C:1870
 drawPlots.C:1871
 drawPlots.C:1872
 drawPlots.C:1873
 drawPlots.C:1874
 drawPlots.C:1875
 drawPlots.C:1876
 drawPlots.C:1877
 drawPlots.C:1878
 drawPlots.C:1879
 drawPlots.C:1880
 drawPlots.C:1881
 drawPlots.C:1882
 drawPlots.C:1883
 drawPlots.C:1884
 drawPlots.C:1885
 drawPlots.C:1886
 drawPlots.C:1887
 drawPlots.C:1888
 drawPlots.C:1889
 drawPlots.C:1890
 drawPlots.C:1891
 drawPlots.C:1892
 drawPlots.C:1893
 drawPlots.C:1894
 drawPlots.C:1895
 drawPlots.C:1896
 drawPlots.C:1897
 drawPlots.C:1898
 drawPlots.C:1899
 drawPlots.C:1900
 drawPlots.C:1901
 drawPlots.C:1902
 drawPlots.C:1903
 drawPlots.C:1904
 drawPlots.C:1905
 drawPlots.C:1906
 drawPlots.C:1907
 drawPlots.C:1908
 drawPlots.C:1909
 drawPlots.C:1910
 drawPlots.C:1911
 drawPlots.C:1912
 drawPlots.C:1913
 drawPlots.C:1914
 drawPlots.C:1915
 drawPlots.C:1916
 drawPlots.C:1917
 drawPlots.C:1918
 drawPlots.C:1919
 drawPlots.C:1920
 drawPlots.C:1921
 drawPlots.C:1922
 drawPlots.C:1923
 drawPlots.C:1924
 drawPlots.C:1925
 drawPlots.C:1926
 drawPlots.C:1927
 drawPlots.C:1928
 drawPlots.C:1929
 drawPlots.C:1930
 drawPlots.C:1931
 drawPlots.C:1932
 drawPlots.C:1933
 drawPlots.C:1934
 drawPlots.C:1935
 drawPlots.C:1936
 drawPlots.C:1937
 drawPlots.C:1938
 drawPlots.C:1939
 drawPlots.C:1940
 drawPlots.C:1941
 drawPlots.C:1942
 drawPlots.C:1943
 drawPlots.C:1944
 drawPlots.C:1945
 drawPlots.C:1946
 drawPlots.C:1947
 drawPlots.C:1948
 drawPlots.C:1949
 drawPlots.C:1950
 drawPlots.C:1951
 drawPlots.C:1952
 drawPlots.C:1953
 drawPlots.C:1954
 drawPlots.C:1955
 drawPlots.C:1956
 drawPlots.C:1957
 drawPlots.C:1958
 drawPlots.C:1959
 drawPlots.C:1960
 drawPlots.C:1961
 drawPlots.C:1962
 drawPlots.C:1963
 drawPlots.C:1964
 drawPlots.C:1965
 drawPlots.C:1966
 drawPlots.C:1967
 drawPlots.C:1968
 drawPlots.C:1969
 drawPlots.C:1970
 drawPlots.C:1971
 drawPlots.C:1972
 drawPlots.C:1973
 drawPlots.C:1974
 drawPlots.C:1975
 drawPlots.C:1976
 drawPlots.C:1977
 drawPlots.C:1978
 drawPlots.C:1979
 drawPlots.C:1980
 drawPlots.C:1981
 drawPlots.C:1982
 drawPlots.C:1983
 drawPlots.C:1984
 drawPlots.C:1985
 drawPlots.C:1986
 drawPlots.C:1987
 drawPlots.C:1988
 drawPlots.C:1989
 drawPlots.C:1990
 drawPlots.C:1991
 drawPlots.C:1992
 drawPlots.C:1993
 drawPlots.C:1994
 drawPlots.C:1995
 drawPlots.C:1996
 drawPlots.C:1997
 drawPlots.C:1998
 drawPlots.C:1999
 drawPlots.C:2000
 drawPlots.C:2001
 drawPlots.C:2002
 drawPlots.C:2003
 drawPlots.C:2004
 drawPlots.C:2005
 drawPlots.C:2006
 drawPlots.C:2007
 drawPlots.C:2008
 drawPlots.C:2009
 drawPlots.C:2010
 drawPlots.C:2011
 drawPlots.C:2012
 drawPlots.C:2013
 drawPlots.C:2014
 drawPlots.C:2015
 drawPlots.C:2016
 drawPlots.C:2017
 drawPlots.C:2018
 drawPlots.C:2019
 drawPlots.C:2020
 drawPlots.C:2021
 drawPlots.C:2022
 drawPlots.C:2023
 drawPlots.C:2024
 drawPlots.C:2025
 drawPlots.C:2026
 drawPlots.C:2027
 drawPlots.C:2028
 drawPlots.C:2029
 drawPlots.C:2030
 drawPlots.C:2031
 drawPlots.C:2032
 drawPlots.C:2033
 drawPlots.C:2034
 drawPlots.C:2035
 drawPlots.C:2036
 drawPlots.C:2037
 drawPlots.C:2038
 drawPlots.C:2039
 drawPlots.C:2040
 drawPlots.C:2041
 drawPlots.C:2042
 drawPlots.C:2043
 drawPlots.C:2044
 drawPlots.C:2045
 drawPlots.C:2046
 drawPlots.C:2047
 drawPlots.C:2048
 drawPlots.C:2049
 drawPlots.C:2050
 drawPlots.C:2051
 drawPlots.C:2052
 drawPlots.C:2053
 drawPlots.C:2054
 drawPlots.C:2055
 drawPlots.C:2056
 drawPlots.C:2057
 drawPlots.C:2058
 drawPlots.C:2059
 drawPlots.C:2060
 drawPlots.C:2061
 drawPlots.C:2062
 drawPlots.C:2063
 drawPlots.C:2064
 drawPlots.C:2065
 drawPlots.C:2066
 drawPlots.C:2067
 drawPlots.C:2068
 drawPlots.C:2069
 drawPlots.C:2070
 drawPlots.C:2071
 drawPlots.C:2072
 drawPlots.C:2073
 drawPlots.C:2074
 drawPlots.C:2075
 drawPlots.C:2076
 drawPlots.C:2077
 drawPlots.C:2078
 drawPlots.C:2079
 drawPlots.C:2080
 drawPlots.C:2081
 drawPlots.C:2082
 drawPlots.C:2083
 drawPlots.C:2084
 drawPlots.C:2085
 drawPlots.C:2086
 drawPlots.C:2087
 drawPlots.C:2088
 drawPlots.C:2089
 drawPlots.C:2090
 drawPlots.C:2091
 drawPlots.C:2092
 drawPlots.C:2093
 drawPlots.C:2094
 drawPlots.C:2095
 drawPlots.C:2096
 drawPlots.C:2097
 drawPlots.C:2098
 drawPlots.C:2099
 drawPlots.C:2100
 drawPlots.C:2101
 drawPlots.C:2102
 drawPlots.C:2103
 drawPlots.C:2104
 drawPlots.C:2105
 drawPlots.C:2106
 drawPlots.C:2107
 drawPlots.C:2108
 drawPlots.C:2109
 drawPlots.C:2110
 drawPlots.C:2111
 drawPlots.C:2112
 drawPlots.C:2113
 drawPlots.C:2114
 drawPlots.C:2115
 drawPlots.C:2116
 drawPlots.C:2117
 drawPlots.C:2118
 drawPlots.C:2119
 drawPlots.C:2120
 drawPlots.C:2121
 drawPlots.C:2122
 drawPlots.C:2123
 drawPlots.C:2124
 drawPlots.C:2125
 drawPlots.C:2126
 drawPlots.C:2127
 drawPlots.C:2128
 drawPlots.C:2129
 drawPlots.C:2130
 drawPlots.C:2131
 drawPlots.C:2132
 drawPlots.C:2133
 drawPlots.C:2134
 drawPlots.C:2135
 drawPlots.C:2136
 drawPlots.C:2137
 drawPlots.C:2138
 drawPlots.C:2139
 drawPlots.C:2140
 drawPlots.C:2141
 drawPlots.C:2142
 drawPlots.C:2143
 drawPlots.C:2144
 drawPlots.C:2145
 drawPlots.C:2146
 drawPlots.C:2147
 drawPlots.C:2148
 drawPlots.C:2149
 drawPlots.C:2150
 drawPlots.C:2151
 drawPlots.C:2152
 drawPlots.C:2153
 drawPlots.C:2154
 drawPlots.C:2155
 drawPlots.C:2156
 drawPlots.C:2157
 drawPlots.C:2158
 drawPlots.C:2159
 drawPlots.C:2160
 drawPlots.C:2161
 drawPlots.C:2162
 drawPlots.C:2163
 drawPlots.C:2164
 drawPlots.C:2165
 drawPlots.C:2166
 drawPlots.C:2167
 drawPlots.C:2168
 drawPlots.C:2169
 drawPlots.C:2170
 drawPlots.C:2171
 drawPlots.C:2172
 drawPlots.C:2173
 drawPlots.C:2174
 drawPlots.C:2175
 drawPlots.C:2176
 drawPlots.C:2177
 drawPlots.C:2178
 drawPlots.C:2179
 drawPlots.C:2180
 drawPlots.C:2181
 drawPlots.C:2182
 drawPlots.C:2183
 drawPlots.C:2184
 drawPlots.C:2185
 drawPlots.C:2186
 drawPlots.C:2187
 drawPlots.C:2188
 drawPlots.C:2189
 drawPlots.C:2190
 drawPlots.C:2191
 drawPlots.C:2192
 drawPlots.C:2193
 drawPlots.C:2194
 drawPlots.C:2195
 drawPlots.C:2196
 drawPlots.C:2197
 drawPlots.C:2198
 drawPlots.C:2199
 drawPlots.C:2200
 drawPlots.C:2201
 drawPlots.C:2202
 drawPlots.C:2203
 drawPlots.C:2204
 drawPlots.C:2205
 drawPlots.C:2206
 drawPlots.C:2207
 drawPlots.C:2208
 drawPlots.C:2209
 drawPlots.C:2210
 drawPlots.C:2211
 drawPlots.C:2212
 drawPlots.C:2213
 drawPlots.C:2214
 drawPlots.C:2215
 drawPlots.C:2216
 drawPlots.C:2217
 drawPlots.C:2218
 drawPlots.C:2219
 drawPlots.C:2220
 drawPlots.C:2221
 drawPlots.C:2222
 drawPlots.C:2223
 drawPlots.C:2224
 drawPlots.C:2225
 drawPlots.C:2226
 drawPlots.C:2227
 drawPlots.C:2228
 drawPlots.C:2229
 drawPlots.C:2230
 drawPlots.C:2231
 drawPlots.C:2232
 drawPlots.C:2233
 drawPlots.C:2234
 drawPlots.C:2235
 drawPlots.C:2236
 drawPlots.C:2237
 drawPlots.C:2238
 drawPlots.C:2239
 drawPlots.C:2240
 drawPlots.C:2241
 drawPlots.C:2242
 drawPlots.C:2243
 drawPlots.C:2244
 drawPlots.C:2245
 drawPlots.C:2246
 drawPlots.C:2247
 drawPlots.C:2248
 drawPlots.C:2249
 drawPlots.C:2250
 drawPlots.C:2251
 drawPlots.C:2252
 drawPlots.C:2253
 drawPlots.C:2254
 drawPlots.C:2255
 drawPlots.C:2256
 drawPlots.C:2257
 drawPlots.C:2258
 drawPlots.C:2259
 drawPlots.C:2260
 drawPlots.C:2261
 drawPlots.C:2262
 drawPlots.C:2263
 drawPlots.C:2264
 drawPlots.C:2265
 drawPlots.C:2266
 drawPlots.C:2267
 drawPlots.C:2268
 drawPlots.C:2269
 drawPlots.C:2270
 drawPlots.C:2271
 drawPlots.C:2272
 drawPlots.C:2273
 drawPlots.C:2274
 drawPlots.C:2275
 drawPlots.C:2276
 drawPlots.C:2277
 drawPlots.C:2278
 drawPlots.C:2279
 drawPlots.C:2280
 drawPlots.C:2281
 drawPlots.C:2282
 drawPlots.C:2283
 drawPlots.C:2284
 drawPlots.C:2285
 drawPlots.C:2286
 drawPlots.C:2287
 drawPlots.C:2288
 drawPlots.C:2289
 drawPlots.C:2290
 drawPlots.C:2291
 drawPlots.C:2292
 drawPlots.C:2293
 drawPlots.C:2294
 drawPlots.C:2295
 drawPlots.C:2296
 drawPlots.C:2297
 drawPlots.C:2298
 drawPlots.C:2299
 drawPlots.C:2300
 drawPlots.C:2301
 drawPlots.C:2302
 drawPlots.C:2303
 drawPlots.C:2304
 drawPlots.C:2305
 drawPlots.C:2306
 drawPlots.C:2307
 drawPlots.C:2308
 drawPlots.C:2309
 drawPlots.C:2310
 drawPlots.C:2311
 drawPlots.C:2312
 drawPlots.C:2313
 drawPlots.C:2314
 drawPlots.C:2315
 drawPlots.C:2316
 drawPlots.C:2317
 drawPlots.C:2318
 drawPlots.C:2319
 drawPlots.C:2320
 drawPlots.C:2321
 drawPlots.C:2322
 drawPlots.C:2323
 drawPlots.C:2324
 drawPlots.C:2325
 drawPlots.C:2326
 drawPlots.C:2327
 drawPlots.C:2328
 drawPlots.C:2329
 drawPlots.C:2330
 drawPlots.C:2331
 drawPlots.C:2332
 drawPlots.C:2333
 drawPlots.C:2334
 drawPlots.C:2335
 drawPlots.C:2336
 drawPlots.C:2337
 drawPlots.C:2338
 drawPlots.C:2339
 drawPlots.C:2340
 drawPlots.C:2341
 drawPlots.C:2342
 drawPlots.C:2343
 drawPlots.C:2344
 drawPlots.C:2345
 drawPlots.C:2346
 drawPlots.C:2347
 drawPlots.C:2348
 drawPlots.C:2349
 drawPlots.C:2350
 drawPlots.C:2351
 drawPlots.C:2352
 drawPlots.C:2353
 drawPlots.C:2354
 drawPlots.C:2355
 drawPlots.C:2356
 drawPlots.C:2357
 drawPlots.C:2358
 drawPlots.C:2359
 drawPlots.C:2360
 drawPlots.C:2361
 drawPlots.C:2362
 drawPlots.C:2363
 drawPlots.C:2364
 drawPlots.C:2365
 drawPlots.C:2366
 drawPlots.C:2367
 drawPlots.C:2368
 drawPlots.C:2369
 drawPlots.C:2370
 drawPlots.C:2371
 drawPlots.C:2372
 drawPlots.C:2373
 drawPlots.C:2374
 drawPlots.C:2375
 drawPlots.C:2376
 drawPlots.C:2377
 drawPlots.C:2378
 drawPlots.C:2379
 drawPlots.C:2380
 drawPlots.C:2381
 drawPlots.C:2382
 drawPlots.C:2383
 drawPlots.C:2384
 drawPlots.C:2385
 drawPlots.C:2386
 drawPlots.C:2387
 drawPlots.C:2388
 drawPlots.C:2389
 drawPlots.C:2390
 drawPlots.C:2391
 drawPlots.C:2392
 drawPlots.C:2393
 drawPlots.C:2394
 drawPlots.C:2395
 drawPlots.C:2396
 drawPlots.C:2397
 drawPlots.C:2398
 drawPlots.C:2399
 drawPlots.C:2400
 drawPlots.C:2401
 drawPlots.C:2402
 drawPlots.C:2403
 drawPlots.C:2404
 drawPlots.C:2405
 drawPlots.C:2406
 drawPlots.C:2407
 drawPlots.C:2408
 drawPlots.C:2409
 drawPlots.C:2410
 drawPlots.C:2411
 drawPlots.C:2412
 drawPlots.C:2413
 drawPlots.C:2414
 drawPlots.C:2415
 drawPlots.C:2416
 drawPlots.C:2417
 drawPlots.C:2418
 drawPlots.C:2419
 drawPlots.C:2420
 drawPlots.C:2421
 drawPlots.C:2422
 drawPlots.C:2423
 drawPlots.C:2424
 drawPlots.C:2425
 drawPlots.C:2426
 drawPlots.C:2427
 drawPlots.C:2428
 drawPlots.C:2429
 drawPlots.C:2430
 drawPlots.C:2431
 drawPlots.C:2432
 drawPlots.C:2433
 drawPlots.C:2434
 drawPlots.C:2435
 drawPlots.C:2436
 drawPlots.C:2437
 drawPlots.C:2438
 drawPlots.C:2439
 drawPlots.C:2440
 drawPlots.C:2441
 drawPlots.C:2442
 drawPlots.C:2443
 drawPlots.C:2444
 drawPlots.C:2445
 drawPlots.C:2446
 drawPlots.C:2447
 drawPlots.C:2448
 drawPlots.C:2449
 drawPlots.C:2450
 drawPlots.C:2451
 drawPlots.C:2452
 drawPlots.C:2453
 drawPlots.C:2454
 drawPlots.C:2455
 drawPlots.C:2456
 drawPlots.C:2457
 drawPlots.C:2458
 drawPlots.C:2459
 drawPlots.C:2460
 drawPlots.C:2461
 drawPlots.C:2462
 drawPlots.C:2463
 drawPlots.C:2464
 drawPlots.C:2465
 drawPlots.C:2466
 drawPlots.C:2467
 drawPlots.C:2468
 drawPlots.C:2469
 drawPlots.C:2470
 drawPlots.C:2471
 drawPlots.C:2472
 drawPlots.C:2473
 drawPlots.C:2474
 drawPlots.C:2475
 drawPlots.C:2476
 drawPlots.C:2477
 drawPlots.C:2478
 drawPlots.C:2479
 drawPlots.C:2480
 drawPlots.C:2481
 drawPlots.C:2482
 drawPlots.C:2483
 drawPlots.C:2484
 drawPlots.C:2485
 drawPlots.C:2486
 drawPlots.C:2487
 drawPlots.C:2488
 drawPlots.C:2489
 drawPlots.C:2490
 drawPlots.C:2491
 drawPlots.C:2492
 drawPlots.C:2493
 drawPlots.C:2494
 drawPlots.C:2495
 drawPlots.C:2496
 drawPlots.C:2497
 drawPlots.C:2498
 drawPlots.C:2499
 drawPlots.C:2500
 drawPlots.C:2501
 drawPlots.C:2502
 drawPlots.C:2503
 drawPlots.C:2504
 drawPlots.C:2505
 drawPlots.C:2506
 drawPlots.C:2507
 drawPlots.C:2508
 drawPlots.C:2509
 drawPlots.C:2510
 drawPlots.C:2511
 drawPlots.C:2512
 drawPlots.C:2513
 drawPlots.C:2514
 drawPlots.C:2515
 drawPlots.C:2516
 drawPlots.C:2517
 drawPlots.C:2518
 drawPlots.C:2519
 drawPlots.C:2520
 drawPlots.C:2521
 drawPlots.C:2522
 drawPlots.C:2523
 drawPlots.C:2524
 drawPlots.C:2525
 drawPlots.C:2526
 drawPlots.C:2527
 drawPlots.C:2528
 drawPlots.C:2529
 drawPlots.C:2530
 drawPlots.C:2531
 drawPlots.C:2532
 drawPlots.C:2533
 drawPlots.C:2534
 drawPlots.C:2535
 drawPlots.C:2536
 drawPlots.C:2537
 drawPlots.C:2538
 drawPlots.C:2539
 drawPlots.C:2540
 drawPlots.C:2541
 drawPlots.C:2542
 drawPlots.C:2543
 drawPlots.C:2544
 drawPlots.C:2545
 drawPlots.C:2546
 drawPlots.C:2547
 drawPlots.C:2548
 drawPlots.C:2549
 drawPlots.C:2550
 drawPlots.C:2551
 drawPlots.C:2552
 drawPlots.C:2553
 drawPlots.C:2554
 drawPlots.C:2555
 drawPlots.C:2556
 drawPlots.C:2557
 drawPlots.C:2558
 drawPlots.C:2559
 drawPlots.C:2560
 drawPlots.C:2561
 drawPlots.C:2562
 drawPlots.C:2563
 drawPlots.C:2564
 drawPlots.C:2565
 drawPlots.C:2566
 drawPlots.C:2567
 drawPlots.C:2568
 drawPlots.C:2569
 drawPlots.C:2570
 drawPlots.C:2571
 drawPlots.C:2572
 drawPlots.C:2573
 drawPlots.C:2574
 drawPlots.C:2575
 drawPlots.C:2576
 drawPlots.C:2577
 drawPlots.C:2578
 drawPlots.C:2579
 drawPlots.C:2580
 drawPlots.C:2581
 drawPlots.C:2582
 drawPlots.C:2583
 drawPlots.C:2584
 drawPlots.C:2585
 drawPlots.C:2586
 drawPlots.C:2587
 drawPlots.C:2588
 drawPlots.C:2589
 drawPlots.C:2590
 drawPlots.C:2591
 drawPlots.C:2592
 drawPlots.C:2593
 drawPlots.C:2594
 drawPlots.C:2595
 drawPlots.C:2596
 drawPlots.C:2597
 drawPlots.C:2598
 drawPlots.C:2599
 drawPlots.C:2600
 drawPlots.C:2601
 drawPlots.C:2602
 drawPlots.C:2603
 drawPlots.C:2604
 drawPlots.C:2605
 drawPlots.C:2606
 drawPlots.C:2607
 drawPlots.C:2608
 drawPlots.C:2609
 drawPlots.C:2610
 drawPlots.C:2611
 drawPlots.C:2612
 drawPlots.C:2613
 drawPlots.C:2614
 drawPlots.C:2615
 drawPlots.C:2616
 drawPlots.C:2617
 drawPlots.C:2618
 drawPlots.C:2619
 drawPlots.C:2620
 drawPlots.C:2621
 drawPlots.C:2622
 drawPlots.C:2623
 drawPlots.C:2624
 drawPlots.C:2625
 drawPlots.C:2626
 drawPlots.C:2627
 drawPlots.C:2628
 drawPlots.C:2629
 drawPlots.C:2630
 drawPlots.C:2631
 drawPlots.C:2632
 drawPlots.C:2633
 drawPlots.C:2634
 drawPlots.C:2635
 drawPlots.C:2636
 drawPlots.C:2637
 drawPlots.C:2638
 drawPlots.C:2639
 drawPlots.C:2640
 drawPlots.C:2641
 drawPlots.C:2642
 drawPlots.C:2643
 drawPlots.C:2644
 drawPlots.C:2645
 drawPlots.C:2646
 drawPlots.C:2647
 drawPlots.C:2648
 drawPlots.C:2649
 drawPlots.C:2650
 drawPlots.C:2651
 drawPlots.C:2652
 drawPlots.C:2653
 drawPlots.C:2654
 drawPlots.C:2655
 drawPlots.C:2656
 drawPlots.C:2657
 drawPlots.C:2658
 drawPlots.C:2659
 drawPlots.C:2660
 drawPlots.C:2661
 drawPlots.C:2662
 drawPlots.C:2663
 drawPlots.C:2664
 drawPlots.C:2665
 drawPlots.C:2666
 drawPlots.C:2667
 drawPlots.C:2668
 drawPlots.C:2669
 drawPlots.C:2670
 drawPlots.C:2671
 drawPlots.C:2672
 drawPlots.C:2673
 drawPlots.C:2674
 drawPlots.C:2675
 drawPlots.C:2676
 drawPlots.C:2677
 drawPlots.C:2678
 drawPlots.C:2679
 drawPlots.C:2680
 drawPlots.C:2681
 drawPlots.C:2682
 drawPlots.C:2683
 drawPlots.C:2684
 drawPlots.C:2685
 drawPlots.C:2686
 drawPlots.C:2687
 drawPlots.C:2688
 drawPlots.C:2689
 drawPlots.C:2690
 drawPlots.C:2691
 drawPlots.C:2692
 drawPlots.C:2693
 drawPlots.C:2694
 drawPlots.C:2695
 drawPlots.C:2696
 drawPlots.C:2697
 drawPlots.C:2698
 drawPlots.C:2699
 drawPlots.C:2700
 drawPlots.C:2701
 drawPlots.C:2702
 drawPlots.C:2703
 drawPlots.C:2704
 drawPlots.C:2705
 drawPlots.C:2706
 drawPlots.C:2707
 drawPlots.C:2708
 drawPlots.C:2709
 drawPlots.C:2710
 drawPlots.C:2711
 drawPlots.C:2712
 drawPlots.C:2713
 drawPlots.C:2714
 drawPlots.C:2715
 drawPlots.C:2716
 drawPlots.C:2717
 drawPlots.C:2718
 drawPlots.C:2719
 drawPlots.C:2720
 drawPlots.C:2721
 drawPlots.C:2722
 drawPlots.C:2723
 drawPlots.C:2724
 drawPlots.C:2725
 drawPlots.C:2726
 drawPlots.C:2727
 drawPlots.C:2728
 drawPlots.C:2729
 drawPlots.C:2730
 drawPlots.C:2731
 drawPlots.C:2732
 drawPlots.C:2733
 drawPlots.C:2734
 drawPlots.C:2735
 drawPlots.C:2736
 drawPlots.C:2737
 drawPlots.C:2738
 drawPlots.C:2739
 drawPlots.C:2740
 drawPlots.C:2741
 drawPlots.C:2742
 drawPlots.C:2743
 drawPlots.C:2744
 drawPlots.C:2745
 drawPlots.C:2746
 drawPlots.C:2747
 drawPlots.C:2748
 drawPlots.C:2749
 drawPlots.C:2750
 drawPlots.C:2751
 drawPlots.C:2752
 drawPlots.C:2753
 drawPlots.C:2754
 drawPlots.C:2755
 drawPlots.C:2756
 drawPlots.C:2757
 drawPlots.C:2758
 drawPlots.C:2759
 drawPlots.C:2760
 drawPlots.C:2761
 drawPlots.C:2762
 drawPlots.C:2763
 drawPlots.C:2764
 drawPlots.C:2765
 drawPlots.C:2766
 drawPlots.C:2767
 drawPlots.C:2768
 drawPlots.C:2769
 drawPlots.C:2770
 drawPlots.C:2771
 drawPlots.C:2772
 drawPlots.C:2773
 drawPlots.C:2774
 drawPlots.C:2775
 drawPlots.C:2776
 drawPlots.C:2777
 drawPlots.C:2778
 drawPlots.C:2779
 drawPlots.C:2780
 drawPlots.C:2781
 drawPlots.C:2782
 drawPlots.C:2783
 drawPlots.C:2784
 drawPlots.C:2785
 drawPlots.C:2786
 drawPlots.C:2787
 drawPlots.C:2788
 drawPlots.C:2789
 drawPlots.C:2790
 drawPlots.C:2791
 drawPlots.C:2792
 drawPlots.C:2793
 drawPlots.C:2794
 drawPlots.C:2795
 drawPlots.C:2796
 drawPlots.C:2797
 drawPlots.C:2798
 drawPlots.C:2799
 drawPlots.C:2800
 drawPlots.C:2801
 drawPlots.C:2802
 drawPlots.C:2803
 drawPlots.C:2804
 drawPlots.C:2805
 drawPlots.C:2806
 drawPlots.C:2807
 drawPlots.C:2808
 drawPlots.C:2809
 drawPlots.C:2810
 drawPlots.C:2811
 drawPlots.C:2812
 drawPlots.C:2813
 drawPlots.C:2814
 drawPlots.C:2815
 drawPlots.C:2816
 drawPlots.C:2817
 drawPlots.C:2818
 drawPlots.C:2819
 drawPlots.C:2820
 drawPlots.C:2821
 drawPlots.C:2822
 drawPlots.C:2823
 drawPlots.C:2824
 drawPlots.C:2825
 drawPlots.C:2826
 drawPlots.C:2827
 drawPlots.C:2828
 drawPlots.C:2829
 drawPlots.C:2830
 drawPlots.C:2831
 drawPlots.C:2832
 drawPlots.C:2833
 drawPlots.C:2834
 drawPlots.C:2835
 drawPlots.C:2836
 drawPlots.C:2837
 drawPlots.C:2838
 drawPlots.C:2839
 drawPlots.C:2840
 drawPlots.C:2841
 drawPlots.C:2842
 drawPlots.C:2843
 drawPlots.C:2844
 drawPlots.C:2845
 drawPlots.C:2846
 drawPlots.C:2847
 drawPlots.C:2848
 drawPlots.C:2849
 drawPlots.C:2850
 drawPlots.C:2851
 drawPlots.C:2852
 drawPlots.C:2853
 drawPlots.C:2854
 drawPlots.C:2855
 drawPlots.C:2856
 drawPlots.C:2857
 drawPlots.C:2858
 drawPlots.C:2859
 drawPlots.C:2860
 drawPlots.C:2861
 drawPlots.C:2862
 drawPlots.C:2863
 drawPlots.C:2864
 drawPlots.C:2865
 drawPlots.C:2866
 drawPlots.C:2867
 drawPlots.C:2868
 drawPlots.C:2869
 drawPlots.C:2870
 drawPlots.C:2871
 drawPlots.C:2872
 drawPlots.C:2873
 drawPlots.C:2874
 drawPlots.C:2875
 drawPlots.C:2876
 drawPlots.C:2877
 drawPlots.C:2878
 drawPlots.C:2879
 drawPlots.C:2880
 drawPlots.C:2881
 drawPlots.C:2882
 drawPlots.C:2883
 drawPlots.C:2884
 drawPlots.C:2885
 drawPlots.C:2886
 drawPlots.C:2887
 drawPlots.C:2888
 drawPlots.C:2889
 drawPlots.C:2890
 drawPlots.C:2891
 drawPlots.C:2892
 drawPlots.C:2893
 drawPlots.C:2894
 drawPlots.C:2895
 drawPlots.C:2896
 drawPlots.C:2897
 drawPlots.C:2898
 drawPlots.C:2899
 drawPlots.C:2900
 drawPlots.C:2901
 drawPlots.C:2902
 drawPlots.C:2903
 drawPlots.C:2904
 drawPlots.C:2905
 drawPlots.C:2906
 drawPlots.C:2907
 drawPlots.C:2908
 drawPlots.C:2909
 drawPlots.C:2910
 drawPlots.C:2911
 drawPlots.C:2912
 drawPlots.C:2913
 drawPlots.C:2914
 drawPlots.C:2915
 drawPlots.C:2916
 drawPlots.C:2917
 drawPlots.C:2918
 drawPlots.C:2919
 drawPlots.C:2920
 drawPlots.C:2921
 drawPlots.C:2922
 drawPlots.C:2923
 drawPlots.C:2924
 drawPlots.C:2925
 drawPlots.C:2926
 drawPlots.C:2927
 drawPlots.C:2928
 drawPlots.C:2929
 drawPlots.C:2930
 drawPlots.C:2931
 drawPlots.C:2932
 drawPlots.C:2933
 drawPlots.C:2934
 drawPlots.C:2935
 drawPlots.C:2936
 drawPlots.C:2937
 drawPlots.C:2938
 drawPlots.C:2939
 drawPlots.C:2940
 drawPlots.C:2941
 drawPlots.C:2942
 drawPlots.C:2943
 drawPlots.C:2944
 drawPlots.C:2945
 drawPlots.C:2946
 drawPlots.C:2947
 drawPlots.C:2948
 drawPlots.C:2949
 drawPlots.C:2950
 drawPlots.C:2951
 drawPlots.C:2952
 drawPlots.C:2953
 drawPlots.C:2954
 drawPlots.C:2955
 drawPlots.C:2956
 drawPlots.C:2957
 drawPlots.C:2958
 drawPlots.C:2959
 drawPlots.C:2960
 drawPlots.C:2961
 drawPlots.C:2962
 drawPlots.C:2963
 drawPlots.C:2964
 drawPlots.C:2965
 drawPlots.C:2966
 drawPlots.C:2967
 drawPlots.C:2968
 drawPlots.C:2969
 drawPlots.C:2970
 drawPlots.C:2971
 drawPlots.C:2972
 drawPlots.C:2973
 drawPlots.C:2974
 drawPlots.C:2975
 drawPlots.C:2976
 drawPlots.C:2977
 drawPlots.C:2978
 drawPlots.C:2979
 drawPlots.C:2980
 drawPlots.C:2981
 drawPlots.C:2982
 drawPlots.C:2983
 drawPlots.C:2984
 drawPlots.C:2985
 drawPlots.C:2986
 drawPlots.C:2987
 drawPlots.C:2988
 drawPlots.C:2989
 drawPlots.C:2990
 drawPlots.C:2991
 drawPlots.C:2992
 drawPlots.C:2993
 drawPlots.C:2994
 drawPlots.C:2995
 drawPlots.C:2996
 drawPlots.C:2997
 drawPlots.C:2998
 drawPlots.C:2999
 drawPlots.C:3000
 drawPlots.C:3001
 drawPlots.C:3002
 drawPlots.C:3003
 drawPlots.C:3004
 drawPlots.C:3005
 drawPlots.C:3006
 drawPlots.C:3007
 drawPlots.C:3008
 drawPlots.C:3009
 drawPlots.C:3010
 drawPlots.C:3011
 drawPlots.C:3012
 drawPlots.C:3013
 drawPlots.C:3014
 drawPlots.C:3015
 drawPlots.C:3016
 drawPlots.C:3017
 drawPlots.C:3018
 drawPlots.C:3019
 drawPlots.C:3020
 drawPlots.C:3021
 drawPlots.C:3022
 drawPlots.C:3023
 drawPlots.C:3024
 drawPlots.C:3025
 drawPlots.C:3026
 drawPlots.C:3027
 drawPlots.C:3028
 drawPlots.C:3029
 drawPlots.C:3030
 drawPlots.C:3031
 drawPlots.C:3032
 drawPlots.C:3033
 drawPlots.C:3034
 drawPlots.C:3035
 drawPlots.C:3036
 drawPlots.C:3037
 drawPlots.C:3038
 drawPlots.C:3039
 drawPlots.C:3040
 drawPlots.C:3041
 drawPlots.C:3042
 drawPlots.C:3043
 drawPlots.C:3044
 drawPlots.C:3045
 drawPlots.C:3046
 drawPlots.C:3047
 drawPlots.C:3048
 drawPlots.C:3049
 drawPlots.C:3050
 drawPlots.C:3051
 drawPlots.C:3052
 drawPlots.C:3053
 drawPlots.C:3054
 drawPlots.C:3055
 drawPlots.C:3056
 drawPlots.C:3057
 drawPlots.C:3058
 drawPlots.C:3059
 drawPlots.C:3060
 drawPlots.C:3061
 drawPlots.C:3062
 drawPlots.C:3063
 drawPlots.C:3064
 drawPlots.C:3065
 drawPlots.C:3066
 drawPlots.C:3067
 drawPlots.C:3068
 drawPlots.C:3069
 drawPlots.C:3070
 drawPlots.C:3071
 drawPlots.C:3072
 drawPlots.C:3073
 drawPlots.C:3074
 drawPlots.C:3075
 drawPlots.C:3076
 drawPlots.C:3077
 drawPlots.C:3078
 drawPlots.C:3079
 drawPlots.C:3080
 drawPlots.C:3081
 drawPlots.C:3082
 drawPlots.C:3083
 drawPlots.C:3084
 drawPlots.C:3085
 drawPlots.C:3086
 drawPlots.C:3087
 drawPlots.C:3088
 drawPlots.C:3089
 drawPlots.C:3090
 drawPlots.C:3091
 drawPlots.C:3092
 drawPlots.C:3093
 drawPlots.C:3094
 drawPlots.C:3095
 drawPlots.C:3096
 drawPlots.C:3097
 drawPlots.C:3098
 drawPlots.C:3099
 drawPlots.C:3100
 drawPlots.C:3101
 drawPlots.C:3102
 drawPlots.C:3103
 drawPlots.C:3104
 drawPlots.C:3105
 drawPlots.C:3106
 drawPlots.C:3107
 drawPlots.C:3108
 drawPlots.C:3109
 drawPlots.C:3110
 drawPlots.C:3111
 drawPlots.C:3112
 drawPlots.C:3113
 drawPlots.C:3114
 drawPlots.C:3115
 drawPlots.C:3116
 drawPlots.C:3117
 drawPlots.C:3118
 drawPlots.C:3119
 drawPlots.C:3120
 drawPlots.C:3121
 drawPlots.C:3122
 drawPlots.C:3123
 drawPlots.C:3124
 drawPlots.C:3125
 drawPlots.C:3126
 drawPlots.C:3127
 drawPlots.C:3128
 drawPlots.C:3129
 drawPlots.C:3130
 drawPlots.C:3131
 drawPlots.C:3132
 drawPlots.C:3133
 drawPlots.C:3134
 drawPlots.C:3135
 drawPlots.C:3136
 drawPlots.C:3137
 drawPlots.C:3138
 drawPlots.C:3139
 drawPlots.C:3140
 drawPlots.C:3141
 drawPlots.C:3142
 drawPlots.C:3143
 drawPlots.C:3144
 drawPlots.C:3145
 drawPlots.C:3146
 drawPlots.C:3147
 drawPlots.C:3148
 drawPlots.C:3149
 drawPlots.C:3150
 drawPlots.C:3151
 drawPlots.C:3152
 drawPlots.C:3153
 drawPlots.C:3154
 drawPlots.C:3155
 drawPlots.C:3156
 drawPlots.C:3157
 drawPlots.C:3158
 drawPlots.C:3159
 drawPlots.C:3160
 drawPlots.C:3161
 drawPlots.C:3162
 drawPlots.C:3163
 drawPlots.C:3164
 drawPlots.C:3165
 drawPlots.C:3166
 drawPlots.C:3167
 drawPlots.C:3168
 drawPlots.C:3169
 drawPlots.C:3170
 drawPlots.C:3171
 drawPlots.C:3172
 drawPlots.C:3173
 drawPlots.C:3174
 drawPlots.C:3175
 drawPlots.C:3176
 drawPlots.C:3177
 drawPlots.C:3178
 drawPlots.C:3179
 drawPlots.C:3180
 drawPlots.C:3181
 drawPlots.C:3182
 drawPlots.C:3183
 drawPlots.C:3184
 drawPlots.C:3185
 drawPlots.C:3186
 drawPlots.C:3187
 drawPlots.C:3188
 drawPlots.C:3189
 drawPlots.C:3190
 drawPlots.C:3191
 drawPlots.C:3192
 drawPlots.C:3193
 drawPlots.C:3194
 drawPlots.C:3195
 drawPlots.C:3196
 drawPlots.C:3197
 drawPlots.C:3198
 drawPlots.C:3199
 drawPlots.C:3200
 drawPlots.C:3201
 drawPlots.C:3202
 drawPlots.C:3203
 drawPlots.C:3204
 drawPlots.C:3205
 drawPlots.C:3206
 drawPlots.C:3207
 drawPlots.C:3208
 drawPlots.C:3209
 drawPlots.C:3210
 drawPlots.C:3211
 drawPlots.C:3212
 drawPlots.C:3213
 drawPlots.C:3214
 drawPlots.C:3215
 drawPlots.C:3216
 drawPlots.C:3217
 drawPlots.C:3218
 drawPlots.C:3219
 drawPlots.C:3220
 drawPlots.C:3221
 drawPlots.C:3222
 drawPlots.C:3223
 drawPlots.C:3224
 drawPlots.C:3225
 drawPlots.C:3226
 drawPlots.C:3227
 drawPlots.C:3228
 drawPlots.C:3229
 drawPlots.C:3230
 drawPlots.C:3231
 drawPlots.C:3232
 drawPlots.C:3233
 drawPlots.C:3234
 drawPlots.C:3235
 drawPlots.C:3236
 drawPlots.C:3237
 drawPlots.C:3238
 drawPlots.C:3239
 drawPlots.C:3240
 drawPlots.C:3241
 drawPlots.C:3242
 drawPlots.C:3243
 drawPlots.C:3244
 drawPlots.C:3245
 drawPlots.C:3246
 drawPlots.C:3247
 drawPlots.C:3248
 drawPlots.C:3249
 drawPlots.C:3250
 drawPlots.C:3251
 drawPlots.C:3252
 drawPlots.C:3253
 drawPlots.C:3254
 drawPlots.C:3255
 drawPlots.C:3256
 drawPlots.C:3257
 drawPlots.C:3258
 drawPlots.C:3259
 drawPlots.C:3260
 drawPlots.C:3261
 drawPlots.C:3262
 drawPlots.C:3263
 drawPlots.C:3264
 drawPlots.C:3265
 drawPlots.C:3266
 drawPlots.C:3267
 drawPlots.C:3268
 drawPlots.C:3269
 drawPlots.C:3270
 drawPlots.C:3271
 drawPlots.C:3272
 drawPlots.C:3273
 drawPlots.C:3274
 drawPlots.C:3275
 drawPlots.C:3276
 drawPlots.C:3277
 drawPlots.C:3278
 drawPlots.C:3279
 drawPlots.C:3280
 drawPlots.C:3281
 drawPlots.C:3282
 drawPlots.C:3283
 drawPlots.C:3284
 drawPlots.C:3285
 drawPlots.C:3286
 drawPlots.C:3287
 drawPlots.C:3288
 drawPlots.C:3289
 drawPlots.C:3290
 drawPlots.C:3291
 drawPlots.C:3292
 drawPlots.C:3293
 drawPlots.C:3294
 drawPlots.C:3295
 drawPlots.C:3296
 drawPlots.C:3297
 drawPlots.C:3298
 drawPlots.C:3299
 drawPlots.C:3300
 drawPlots.C:3301
 drawPlots.C:3302
 drawPlots.C:3303
 drawPlots.C:3304
 drawPlots.C:3305
 drawPlots.C:3306
 drawPlots.C:3307
 drawPlots.C:3308
 drawPlots.C:3309
 drawPlots.C:3310
 drawPlots.C:3311
 drawPlots.C:3312
 drawPlots.C:3313
 drawPlots.C:3314
 drawPlots.C:3315
 drawPlots.C:3316
 drawPlots.C:3317
 drawPlots.C:3318
 drawPlots.C:3319
 drawPlots.C:3320
 drawPlots.C:3321
 drawPlots.C:3322
 drawPlots.C:3323
 drawPlots.C:3324
 drawPlots.C:3325
 drawPlots.C:3326
 drawPlots.C:3327
 drawPlots.C:3328
 drawPlots.C:3329
 drawPlots.C:3330
 drawPlots.C:3331
 drawPlots.C:3332
 drawPlots.C:3333
 drawPlots.C:3334
 drawPlots.C:3335
 drawPlots.C:3336
 drawPlots.C:3337
 drawPlots.C:3338
 drawPlots.C:3339
 drawPlots.C:3340
 drawPlots.C:3341
 drawPlots.C:3342
 drawPlots.C:3343
 drawPlots.C:3344
 drawPlots.C:3345
 drawPlots.C:3346
 drawPlots.C:3347
 drawPlots.C:3348
 drawPlots.C:3349
 drawPlots.C:3350
 drawPlots.C:3351
 drawPlots.C:3352
 drawPlots.C:3353
 drawPlots.C:3354
 drawPlots.C:3355
 drawPlots.C:3356
 drawPlots.C:3357
 drawPlots.C:3358
 drawPlots.C:3359
 drawPlots.C:3360
 drawPlots.C:3361
 drawPlots.C:3362
 drawPlots.C:3363
 drawPlots.C:3364
 drawPlots.C:3365
 drawPlots.C:3366
 drawPlots.C:3367
 drawPlots.C:3368
 drawPlots.C:3369
 drawPlots.C:3370
 drawPlots.C:3371
 drawPlots.C:3372
 drawPlots.C:3373
 drawPlots.C:3374
 drawPlots.C:3375
 drawPlots.C:3376
 drawPlots.C:3377
 drawPlots.C:3378
 drawPlots.C:3379
 drawPlots.C:3380
 drawPlots.C:3381
 drawPlots.C:3382
 drawPlots.C:3383
 drawPlots.C:3384
 drawPlots.C:3385
 drawPlots.C:3386
 drawPlots.C:3387
 drawPlots.C:3388
 drawPlots.C:3389
 drawPlots.C:3390
 drawPlots.C:3391
 drawPlots.C:3392
 drawPlots.C:3393
 drawPlots.C:3394
 drawPlots.C:3395
 drawPlots.C:3396
 drawPlots.C:3397
 drawPlots.C:3398
 drawPlots.C:3399
 drawPlots.C:3400
 drawPlots.C:3401
 drawPlots.C:3402
 drawPlots.C:3403
 drawPlots.C:3404
 drawPlots.C:3405
 drawPlots.C:3406
 drawPlots.C:3407
 drawPlots.C:3408
 drawPlots.C:3409
 drawPlots.C:3410
 drawPlots.C:3411
 drawPlots.C:3412
 drawPlots.C:3413
 drawPlots.C:3414
 drawPlots.C:3415
 drawPlots.C:3416
 drawPlots.C:3417
 drawPlots.C:3418
 drawPlots.C:3419
 drawPlots.C:3420
 drawPlots.C:3421
 drawPlots.C:3422
 drawPlots.C:3423
 drawPlots.C:3424
 drawPlots.C:3425
 drawPlots.C:3426
 drawPlots.C:3427
 drawPlots.C:3428
 drawPlots.C:3429
 drawPlots.C:3430
 drawPlots.C:3431
 drawPlots.C:3432
 drawPlots.C:3433
 drawPlots.C:3434
 drawPlots.C:3435
 drawPlots.C:3436
 drawPlots.C:3437
 drawPlots.C:3438
 drawPlots.C:3439
 drawPlots.C:3440
 drawPlots.C:3441
 drawPlots.C:3442
 drawPlots.C:3443
 drawPlots.C:3444
 drawPlots.C:3445
 drawPlots.C:3446
 drawPlots.C:3447
 drawPlots.C:3448
 drawPlots.C:3449
 drawPlots.C:3450
 drawPlots.C:3451
 drawPlots.C:3452
 drawPlots.C:3453
 drawPlots.C:3454
 drawPlots.C:3455
 drawPlots.C:3456
 drawPlots.C:3457
 drawPlots.C:3458
 drawPlots.C:3459
 drawPlots.C:3460
 drawPlots.C:3461
 drawPlots.C:3462
 drawPlots.C:3463
 drawPlots.C:3464
 drawPlots.C:3465
 drawPlots.C:3466
 drawPlots.C:3467
 drawPlots.C:3468
 drawPlots.C:3469
 drawPlots.C:3470
 drawPlots.C:3471
 drawPlots.C:3472
 drawPlots.C:3473
 drawPlots.C:3474
 drawPlots.C:3475
 drawPlots.C:3476
 drawPlots.C:3477
 drawPlots.C:3478
 drawPlots.C:3479
 drawPlots.C:3480
 drawPlots.C:3481
 drawPlots.C:3482
 drawPlots.C:3483
 drawPlots.C:3484
 drawPlots.C:3485
 drawPlots.C:3486
 drawPlots.C:3487
 drawPlots.C:3488
 drawPlots.C:3489
 drawPlots.C:3490
 drawPlots.C:3491
 drawPlots.C:3492
 drawPlots.C:3493
 drawPlots.C:3494
 drawPlots.C:3495
 drawPlots.C:3496
 drawPlots.C:3497
 drawPlots.C:3498
 drawPlots.C:3499
 drawPlots.C:3500
 drawPlots.C:3501
 drawPlots.C:3502
 drawPlots.C:3503
 drawPlots.C:3504
 drawPlots.C:3505
 drawPlots.C:3506
 drawPlots.C:3507
 drawPlots.C:3508
 drawPlots.C:3509
 drawPlots.C:3510
 drawPlots.C:3511
 drawPlots.C:3512
 drawPlots.C:3513
 drawPlots.C:3514
 drawPlots.C:3515
 drawPlots.C:3516
 drawPlots.C:3517
 drawPlots.C:3518
 drawPlots.C:3519
 drawPlots.C:3520
 drawPlots.C:3521
 drawPlots.C:3522
 drawPlots.C:3523
 drawPlots.C:3524
 drawPlots.C:3525
 drawPlots.C:3526
 drawPlots.C:3527
 drawPlots.C:3528
 drawPlots.C:3529
 drawPlots.C:3530
 drawPlots.C:3531
 drawPlots.C:3532
 drawPlots.C:3533
 drawPlots.C:3534
 drawPlots.C:3535
 drawPlots.C:3536
 drawPlots.C:3537
 drawPlots.C:3538
 drawPlots.C:3539
 drawPlots.C:3540
 drawPlots.C:3541
 drawPlots.C:3542
 drawPlots.C:3543
 drawPlots.C:3544
 drawPlots.C:3545
 drawPlots.C:3546
 drawPlots.C:3547
 drawPlots.C:3548
 drawPlots.C:3549
 drawPlots.C:3550
 drawPlots.C:3551
 drawPlots.C:3552
 drawPlots.C:3553
 drawPlots.C:3554
 drawPlots.C:3555
 drawPlots.C:3556
 drawPlots.C:3557
 drawPlots.C:3558
 drawPlots.C:3559
 drawPlots.C:3560
 drawPlots.C:3561
 drawPlots.C:3562
 drawPlots.C:3563
 drawPlots.C:3564
 drawPlots.C:3565
 drawPlots.C:3566
 drawPlots.C:3567
 drawPlots.C:3568
 drawPlots.C:3569
 drawPlots.C:3570
 drawPlots.C:3571
 drawPlots.C:3572
 drawPlots.C:3573
 drawPlots.C:3574
 drawPlots.C:3575
 drawPlots.C:3576
 drawPlots.C:3577
 drawPlots.C:3578
 drawPlots.C:3579
 drawPlots.C:3580
 drawPlots.C:3581
 drawPlots.C:3582
 drawPlots.C:3583
 drawPlots.C:3584
 drawPlots.C:3585
 drawPlots.C:3586
 drawPlots.C:3587
 drawPlots.C:3588
 drawPlots.C:3589
 drawPlots.C:3590
 drawPlots.C:3591
 drawPlots.C:3592
 drawPlots.C:3593
 drawPlots.C:3594
 drawPlots.C:3595
 drawPlots.C:3596
 drawPlots.C:3597
 drawPlots.C:3598
 drawPlots.C:3599
 drawPlots.C:3600
 drawPlots.C:3601
 drawPlots.C:3602
 drawPlots.C:3603
 drawPlots.C:3604
 drawPlots.C:3605
 drawPlots.C:3606
 drawPlots.C:3607
 drawPlots.C:3608
 drawPlots.C:3609
 drawPlots.C:3610
 drawPlots.C:3611
 drawPlots.C:3612
 drawPlots.C:3613
 drawPlots.C:3614
 drawPlots.C:3615
 drawPlots.C:3616
 drawPlots.C:3617
 drawPlots.C:3618
 drawPlots.C:3619
 drawPlots.C:3620
 drawPlots.C:3621
 drawPlots.C:3622
 drawPlots.C:3623
 drawPlots.C:3624
 drawPlots.C:3625
 drawPlots.C:3626
 drawPlots.C:3627
 drawPlots.C:3628
 drawPlots.C:3629
 drawPlots.C:3630
 drawPlots.C:3631
 drawPlots.C:3632
 drawPlots.C:3633
 drawPlots.C:3634
 drawPlots.C:3635
 drawPlots.C:3636
 drawPlots.C:3637
 drawPlots.C:3638
 drawPlots.C:3639
 drawPlots.C:3640
 drawPlots.C:3641
 drawPlots.C:3642
 drawPlots.C:3643
 drawPlots.C:3644
 drawPlots.C:3645
 drawPlots.C:3646
 drawPlots.C:3647
 drawPlots.C:3648
 drawPlots.C:3649
 drawPlots.C:3650
 drawPlots.C:3651
 drawPlots.C:3652
 drawPlots.C:3653
 drawPlots.C:3654
 drawPlots.C:3655
 drawPlots.C:3656
 drawPlots.C:3657
 drawPlots.C:3658
 drawPlots.C:3659
 drawPlots.C:3660
 drawPlots.C:3661
 drawPlots.C:3662
 drawPlots.C:3663
 drawPlots.C:3664
 drawPlots.C:3665
 drawPlots.C:3666
 drawPlots.C:3667
 drawPlots.C:3668
 drawPlots.C:3669
 drawPlots.C:3670
 drawPlots.C:3671
 drawPlots.C:3672
 drawPlots.C:3673
 drawPlots.C:3674
 drawPlots.C:3675
 drawPlots.C:3676
 drawPlots.C:3677
 drawPlots.C:3678
 drawPlots.C:3679
 drawPlots.C:3680
 drawPlots.C:3681
 drawPlots.C:3682
 drawPlots.C:3683
 drawPlots.C:3684
 drawPlots.C:3685
 drawPlots.C:3686
 drawPlots.C:3687
 drawPlots.C:3688
 drawPlots.C:3689
 drawPlots.C:3690
 drawPlots.C:3691
 drawPlots.C:3692
 drawPlots.C:3693
 drawPlots.C:3694
 drawPlots.C:3695
 drawPlots.C:3696
 drawPlots.C:3697
 drawPlots.C:3698
 drawPlots.C:3699
 drawPlots.C:3700
 drawPlots.C:3701
 drawPlots.C:3702
 drawPlots.C:3703
 drawPlots.C:3704
 drawPlots.C:3705
 drawPlots.C:3706
 drawPlots.C:3707
 drawPlots.C:3708
 drawPlots.C:3709
 drawPlots.C:3710
 drawPlots.C:3711
 drawPlots.C:3712
 drawPlots.C:3713
 drawPlots.C:3714
 drawPlots.C:3715
 drawPlots.C:3716
 drawPlots.C:3717
 drawPlots.C:3718
 drawPlots.C:3719
 drawPlots.C:3720
 drawPlots.C:3721
 drawPlots.C:3722
 drawPlots.C:3723
 drawPlots.C:3724
 drawPlots.C:3725
 drawPlots.C:3726
 drawPlots.C:3727
 drawPlots.C:3728
 drawPlots.C:3729
 drawPlots.C:3730
 drawPlots.C:3731
 drawPlots.C:3732
 drawPlots.C:3733
 drawPlots.C:3734
 drawPlots.C:3735
 drawPlots.C:3736
 drawPlots.C:3737
 drawPlots.C:3738
 drawPlots.C:3739
 drawPlots.C:3740
 drawPlots.C:3741
 drawPlots.C:3742
 drawPlots.C:3743
 drawPlots.C:3744
 drawPlots.C:3745
 drawPlots.C:3746
 drawPlots.C:3747
 drawPlots.C:3748
 drawPlots.C:3749
 drawPlots.C:3750
 drawPlots.C:3751
 drawPlots.C:3752
 drawPlots.C:3753
 drawPlots.C:3754
 drawPlots.C:3755
 drawPlots.C:3756
 drawPlots.C:3757
 drawPlots.C:3758
 drawPlots.C:3759
 drawPlots.C:3760
 drawPlots.C:3761
 drawPlots.C:3762
 drawPlots.C:3763
 drawPlots.C:3764
 drawPlots.C:3765
 drawPlots.C:3766
 drawPlots.C:3767
 drawPlots.C:3768
 drawPlots.C:3769
 drawPlots.C:3770
 drawPlots.C:3771
 drawPlots.C:3772
 drawPlots.C:3773
 drawPlots.C:3774
 drawPlots.C:3775
 drawPlots.C:3776
 drawPlots.C:3777
 drawPlots.C:3778
 drawPlots.C:3779
 drawPlots.C:3780
 drawPlots.C:3781
 drawPlots.C:3782
 drawPlots.C:3783
 drawPlots.C:3784
 drawPlots.C:3785
 drawPlots.C:3786
 drawPlots.C:3787
 drawPlots.C:3788
 drawPlots.C:3789
 drawPlots.C:3790
 drawPlots.C:3791
 drawPlots.C:3792
 drawPlots.C:3793
 drawPlots.C:3794
 drawPlots.C:3795
 drawPlots.C:3796
 drawPlots.C:3797
 drawPlots.C:3798
 drawPlots.C:3799
 drawPlots.C:3800
 drawPlots.C:3801
 drawPlots.C:3802
 drawPlots.C:3803
 drawPlots.C:3804
 drawPlots.C:3805
 drawPlots.C:3806
 drawPlots.C:3807
 drawPlots.C:3808
 drawPlots.C:3809
 drawPlots.C:3810
 drawPlots.C:3811
 drawPlots.C:3812
 drawPlots.C:3813
 drawPlots.C:3814
 drawPlots.C:3815
 drawPlots.C:3816
 drawPlots.C:3817
 drawPlots.C:3818
 drawPlots.C:3819
 drawPlots.C:3820
 drawPlots.C:3821
 drawPlots.C:3822
 drawPlots.C:3823
 drawPlots.C:3824
 drawPlots.C:3825
 drawPlots.C:3826
 drawPlots.C:3827
 drawPlots.C:3828
 drawPlots.C:3829
 drawPlots.C:3830
 drawPlots.C:3831