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>
#include <TLegend.h>
#include <TPad.h>
#include <TF1.h>

extern TPad* gPad;

void Track2Particle1DCreatePlots(const char* fileName = "correction_map.root", const char* folderName = "dndeta_correction", Float_t upperPtLimit = 10);

#endif

Int_t markers[] = {20,20,21,22,23,28,29};
Int_t colors[]  = {1,2,3,4,6,8,102};

void loadlibs()
{
  gSystem->Load("libTree");
  gSystem->Load("libVMC");

  gSystem->Load("libSTEERBase");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libPWG0base");
}

void SetRanges(TAxis* axis)
{
  if (strcmp(axis->GetTitle(), "#eta") == 0)
    axis->SetRangeUser(-1.7999, 1.7999);
  if (strcmp(axis->GetTitle(), "p_{T} [GeV/c]") == 0)
    axis->SetRangeUser(0, 9.9999);
  if (strcmp(axis->GetTitle(), "vtx z [cm]") == 0)
    axis->SetRangeUser(-15, 14.9999);
  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);

  SetRanges(hist);
}

void Prepare1DPlot(TH1* hist, Bool_t setRanges = kTRUE)
{
  hist->SetLineWidth(2);
  hist->SetStats(kFALSE);

  hist->GetXaxis()->SetTitleOffset(1.2);
  hist->GetYaxis()->SetTitleOffset(1.2);

  if (setRanges)
    SetRanges(hist);
}

void InitPad()
{
  if (!gPad)
    return;

  gPad->Range(0, 0, 1, 1);
  gPad->SetLeftMargin(0.15);
  //gPad->SetRightMargin(0.05);
  //gPad->SetTopMargin(0.13);
  //gPad->SetBottomMargin(0.1);

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

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

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

void Secondaries()
{
  TFile* file = TFile::Open("systematics.root");

  TH2F* secondaries = dynamic_cast<TH2F*> (file->Get("fSecondaries"));
  if (!secondaries)
  {
    printf("Could not read histogram\n");
    return;
  }

  TCanvas* canvas = new TCanvas("Secondaries", "Secondaries", 1000, 1000);
  canvas->Divide(3, 3);
  for (Int_t i=1; i<=8; i++)
  {
    TH1D* hist = secondaries->ProjectionY(Form("proj_%d", i), i, i);
    hist->SetTitle(secondaries->GetXaxis()->GetBinLabel(i));

    canvas->cd(i);
    hist->Draw();
  }
}

void Track2Particle1DComposition(const char** fileNames, Int_t folderCount, const char** folderNames, Float_t upperPtLimit = 9.9)
{
  gSystem->Load("libPWG0base");

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

  TLegend* legend = new TLegend(0.7, 0.7, 0.95, 0.95);

  for (Int_t i=0; i<folderCount; ++i)
  {
    Correction1DCreatePlots(fileNames[i], folderNames[i], upperPtLimit);

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

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

    const char* title = "Track2Particle Correction";
    corrX->SetTitle(title);
    corrY->SetTitle(title);
    corrZ->SetTitle(title);

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

    corrX->SetLineColor(i+1);
    corrY->SetLineColor(i+1);
    corrZ->SetLineColor(i+1);

    canvas->cd(1);
    InitPad();
    corrX->DrawCopy(((i>0) ? "SAME" : ""));

    canvas->cd(2);
    InitPad();
    corrY->DrawCopy(((i>0) ? "SAME" : ""));

    canvas->cd(3);
    InitPad();
    corrZ->DrawCopy(((i>0) ? "SAME" : ""));

    legend->AddEntry(corrZ, folderNames[i]);
  }

  legend->Draw();

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

TH1** DrawRatios(const char* fileName = "systematics.root")
{
  gSystem->Load("libPWG0base");

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

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

  TH1** ptDists = new TH1*[4];

  TLegend* legend = new TLegend(0.73, 0.73, 0.98, 0.98);

  const char* folderNames[] = { "correction_0", "correction_1", "correction_2", "correction_3" };
  const char* particleNames[] = { "#pi", "K", "p", "other" };
  for (Int_t i=0; i<4; ++i)
  {
    AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(folderNames[i], folderNames[i]);
    dNdEtaCorrection->LoadHistograms(fileName, folderNames[i]);

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

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

    ptDists[i] = dynamic_cast<TH1*> (gene->Project3D("z")->Clone(Form("%s_z", folderNames[i])));
    ptDists[i]->SetTitle(";p_{T};Count");
    if (!ptDists[i])
    {
      printf("Problem getting distribution %d.\n", i);
      return 0;
    }

    ptDists[i]->GetYaxis()->SetRangeUser(1, ptDists[i]->GetMaximum()*1.1);
    ptDists[i]->GetXaxis()->SetRangeUser(0, 9.9);
    ptDists[i]->SetLineColor(i+1);
    ptDists[i]->DrawCopy((i == 0) ? "" : "SAME");
    ptDists[i]->GetYaxis()->SetRange(0, 0);

    legend->AddEntry(ptDists[i], particleNames[i]);
  }
  gPad->SetLogy();

  TH1* total = dynamic_cast<TH1*> (ptDists[0]->Clone("total"));

  for (Int_t i=1; i<4; ++i)
    total->Add(ptDists[i]);

  canvas->cd(2);
  for (Int_t i=0; i<4; ++i)
  {
    ptDists[i]->Divide(total);
    ptDists[i]->SetStats(kFALSE);
    ptDists[i]->SetTitle(";p_{T};Fraction of total");
    ptDists[i]->GetYaxis()->SetRangeUser(0, 1);
    ptDists[i]->Draw((i == 0) ? "" : "SAME");
  }
  legend->SetFillColor(0);
  legend->Draw();

  canvas->SaveAs("DrawRatios.gif");


  canvas = new TCanvas("PythiaRatios", "PythiaRatios", 500, 500);
  for (Int_t i=0; i<4; ++i)
  {
    TH1* hist = ptDists[i]->Clone();
    hist->GetXaxis()->SetRangeUser(0, 1.9);
    hist->Draw((i == 0) ? "" : "SAME");
  }
  legend->Draw();

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

  file->Close();

  return ptDists;
}

void DrawCompareToReal()
{
  gROOT->ProcessLine(".L drawPlots.C");

  const char* fileNames[] = { "correction_map.root", "new_compositions.root" };
  const char* folderNames[] = { "dndeta_correction", "PythiaRatios" };

  Track2Particle1DComposition(fileNames, 2, folderNames);
}

void DrawDifferentSpecies()
{
  gROOT->ProcessLine(".L drawPlots.C");

  const char* fileNames[] = { "systematics.root", "systematics.root", "systematics.root", "systematics.root" };
  const char* folderNames[] = { "correction_0", "correction_1", "correction_2", "correction_3" };

  Track2Particle1DComposition(fileNames, 4, folderNames);
}

void DrawpiKpAndCombined()
{
  gROOT->ProcessLine(".L drawPlots.C");

  const char* fileNames[] = { "systematics.root", "systematics.root", "systematics.root", "correction_map.root" };
  const char* folderNames[] = { "correction_0", "correction_1", "correction_2", "dndeta_correction" };

  Track2Particle1DComposition(fileNames, 4, folderNames);
}

void DrawSpeciesAndCombination()
{
  gROOT->ProcessLine(".L drawPlots.C");

  const char* fileNames[] = { "systematics.root", "systematics.root", "systematics.root", "new_compositions.root" };
  const char* folderNames[] = { "correction_0", "correction_1", "correction_2", "PythiaRatios" };

  Track2Particle1DComposition(fileNames, 4, folderNames);
}

void DrawSimulatedVsCombined()
{
  gROOT->ProcessLine(".L drawPlots.C");

  const char* fileNames[] = { "new_compositions.root", "new_compositions.root" };
  const char* folderNames[] = { "Pythia", "PythiaRatios" };

  Track2Particle1DComposition(fileNames, 2, folderNames);
}

void DrawBoosts()
{
  gROOT->ProcessLine(".L drawPlots.C");

  const char* fileNames[] = { "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root" };
  const char* folderNames[] = { "PythiaRatios", "PiBoosted", "KBoosted", "pBoosted" };

  Track2Particle1DComposition(fileNames, 4, folderNames);
}

TH2F* HistogramDifferences(const char* filename, const char* folder1, const char* folder2)
{
  gSystem->Load("libPWG0base");

  AlidNdEtaCorrection* fdNdEtaCorrection[2];

  TFile::Open(filename);

  fdNdEtaCorrection[0] = new AlidNdEtaCorrection(folder1, folder1);
  fdNdEtaCorrection[0]->LoadHistograms(filename, folder1);

  fdNdEtaCorrection[1] = new AlidNdEtaCorrection(folder2, folder2);
  fdNdEtaCorrection[1]->LoadHistograms(filename, folder2);

  TH3F* hist1 = fdNdEtaCorrection[0]->GetTrack2ParticleCorrection()->GetCorrectionHistogram();
  TH3F* hist2 = fdNdEtaCorrection[1]->GetTrack2ParticleCorrection()->GetCorrectionHistogram();

  //TH1F* difference = new TH1F("difference", Form(";#DeltaC_{pT, z, #eta} %s / %s;Count", folder2, folder1), 1000, 0.9, 1.1);
  TH2F* difference = new TH2F(Form("difference_%s_%s", folder1, folder2), Form(";#Sigma (C_{pT, z} %s / C_{pT, z} %s);#eta;Count", folder2, folder1), 100, 0.9, 1.1, hist1->GetYaxis()->GetNbins(), hist1->GetYaxis()->GetXmin(), hist1->GetYaxis()->GetXmax());

  for (Int_t x=hist1->GetXaxis()->FindBin(-10); x<=hist1->GetXaxis()->FindBin(10); ++x)
    for (Int_t y=hist1->GetYaxis()->FindBin(-0.8); y<=hist1->GetYaxis()->FindBin(0.8); ++y)
      for (Int_t z=hist1->GetZaxis()->FindBin(0.3); z<=hist1->GetZaxis()->FindBin(9.9); ++z)
        if (hist1->GetBinContent(x, y, z) != 0)
          difference->Fill(hist2->GetBinContent(x, y, z) / hist1->GetBinContent(x, y, z), hist1->GetYaxis()->GetBinCenter(y));

  difference->GetYaxis()->SetRangeUser(-0.8, 0.8);

  printf("Over-/Underflow bins: %d %d\n", difference->GetBinContent(0), difference->GetBinContent(difference->GetNbinsX()+1));

  return difference;
}

void HistogramDifferences()
{
  TH2F* KBoosted = HistogramDifferences("new_compositions.root", "PythiaRatios", "KBoosted");
  TH2F* pBoosted = HistogramDifferences("new_compositions.root", "PythiaRatios", "pBoosted");
  TH2F* KReduced = HistogramDifferences("new_compositions.root", "PythiaRatios", "KReduced");
  TH2F* pReduced = HistogramDifferences("new_compositions.root", "PythiaRatios", "pReduced");

  TCanvas* canvas = new TCanvas("HistogramDifferences", "HistogramDifferences", 1000, 1000);
  canvas->Divide(2, 2);

  canvas->cd(1);
  KBoosted->GetXaxis()->SetRangeUser(-0.05, 0.05);
  KBoosted->Draw("COLZ");

  canvas->cd(2);
  KReduced->GetXaxis()->SetRangeUser(-0.05, 0.05);
  KReduced->Draw("COLZ");

  canvas->cd(3);
  pBoosted->GetXaxis()->SetRangeUser(-0.02, 0.02);
  pBoosted->Draw("COLZ");

  canvas->cd(4);
  pReduced->GetXaxis()->SetRangeUser(-0.02, 0.02);
  pReduced->Draw("COLZ");

  canvas->SaveAs("HistogramDifferences.gif");

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

  canvas->cd(1);
  gPad->SetBottomMargin(0.13);
  KBoosted->SetTitle("a) Ratio of correction maps");
  KBoosted->SetStats(kFALSE);
  KBoosted->GetXaxis()->SetTitleOffset(1.4);
  KBoosted->GetXaxis()->SetLabelOffset(0.02);
  KBoosted->Draw("COLZ");

  canvas->cd(2);
  gPad->SetGridx();
  gPad->SetGridy();

  TLegend* legend = new TLegend(0.73, 0.73, 0.98, 0.98);

  for (Int_t i=0; i<4; ++i)
  {
    TH2F* hist = 0;
    TString name;
    switch (i)
    {
      case 0: hist = KBoosted; name = "K enhanced"; break;
      case 1: hist = KReduced; name = "K reduced"; break;
      case 2: hist = pBoosted; name = "p enhanced"; break;
      case 3: hist = pReduced; name = "p reduced"; break;
    }

    TProfile* profile = hist->ProfileY();
    profile->SetTitle("b) Mean and RMS");
    profile->GetXaxis()->SetRange(hist->GetYaxis()->GetFirst(), hist->GetYaxis()->GetLast());
    profile->GetXaxis()->SetTitleOffset(1.2);
    profile->GetXaxis()->SetLabelOffset(0.02);
    profile->GetYaxis()->SetRangeUser(0.98, 1.02);
    profile->SetStats(kFALSE);
    profile->SetLineColor(i+1);
    profile->SetMarkerColor(i+1);
    profile->DrawCopy(((i > 0) ? "SAME" : ""));


    legend->AddEntry(profile, name);
  }

  legend->Draw();
  canvas->SaveAs("particlecomposition_result.eps");
}


void ScalePtDependent(TH3F* hist, TF1* function)
{
  // assumes that pt is the third dimension of hist
  // scales with function(pt)

  for (Int_t z=1; z<=hist->GetNbinsZ(); ++z)
  {
    Double_t factor = function->Eval(hist->GetZaxis()->GetBinCenter(z));
    printf("z = %d, pt = %f, scaling with %f\n", z, hist->GetZaxis()->GetBinCenter(z), factor);

    for (Int_t x=1; x<=hist->GetNbinsX(); ++x)
      for (Int_t y=1; y<=hist->GetNbinsY(); ++y)
        hist->SetBinContent(x, y, z, hist->GetBinContent(x, y, z) * factor);
  }
}

void ScalePtDependent(TH3F* hist, TH1* function)
{
  // assumes that pt is the third dimension of hist
  // scales with histogram(pt)

  for (Int_t z=1; z<=hist->GetNbinsZ(); ++z)
  {
    Double_t factor = function->GetBinContent(function->GetXaxis()->FindBin(hist->GetZaxis()->GetBinCenter(z)));
    printf("z = %d, pt = %f, scaling with %f\n", z, hist->GetZaxis()->GetBinCenter(z), factor);

    for (Int_t x=1; x<=hist->GetNbinsX(); ++x)
      for (Int_t y=1; y<=hist->GetNbinsY(); ++y)
        hist->SetBinContent(x, y, z, hist->GetBinContent(x, y, z) * factor);
  }
}

const char* ChangeComposition(void** correctionPointer, Int_t index)
{
  AlidNdEtaCorrection** fdNdEtaCorrection = (AlidNdEtaCorrection**) correctionPointer;

  switch (index)
  {
    case 0: // result from pp events
      {
        TFile::Open("pythiaratios.root");

        for (Int_t i=0; i<4; ++i)
        {
          TString name;
          name.Form("correction_%d", i);
          fdNdEtaCorrection[i] = new AlidNdEtaCorrection(name, name);
          fdNdEtaCorrection[i]->LoadHistograms("pythiaratios.root", name);
        }
      }
      return "Pythia";
      break;

    case 1: // each species rated with pythia ratios
      /*TH1** ptDists = DrawRatios("pythiaratios.root");

      for (Int_t i=0; i<3; ++i)
      {
        ScalePtDependent(fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetMeasuredHistogram(), ptDists[i]);
        ScalePtDependent(fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetGeneratedHistogram(), ptDists[i]);
      }*/
      return "PythiaRatios";
      break;

      // one species enhanced / reduced
    case 2: // + 30% kaons
    case 3: // - 30% kaons
    case 4: // + 30% protons
    case 5: // - 30% protons
    case 6: // + 30% kaons + 30% protons
    case 7: // - 30% kaons - 30% protons
    case 8: // + 30% kaons - 30% protons
    case 9: // - 30% kaons + 30% protons
    case 10: // + 30% others
    case 11: // - 30% others
      TString* str = new TString;
      if (index < 6)
      {
        Int_t correctionIndex = index / 2;
        Double_t scaleFactor = (index % 2 == 0) ? 1.3 : 0.7;
  
        fdNdEtaCorrection[correctionIndex]->GetTrack2ParticleCorrection()->GetTrackCorrection()->Scale(scaleFactor);
        str->Form("%s%s", (correctionIndex == 0) ? "Pi" : ((correctionIndex == 1) ? "K" : (correctionIndex == 2) ? "p" : "others"), (index % 2 == 0) ? "Boosted" : "Reduced");
      }
      else if (index < 10)
      {
        Double_t scaleFactor = (index % 2 == 0) ? 1.3 : 0.7;
        fdNdEtaCorrection[1]->GetTrack2ParticleCorrection()->GetTrackCorrection()->Scale(scaleFactor);
        str->Form("%s%s", "K", (scaleFactor > 1) ? "Boosted" : "Reduced");
        
        if (index >= 8)
          scaleFactor = (index % 2 == 0) ? 0.3 : 1.7;
        fdNdEtaCorrection[2]->GetTrack2ParticleCorrection()->GetTrackCorrection()->Scale(scaleFactor);
        *str += Form("%s%s", "p", (scaleFactor > 1) ? "Boosted" : "Reduced");
      }
      else
      {
        Double_t scaleFactor = (index % 2 == 0) ? 1.3 : 0.7;
        fdNdEtaCorrection[3]->GetTrack2ParticleCorrection()->GetTrackCorrection()->Scale(scaleFactor);
        str->Form("%s%s", "others", (scaleFactor > 1) ? "Boosted" : "Reduced");
      }

      return str->Data();
      break;

      // each species rated with pythia ratios
    case 12: // + 50% pions
    case 13: // - 50% pions
    case 14: // + 50% kaons
    case 15: // - 50% kaons
    case 16: // + 50% protons
    case 17: // - 50% protons
      TH1** ptDists = DrawRatios("pythiaratios.root");
      Int_t functionIndex = (index - 2) / 2;
      Double_t scaleFactor = (index % 2 == 0) ? 1.5 : 0.5;
      ptDists[functionIndex]->Scale(scaleFactor);

      for (Int_t i=0; i<3; ++i)
      {
        ScalePtDependent(fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram(), ptDists[i]);
        ScalePtDependent(fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram(), ptDists[i]);
      }
      TString* str = new TString;
      str->Form("%s%s", (functionIndex == 0) ? "Pi" : ((functionIndex == 1) ? "K" : "p"), (index % 2 == 0) ? "Boosted" : "Reduced");
      return str->Data();
      break;

    case 999:
      TF1* ptDependence = new TF1("simple", "x", 0, 100);
      ScalePtDependent(fdNdEtaCorrection[0]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram(), ptDependence);
      ScalePtDependent(fdNdEtaCorrection[0]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram(), ptDependence);
      break;

  }

  return "noname";
}

void Composition()
{
  loadlibs();

  gSystem->Unlink("new_compositions.root");
  gSystem->Unlink("new_compositions_analysis.root");
  
  const char* names[] = { "pi", "K", "p", "other" };
  TH1* hRatios[20];

  //backgroundEvents = 1162+434; // Michele for MB1, run 104892, 15.02.10
  backgroundEvents = -1;    // use 0 bin from MC! for 2.36 TeV
  
  Printf("Subtracting %d background events!!!", backgroundEvents);
  gSystem->Sleep(1000);
  
  Int_t nCompositions = 12;
  Int_t counter = 0;
  for (Int_t comp = 1; comp < nCompositions; ++comp)
  {
    AlidNdEtaCorrection* fdNdEtaCorrection[4];

    TFile::Open("correction_mapparticle-species.root");

    for (Int_t i=0; i<4; ++i)
    {
      TString name;
      name.Form("dndeta_correction_%s", names[i]);
      fdNdEtaCorrection[i] = new AlidNdEtaCorrection(name, name);
      fdNdEtaCorrection[i]->LoadHistograms();
    }

    const char* newName = ChangeComposition(fdNdEtaCorrection, comp);

    Double_t geneCount[5];
    Double_t measCount[5];
    geneCount[4] = 0;
    measCount[4] = 0;

    for (Int_t i=0; i<4; ++i)
    {
      geneCount[i] = fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetGeneratedHistogram()->Integral();
      measCount[i] = fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetTrackCorrection()->GetMeasuredHistogram()->Integral();

      geneCount[4] += geneCount[i];
      measCount[4] += measCount[i];

      printf("Particle %s: %d gene, %d meas\n", ((i == 0) ? "pi" : (i == 1) ? "K" : (i == 2) ? "p" : "others"), (Int_t) geneCount[i], (Int_t) measCount[i]);
    }

    printf("Generated ratios are:     %f pi, %f K, %f p, %f others\n", geneCount[0] / geneCount[4], geneCount[1] / geneCount[4], geneCount[2] / geneCount[4], geneCount[3] / geneCount[4]);

    printf("Reconstructed ratios are: %f pi, %f K, %f p, %f others\n", measCount[0] / measCount[4], measCount[1] / measCount[4], measCount[2] / measCount[4], measCount[3] / measCount[4]);

    TList* collection = new TList;

    // skip "other" particle correction here
    // with them has to be dealt differently, maybe just increasing the neutral particles...
    for (Int_t i=1; i<4; ++i)
      collection->Add(fdNdEtaCorrection[i]);

    fdNdEtaCorrection[0]->Merge(collection);
    fdNdEtaCorrection[0]->Finish();

    delete collection;

    // save everything
    TFile* file = TFile::Open("new_compositions.root", "UPDATE");
    fdNdEtaCorrection[0]->SetName(newName);
    fdNdEtaCorrection[0]->SaveHistograms();
    //file->Write();
    file->Close();
    
    // correct dNdeta distribution with modified correction map
    TFile::Open("analysis_esd_raw.root");

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

    fdNdEtaAnalysis->Finish(fdNdEtaCorrection[0], 0.2, 3, newName);
    
    hRatios[counter] = (TH1F*) fdNdEtaAnalysis->GetdNdEtaHistogram()->Clone(newName);
    hRatios[counter]->SetTitle(newName);
    hRatios[counter]->SetYTitle("dN_{ch}/d#eta ratio #frac{default composition}{modified composition}");

    if (counter > 0)
      hRatios[counter]->Divide(hRatios[0],hRatios[counter],1,1);

    file = TFile::Open("new_compositions_analysis.root", "UPDATE");
    hRatios[counter]->Write();
    file->Close();
    
    delete fdNdEtaAnalysis;

    counter++;
  }

  /*
  gROOT->ProcessLine(".L drawPlots.C");

  const char* fileNames[] = {"new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root", "new_compositions.root" };
  const char* folderNames[] = { "PythiaRatios", "PiBoosted", "PiReduced", "KBoosted", "KReduced", "pBoosted", "pReduced" };

  Track2Particle1DComposition(fileNames, nCompositions, folderNames);
  */
}


void drawSystematics()
{
  //Secondaries();
  //DrawDifferentSpecies();
  //Composition();

  Sigma2VertexSimulation();

}

void DrawdNdEtaDifferences()
{
  TH1* hists[5];

  TLegend* legend = new TLegend(0.3, 0.73, 0.70, 0.98);
  legend->SetFillColor(0);

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

  canvas->cd(1);

  for (Int_t i=0; i<5; ++i)
  {
    hists[i] = 0;
    TFile* file = 0;
    TString title;

    switch(i)
    {
      case 0 : file = TFile::Open("systematics_dndeta_reference.root"); title = "standard composition"; break;
      case 1 : file = TFile::Open("systematics_dndeta_KBoosted.root"); title = "+ 50% kaons"; break;
      case 2 : file = TFile::Open("systematics_dndeta_KReduced.root"); title = "- 50% kaons"; break;
      case 3 : file = TFile::Open("systematics_dndeta_pBoosted.root"); title = "+ 50% protons"; break;
      case 4 : file = TFile::Open("systematics_dndeta_pReduced.root"); title = "- 50% protons"; break;
      default: return;
    }

    if (file)
    {
      hists[i] = (TH1*) file->Get("dndeta/dndeta_dNdEta_corrected_2");
      hists[i]->SetTitle("a)");

      Prepare1DPlot(hists[i], kFALSE);
      hists[i]->GetXaxis()->SetRangeUser(-0.7999, 0.7999);
      hists[i]->GetYaxis()->SetRangeUser(6, 7);
      hists[i]->SetLineColor(colors[i]);
      hists[i]->SetMarkerColor(colors[i]);
      hists[i]->SetMarkerStyle(markers[i]);
      hists[i]->GetXaxis()->SetLabelOffset(0.015);
      hists[i]->GetYaxis()->SetTitleOffset(1.5);
      gPad->SetLeftMargin(0.12);
      hists[i]->DrawCopy(((i > 0) ? "SAME" : ""));

      legend->AddEntry(hists[i], title);
      hists[i]->SetTitle(title);
    }
  }
  legend->Draw();

  canvas->cd(2);
  gPad->SetLeftMargin(0.14);

  TLegend* legend2 = new TLegend(0.73, 0.73, 0.98, 0.98);
  legend2->SetFillColor(0);

  for (Int_t i=1; i<5; ++i)
  {
    if (hists[i])
    {
      legend2->AddEntry(hists[i]);

      hists[i]->Divide(hists[0]);
      hists[i]->SetTitle("b)");
      hists[i]->SetLineColor(colors[i-1]);
      hists[i]->SetMarkerColor(colors[i-1]);
      hists[i]->GetYaxis()->SetRangeUser(0.95, 1.05);
      hists[i]->GetYaxis()->SetTitle("Ratio to standard composition");
      hists[i]->GetYaxis()->SetTitleOffset(1.8);
      hists[i]->DrawCopy(((i > 1) ? "SAME" : ""));
    }
  }

  legend2->Draw();

  canvas->SaveAs("particlecomposition_result_detail.gif");

  TCanvas* canvas2 = new TCanvas("DrawdNdEtaDifferences2", "DrawdNdEtaDifferences2", 700, 500);

  for (Int_t i=1; i<5; ++i)
  {
    if (hists[i])
    {
      hists[i]->SetTitle("");
      hists[i]->GetYaxis()->SetTitleOffset(1.1);
      hists[i]->DrawCopy(((i > 1) ? "SAME" : ""));
    }
  }

  legend2->Draw();

  canvas2->SaveAs("particlecomposition_result.gif");
  canvas2->SaveAs("particlecomposition_result.eps");
}

void mergeCorrectionsWithDifferentCrosssections(Int_t origin, Int_t correctionTarget = 3, Char_t* correctionFileName="correction_mapprocess-types.root", const char* analysisFileName = "analysis_esd_raw.root", const Char_t* outputFileName=0) {
  //
  // Function used to merge standard corrections with vertex
  // reconstruction corrections obtained by a certain mix of ND, DD
  // and SD events.
  //
  // the dn/deta spectrum is corrected and the ratios
  // (standard to changed x-section) of the different dN/deta
  // distributions are saved to a file.
  //
  // correctionTarget is of type AlidNdEtaCorrection::CorrectionType
  //    kINEL = 3
  //    kNSD = 4
  //    kOnePart = 6

  if (outputFileName == 0)
  {
    if (correctionTarget == 3)
      outputFileName = "systematics_vtxtrigger_compositions_inel.root";
    if (correctionTarget == 4)
      outputFileName = "systematics_vtxtrigger_compositions_nsd.root";
    if (correctionTarget == 6)
      outputFileName = "systematics_vtxtrigger_compositions_onepart.root";
  }

  loadlibs();

  const Char_t* typeName[] = { "vertexreco", "trigger", "vtxtrigger" };

  //Karel:
//     fsd = 0.153 +- 0.031 (0.050 to take into account SD definition) --> change
//     fdd = 0.080 +- 0.050 --> change 
//     fnd = 0.767 +- 0.059 --> keep (error small)

//  const Char_t* changes[]  = { "pythia","ddmore","ddless","sdmore","sdless", "dmore", "dless", "sdlessddmore", "sdmoreddless", "ddmore25","ddless25","sdmore25","sdless25", "dmore25", "dless25", "sdlessddmore25", "sdmoreddless25"};
  //Float_t scalesND[] = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,  1.0,  1.0,  1.0,  1.0,  1.0,  1.0,  1.0 };
  //Float_t scalesDD[] = {1.0, 1.5, 0.5, 1.0, 1.0, 1.5, 0.5, 1.5, 0.5, 1.25, 0.75, 1.0,  1.0,  1.25, 0.75, 1.25, 0.75};
  //Float_t scalesSD[] = {1.0, 1.0, 1.0, 1.5, 0.5, 1.5, 0.5, 0.5, 1.5, 1.0,  1.0,  1.25, 0.75, 1.25, 0.75, 0.75, 1.25};
  //Float_t scalesDD[] = {1.0, 1.4, 0.6, 1.0, 1.0, 1.4, 0.6, 1.4, 0.6, 1.25, 0.75, 1.0,  1.0,  1.25, 0.75, 1.25, 0.75};
  //Float_t scalesSD[] = {1.0, 1.0, 1.0, 1.4, 0.6, 1.4, 0.6, 0.4, 1.6, 1.0,  1.0,  1.25, 0.75, 1.25, 0.75, 0.75, 1.25};
/*  Int_t nChanges = 9;

  const Char_t* changes[]  = { "ua5","ddmore","ddless","sdmore","sdless", "dmore", "dless", "sdlessddmore", "sdmoreddless" };
  Float_t scalesND[] = {0.767, 0.767, 0.767, 0.767, 0.767, 0.767, 0.767, 0.767, 0.767};
  Float_t scalesDD[] = {0.080, 0.130, 0.030, 0.080, 0.080, 0.130, 0.030, 0.130, 0.030};
  Float_t scalesSD[] = {0.153, 0.153, 0.153, 0.203, 0.103, 0.203, 0.103, 0.103, 0.203};*/
  
  Float_t ref_SD = -1;
  Float_t ref_DD = -1;
  Float_t ref_ND = -1;
  
  Float_t error_SD = -1;
  Float_t error_DD = -1;
  Float_t error_ND = -1;
  
  GetRelativeFractions(origin, ref_SD, ref_DD, ref_ND, error_SD, error_DD, error_ND);
  
  Printf("Using x-sections:\n SD: %f +- %f\n DD: %f +- %f\n ND: %f +- %f", ref_SD, error_SD, ref_DD, error_DD, ref_ND, error_ND);
  
  const Char_t* changes[]  = { "default","sdless","sdmore","ddless","ddmore", "dless", "dmore", "sdlessddmore", "sdmoreddless" };
  Int_t nChanges = 9;
  Float_t scalesSD[9];
  Float_t scalesDD[9];
  Float_t scalesND[9];
  
  if (1)
  {
    // sample 8 points on the error ellipse
    for (Int_t i=0; i<9; i++)
    {
      Float_t factorSD = 0;
      Float_t factorDD = 0;
      
      if (i > 0 && i < 3)
        factorSD = (i % 2 == 0) ? 1 : -1;
      else if (i >= 3 && i < 5)
        factorDD = (i % 2 == 0) ? 1 : -1;
      else if (i >= 5 && i < 9)
      {
        factorSD = ((i % 2 == 0) ? 1.0 : -1.0) / TMath::Sqrt(2);
        if (i == 5 || i == 6)
          factorDD = factorSD;
        else
          factorDD = -factorSD;
      }
      
      scalesSD[i] = ref_SD + factorSD * error_SD;
      scalesDD[i] = ref_DD + factorDD * error_DD;
      scalesND[i] = 1.0 - scalesDD[i] - scalesSD[i];
      
      Printf("Case %d: SD: %f DD: %f ND: %f", i, scalesSD[i], scalesDD[i], scalesND[i]);
    }
  }
  else
  {
    Printf("WARNING: Special treatment for ratios active");
    gSystem->Sleep(1000);
    
    // constrained values by allowed changing of cross-sections
    Float_t pythiaScaling = 0.224 / 0.189;

    if (origin == 10)
    {
      // 900 GeV
      for (Int_t i=0; i<9; i++)
      {
        scalesSD[i] = 15.3;
        scalesDD[i] = 9.5;
      }

      scalesSD[1] = 15.7;
      scalesSD[2] = 17.6;
      scalesSD[3] = 13.5;
      scalesSD[4] = 17.6;

      scalesDD[5] = 15.5;
      scalesDD[6] = 8.8;
      scalesDD[7] = 13.8;
      scalesDD[8] = 7.6;
    }
    else if (origin == 20)
    {
      // 2.36 TeV
      pythiaScaling = 0.217 / 0.167;
      
      for (Int_t i=0; i<9; i++)
      {
        scalesSD[i] = 15.9;
        scalesDD[i] = 10.7;
      }

      scalesSD[1] = 13.5;
      scalesSD[2] = 15.2;
      scalesSD[3] = 13.5;
      scalesSD[4] = 17.6;

      scalesDD[5] = 13.8;
      scalesDD[6] = 7.6;
      scalesDD[7] = 13.8;
      scalesDD[8] = 7.6;
    }
    else
      AliFatal("Not supported");

    for (Int_t i=0; i<9; i++)
    {
      scalesSD[i] /= 100;
      scalesSD[i] *= pythiaScaling;
      scalesDD[i] /= 100;
      scalesND[i] = 1.0 - scalesDD[i] - scalesSD[i];
      Printf("Case %d: SD: %f DD: %f ND: %f", i, scalesSD[i], scalesDD[i], scalesND[i]);
    }
  }
  
  Int_t backgroundEvents = 0;
  
  //backgroundEvents = 1162+434; // Michele for MB1, run 104892, 15.02.10
  //backgroundEvents = 6;          // Michele for V0AND, run 104892, 15.02.10
  
  //backgroundEvents = 4398+961;   // Michele for MB1, run 104824-52, 16.02.10
  //backgroundEvents = 19;         // Michele for V0AND, run 104824-52, 16.02.10
  
  backgroundEvents = -1;    // use 0 bin from MC! for 2.36 TeV
  
  Printf("Subtracting %d background events!!!", backgroundEvents);
  gSystem->Sleep(1000);
  
  /*
  const Char_t* changes[]  = { "pythia", "qgsm", "phojet"};
  Float_t scalesND[] = {1.0, 1.10, 1.11};
  Float_t scalesSD[] = {1.0, 0.69, 0.86};
  Float_t scalesDD[] = {1.0, 0.98, 0.61};
  Int_t nChanges = 3;
  */
  
  // cross section from Pythia
  // 14 TeV!
//   Float_t sigmaND = 55.2;
//   Float_t sigmaDD = 9.78;
//   Float_t sigmaSD = 14.30;

  // standard correction
  TFile::Open(correctionFileName);
  AlidNdEtaCorrection* correctionStandard = new AlidNdEtaCorrection("dndeta_correction","dndeta_correction");
  correctionStandard->LoadHistograms();

  // dont take vertexreco from this one
  correctionStandard->GetVertexRecoCorrection()->Reset();
  // dont take triggerbias from this one
  correctionStandard->GetTriggerBiasCorrectionINEL()->Reset();
  correctionStandard->GetTriggerBiasCorrectionNSD()->Reset();
  correctionStandard->GetTriggerBiasCorrectionND()->Reset();
  correctionStandard->GetTriggerBiasCorrectionOnePart()->Reset();

  AlidNdEtaCorrection* corrections[100];
  TH1F* hRatios[100];

  Int_t counter = 0;
  for (Int_t j=2; j<3; j++) { // j = 0 (change vtx), j = 1 (change trg), j = 2 (change both)

    for (Int_t i=0; i<nChanges; i++) {
      TFile::Open(correctionFileName);

      TString name;
      name.Form("dndeta_correction_syst_%s_%s", typeName[j], changes[i]);
      AlidNdEtaCorrection* current = new AlidNdEtaCorrection(name, name);
      current->LoadHistograms("dndeta_correction");
      current->Reset();

      name.Form("dndeta_correction_ND");
      AlidNdEtaCorrection* dNdEtaCorrectionND = new AlidNdEtaCorrection(name,name);
      dNdEtaCorrectionND->LoadHistograms();
      name.Form("dndeta_correction_DD");
      AlidNdEtaCorrection* dNdEtaCorrectionDD = new AlidNdEtaCorrection(name,name);
      dNdEtaCorrectionDD->LoadHistograms();
      name.Form("dndeta_correction_SD");
      AlidNdEtaCorrection* dNdEtaCorrectionSD = new AlidNdEtaCorrection(name,name);
      dNdEtaCorrectionSD->LoadHistograms();

      // calculating relative
      Float_t nd = dNdEtaCorrectionND->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral();
      Float_t dd = dNdEtaCorrectionDD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral();
      Float_t sd = dNdEtaCorrectionSD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral();
      Float_t total = nd + dd + sd;
      
      nd /= total;
      sd /= total;
      dd /= total;
      
      Printf("Ratios in the correction map are: ND=%f, DD=%f, SD=%f", nd, dd, sd);
      
      Float_t scaleND = scalesND[i] / nd;
      Float_t scaleDD = scalesDD[i] / dd;
      Float_t scaleSD = scalesSD[i] / sd;
      
      Printf("ND=%.2f, DD=%.2f, SD=%.2f",scaleND, scaleDD, scaleSD);      
      
/*      Float_t nd = 100 * sigmaND/(sigmaND + (scalesDD[i]*sigmaDD) + (scalesDD[i]*sigmaSD));
      Float_t dd = 100 * (scalesDD[i]*sigmaDD)/(sigmaND + (scalesDD[i]*sigmaDD) + (scalesDD[i]*sigmaSD));
      Float_t sd = 100 * (scalesSD[i]*sigmaSD)/(sigmaND + (scalesDD[i]*sigmaDD) + (scalesDD[i]*sigmaSD));

      printf(Form("%s : ND=%.2f\%, DD=%.2f\%, SD=%.2f\% \n",changes[i],nd,dd,sd));*/
      current->SetTitle(Form("ND=%.2f\%,DD=%.2f\%,SD=%.2f\%",scaleND,scaleDD,scaleSD));
      current->SetTitle(name);

      // scale
      if (j == 0 || j == 2)
      {
        dNdEtaCorrectionND->GetVertexRecoCorrection()->Scale(scaleND);
        dNdEtaCorrectionDD->GetVertexRecoCorrection()->Scale(scaleDD);
        dNdEtaCorrectionSD->GetVertexRecoCorrection()->Scale(scaleSD);
      }
      if (j == 1 || j == 2)
      {
        dNdEtaCorrectionND->GetTriggerBiasCorrectionINEL()->Scale(scaleND);
        dNdEtaCorrectionDD->GetTriggerBiasCorrectionINEL()->Scale(scaleDD);
        dNdEtaCorrectionSD->GetTriggerBiasCorrectionINEL()->Scale(scaleSD);

        dNdEtaCorrectionND->GetTriggerBiasCorrectionNSD()->Scale(scaleND);
        dNdEtaCorrectionDD->GetTriggerBiasCorrectionNSD()->Scale(scaleDD);
        dNdEtaCorrectionSD->GetTriggerBiasCorrectionNSD()->Scale(scaleSD);

        dNdEtaCorrectionND->GetTriggerBiasCorrectionND()->Scale(scaleND);
        dNdEtaCorrectionDD->GetTriggerBiasCorrectionND()->Scale(scaleDD);
        dNdEtaCorrectionSD->GetTriggerBiasCorrectionND()->Scale(scaleSD);

        dNdEtaCorrectionND->GetTriggerBiasCorrectionOnePart()->Scale(scaleND);
        dNdEtaCorrectionDD->GetTriggerBiasCorrectionOnePart()->Scale(scaleDD);
        dNdEtaCorrectionSD->GetTriggerBiasCorrectionOnePart()->Scale(scaleSD);
      }

      //clear track in correction
      dNdEtaCorrectionND->GetTrack2ParticleCorrection()->Reset();
      dNdEtaCorrectionDD->GetTrack2ParticleCorrection()->Reset();
      dNdEtaCorrectionSD->GetTrack2ParticleCorrection()->Reset();

      TList collection;
      collection.Add(correctionStandard);
      collection.Add(dNdEtaCorrectionND);
      collection.Add(dNdEtaCorrectionDD);
      collection.Add(dNdEtaCorrectionSD);

      current->Merge(&collection);
      current->Finish();
      
      // print 0 bin efficiency
      TH1* hist2 = current->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->Get1DCorrection("y", -10, 10);
      if (hist2->GetBinContent(1))
      {
        Float_t triggerEff = 100.0 / hist2->GetBinContent(1);
        Printf("trigger eff in 0 bin is: %.2f %%", triggerEff);
      }

      corrections[counter] = current;

      // now correct dNdeta distribution with modified correction map
      TFile::Open(analysisFileName);

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

      fdNdEtaAnalysis->Finish(current, 0.151, correctionTarget, Form("%d %d", j, i), backgroundEvents);

      name = "ratio";
      if (j==0) name.Append("_vetexReco_");
      if (j==1) name.Append("_triggerBias_");
      if (j==2) name.Append("_vertexReco_triggerBias_");
      name.Append(changes[i]);

      hRatios[counter] = (TH1F*) fdNdEtaAnalysis->GetdNdEtaHistogram()->Clone(name);

      name.Form("ND #times %0.2f DD #times %0.2f, SD #times %0.2f",scaleND,scaleDD,scaleSD);
      hRatios[counter]->SetTitle(name.Data());
      hRatios[counter]->SetYTitle("dN_{ch}/d#eta ratio #frac{default cross-section}{modified cross-sections}");
      
      TF1* pol0 = new TF1("pol0", "[0]", -0.49, 0.49);
      pol0->SetParameter(0, 0);
      hRatios[counter]->Fit(pol0, "RN");
      Printf("Case %d: %f", i, pol0->GetParameter(0));
      
      if (counter > 0)
        hRatios[counter]->Divide(hRatios[0],hRatios[counter],1,1);

      delete fdNdEtaAnalysis;

      counter++;
    }
  }

  TFile* fout = new TFile(outputFileName,"RECREATE");

  // to make everything consistent
  hRatios[0]->Divide(hRatios[0],hRatios[0],1,1);

  for (Int_t i=0; i<counter; i++)
  {
    corrections[i]->SaveHistograms();
    hRatios[i]->Write();
  }

  fout->Write();
  fout->Close();
}

void GetRelativeFractions(Int_t origin, Float_t& ref_SD, Float_t& ref_DD, Float_t& ref_ND, Float_t& error_SD, Float_t& error_DD, Float_t& error_ND)
{
  // origin: 
  //   -1 = Pythia (test)
  //   0 = UA5
  //   1 = Data 1.8 TeV
  //   2 = Tel-Aviv
  //   3 = Durham
  //

  switch (origin)
  {
    case -10: // Pythia default at 7 GeV, 50% error
      Printf("PYTHIA x-sections");
      ref_SD = 0.192637; error_SD = ref_SD * 0.5;
      ref_DD = 0.129877; error_DD = ref_DD * 0.5;
      ref_ND = 0.677486; error_ND = 0;
      break;

    case -1: // Pythia default at 900 GeV, as test
      Printf("PYTHIA x-sections");
      ref_SD = 0.223788;
      ref_DD = 0.123315;
      ref_ND = 0.652897;
      break;
      
    case 0: // UA5
      Printf("UA5 x-sections a la first paper");
      ref_SD = 0.153; error_SD = 0.05;
      ref_DD = 0.080; error_DD = 0.05;
      ref_ND = 0.767; error_ND = 0;
      break;
      
    case 10: // UA5
      Printf("UA5 x-sections hadron level definition for Pythia"); 
      // Fractions in Pythia with UA5 cuts selection for SD
      // ND: 0.688662
      // SD: 0.188588 --> this should be 15.3
      // DD: 0.122750
      ref_SD = 0.224 * 0.153 / 0.189; error_SD = 0.023 * 0.224 / 0.189;
      ref_DD = 0.095;                 error_DD = 0.06; 
      ref_ND = 1.0 - ref_SD - ref_DD; error_ND = 0;
      break;
    
    case 11: // UA5
      Printf("UA5 x-sections hadron level definition for Phojet"); 
      // Fractions in Phojet with UA5 cuts selection for SD
      // ND: 0.783573
      // SD: 0.151601 --> this should be 15.3
      // DD: 0.064827
      ref_SD = 0.191 * 0.153 / 0.152; error_SD = 0.023 * 0.191 / 0.152;
      ref_DD = 0.095;                 error_DD = 0.06; 
      ref_ND = 1.0 - ref_SD - ref_DD; error_ND = 0;
      break;
      
    case 20: // E710, 1.8 TeV
      Printf("E710 x-sections hadron level definition for Pythia");
      // ND: 0.705709
      // SD: 0.166590 --> this should be 15.9
      // DD: 0.127701
      ref_SD = 0.217 * 0.159 / 0.167; error_SD = 0.024 * 0.217 / 0.167;
      ref_DD = 0.075 * 1.43;          error_DD = 0.02 * 1.43; 
      ref_ND = 1.0 - ref_SD - ref_DD; error_ND = 0;
      break;
    
    case 21: // E710, 1.8 TeV
      Printf("E710 x-sections hadron level definition for Phojet"); 
      // ND: 0.817462
      // SD: 0.125506 --> this should be 15.9
      // DD: 0.057032
      ref_SD = 0.161 * 0.159 / 0.126; error_SD = 0.024 * 0.161 / 0.126;
      ref_DD = 0.075 * 1.43;         error_DD = 0.02 * 1.43;
      ref_ND = 1.0 - ref_SD - ref_DD; error_ND = 0;
      break;
    
    case 1: // data 1.8 TeV
      Printf("??? x-sections");
      ref_SD = 0.152;
      ref_DD = 0.092;
      ref_ND = 1 - ref_SD - ref_DD;
      break;
      
    case 2: // tel-aviv model
      Printf("Tel-aviv model x-sections");
      ref_SD = 0.171;
      ref_DD = 0.094;
      ref_ND = 1 - ref_SD - ref_DD;
      break;
    
    case 3: // durham model
      Printf("Durham model x-sections");
      ref_SD = 0.190;
      ref_DD = 0.125;
      ref_ND = 1 - ref_SD - ref_DD;
      break;
    
    default:
      AliFatal(Form("Unknown origin %d", origin));
  }
}

void CreateCorrectionsWithUA5CrossSections(Int_t origin, const Char_t* correctionFileName="correction_mapprocess-types.root", const Char_t* outputFileName="correction_map2.root") {
  //
  // Function used to merge standard corrections with vertex
  // reconstruction corrections obtained by a certain mix of ND, DD
  // and SD events.
  //
  loadlibs();

  const Char_t* typeName[] = { "vertexreco", "trigger", "vtxtrigger" };
  
  Float_t ref_SD = -1;
  Float_t ref_DD = -1;
  Float_t ref_ND = -1;
  
  Float_t error_SD = -1;
  Float_t error_DD = -1;
  Float_t error_ND = -1;
  
  GetRelativeFractions(origin, ref_SD, ref_DD, ref_ND, error_SD, error_DD, error_ND);
  
  Printf("Using x-sections:\n SD: %f +- %f\n DD: %f +- %f\n ND: %f +- %f", ref_SD, error_SD, ref_DD, error_DD, ref_ND, error_ND);
  
//Karel (UA5):
//     fsd = 0.153 +- 0.031
//     fdd = 0.080 +- 0.050
//     fnd = 0.767 +- 0.059

//       Karel (1.8 TeV):
//       
//       Tel-Aviv model Sd/Inel = 0.171           Dd/Inel = 0.094
//       Durham model   Sd/Inel = 0.190           Dd/Inel = 0.125
//       Data           Sd/Inel = 0.152 +- 0.030  Dd/Inel = 0.092 +- 0.45

  // standard correction
  TFile::Open(correctionFileName);
  AlidNdEtaCorrection* correctionStandard = new AlidNdEtaCorrection("dndeta_correction","dndeta_correction");
  correctionStandard->LoadHistograms();

  // dont take vertexreco from this one
  correctionStandard->GetVertexRecoCorrection()->Reset();
  // dont take triggerbias from this one
  correctionStandard->GetTriggerBiasCorrectionINEL()->Reset();
  correctionStandard->GetTriggerBiasCorrectionNSD()->Reset();
  correctionStandard->GetTriggerBiasCorrectionND()->Reset();
  correctionStandard->GetTriggerBiasCorrectionOnePart()->Reset();

  AlidNdEtaCorrection* corrections[100];
  TH1F* hRatios[100];

  Int_t counter = 0;
      
  TFile::Open(correctionFileName);

  AlidNdEtaCorrection* current = new AlidNdEtaCorrection("dndeta_correction_ua5", "dndeta_correction_ua5");
  current->LoadHistograms("dndeta_correction");
  current->Reset();

  TString name;
  name.Form("dndeta_correction_ND");
  AlidNdEtaCorrection* dNdEtaCorrectionND = new AlidNdEtaCorrection(name,name);
  dNdEtaCorrectionND->LoadHistograms();
  name.Form("dndeta_correction_DD");
  AlidNdEtaCorrection* dNdEtaCorrectionDD = new AlidNdEtaCorrection(name,name);
  dNdEtaCorrectionDD->LoadHistograms();
  name.Form("dndeta_correction_SD");
  AlidNdEtaCorrection* dNdEtaCorrectionSD = new AlidNdEtaCorrection(name,name);
  dNdEtaCorrectionSD->LoadHistograms();

  // calculating relative
  Float_t nd = dNdEtaCorrectionND->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral();
  Float_t dd = dNdEtaCorrectionDD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral();
  Float_t sd = dNdEtaCorrectionSD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral();
  Float_t total = nd + dd + sd;
  
  nd /= total;
  sd /= total;
  dd /= total;
  
  Printf("Ratios in the correction map are: ND=%f, DD=%f, SD=%f", nd, dd, sd);
  
  Float_t scaleND = ref_ND / nd;
  Float_t scaleDD = ref_DD / dd;
  Float_t scaleSD = ref_SD / sd;
  
  Printf("ND=%.2f, DD=%.2f, SD=%.2f",scaleND, scaleDD, scaleSD);

  // scale
  dNdEtaCorrectionND->GetVertexRecoCorrection()->Scale(scaleND);
  dNdEtaCorrectionDD->GetVertexRecoCorrection()->Scale(scaleDD);
  dNdEtaCorrectionSD->GetVertexRecoCorrection()->Scale(scaleSD);
    
  dNdEtaCorrectionND->GetTriggerBiasCorrectionINEL()->Scale(scaleND);
  dNdEtaCorrectionDD->GetTriggerBiasCorrectionINEL()->Scale(scaleDD);
  dNdEtaCorrectionSD->GetTriggerBiasCorrectionINEL()->Scale(scaleSD);

  dNdEtaCorrectionND->GetTriggerBiasCorrectionNSD()->Scale(scaleND);
  dNdEtaCorrectionDD->GetTriggerBiasCorrectionNSD()->Scale(scaleDD);
  dNdEtaCorrectionSD->GetTriggerBiasCorrectionNSD()->Scale(scaleSD);

  dNdEtaCorrectionND->GetTriggerBiasCorrectionND()->Scale(scaleND);
  dNdEtaCorrectionDD->GetTriggerBiasCorrectionND()->Scale(scaleDD);
  dNdEtaCorrectionSD->GetTriggerBiasCorrectionND()->Scale(scaleSD);

  dNdEtaCorrectionND->GetTriggerBiasCorrectionOnePart()->Scale(scaleND);
  dNdEtaCorrectionDD->GetTriggerBiasCorrectionOnePart()->Scale(scaleDD);
  dNdEtaCorrectionSD->GetTriggerBiasCorrectionOnePart()->Scale(scaleSD);

  //clear track in correction
  dNdEtaCorrectionND->GetTrack2ParticleCorrection()->Reset();
  dNdEtaCorrectionDD->GetTrack2ParticleCorrection()->Reset();
  dNdEtaCorrectionSD->GetTrack2ParticleCorrection()->Reset();

  TList collection;
  collection.Add(correctionStandard);
  collection.Add(dNdEtaCorrectionND);
  collection.Add(dNdEtaCorrectionDD);
  collection.Add(dNdEtaCorrectionSD);

  current->Merge(&collection);
  current->Finish();

  // print 0 bin efficiency
  TH1* hist2 = current->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->Get1DCorrection("y", -10, 10);
  if (hist2->GetBinContent(1) > 0)
  {
    Float_t triggerEff = 100.0 / hist2->GetBinContent(1);
    Printf("trigger eff in 0 bin is: %.2f %%", triggerEff);
  }
  
  TFile* fout = new TFile(outputFileName,"RECREATE");
  current->SaveHistograms();

  fout->Write();
  fout->Close();

  Printf("Trigger efficiencies:");
  Printf("ND: %.2f %%", 100.0 * dNdEtaCorrectionND->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral() / dNdEtaCorrectionND->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral());
  Printf("SD: %.2f %%", 100.0 * dNdEtaCorrectionSD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral() / dNdEtaCorrectionSD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral());
  Printf("DD: %.2f %%", 100.0 * dNdEtaCorrectionDD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral() / dNdEtaCorrectionDD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral());
  Printf("INEL: %.2f %%", 100.0 * current->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral() / current->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral());
  Printf("NSD: %.2f %%", 100.0 * (dNdEtaCorrectionND->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral() + dNdEtaCorrectionDD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetMeasuredHistogram()->Integral()) / (dNdEtaCorrectionND->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral() + dNdEtaCorrectionDD->GetTriggerBiasCorrectionINEL()->GetEventCorrection()->GetGeneratedHistogram()->Integral()));
}

DrawTriggerEfficiency(Char_t* fileName) {

  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(0);
  gStyle->SetOptFit(0);

  gStyle->SetTextSize(0.04);
  gStyle->SetTitleSize(0.05,"xyz");
  //gStyle->SetTitleFont(133, "xyz");
  //gStyle->SetLabelFont(133, "xyz");
  //gStyle->SetLabelSize(17, "xyz");
  gStyle->SetLabelOffset(0.01, "xyz");

  gStyle->SetTitleOffset(1.1, "y");
  gStyle->SetTitleOffset(1.1, "x");
  gStyle->SetEndErrorSize(0.0);

  //##############################################

  //making canvas and pads
  TCanvas *c = new TCanvas("trigger_eff", "",600,500);

  TPad* p1 = new TPad("pad1","", 0, 0.0, 1.0, 1.0, 0, 0, 0);

  p1->SetBottomMargin(0.15);
  p1->SetTopMargin(0.03);
  p1->SetLeftMargin(0.15);
  p1->SetRightMargin(0.03);
  
  p1->SetGridx();
  p1->SetGridy();

  p1->Draw();
  p1->cd();

  gSystem->Load("libPWG0base");

  AlidNdEtaCorrection* corrections[4];
  AliCorrectionMatrix2D* triggerBiasCorrection[4];

  TH1F* hTriggerEffInv[4];
  TH1F* hTriggerEff[4];

  Char_t* names[] = {"triggerBiasND", "triggerBiasDD", "triggerBiasSD", "triggerBiasINEL"};
  
  for (Int_t i=0; i<4; i++) {
    corrections[i] = new AlidNdEtaCorrection(names[i], names[i]);
    corrections[i]->LoadHistograms(fileName, names[i]);    

    triggerBiasCorrection[i] = corrections[i]->GetTriggerBiasCorrectionINEL();

    
    hTriggerEffInv[i] = triggerBiasCorrection[i]->Get1DCorrection();
    hTriggerEff[i]    = (TH1F*)hTriggerEffInv[i]->Clone();
    
    for (Int_t b=0; b<=hTriggerEff[i]->GetNbinsX(); b++) {
      hTriggerEff[i]->SetBinContent(b,1);
      hTriggerEff[i]->SetBinError(b,0);
    }
    hTriggerEff[i]->Divide(hTriggerEff[i],hTriggerEffInv[i]);
    hTriggerEff[i]->Scale(100);
  }

  Int_t colors[] = {2,3,4,1};
  Float_t effs[4];
  for (Int_t i=0; i<4; i++) {
    hTriggerEff[i]->Fit("pol0","","",-20,20);
    effs[i] = ((TF1*)hTriggerEff[i]->GetListOfFunctions()->At(0))->GetParameter(0);
    ((TF1*)hTriggerEff[i]->GetListOfFunctions()->At(0))->SetLineWidth(1);
    ((TF1*)hTriggerEff[i]->GetListOfFunctions()->At(0))->SetLineStyle(2);
    ((TF1*)hTriggerEff[i]->GetListOfFunctions()->At(0))->SetLineColor(colors[i]);
    cout << effs[i] << endl;
  }


  Char_t* text[] = {"ND", "DD", "SD", "INEL"};
  TLatex* latex[4];

  TH2F* null = new TH2F("","",100,-25,35,100,0,110);
  null->SetXTitle("Vertex z [cm]");
  null->GetXaxis()->CenterTitle(kTRUE);
  null->SetYTitle("Trigger efficiency [%]");
  null->GetYaxis()->CenterTitle(kTRUE);
  null->Draw();


  for (Int_t i=0; i<4; i++) {
    hTriggerEff[i]->SetLineWidth(2);
    hTriggerEff[i]->SetLineColor(colors[i]);

    hTriggerEff[i]->Draw("same");

    latex[i] = new TLatex(22,effs[i]-1.5, Form("%s (%0.1f)",text[i],effs[i]));
    latex[i]->SetTextColor(colors[i]);
    latex[i]->Draw();
  }
  
}


DrawSpectraPID(Char_t* fileName) {

  gSystem->Load("libPWG0base");

  Char_t* names[] = {"correction_0", "correction_1", "correction_2", "correction_3"};
  AlidNdEtaCorrection* corrections[4];
  AliCorrectionMatrix3D* trackToPartCorrection[4];

  TH1F* measuredPt[4];
  TH1F* generatedPt[4];
  TH1F* ratioPt[4];

  for (Int_t i=0; i<4; i++) {
    corrections[i] = new AlidNdEtaCorrection(names[i], names[i]);
    corrections[i]->LoadHistograms(fileName, names[i]);    

    trackToPartCorrection[i] = corrections[i]->GetTrack2ParticleCorrection();

    Int_t binX1 = (TH1F*)trackToPartCorrection[i]->GetMeasuredHistogram()->GetXaxis()->FindBin(-10);
    Int_t binX2 = (TH1F*)trackToPartCorrection[i]->GetMeasuredHistogram()->GetXaxis()->FindBin(10);
    Int_t binY1 = (TH1F*)trackToPartCorrection[i]->GetMeasuredHistogram()->GetYaxis()->FindBin(-1);
    Int_t binY2 = (TH1F*)trackToPartCorrection[i]->GetMeasuredHistogram()->GetYaxis()->FindBin(1);

    measuredPt[i]  = (TH1F*)trackToPartCorrection[i]->GetMeasuredHistogram()->ProjectionZ(Form("m_%d",i),binX1,binX2,binY1,binY2);
    generatedPt[i] = (TH1F*)trackToPartCorrection[i]->GetGeneratedHistogram()->ProjectionZ(Form("g_%d",i),binX1,binX2,binY1,binY2);
    ratioPt[i] = (TH1F*)generatedPt[i]->Clone(Form("r_%d",i));
    ratioPt[i]->Divide(measuredPt[i], generatedPt[i], 1,1,"B");
  }
  
  ratioPt[0]->Draw();
  
  for (Int_t i=0; i<3; i++) {
    ratioPt[i]->SetLineColor(i+1);
    ratioPt[i]->SetLineWidth(2);
    
    ratioPt[i]->Draw("same");
    
  }

  return;
  measuredPt[0]->SetLineColor(2);
  measuredPt[0]->SetLineWidth(5);

  measuredPt[0]->Draw();
  generatedPt[0]->Draw("same");
}

void changePtSpectrum(const char* fileName = "analysis_mc.root", Float_t ptCutOff = 0.2, const char* fileName2 = 0)
{
  Float_t factor = 0.5;

  TFile* file = TFile::Open(fileName);
  TH1F* hist = dynamic_cast<TH1F*> (file->Get("dndeta_check_pt")->Clone());
  
  TH1* hist2 = 0;
  if (fileName2)
  {
    file2 = TFile::Open(fileName2);
    hist2 = dynamic_cast<TH1*> (file2->Get("dndeta_check_pt")->Clone());
    hist2->Scale(hist->GetBinContent(hist->FindBin(ptCutOff)) / hist2->GetBinContent(hist2->FindBin(ptCutOff)));
  }
  
  //hist->Scale(1.0 / hist->Integral());

  //hist->Rebin(3);
  //hist->Scale(1.0/3);

  TH1F* clone1 = dynamic_cast<TH1F*> (hist->Clone("clone1"));
  TH1F* clone2 = dynamic_cast<TH1F*> (hist->Clone("clone2"));

  TH1F* scale1 =  dynamic_cast<TH1F*> (hist->Clone("scale1"));
  TH1F* scale2 =  dynamic_cast<TH1F*> (hist->Clone("scale2"));

  for (Int_t i=1; i <= hist->GetNbinsX(); ++i)
  {
    if (hist->GetBinCenter(i) > ptCutOff)
    {
      scale1->SetBinContent(i, 1);
      scale2->SetBinContent(i, 1);
    }
    else
    {
      // 90 % at pt = 0, 0% at pt = ptcutoff
      scale1->SetBinContent(i, 1 - (ptCutOff - hist->GetBinCenter(i)) / ptCutOff * factor);

      // 110% at pt = 0, ...
      scale2->SetBinContent(i, 1 + (ptCutOff - hist->GetBinCenter(i)) / ptCutOff * factor);
    }
    scale1->SetBinError(i, 0);
    scale2->SetBinError(i, 0);
  }

  /*
  new TCanvas;
  scale1->Draw();
  scale2->SetLineColor(kRed);
  scale2->Draw("SAME");
  */

  clone1->Multiply(scale1);
  clone2->Multiply(scale2);

  Prepare1DPlot(hist);
  Prepare1DPlot(clone1);
  Prepare1DPlot(clone2);

  /*hist->SetMarkerStyle(markers[0]);
  clone1->SetMarkerStyle(markers[0]);
  clone2->SetMarkerStyle(markers[0]);*/

  hist->SetTitle(";p_{T} in GeV/c;dN_{ch}/dp_{T} in c/GeV");
  hist->GetXaxis()->SetRangeUser(0, 0.5);
  hist->GetYaxis()->SetRangeUser(0.01, clone2->GetMaximum() * 1.1);
  hist->GetYaxis()->SetTitleOffset(1);

  TCanvas* canvas = new TCanvas("c", "c", 600, 600);
  gPad->SetGridx();
  gPad->SetGridy();
  gPad->SetTopMargin(0.05);
  gPad->SetRightMargin(0.05);
  gPad->SetBottomMargin(0.12);
  hist->Draw("H");
  clone1->SetLineColor(kRed);
  clone1->Draw("HSAME");
  clone2->SetLineColor(kBlue);
  clone2->Draw("HSAME");
  hist->Draw("HSAME");
  
  if (hist2)
  {
    Prepare1DPlot(hist2);
    hist2->SetLineStyle(2);
    hist2->Draw("HSAME");
  }

  Float_t fraction =  hist->Integral(hist->GetXaxis()->FindBin(ptCutOff), hist->GetNbinsX()) / hist->Integral(1, hist->GetNbinsX());
  Float_t fraction1 = clone1->Integral(clone1->GetXaxis()->FindBin(ptCutOff), clone1->GetNbinsX()) / clone1->Integral(1, clone1->GetNbinsX());
  Float_t fraction2 = clone2->Integral(clone2->GetXaxis()->FindBin(ptCutOff), clone2->GetNbinsX()) / clone2->Integral(1, clone2->GetNbinsX());

  printf("%f %f %f\n", fraction, fraction1, fraction2);
  printf("Rel. %f %f\n", fraction1 / fraction, fraction2 / fraction);

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

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

  AlidNdEtaCorrection* fdNdEtaCorrection[4];

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

  for (Int_t i=0; i<4; ++i)
  {
    TString name;
    name.Form("correction_%d", i);
    fdNdEtaCorrection[i] = new AlidNdEtaCorrection(name, name);
    fdNdEtaCorrection[i]->LoadHistograms("systematics.root", name);
  }

  Double_t geneCount[5];
  Double_t measCount[5];
  geneCount[4] = 0;
  measCount[4] = 0;

  for (Int_t i=0; i<4; ++i)
  {
    TH3F* hist = (TH3F*) fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetGeneratedHistogram();
    geneCount[i] = hist->Integral(hist->GetXaxis()->FindBin(-10), hist->GetXaxis()->FindBin(10),
                                  hist->GetYaxis()->FindBin(-0.8), hist->GetYaxis()->FindBin(0.8),
                                  1, hist->GetZaxis()->FindBin(0.3));

    hist = (TH3F*) fdNdEtaCorrection[i]->GetTrack2ParticleCorrection()->GetMeasuredHistogram();
    measCount[i] = hist->Integral(hist->GetXaxis()->FindBin(-10), hist->GetXaxis()->FindBin(10), hist->GetYaxis()->FindBin(-0.8), hist->GetYaxis()->FindBin(0.8), 1, hist->GetZaxis()->FindBin(0.3));

    geneCount[4] += geneCount[i];
    measCount[4] += measCount[i];

    printf("Particle %s: %d gene, %d meas\n", ((i == 0) ? "pi" : (i == 1) ? "K" : (i == 2) ? "p" : "others"), (Int_t) geneCount[i], (Int_t) measCount[i]);
  }

  printf("Generated ratios are:     %f pi, %f K, %f p, %f others\n", geneCount[0] / geneCount[4], geneCount[1] / geneCount[4], geneCount[2] / geneCount[4], geneCount[3] / geneCount[4]);

  printf("Reconstructed ratios are: %f pi, %f K, %f p, %f others\n", measCount[0] / measCount[4], measCount[1] / measCount[4], measCount[2] / measCount[4], measCount[3] / measCount[4]);
}


mergeCorrectionsMisalignment(Char_t* alignedFile = "correction_map_aligned.root",
					     Char_t* misalignedFile = "correction_map_misaligned.root",
					     Char_t* outputFileName="correction_map_misaligned_single.root")
{
  //
  // from the aligned and misaligned corrections, 3 new corrections are created
  // in these new corrections only one of the corrections (track2particle, vertex, trigger)
  // is taken from the misaligned input to allow study of the effect on the different
  // corrections

  gSystem->Load("libPWG0base");

  const Char_t* typeName[] = { "track2particle", "vertex", "trigger" };

  AlidNdEtaCorrection* corrections[3];
  for (Int_t j=0; j<3; j++) { // j = 0 (track2particle), j = 1 (vertex), j = 2 (trigger)
    AlidNdEtaCorrection* alignedCorrection = new AlidNdEtaCorrection("dndeta_correction","dndeta_correction");
    alignedCorrection->LoadHistograms(alignedFile);

    AlidNdEtaCorrection* misalignedCorrection = new AlidNdEtaCorrection("dndeta_correction","dndeta_correction");
    misalignedCorrection->LoadHistograms(misalignedFile);

    TString name;
    name.Form("dndeta_correction_alignment_%s", typeName[j]);
    AlidNdEtaCorrection* current = new AlidNdEtaCorrection(name, name);

    switch (j)
    {
      case 0:
        alignedCorrection->GetTrack2ParticleCorrection()->Reset();
        misalignedCorrection->GetTriggerBiasCorrectionNSD()->Reset();
        misalignedCorrection->GetTriggerBiasCorrectionND()->Reset();
        misalignedCorrection->GetTriggerBiasCorrectionINEL()->Reset();
        misalignedCorrection->GetVertexRecoCorrection()->Reset();
        break;

      case 1:
        misalignedCorrection->GetTrack2ParticleCorrection()->Reset();
        misalignedCorrection->GetTriggerBiasCorrectionNSD()->Reset();
        misalignedCorrection->GetTriggerBiasCorrectionND()->Reset();
        misalignedCorrection->GetTriggerBiasCorrectionINEL()->Reset();
        alignedCorrection->GetVertexRecoCorrection()->Reset();
        break;

      case 2:
        misalignedCorrection->GetTrack2ParticleCorrection()->Reset();
        alignedCorrection->GetTriggerBiasCorrectionNSD()->Reset();
        alignedCorrection->GetTriggerBiasCorrectionND()->Reset();
        alignedCorrection->GetTriggerBiasCorrectionINEL()->Reset();
        misalignedCorrection->GetVertexRecoCorrection()->Reset();
        break;

      default:
        return;
    }

    TList collection;
    collection.Add(misalignedCorrection);
    collection.Add(alignedCorrection);

    current->Merge(&collection);
    current->Finish();

    corrections[j] = current;
  }

  TFile* fout = new TFile(outputFileName, "RECREATE");

  for (Int_t i=0; i<3; i++)
    corrections[i]->SaveHistograms();

  fout->Write();
  fout->Close();
}


void DrawdNdEtaDifferencesAlignment()
{
  TH1* hists[5];

  TLegend* legend = new TLegend(0.3, 0.73, 0.70, 0.98);
  legend->SetFillColor(0);

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

  canvas->cd(1);

  for (Int_t i=0; i<5; ++i)
  {
    hists[i] = 0;
    TFile* file = 0;
    TString title;

    switch(i)
    {
      case 0 : file = TFile::Open("systematics_misalignment_aligned.root"); title = "aligned"; break;
      case 1 : file = TFile::Open("systematics_misalignment_misaligned.root"); title = "fully misaligned"; break;
      case 2 : file = TFile::Open("systematics_misalignment_track2particle.root"); title = "only track2particle"; break;
      case 3 : file = TFile::Open("systematics_misalignment_vertex.root"); title = "only vertex rec."; break;
      case 4 : file = TFile::Open("systematics_misalignment_trigger.root"); title = "only trigger bias"; break;
      default: return;
    }

    if (file)
    {
      hists[i] = (TH1*) file->Get("dndeta/dndeta_dNdEta_corrected_2");
      hists[i]->SetTitle("");

      Prepare1DPlot(hists[i], kFALSE);
      hists[i]->GetXaxis()->SetRangeUser(-0.7999, 0.7999);
      hists[i]->GetYaxis()->SetRangeUser(6, 7);
      hists[i]->SetLineWidth(1);
      hists[i]->SetLineColor(colors[i]);
      hists[i]->SetMarkerColor(colors[i]);
      hists[i]->SetMarkerStyle(markers[i]);
      hists[i]->GetXaxis()->SetLabelOffset(0.015);
      hists[i]->GetYaxis()->SetTitleOffset(1.5);
      gPad->SetLeftMargin(0.12);
      hists[i]->DrawCopy(((i > 0) ? "SAME" : ""));

      legend->AddEntry(hists[i], title);
      hists[i]->SetTitle(title);
    }
  }
  legend->Draw();

  canvas->cd(2);
  gPad->SetLeftMargin(0.14);

  TLegend* legend2 = new TLegend(0.63, 0.73, 0.98, 0.98);
  legend2->SetFillColor(0);

  for (Int_t i=1; i<5; ++i)
  {
    if (hists[i])
    {
      legend2->AddEntry(hists[i]);

      hists[i]->Divide(hists[0]);
      hists[i]->SetTitle("b)");
      hists[i]->GetYaxis()->SetRangeUser(0.9, 1.1);
      hists[i]->GetYaxis()->SetTitle("Ratio to standard composition");
      hists[i]->GetYaxis()->SetTitleOffset(1.8);
      hists[i]->DrawCopy(((i > 1) ? "SAME" : ""));
    }
  }

  legend2->Draw();

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

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

  AlidNdEtaCorrection* fdNdEtaCorrectionLow[4];
  AlidNdEtaCorrection* fdNdEtaCorrectionHigh[4];

  TFile::Open("systematics-low-multiplicity.root");

  for (Int_t i=0; i<4; ++i)
  {
    TString name;
    name.Form("correction_%d", i);
    fdNdEtaCorrectionLow[i] = new AlidNdEtaCorrection(name, name);
    fdNdEtaCorrectionLow[i]->LoadHistograms("systematics-low-multiplicity.root", name);
  }

  TList list;
  for (Int_t i=1; i<4; ++i)
    list.Add(fdNdEtaCorrectionLow[i]);

  fdNdEtaCorrectionLow[0]->Merge(&list);
  fdNdEtaCorrectionLow[0]->Finish();

  TFile::Open("systematics-high-multiplicity.root");

  for (Int_t i=0; i<4; ++i)
  {
    TString name;
    name.Form("correction_%d", i);
    fdNdEtaCorrectionHigh[i] = new AlidNdEtaCorrection(name, name);
    fdNdEtaCorrectionHigh[i]->LoadHistograms("systematics-high-multiplicity.root", name);
  }

  TList list2;
  for (Int_t i=1; i<4; ++i)
    list2.Add(fdNdEtaCorrectionHigh[i]);

  fdNdEtaCorrectionHigh[0]->Merge(&list2);
  fdNdEtaCorrectionHigh[0]->Finish();

  TH1F* outputLow = new TH1F("Track2ParticleLow", "Track2Particle at low multiplicity", 200, 0, 2);
  TH1F* outputHigh = new TH1F("Track2ParticleHigh", "Track2Particle at high multiplicity", 200, 0, 2);

  TH3F* hist = fdNdEtaCorrectionLow[0]->GetTrack2ParticleCorrection()->GetCorrectionHistogram();
  TH3F* hist2 = fdNdEtaCorrectionHigh[0]->GetTrack2ParticleCorrection()->GetCorrectionHistogram();
  for (Int_t x=hist->GetXaxis()->FindBin(-10); x<=hist->GetXaxis()->FindBin(10); ++x)
    for (Int_t y=hist->GetYaxis()->FindBin(-0.8); y<=hist->GetYaxis()->FindBin(0.8); ++y)
      for (Int_t z=hist->GetZaxis()->FindBin(0.3); z<=hist->GetZaxis()->FindBin(9.9); ++z)
      //for (Int_t z=1; z<=hist->GetNbinsZ(); ++z)
      {
        if (hist->GetBinContent(x, y, z) > 0)
          outputLow->Fill(hist->GetBinContent(x, y, z));
        //if (hist->GetBinContent(x, y, z) == 1)
        //  printf("z = %f, eta = %f, pt = %f: %f %f %f\n", hist->GetXaxis()->GetBinCenter(x), hist->GetYaxis()->GetBinCenter(y), hist->GetZaxis()->GetBinCenter(z), hist->GetBinContent(x, y, z), fdNdEtaCorrectionLow[0]->GetTrack2ParticleCorrection()->GetGeneratedHistogram()->GetBinContent(x, y, z), fdNdEtaCorrectionLow[0]->GetTrack2ParticleCorrection()->GetMeasuredHistogram()->GetBinContent(x, y, z));

        if (hist2->GetBinContent(x, y, z) > 0)
          outputHigh->Fill(hist2->GetBinContent(x, y, z));
      }

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

  canvas->cd(1);
  outputLow->Draw();
  outputLow->Fit("gaus", "0");
  outputLow->GetFunction("gaus")->SetLineColor(2);
  outputLow->GetFunction("gaus")->DrawCopy("SAME");

  canvas->cd(2);
  outputHigh->Draw();
  outputHigh->Fit("gaus", "0");
  outputHigh->GetFunction("gaus")->DrawCopy("SAME");

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

void PlotErrors(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax, const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction")
{
    gSystem->Load("libPWG0base");
	
	AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
    dNdEtaCorrection->LoadHistograms(correctionMapFile, correctionMapFolder);
    
    dNdEtaCorrection->GetTrack2ParticleCorrection()->PlotBinErrors(xmin, xmax, ymin, ymax, zmin, zmax)->Draw();
}


void runStudy(const char* baseCorrectionMapFile = "correction_map.root", const char* baseCorrectionMapFolder = "dndeta_correction", const char* changedCorrectionMapFile = "correction_map.root", const char* changedCorrectionMapFolder = "dndeta_correction", const char* dataFile = "analysis_esd_raw.root", const char* output = "analysis_esd_syst.root")
{
  gSystem->Load("libPWG0base");

  TFile* file = TFile::Open(output, "RECREATE");

  const Int_t max = 5;
  dNdEtaAnalysis* fdNdEtaAnalysis[5];

  new TCanvas;
  TLegend* legend = new TLegend(0.63, 0.73, 0.98, 0.98);
  legend->SetFillColor(0);

  for (Int_t i = 0; i < max; ++i)
  {
    TFile::Open(baseCorrectionMapFile);
    AlidNdEtaCorrection* baseCorrection = new AlidNdEtaCorrection(baseCorrectionMapFolder, baseCorrectionMapFolder);
    baseCorrection->LoadHistograms();

    AlidNdEtaCorrection::CorrectionType correctionType = AlidNdEtaCorrection::kNone;
    const char* name = 0;

    TFile::Open(changedCorrectionMapFile);
    switch (i)
    {
      case 0 :
        name = "default";
        break;

      case 1 :
        baseCorrection->GetTrack2ParticleCorrection()->LoadHistograms(Form("%s/Track2Particle", changedCorrectionMapFolder));
        name = "Track2Particle";
        break;

      case 2 :
        baseCorrection->GetVertexRecoCorrection()->LoadHistograms(Form("%s/VertexReconstruction", changedCorrectionMapFolder));
        name = "VertexReco";
        break;

      case 3 :
        baseCorrection->GetTriggerBiasCorrectionINEL()->LoadHistograms(Form("%s/TriggerBias_MBToINEL", changedCorrectionMapFolder));
        name = "TriggerBias_MBToINEL";
        break;

      case 4 :
        baseCorrection->LoadHistograms(changedCorrectionMapFolder);
        name = "all";
        break;

      default: return;
    }

    TFile::Open(dataFile);
    fdNdEtaAnalysis[i] = new dNdEtaAnalysis(name, name);
    fdNdEtaAnalysis[i]->LoadHistograms("dndeta");

    fdNdEtaAnalysis[i]->Finish(baseCorrection, 0.3, AlidNdEtaCorrection::kINEL);
    file->cd();
    fdNdEtaAnalysis[i]->SaveHistograms();

    TH1* hist = fdNdEtaAnalysis[i]->GetdNdEtaHistogram(0);
    hist->SetLineColor(colors[i]);
    hist->SetMarkerColor(colors[i]);
    hist->SetMarkerStyle(markers[i]+1);
    hist->DrawCopy((i == 0) ? "" : "SAME");
    legend->AddEntry(hist, name);
  }

  legend->Draw();
}

void ChangePtInCorrection(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();

  AliCorrection* corr = dNdEtaCorrection->GetCorrection(AlidNdEtaCorrection::kTrack2Particle);
 
  Printf(">>>> Before");
  corr->PrintInfo(0);

  Float_t factor = 0.5;
  Float_t ptCutOff = 0.2;
  
  TH3* gene = corr->GetTrackCorrection()->GetGeneratedHistogram();
  TH3* meas = corr->GetTrackCorrection()->GetMeasuredHistogram();
  
  for (Int_t z = 1; z <= gene->GetZaxis()->FindBin(ptCutOff - 0.01); z++)
  {
    Float_t localFactor = 1 - (ptCutOff - gene->GetZaxis()->GetBinCenter(z)) / ptCutOff * factor;
    Printf("%f %f", gene->GetZaxis()->GetBinCenter(z), localFactor);
    for (Int_t x = 1; x <= gene->GetNbinsX(); x++)
      for (Int_t y = 1; y <= gene->GetNbinsY(); y++)
      {
        gene->SetBinContent(x, y, z, gene->GetBinContent(x, y, z) * localFactor);
        meas->SetBinContent(x, y, z, meas->GetBinContent(x, y, z) * localFactor);
      }
  }
  
  dNdEtaCorrection->Finish();
  
  Printf(">>>> After");
  corr->PrintInfo(0);
}

Float_t FitAverage(TH1* hist, Int_t n, Float_t* begin, Float_t *end, Int_t color, Int_t& totalBins)
{
  Float_t average = 0;
  totalBins = 0;
  
  for (Int_t i=0; i<n; i++)
  {
    func = new TF1("func", "[0]", hist->GetXaxis()->GetBinLowEdge(hist->GetXaxis()->FindBin(begin[i])), hist->GetXaxis()->GetBinUpEdge(hist->GetXaxis()->FindBin(end[i])));
    Int_t bins = hist->GetXaxis()->FindBin(end[i]) - hist->GetXaxis()->FindBin(begin[i]) + 1;
    func->SetParameter(0, 1);
    func->SetLineColor(color);

    hist->Fit(func, "RNQ");
    func->Draw("SAME");
    
    average += func->GetParameter(0) * bins;
    totalBins += bins;
  }
  
  return average / totalBins;
}

void SPDIntegrateGaps(Bool_t all, const char* mcFile = "../../../LHC10b2/v0or/spd/analysis_esd_raw.root")
{
  Float_t eta = 1.29;
  Int_t binBegin = ((TH2*) gFile->Get("fEtaPhi"))->GetXaxis()->FindBin(-eta);
  Int_t binEnd   = ((TH2*) gFile->Get("fEtaPhi"))->GetXaxis()->FindBin(eta);
  
  Printf("eta range: %f bins: %d %d", eta, binBegin, binEnd);
  
  if (!all)
    Printf("Eta smaller than 0 side");
  
  c = new TCanvas;
  TFile::Open("analysis_esd_raw.root");
  hist = ((TH2*) gFile->Get("fEtaPhi"))->ProjectionY("hist", binBegin, (all) ? binEnd : 40);
  hist->Rebin(2);
  hist->SetStats(0);
  hist->Sumw2();
  hist->Draw("HIST");
  gPad->SetGridx();
  gPad->SetGridy();
  
  TFile::Open(mcFile);  
  mcHist = ((TH2*) gFile->Get("fEtaPhi"))->ProjectionY("mcHist", binBegin, (all) ? binEnd : 40);
  mcHist->Rebin(2);
  mcHist->SetLineColor(2);
  mcHist->Scale(hist->Integral() / mcHist->Integral());
  mcHist->Draw("SAME");
  
  Float_t add = 0;
  Int_t bins;
  
  Float_t okRangeBegin[] = { 0.04, 0.67, 1.34 };
  Float_t okRangeEnd[] =   { 0.55, 1.24, 1.63 };
  Float_t gapRangeBegin[] = { 0.6, 1.27  };
  Float_t gapRangeEnd[] =   { 0.65, 1.32 };
  Float_t averageOK  = FitAverage(hist, 3, okRangeBegin, okRangeEnd, 1, bins);
  Float_t averageGap = FitAverage(hist, 2, gapRangeBegin, gapRangeEnd, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);
  
  Float_t okRangeBegin2[] = { 2.4, 2.65 };
  Float_t okRangeEnd2[] =   { 2.55, 3.2 };
  Float_t gapRangeBegin2[] = { 2.59, 3.3 };
  Float_t gapRangeEnd2[] =   { 2.61, 3.3 };
  averageOK  = FitAverage(hist, 2, okRangeBegin2, okRangeEnd2, 1, bins);
  averageGap = FitAverage(hist, 2, gapRangeBegin2, gapRangeEnd2, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);
  
  Float_t okRangeBegin3[] = { 3.55, 3.9 };
  Float_t okRangeEnd3[] =   { 3.8, 4.15 };
  Float_t gapRangeBegin3[] = { 3.83  };
  Float_t gapRangeEnd3[] =   { 3.86 };
  averageOK  = FitAverage(hist, 2, okRangeBegin3, okRangeEnd3, 1, bins);
  averageGap = FitAverage(hist, 1, gapRangeBegin3, gapRangeEnd3, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);
  
  Float_t okRangeBegin4[] = { 4.2, 4.5 };
  Float_t okRangeEnd4[] =   { 4.4, 4.7 };
  Float_t gapRangeBegin4[] = { 4.45  };
  Float_t gapRangeEnd4[] =   { 4.45 };
  averageOK  = FitAverage(hist, 2, okRangeBegin4, okRangeEnd4, 1, bins);
  averageGap = FitAverage(hist, 1, gapRangeBegin4, gapRangeEnd4, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);
  
  Float_t okRangeBegin5[] = { 5.4, 5.7 };
  Float_t okRangeEnd5[] =   { 5.6, 5.8 };
  Float_t gapRangeBegin5[] = { 5.63  };
  Float_t gapRangeEnd5[] =   { 5.67 };
  averageOK  = FitAverage(hist, 2, okRangeBegin5, okRangeEnd5, 1, bins);
  averageGap = FitAverage(hist, 1, gapRangeBegin5, gapRangeEnd5, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);
  
  Printf("This adds %.2f %% to the total number of tracklets (%f)", 100.0 * add / hist->Integral(), hist->Integral());
  c->SaveAs("gap1.png");
  
  add1 = add;
  total1 = hist->Integral();

  if (all)
    return;

  Printf("\nEta larger than 0 side");
  
  c = new TCanvas;
  TFile::Open("analysis_esd_raw.root");
  hist = ((TH2*) gFile->Get("fEtaPhi"))->ProjectionY("hist2", 41, binEnd);
  hist->Rebin(2);
  hist->SetStats(0);
  hist->Sumw2();
  hist->Draw("HIST");
  gPad->SetGridx();
  gPad->SetGridy();
  
  TFile::Open(mcFile);  
  mcHist = ((TH2*) gFile->Get("fEtaPhi"))->ProjectionY("mcHist", 41, binEnd);
  mcHist->Rebin(2);
  mcHist->SetLineColor(2);
  mcHist->Scale(hist->Integral() / mcHist->Integral());
  mcHist->Draw("SAME");
  
  add = 0;
  
  Float_t okRangeBegin[] = { 0.04, 0.67, 1.34 };
  Float_t okRangeEnd[] =   { 0.55, 1.24, 1.63 };
  Float_t gapRangeBegin[] = { 0.6, 1.27  };
  Float_t gapRangeEnd[] =   { 0.65, 1.32 };
  Float_t averageOK  = FitAverage(hist, 3, okRangeBegin, okRangeEnd, 1, bins);
  Float_t averageGap = FitAverage(hist, 2, gapRangeBegin, gapRangeEnd, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);
  
  Float_t okRangeBegin2[] = { 2.32, 2.65 };
  Float_t okRangeEnd2[] =   { 2.55, 3.2 };
  Float_t gapRangeBegin2[] = { 2.59, 3.3 };
  Float_t gapRangeEnd2[] =   { 2.61, 3.3 };
  averageOK  = FitAverage(hist, 2, okRangeBegin2, okRangeEnd2, 1, bins);
  averageGap = FitAverage(hist, 2, gapRangeBegin2, gapRangeEnd2, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);
  
  Float_t okRangeBegin3[] = { 3.55, 3.9 };
  Float_t okRangeEnd3[] =   { 3.8, 4.15 };
  Float_t gapRangeBegin3[] = { 3.83  };
  Float_t gapRangeEnd3[] =   { 3.86 };
  averageOK  = FitAverage(hist, 2, okRangeBegin3, okRangeEnd3, 1, bins);
  averageGap = FitAverage(hist, 1, gapRangeBegin3, gapRangeEnd3, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);
  
  Float_t okRangeBegin4[] = { 4.2, 4.5 };
  Float_t okRangeEnd4[] =   { 4.4, 4.7 };
  Float_t gapRangeBegin4[] = { 4.45  };
  Float_t gapRangeEnd4[] =   { 4.45 };
  averageOK  = FitAverage(hist, 2, okRangeBegin4, okRangeEnd4, 1, bins);
  averageGap = FitAverage(hist, 1, gapRangeBegin4, gapRangeEnd4, 2, bins);
  add += bins * (averageOK - averageGap);
  Printf("Average OK: %f %f %d: %f", averageOK, averageGap, bins, add);

  Printf("This adds %.2f %% to the total number of tracklets (%f)", 100.0 * add / hist->Integral(), hist->Integral());
  c->SaveAs("gap2.png");
  
  Printf("In total we add %.2f %%.", 100.0 * (add1 + add) / (total1 + hist->Integral()));
}
 drawSystematics.C:1
 drawSystematics.C:2
 drawSystematics.C:3
 drawSystematics.C:4
 drawSystematics.C:5
 drawSystematics.C:6
 drawSystematics.C:7
 drawSystematics.C:8
 drawSystematics.C:9
 drawSystematics.C:10
 drawSystematics.C:11
 drawSystematics.C:12
 drawSystematics.C:13
 drawSystematics.C:14
 drawSystematics.C:15
 drawSystematics.C:16
 drawSystematics.C:17
 drawSystematics.C:18
 drawSystematics.C:19
 drawSystematics.C:20
 drawSystematics.C:21
 drawSystematics.C:22
 drawSystematics.C:23
 drawSystematics.C:24
 drawSystematics.C:25
 drawSystematics.C:26
 drawSystematics.C:27
 drawSystematics.C:28
 drawSystematics.C:29
 drawSystematics.C:30
 drawSystematics.C:31
 drawSystematics.C:32
 drawSystematics.C:33
 drawSystematics.C:34
 drawSystematics.C:35
 drawSystematics.C:36
 drawSystematics.C:37
 drawSystematics.C:38
 drawSystematics.C:39
 drawSystematics.C:40
 drawSystematics.C:41
 drawSystematics.C:42
 drawSystematics.C:43
 drawSystematics.C:44
 drawSystematics.C:45
 drawSystematics.C:46
 drawSystematics.C:47
 drawSystematics.C:48
 drawSystematics.C:49
 drawSystematics.C:50
 drawSystematics.C:51
 drawSystematics.C:52
 drawSystematics.C:53
 drawSystematics.C:54
 drawSystematics.C:55
 drawSystematics.C:56
 drawSystematics.C:57
 drawSystematics.C:58
 drawSystematics.C:59
 drawSystematics.C:60
 drawSystematics.C:61
 drawSystematics.C:62
 drawSystematics.C:63
 drawSystematics.C:64
 drawSystematics.C:65
 drawSystematics.C:66
 drawSystematics.C:67
 drawSystematics.C:68
 drawSystematics.C:69
 drawSystematics.C:70
 drawSystematics.C:71
 drawSystematics.C:72
 drawSystematics.C:73
 drawSystematics.C:74
 drawSystematics.C:75
 drawSystematics.C:76
 drawSystematics.C:77
 drawSystematics.C:78
 drawSystematics.C:79
 drawSystematics.C:80
 drawSystematics.C:81
 drawSystematics.C:82
 drawSystematics.C:83
 drawSystematics.C:84
 drawSystematics.C:85
 drawSystematics.C:86
 drawSystematics.C:87
 drawSystematics.C:88
 drawSystematics.C:89
 drawSystematics.C:90
 drawSystematics.C:91
 drawSystematics.C:92
 drawSystematics.C:93
 drawSystematics.C:94
 drawSystematics.C:95
 drawSystematics.C:96
 drawSystematics.C:97
 drawSystematics.C:98
 drawSystematics.C:99
 drawSystematics.C:100
 drawSystematics.C:101
 drawSystematics.C:102
 drawSystematics.C:103
 drawSystematics.C:104
 drawSystematics.C:105
 drawSystematics.C:106
 drawSystematics.C:107
 drawSystematics.C:108
 drawSystematics.C:109
 drawSystematics.C:110
 drawSystematics.C:111
 drawSystematics.C:112
 drawSystematics.C:113
 drawSystematics.C:114
 drawSystematics.C:115
 drawSystematics.C:116
 drawSystematics.C:117
 drawSystematics.C:118
 drawSystematics.C:119
 drawSystematics.C:120
 drawSystematics.C:121
 drawSystematics.C:122
 drawSystematics.C:123
 drawSystematics.C:124
 drawSystematics.C:125
 drawSystematics.C:126
 drawSystematics.C:127
 drawSystematics.C:128
 drawSystematics.C:129
 drawSystematics.C:130
 drawSystematics.C:131
 drawSystematics.C:132
 drawSystematics.C:133
 drawSystematics.C:134
 drawSystematics.C:135
 drawSystematics.C:136
 drawSystematics.C:137
 drawSystematics.C:138
 drawSystematics.C:139
 drawSystematics.C:140
 drawSystematics.C:141
 drawSystematics.C:142
 drawSystematics.C:143
 drawSystematics.C:144
 drawSystematics.C:145
 drawSystematics.C:146
 drawSystematics.C:147
 drawSystematics.C:148
 drawSystematics.C:149
 drawSystematics.C:150
 drawSystematics.C:151
 drawSystematics.C:152
 drawSystematics.C:153
 drawSystematics.C:154
 drawSystematics.C:155
 drawSystematics.C:156
 drawSystematics.C:157
 drawSystematics.C:158
 drawSystematics.C:159
 drawSystematics.C:160
 drawSystematics.C:161
 drawSystematics.C:162
 drawSystematics.C:163
 drawSystematics.C:164
 drawSystematics.C:165
 drawSystematics.C:166
 drawSystematics.C:167
 drawSystematics.C:168
 drawSystematics.C:169
 drawSystematics.C:170
 drawSystematics.C:171
 drawSystematics.C:172
 drawSystematics.C:173
 drawSystematics.C:174
 drawSystematics.C:175
 drawSystematics.C:176
 drawSystematics.C:177
 drawSystematics.C:178
 drawSystematics.C:179
 drawSystematics.C:180
 drawSystematics.C:181
 drawSystematics.C:182
 drawSystematics.C:183
 drawSystematics.C:184
 drawSystematics.C:185
 drawSystematics.C:186
 drawSystematics.C:187
 drawSystematics.C:188
 drawSystematics.C:189
 drawSystematics.C:190
 drawSystematics.C:191
 drawSystematics.C:192
 drawSystematics.C:193
 drawSystematics.C:194
 drawSystematics.C:195
 drawSystematics.C:196
 drawSystematics.C:197
 drawSystematics.C:198
 drawSystematics.C:199
 drawSystematics.C:200
 drawSystematics.C:201
 drawSystematics.C:202
 drawSystematics.C:203
 drawSystematics.C:204
 drawSystematics.C:205
 drawSystematics.C:206
 drawSystematics.C:207
 drawSystematics.C:208
 drawSystematics.C:209
 drawSystematics.C:210
 drawSystematics.C:211
 drawSystematics.C:212
 drawSystematics.C:213
 drawSystematics.C:214
 drawSystematics.C:215
 drawSystematics.C:216
 drawSystematics.C:217
 drawSystematics.C:218
 drawSystematics.C:219
 drawSystematics.C:220
 drawSystematics.C:221
 drawSystematics.C:222
 drawSystematics.C:223
 drawSystematics.C:224
 drawSystematics.C:225
 drawSystematics.C:226
 drawSystematics.C:227
 drawSystematics.C:228
 drawSystematics.C:229
 drawSystematics.C:230
 drawSystematics.C:231
 drawSystematics.C:232
 drawSystematics.C:233
 drawSystematics.C:234
 drawSystematics.C:235
 drawSystematics.C:236
 drawSystematics.C:237
 drawSystematics.C:238
 drawSystematics.C:239
 drawSystematics.C:240
 drawSystematics.C:241
 drawSystematics.C:242
 drawSystematics.C:243
 drawSystematics.C:244
 drawSystematics.C:245
 drawSystematics.C:246
 drawSystematics.C:247
 drawSystematics.C:248
 drawSystematics.C:249
 drawSystematics.C:250
 drawSystematics.C:251
 drawSystematics.C:252
 drawSystematics.C:253
 drawSystematics.C:254
 drawSystematics.C:255
 drawSystematics.C:256
 drawSystematics.C:257
 drawSystematics.C:258
 drawSystematics.C:259
 drawSystematics.C:260
 drawSystematics.C:261
 drawSystematics.C:262
 drawSystematics.C:263
 drawSystematics.C:264
 drawSystematics.C:265
 drawSystematics.C:266
 drawSystematics.C:267
 drawSystematics.C:268
 drawSystematics.C:269
 drawSystematics.C:270
 drawSystematics.C:271
 drawSystematics.C:272
 drawSystematics.C:273
 drawSystematics.C:274
 drawSystematics.C:275
 drawSystematics.C:276
 drawSystematics.C:277
 drawSystematics.C:278
 drawSystematics.C:279
 drawSystematics.C:280
 drawSystematics.C:281
 drawSystematics.C:282
 drawSystematics.C:283
 drawSystematics.C:284
 drawSystematics.C:285
 drawSystematics.C:286
 drawSystematics.C:287
 drawSystematics.C:288
 drawSystematics.C:289
 drawSystematics.C:290
 drawSystematics.C:291
 drawSystematics.C:292
 drawSystematics.C:293
 drawSystematics.C:294
 drawSystematics.C:295
 drawSystematics.C:296
 drawSystematics.C:297
 drawSystematics.C:298
 drawSystematics.C:299
 drawSystematics.C:300
 drawSystematics.C:301
 drawSystematics.C:302
 drawSystematics.C:303
 drawSystematics.C:304
 drawSystematics.C:305
 drawSystematics.C:306
 drawSystematics.C:307
 drawSystematics.C:308
 drawSystematics.C:309
 drawSystematics.C:310
 drawSystematics.C:311
 drawSystematics.C:312
 drawSystematics.C:313
 drawSystematics.C:314
 drawSystematics.C:315
 drawSystematics.C:316
 drawSystematics.C:317
 drawSystematics.C:318
 drawSystematics.C:319
 drawSystematics.C:320
 drawSystematics.C:321
 drawSystematics.C:322
 drawSystematics.C:323
 drawSystematics.C:324
 drawSystematics.C:325
 drawSystematics.C:326
 drawSystematics.C:327
 drawSystematics.C:328
 drawSystematics.C:329
 drawSystematics.C:330
 drawSystematics.C:331
 drawSystematics.C:332
 drawSystematics.C:333
 drawSystematics.C:334
 drawSystematics.C:335
 drawSystematics.C:336
 drawSystematics.C:337
 drawSystematics.C:338
 drawSystematics.C:339
 drawSystematics.C:340
 drawSystematics.C:341
 drawSystematics.C:342
 drawSystematics.C:343
 drawSystematics.C:344
 drawSystematics.C:345
 drawSystematics.C:346
 drawSystematics.C:347
 drawSystematics.C:348
 drawSystematics.C:349
 drawSystematics.C:350
 drawSystematics.C:351
 drawSystematics.C:352
 drawSystematics.C:353
 drawSystematics.C:354
 drawSystematics.C:355
 drawSystematics.C:356
 drawSystematics.C:357
 drawSystematics.C:358
 drawSystematics.C:359
 drawSystematics.C:360
 drawSystematics.C:361
 drawSystematics.C:362
 drawSystematics.C:363
 drawSystematics.C:364
 drawSystematics.C:365
 drawSystematics.C:366
 drawSystematics.C:367
 drawSystematics.C:368
 drawSystematics.C:369
 drawSystematics.C:370
 drawSystematics.C:371
 drawSystematics.C:372
 drawSystematics.C:373
 drawSystematics.C:374
 drawSystematics.C:375
 drawSystematics.C:376
 drawSystematics.C:377
 drawSystematics.C:378
 drawSystematics.C:379
 drawSystematics.C:380
 drawSystematics.C:381
 drawSystematics.C:382
 drawSystematics.C:383
 drawSystematics.C:384
 drawSystematics.C:385
 drawSystematics.C:386
 drawSystematics.C:387
 drawSystematics.C:388
 drawSystematics.C:389
 drawSystematics.C:390
 drawSystematics.C:391
 drawSystematics.C:392
 drawSystematics.C:393
 drawSystematics.C:394
 drawSystematics.C:395
 drawSystematics.C:396
 drawSystematics.C:397
 drawSystematics.C:398
 drawSystematics.C:399
 drawSystematics.C:400
 drawSystematics.C:401
 drawSystematics.C:402
 drawSystematics.C:403
 drawSystematics.C:404
 drawSystematics.C:405
 drawSystematics.C:406
 drawSystematics.C:407
 drawSystematics.C:408
 drawSystematics.C:409
 drawSystematics.C:410
 drawSystematics.C:411
 drawSystematics.C:412
 drawSystematics.C:413
 drawSystematics.C:414
 drawSystematics.C:415
 drawSystematics.C:416
 drawSystematics.C:417
 drawSystematics.C:418
 drawSystematics.C:419
 drawSystematics.C:420
 drawSystematics.C:421
 drawSystematics.C:422
 drawSystematics.C:423
 drawSystematics.C:424
 drawSystematics.C:425
 drawSystematics.C:426
 drawSystematics.C:427
 drawSystematics.C:428
 drawSystematics.C:429
 drawSystematics.C:430
 drawSystematics.C:431
 drawSystematics.C:432
 drawSystematics.C:433
 drawSystematics.C:434
 drawSystematics.C:435
 drawSystematics.C:436
 drawSystematics.C:437
 drawSystematics.C:438
 drawSystematics.C:439
 drawSystematics.C:440
 drawSystematics.C:441
 drawSystematics.C:442
 drawSystematics.C:443
 drawSystematics.C:444
 drawSystematics.C:445
 drawSystematics.C:446
 drawSystematics.C:447
 drawSystematics.C:448
 drawSystematics.C:449
 drawSystematics.C:450
 drawSystematics.C:451
 drawSystematics.C:452
 drawSystematics.C:453
 drawSystematics.C:454
 drawSystematics.C:455
 drawSystematics.C:456
 drawSystematics.C:457
 drawSystematics.C:458
 drawSystematics.C:459
 drawSystematics.C:460
 drawSystematics.C:461
 drawSystematics.C:462
 drawSystematics.C:463
 drawSystematics.C:464
 drawSystematics.C:465
 drawSystematics.C:466
 drawSystematics.C:467
 drawSystematics.C:468
 drawSystematics.C:469
 drawSystematics.C:470
 drawSystematics.C:471
 drawSystematics.C:472
 drawSystematics.C:473
 drawSystematics.C:474
 drawSystematics.C:475
 drawSystematics.C:476
 drawSystematics.C:477
 drawSystematics.C:478
 drawSystematics.C:479
 drawSystematics.C:480
 drawSystematics.C:481
 drawSystematics.C:482
 drawSystematics.C:483
 drawSystematics.C:484
 drawSystematics.C:485
 drawSystematics.C:486
 drawSystematics.C:487
 drawSystematics.C:488
 drawSystematics.C:489
 drawSystematics.C:490
 drawSystematics.C:491
 drawSystematics.C:492
 drawSystematics.C:493
 drawSystematics.C:494
 drawSystematics.C:495
 drawSystematics.C:496
 drawSystematics.C:497
 drawSystematics.C:498
 drawSystematics.C:499
 drawSystematics.C:500
 drawSystematics.C:501
 drawSystematics.C:502
 drawSystematics.C:503
 drawSystematics.C:504
 drawSystematics.C:505
 drawSystematics.C:506
 drawSystematics.C:507
 drawSystematics.C:508
 drawSystematics.C:509
 drawSystematics.C:510
 drawSystematics.C:511
 drawSystematics.C:512
 drawSystematics.C:513
 drawSystematics.C:514
 drawSystematics.C:515
 drawSystematics.C:516
 drawSystematics.C:517
 drawSystematics.C:518
 drawSystematics.C:519
 drawSystematics.C:520
 drawSystematics.C:521
 drawSystematics.C:522
 drawSystematics.C:523
 drawSystematics.C:524
 drawSystematics.C:525
 drawSystematics.C:526
 drawSystematics.C:527
 drawSystematics.C:528
 drawSystematics.C:529
 drawSystematics.C:530
 drawSystematics.C:531
 drawSystematics.C:532
 drawSystematics.C:533
 drawSystematics.C:534
 drawSystematics.C:535
 drawSystematics.C:536
 drawSystematics.C:537
 drawSystematics.C:538
 drawSystematics.C:539
 drawSystematics.C:540
 drawSystematics.C:541
 drawSystematics.C:542
 drawSystematics.C:543
 drawSystematics.C:544
 drawSystematics.C:545
 drawSystematics.C:546
 drawSystematics.C:547
 drawSystematics.C:548
 drawSystematics.C:549
 drawSystematics.C:550
 drawSystematics.C:551
 drawSystematics.C:552
 drawSystematics.C:553
 drawSystematics.C:554
 drawSystematics.C:555
 drawSystematics.C:556
 drawSystematics.C:557
 drawSystematics.C:558
 drawSystematics.C:559
 drawSystematics.C:560
 drawSystematics.C:561
 drawSystematics.C:562
 drawSystematics.C:563
 drawSystematics.C:564
 drawSystematics.C:565
 drawSystematics.C:566
 drawSystematics.C:567
 drawSystematics.C:568
 drawSystematics.C:569
 drawSystematics.C:570
 drawSystematics.C:571
 drawSystematics.C:572
 drawSystematics.C:573
 drawSystematics.C:574
 drawSystematics.C:575
 drawSystematics.C:576
 drawSystematics.C:577
 drawSystematics.C:578
 drawSystematics.C:579
 drawSystematics.C:580
 drawSystematics.C:581
 drawSystematics.C:582
 drawSystematics.C:583
 drawSystematics.C:584
 drawSystematics.C:585
 drawSystematics.C:586
 drawSystematics.C:587
 drawSystematics.C:588
 drawSystematics.C:589
 drawSystematics.C:590
 drawSystematics.C:591
 drawSystematics.C:592
 drawSystematics.C:593
 drawSystematics.C:594
 drawSystematics.C:595
 drawSystematics.C:596
 drawSystematics.C:597
 drawSystematics.C:598
 drawSystematics.C:599
 drawSystematics.C:600
 drawSystematics.C:601
 drawSystematics.C:602
 drawSystematics.C:603
 drawSystematics.C:604
 drawSystematics.C:605
 drawSystematics.C:606
 drawSystematics.C:607
 drawSystematics.C:608
 drawSystematics.C:609
 drawSystematics.C:610
 drawSystematics.C:611
 drawSystematics.C:612
 drawSystematics.C:613
 drawSystematics.C:614
 drawSystematics.C:615
 drawSystematics.C:616
 drawSystematics.C:617
 drawSystematics.C:618
 drawSystematics.C:619
 drawSystematics.C:620
 drawSystematics.C:621
 drawSystematics.C:622
 drawSystematics.C:623
 drawSystematics.C:624
 drawSystematics.C:625
 drawSystematics.C:626
 drawSystematics.C:627
 drawSystematics.C:628
 drawSystematics.C:629
 drawSystematics.C:630
 drawSystematics.C:631
 drawSystematics.C:632
 drawSystematics.C:633
 drawSystematics.C:634
 drawSystematics.C:635
 drawSystematics.C:636
 drawSystematics.C:637
 drawSystematics.C:638
 drawSystematics.C:639
 drawSystematics.C:640
 drawSystematics.C:641
 drawSystematics.C:642
 drawSystematics.C:643
 drawSystematics.C:644
 drawSystematics.C:645
 drawSystematics.C:646
 drawSystematics.C:647
 drawSystematics.C:648
 drawSystematics.C:649
 drawSystematics.C:650
 drawSystematics.C:651
 drawSystematics.C:652
 drawSystematics.C:653
 drawSystematics.C:654
 drawSystematics.C:655
 drawSystematics.C:656
 drawSystematics.C:657
 drawSystematics.C:658
 drawSystematics.C:659
 drawSystematics.C:660
 drawSystematics.C:661
 drawSystematics.C:662
 drawSystematics.C:663
 drawSystematics.C:664
 drawSystematics.C:665
 drawSystematics.C:666
 drawSystematics.C:667
 drawSystematics.C:668
 drawSystematics.C:669
 drawSystematics.C:670
 drawSystematics.C:671
 drawSystematics.C:672
 drawSystematics.C:673
 drawSystematics.C:674
 drawSystematics.C:675
 drawSystematics.C:676
 drawSystematics.C:677
 drawSystematics.C:678
 drawSystematics.C:679
 drawSystematics.C:680
 drawSystematics.C:681
 drawSystematics.C:682
 drawSystematics.C:683
 drawSystematics.C:684
 drawSystematics.C:685
 drawSystematics.C:686
 drawSystematics.C:687
 drawSystematics.C:688
 drawSystematics.C:689
 drawSystematics.C:690
 drawSystematics.C:691
 drawSystematics.C:692
 drawSystematics.C:693
 drawSystematics.C:694
 drawSystematics.C:695
 drawSystematics.C:696
 drawSystematics.C:697
 drawSystematics.C:698
 drawSystematics.C:699
 drawSystematics.C:700
 drawSystematics.C:701
 drawSystematics.C:702
 drawSystematics.C:703
 drawSystematics.C:704
 drawSystematics.C:705
 drawSystematics.C:706
 drawSystematics.C:707
 drawSystematics.C:708
 drawSystematics.C:709
 drawSystematics.C:710
 drawSystematics.C:711
 drawSystematics.C:712
 drawSystematics.C:713
 drawSystematics.C:714
 drawSystematics.C:715
 drawSystematics.C:716
 drawSystematics.C:717
 drawSystematics.C:718
 drawSystematics.C:719
 drawSystematics.C:720
 drawSystematics.C:721
 drawSystematics.C:722
 drawSystematics.C:723
 drawSystematics.C:724
 drawSystematics.C:725
 drawSystematics.C:726
 drawSystematics.C:727
 drawSystematics.C:728
 drawSystematics.C:729
 drawSystematics.C:730
 drawSystematics.C:731
 drawSystematics.C:732
 drawSystematics.C:733
 drawSystematics.C:734
 drawSystematics.C:735
 drawSystematics.C:736
 drawSystematics.C:737
 drawSystematics.C:738
 drawSystematics.C:739
 drawSystematics.C:740
 drawSystematics.C:741
 drawSystematics.C:742
 drawSystematics.C:743
 drawSystematics.C:744
 drawSystematics.C:745
 drawSystematics.C:746
 drawSystematics.C:747
 drawSystematics.C:748
 drawSystematics.C:749
 drawSystematics.C:750
 drawSystematics.C:751
 drawSystematics.C:752
 drawSystematics.C:753
 drawSystematics.C:754
 drawSystematics.C:755
 drawSystematics.C:756
 drawSystematics.C:757
 drawSystematics.C:758
 drawSystematics.C:759
 drawSystematics.C:760
 drawSystematics.C:761
 drawSystematics.C:762
 drawSystematics.C:763
 drawSystematics.C:764
 drawSystematics.C:765
 drawSystematics.C:766
 drawSystematics.C:767
 drawSystematics.C:768
 drawSystematics.C:769
 drawSystematics.C:770
 drawSystematics.C:771
 drawSystematics.C:772
 drawSystematics.C:773
 drawSystematics.C:774
 drawSystematics.C:775
 drawSystematics.C:776
 drawSystematics.C:777
 drawSystematics.C:778
 drawSystematics.C:779
 drawSystematics.C:780
 drawSystematics.C:781
 drawSystematics.C:782
 drawSystematics.C:783
 drawSystematics.C:784
 drawSystematics.C:785
 drawSystematics.C:786
 drawSystematics.C:787
 drawSystematics.C:788
 drawSystematics.C:789
 drawSystematics.C:790
 drawSystematics.C:791
 drawSystematics.C:792
 drawSystematics.C:793
 drawSystematics.C:794
 drawSystematics.C:795
 drawSystematics.C:796
 drawSystematics.C:797
 drawSystematics.C:798
 drawSystematics.C:799
 drawSystematics.C:800
 drawSystematics.C:801
 drawSystematics.C:802
 drawSystematics.C:803
 drawSystematics.C:804
 drawSystematics.C:805
 drawSystematics.C:806
 drawSystematics.C:807
 drawSystematics.C:808
 drawSystematics.C:809
 drawSystematics.C:810
 drawSystematics.C:811
 drawSystematics.C:812
 drawSystematics.C:813
 drawSystematics.C:814
 drawSystematics.C:815
 drawSystematics.C:816
 drawSystematics.C:817
 drawSystematics.C:818
 drawSystematics.C:819
 drawSystematics.C:820
 drawSystematics.C:821
 drawSystematics.C:822
 drawSystematics.C:823
 drawSystematics.C:824
 drawSystematics.C:825
 drawSystematics.C:826
 drawSystematics.C:827
 drawSystematics.C:828
 drawSystematics.C:829
 drawSystematics.C:830
 drawSystematics.C:831
 drawSystematics.C:832
 drawSystematics.C:833
 drawSystematics.C:834
 drawSystematics.C:835
 drawSystematics.C:836
 drawSystematics.C:837
 drawSystematics.C:838
 drawSystematics.C:839
 drawSystematics.C:840
 drawSystematics.C:841
 drawSystematics.C:842
 drawSystematics.C:843
 drawSystematics.C:844
 drawSystematics.C:845
 drawSystematics.C:846
 drawSystematics.C:847
 drawSystematics.C:848
 drawSystematics.C:849
 drawSystematics.C:850
 drawSystematics.C:851
 drawSystematics.C:852
 drawSystematics.C:853
 drawSystematics.C:854
 drawSystematics.C:855
 drawSystematics.C:856
 drawSystematics.C:857
 drawSystematics.C:858
 drawSystematics.C:859
 drawSystematics.C:860
 drawSystematics.C:861
 drawSystematics.C:862
 drawSystematics.C:863
 drawSystematics.C:864
 drawSystematics.C:865
 drawSystematics.C:866
 drawSystematics.C:867
 drawSystematics.C:868
 drawSystematics.C:869
 drawSystematics.C:870
 drawSystematics.C:871
 drawSystematics.C:872
 drawSystematics.C:873
 drawSystematics.C:874
 drawSystematics.C:875
 drawSystematics.C:876
 drawSystematics.C:877
 drawSystematics.C:878
 drawSystematics.C:879
 drawSystematics.C:880
 drawSystematics.C:881
 drawSystematics.C:882
 drawSystematics.C:883
 drawSystematics.C:884
 drawSystematics.C:885
 drawSystematics.C:886
 drawSystematics.C:887
 drawSystematics.C:888
 drawSystematics.C:889
 drawSystematics.C:890
 drawSystematics.C:891
 drawSystematics.C:892
 drawSystematics.C:893
 drawSystematics.C:894
 drawSystematics.C:895
 drawSystematics.C:896
 drawSystematics.C:897
 drawSystematics.C:898
 drawSystematics.C:899
 drawSystematics.C:900
 drawSystematics.C:901
 drawSystematics.C:902
 drawSystematics.C:903
 drawSystematics.C:904
 drawSystematics.C:905
 drawSystematics.C:906
 drawSystematics.C:907
 drawSystematics.C:908
 drawSystematics.C:909
 drawSystematics.C:910
 drawSystematics.C:911
 drawSystematics.C:912
 drawSystematics.C:913
 drawSystematics.C:914
 drawSystematics.C:915
 drawSystematics.C:916
 drawSystematics.C:917
 drawSystematics.C:918
 drawSystematics.C:919
 drawSystematics.C:920
 drawSystematics.C:921
 drawSystematics.C:922
 drawSystematics.C:923
 drawSystematics.C:924
 drawSystematics.C:925
 drawSystematics.C:926
 drawSystematics.C:927
 drawSystematics.C:928
 drawSystematics.C:929
 drawSystematics.C:930
 drawSystematics.C:931
 drawSystematics.C:932
 drawSystematics.C:933
 drawSystematics.C:934
 drawSystematics.C:935
 drawSystematics.C:936
 drawSystematics.C:937
 drawSystematics.C:938
 drawSystematics.C:939
 drawSystematics.C:940
 drawSystematics.C:941
 drawSystematics.C:942
 drawSystematics.C:943
 drawSystematics.C:944
 drawSystematics.C:945
 drawSystematics.C:946
 drawSystematics.C:947
 drawSystematics.C:948
 drawSystematics.C:949
 drawSystematics.C:950
 drawSystematics.C:951
 drawSystematics.C:952
 drawSystematics.C:953
 drawSystematics.C:954
 drawSystematics.C:955
 drawSystematics.C:956
 drawSystematics.C:957
 drawSystematics.C:958
 drawSystematics.C:959
 drawSystematics.C:960
 drawSystematics.C:961
 drawSystematics.C:962
 drawSystematics.C:963
 drawSystematics.C:964
 drawSystematics.C:965
 drawSystematics.C:966
 drawSystematics.C:967
 drawSystematics.C:968
 drawSystematics.C:969
 drawSystematics.C:970
 drawSystematics.C:971
 drawSystematics.C:972
 drawSystematics.C:973
 drawSystematics.C:974
 drawSystematics.C:975
 drawSystematics.C:976
 drawSystematics.C:977
 drawSystematics.C:978
 drawSystematics.C:979
 drawSystematics.C:980
 drawSystematics.C:981
 drawSystematics.C:982
 drawSystematics.C:983
 drawSystematics.C:984
 drawSystematics.C:985
 drawSystematics.C:986
 drawSystematics.C:987
 drawSystematics.C:988
 drawSystematics.C:989
 drawSystematics.C:990
 drawSystematics.C:991
 drawSystematics.C:992
 drawSystematics.C:993
 drawSystematics.C:994
 drawSystematics.C:995
 drawSystematics.C:996
 drawSystematics.C:997
 drawSystematics.C:998
 drawSystematics.C:999
 drawSystematics.C:1000
 drawSystematics.C:1001
 drawSystematics.C:1002
 drawSystematics.C:1003
 drawSystematics.C:1004
 drawSystematics.C:1005
 drawSystematics.C:1006
 drawSystematics.C:1007
 drawSystematics.C:1008
 drawSystematics.C:1009
 drawSystematics.C:1010
 drawSystematics.C:1011
 drawSystematics.C:1012
 drawSystematics.C:1013
 drawSystematics.C:1014
 drawSystematics.C:1015
 drawSystematics.C:1016
 drawSystematics.C:1017
 drawSystematics.C:1018
 drawSystematics.C:1019
 drawSystematics.C:1020
 drawSystematics.C:1021
 drawSystematics.C:1022
 drawSystematics.C:1023
 drawSystematics.C:1024
 drawSystematics.C:1025
 drawSystematics.C:1026
 drawSystematics.C:1027
 drawSystematics.C:1028
 drawSystematics.C:1029
 drawSystematics.C:1030
 drawSystematics.C:1031
 drawSystematics.C:1032
 drawSystematics.C:1033
 drawSystematics.C:1034
 drawSystematics.C:1035
 drawSystematics.C:1036
 drawSystematics.C:1037
 drawSystematics.C:1038
 drawSystematics.C:1039
 drawSystematics.C:1040
 drawSystematics.C:1041
 drawSystematics.C:1042
 drawSystematics.C:1043
 drawSystematics.C:1044
 drawSystematics.C:1045
 drawSystematics.C:1046
 drawSystematics.C:1047
 drawSystematics.C:1048
 drawSystematics.C:1049
 drawSystematics.C:1050
 drawSystematics.C:1051
 drawSystematics.C:1052
 drawSystematics.C:1053
 drawSystematics.C:1054
 drawSystematics.C:1055
 drawSystematics.C:1056
 drawSystematics.C:1057
 drawSystematics.C:1058
 drawSystematics.C:1059
 drawSystematics.C:1060
 drawSystematics.C:1061
 drawSystematics.C:1062
 drawSystematics.C:1063
 drawSystematics.C:1064
 drawSystematics.C:1065
 drawSystematics.C:1066
 drawSystematics.C:1067
 drawSystematics.C:1068
 drawSystematics.C:1069
 drawSystematics.C:1070
 drawSystematics.C:1071
 drawSystematics.C:1072
 drawSystematics.C:1073
 drawSystematics.C:1074
 drawSystematics.C:1075
 drawSystematics.C:1076
 drawSystematics.C:1077
 drawSystematics.C:1078
 drawSystematics.C:1079
 drawSystematics.C:1080
 drawSystematics.C:1081
 drawSystematics.C:1082
 drawSystematics.C:1083
 drawSystematics.C:1084
 drawSystematics.C:1085
 drawSystematics.C:1086
 drawSystematics.C:1087
 drawSystematics.C:1088
 drawSystematics.C:1089
 drawSystematics.C:1090
 drawSystematics.C:1091
 drawSystematics.C:1092
 drawSystematics.C:1093
 drawSystematics.C:1094
 drawSystematics.C:1095
 drawSystematics.C:1096
 drawSystematics.C:1097
 drawSystematics.C:1098
 drawSystematics.C:1099
 drawSystematics.C:1100
 drawSystematics.C:1101
 drawSystematics.C:1102
 drawSystematics.C:1103
 drawSystematics.C:1104
 drawSystematics.C:1105
 drawSystematics.C:1106
 drawSystematics.C:1107
 drawSystematics.C:1108
 drawSystematics.C:1109
 drawSystematics.C:1110
 drawSystematics.C:1111
 drawSystematics.C:1112
 drawSystematics.C:1113
 drawSystematics.C:1114
 drawSystematics.C:1115
 drawSystematics.C:1116
 drawSystematics.C:1117
 drawSystematics.C:1118
 drawSystematics.C:1119
 drawSystematics.C:1120
 drawSystematics.C:1121
 drawSystematics.C:1122
 drawSystematics.C:1123
 drawSystematics.C:1124
 drawSystematics.C:1125
 drawSystematics.C:1126
 drawSystematics.C:1127
 drawSystematics.C:1128
 drawSystematics.C:1129
 drawSystematics.C:1130
 drawSystematics.C:1131
 drawSystematics.C:1132
 drawSystematics.C:1133
 drawSystematics.C:1134
 drawSystematics.C:1135
 drawSystematics.C:1136
 drawSystematics.C:1137
 drawSystematics.C:1138
 drawSystematics.C:1139
 drawSystematics.C:1140
 drawSystematics.C:1141
 drawSystematics.C:1142
 drawSystematics.C:1143
 drawSystematics.C:1144
 drawSystematics.C:1145
 drawSystematics.C:1146
 drawSystematics.C:1147
 drawSystematics.C:1148
 drawSystematics.C:1149
 drawSystematics.C:1150
 drawSystematics.C:1151
 drawSystematics.C:1152
 drawSystematics.C:1153
 drawSystematics.C:1154
 drawSystematics.C:1155
 drawSystematics.C:1156
 drawSystematics.C:1157
 drawSystematics.C:1158
 drawSystematics.C:1159
 drawSystematics.C:1160
 drawSystematics.C:1161
 drawSystematics.C:1162
 drawSystematics.C:1163
 drawSystematics.C:1164
 drawSystematics.C:1165
 drawSystematics.C:1166
 drawSystematics.C:1167
 drawSystematics.C:1168
 drawSystematics.C:1169
 drawSystematics.C:1170
 drawSystematics.C:1171
 drawSystematics.C:1172
 drawSystematics.C:1173
 drawSystematics.C:1174
 drawSystematics.C:1175
 drawSystematics.C:1176
 drawSystematics.C:1177
 drawSystematics.C:1178
 drawSystematics.C:1179
 drawSystematics.C:1180
 drawSystematics.C:1181
 drawSystematics.C:1182
 drawSystematics.C:1183
 drawSystematics.C:1184
 drawSystematics.C:1185
 drawSystematics.C:1186
 drawSystematics.C:1187
 drawSystematics.C:1188
 drawSystematics.C:1189
 drawSystematics.C:1190
 drawSystematics.C:1191
 drawSystematics.C:1192
 drawSystematics.C:1193
 drawSystematics.C:1194
 drawSystematics.C:1195
 drawSystematics.C:1196
 drawSystematics.C:1197
 drawSystematics.C:1198
 drawSystematics.C:1199
 drawSystematics.C:1200
 drawSystematics.C:1201
 drawSystematics.C:1202
 drawSystematics.C:1203
 drawSystematics.C:1204
 drawSystematics.C:1205
 drawSystematics.C:1206
 drawSystematics.C:1207
 drawSystematics.C:1208
 drawSystematics.C:1209
 drawSystematics.C:1210
 drawSystematics.C:1211
 drawSystematics.C:1212
 drawSystematics.C:1213
 drawSystematics.C:1214
 drawSystematics.C:1215
 drawSystematics.C:1216
 drawSystematics.C:1217
 drawSystematics.C:1218
 drawSystematics.C:1219
 drawSystematics.C:1220
 drawSystematics.C:1221
 drawSystematics.C:1222
 drawSystematics.C:1223
 drawSystematics.C:1224
 drawSystematics.C:1225
 drawSystematics.C:1226
 drawSystematics.C:1227
 drawSystematics.C:1228
 drawSystematics.C:1229
 drawSystematics.C:1230
 drawSystematics.C:1231
 drawSystematics.C:1232
 drawSystematics.C:1233
 drawSystematics.C:1234
 drawSystematics.C:1235
 drawSystematics.C:1236
 drawSystematics.C:1237
 drawSystematics.C:1238
 drawSystematics.C:1239
 drawSystematics.C:1240
 drawSystematics.C:1241
 drawSystematics.C:1242
 drawSystematics.C:1243
 drawSystematics.C:1244
 drawSystematics.C:1245
 drawSystematics.C:1246
 drawSystematics.C:1247
 drawSystematics.C:1248
 drawSystematics.C:1249
 drawSystematics.C:1250
 drawSystematics.C:1251
 drawSystematics.C:1252
 drawSystematics.C:1253
 drawSystematics.C:1254
 drawSystematics.C:1255
 drawSystematics.C:1256
 drawSystematics.C:1257
 drawSystematics.C:1258
 drawSystematics.C:1259
 drawSystematics.C:1260
 drawSystematics.C:1261
 drawSystematics.C:1262
 drawSystematics.C:1263
 drawSystematics.C:1264
 drawSystematics.C:1265
 drawSystematics.C:1266
 drawSystematics.C:1267
 drawSystematics.C:1268
 drawSystematics.C:1269
 drawSystematics.C:1270
 drawSystematics.C:1271
 drawSystematics.C:1272
 drawSystematics.C:1273
 drawSystematics.C:1274
 drawSystematics.C:1275
 drawSystematics.C:1276
 drawSystematics.C:1277
 drawSystematics.C:1278
 drawSystematics.C:1279
 drawSystematics.C:1280
 drawSystematics.C:1281
 drawSystematics.C:1282
 drawSystematics.C:1283
 drawSystematics.C:1284
 drawSystematics.C:1285
 drawSystematics.C:1286
 drawSystematics.C:1287
 drawSystematics.C:1288
 drawSystematics.C:1289
 drawSystematics.C:1290
 drawSystematics.C:1291
 drawSystematics.C:1292
 drawSystematics.C:1293
 drawSystematics.C:1294
 drawSystematics.C:1295
 drawSystematics.C:1296
 drawSystematics.C:1297
 drawSystematics.C:1298
 drawSystematics.C:1299
 drawSystematics.C:1300
 drawSystematics.C:1301
 drawSystematics.C:1302
 drawSystematics.C:1303
 drawSystematics.C:1304
 drawSystematics.C:1305
 drawSystematics.C:1306
 drawSystematics.C:1307
 drawSystematics.C:1308
 drawSystematics.C:1309
 drawSystematics.C:1310
 drawSystematics.C:1311
 drawSystematics.C:1312
 drawSystematics.C:1313
 drawSystematics.C:1314
 drawSystematics.C:1315
 drawSystematics.C:1316
 drawSystematics.C:1317
 drawSystematics.C:1318
 drawSystematics.C:1319
 drawSystematics.C:1320
 drawSystematics.C:1321
 drawSystematics.C:1322
 drawSystematics.C:1323
 drawSystematics.C:1324
 drawSystematics.C:1325
 drawSystematics.C:1326
 drawSystematics.C:1327
 drawSystematics.C:1328
 drawSystematics.C:1329
 drawSystematics.C:1330
 drawSystematics.C:1331
 drawSystematics.C:1332
 drawSystematics.C:1333
 drawSystematics.C:1334
 drawSystematics.C:1335
 drawSystematics.C:1336
 drawSystematics.C:1337
 drawSystematics.C:1338
 drawSystematics.C:1339
 drawSystematics.C:1340
 drawSystematics.C:1341
 drawSystematics.C:1342
 drawSystematics.C:1343
 drawSystematics.C:1344
 drawSystematics.C:1345
 drawSystematics.C:1346
 drawSystematics.C:1347
 drawSystematics.C:1348
 drawSystematics.C:1349
 drawSystematics.C:1350
 drawSystematics.C:1351
 drawSystematics.C:1352
 drawSystematics.C:1353
 drawSystematics.C:1354
 drawSystematics.C:1355
 drawSystematics.C:1356
 drawSystematics.C:1357
 drawSystematics.C:1358
 drawSystematics.C:1359
 drawSystematics.C:1360
 drawSystematics.C:1361
 drawSystematics.C:1362
 drawSystematics.C:1363
 drawSystematics.C:1364
 drawSystematics.C:1365
 drawSystematics.C:1366
 drawSystematics.C:1367
 drawSystematics.C:1368
 drawSystematics.C:1369
 drawSystematics.C:1370
 drawSystematics.C:1371
 drawSystematics.C:1372
 drawSystematics.C:1373
 drawSystematics.C:1374
 drawSystematics.C:1375
 drawSystematics.C:1376
 drawSystematics.C:1377
 drawSystematics.C:1378
 drawSystematics.C:1379
 drawSystematics.C:1380
 drawSystematics.C:1381
 drawSystematics.C:1382
 drawSystematics.C:1383
 drawSystematics.C:1384
 drawSystematics.C:1385
 drawSystematics.C:1386
 drawSystematics.C:1387
 drawSystematics.C:1388
 drawSystematics.C:1389
 drawSystematics.C:1390
 drawSystematics.C:1391
 drawSystematics.C:1392
 drawSystematics.C:1393
 drawSystematics.C:1394
 drawSystematics.C:1395
 drawSystematics.C:1396
 drawSystematics.C:1397
 drawSystematics.C:1398
 drawSystematics.C:1399
 drawSystematics.C:1400
 drawSystematics.C:1401
 drawSystematics.C:1402
 drawSystematics.C:1403
 drawSystematics.C:1404
 drawSystematics.C:1405
 drawSystematics.C:1406
 drawSystematics.C:1407
 drawSystematics.C:1408
 drawSystematics.C:1409
 drawSystematics.C:1410
 drawSystematics.C:1411
 drawSystematics.C:1412
 drawSystematics.C:1413
 drawSystematics.C:1414
 drawSystematics.C:1415
 drawSystematics.C:1416
 drawSystematics.C:1417
 drawSystematics.C:1418
 drawSystematics.C:1419
 drawSystematics.C:1420
 drawSystematics.C:1421
 drawSystematics.C:1422
 drawSystematics.C:1423
 drawSystematics.C:1424
 drawSystematics.C:1425
 drawSystematics.C:1426
 drawSystematics.C:1427
 drawSystematics.C:1428
 drawSystematics.C:1429
 drawSystematics.C:1430
 drawSystematics.C:1431
 drawSystematics.C:1432
 drawSystematics.C:1433
 drawSystematics.C:1434
 drawSystematics.C:1435
 drawSystematics.C:1436
 drawSystematics.C:1437
 drawSystematics.C:1438
 drawSystematics.C:1439
 drawSystematics.C:1440
 drawSystematics.C:1441
 drawSystematics.C:1442
 drawSystematics.C:1443
 drawSystematics.C:1444
 drawSystematics.C:1445
 drawSystematics.C:1446
 drawSystematics.C:1447
 drawSystematics.C:1448
 drawSystematics.C:1449
 drawSystematics.C:1450
 drawSystematics.C:1451
 drawSystematics.C:1452
 drawSystematics.C:1453
 drawSystematics.C:1454
 drawSystematics.C:1455
 drawSystematics.C:1456
 drawSystematics.C:1457
 drawSystematics.C:1458
 drawSystematics.C:1459
 drawSystematics.C:1460
 drawSystematics.C:1461
 drawSystematics.C:1462
 drawSystematics.C:1463
 drawSystematics.C:1464
 drawSystematics.C:1465
 drawSystematics.C:1466
 drawSystematics.C:1467
 drawSystematics.C:1468
 drawSystematics.C:1469
 drawSystematics.C:1470
 drawSystematics.C:1471
 drawSystematics.C:1472
 drawSystematics.C:1473
 drawSystematics.C:1474
 drawSystematics.C:1475
 drawSystematics.C:1476
 drawSystematics.C:1477
 drawSystematics.C:1478
 drawSystematics.C:1479
 drawSystematics.C:1480
 drawSystematics.C:1481
 drawSystematics.C:1482
 drawSystematics.C:1483
 drawSystematics.C:1484
 drawSystematics.C:1485
 drawSystematics.C:1486
 drawSystematics.C:1487
 drawSystematics.C:1488
 drawSystematics.C:1489
 drawSystematics.C:1490
 drawSystematics.C:1491
 drawSystematics.C:1492
 drawSystematics.C:1493
 drawSystematics.C:1494
 drawSystematics.C:1495
 drawSystematics.C:1496
 drawSystematics.C:1497
 drawSystematics.C:1498
 drawSystematics.C:1499
 drawSystematics.C:1500
 drawSystematics.C:1501
 drawSystematics.C:1502
 drawSystematics.C:1503
 drawSystematics.C:1504
 drawSystematics.C:1505
 drawSystematics.C:1506
 drawSystematics.C:1507
 drawSystematics.C:1508
 drawSystematics.C:1509
 drawSystematics.C:1510
 drawSystematics.C:1511
 drawSystematics.C:1512
 drawSystematics.C:1513
 drawSystematics.C:1514
 drawSystematics.C:1515
 drawSystematics.C:1516
 drawSystematics.C:1517
 drawSystematics.C:1518
 drawSystematics.C:1519
 drawSystematics.C:1520
 drawSystematics.C:1521
 drawSystematics.C:1522
 drawSystematics.C:1523
 drawSystematics.C:1524
 drawSystematics.C:1525
 drawSystematics.C:1526
 drawSystematics.C:1527
 drawSystematics.C:1528
 drawSystematics.C:1529
 drawSystematics.C:1530
 drawSystematics.C:1531
 drawSystematics.C:1532
 drawSystematics.C:1533
 drawSystematics.C:1534
 drawSystematics.C:1535
 drawSystematics.C:1536
 drawSystematics.C:1537
 drawSystematics.C:1538
 drawSystematics.C:1539
 drawSystematics.C:1540
 drawSystematics.C:1541
 drawSystematics.C:1542
 drawSystematics.C:1543
 drawSystematics.C:1544
 drawSystematics.C:1545
 drawSystematics.C:1546
 drawSystematics.C:1547
 drawSystematics.C:1548
 drawSystematics.C:1549
 drawSystematics.C:1550
 drawSystematics.C:1551
 drawSystematics.C:1552
 drawSystematics.C:1553
 drawSystematics.C:1554
 drawSystematics.C:1555
 drawSystematics.C:1556
 drawSystematics.C:1557
 drawSystematics.C:1558
 drawSystematics.C:1559
 drawSystematics.C:1560
 drawSystematics.C:1561
 drawSystematics.C:1562
 drawSystematics.C:1563
 drawSystematics.C:1564
 drawSystematics.C:1565
 drawSystematics.C:1566
 drawSystematics.C:1567
 drawSystematics.C:1568
 drawSystematics.C:1569
 drawSystematics.C:1570
 drawSystematics.C:1571
 drawSystematics.C:1572
 drawSystematics.C:1573
 drawSystematics.C:1574
 drawSystematics.C:1575
 drawSystematics.C:1576
 drawSystematics.C:1577
 drawSystematics.C:1578
 drawSystematics.C:1579
 drawSystematics.C:1580
 drawSystematics.C:1581
 drawSystematics.C:1582
 drawSystematics.C:1583
 drawSystematics.C:1584
 drawSystematics.C:1585
 drawSystematics.C:1586
 drawSystematics.C:1587
 drawSystematics.C:1588
 drawSystematics.C:1589
 drawSystematics.C:1590
 drawSystematics.C:1591
 drawSystematics.C:1592
 drawSystematics.C:1593
 drawSystematics.C:1594
 drawSystematics.C:1595
 drawSystematics.C:1596
 drawSystematics.C:1597
 drawSystematics.C:1598
 drawSystematics.C:1599
 drawSystematics.C:1600
 drawSystematics.C:1601
 drawSystematics.C:1602
 drawSystematics.C:1603
 drawSystematics.C:1604
 drawSystematics.C:1605
 drawSystematics.C:1606
 drawSystematics.C:1607
 drawSystematics.C:1608
 drawSystematics.C:1609
 drawSystematics.C:1610
 drawSystematics.C:1611
 drawSystematics.C:1612
 drawSystematics.C:1613
 drawSystematics.C:1614
 drawSystematics.C:1615
 drawSystematics.C:1616
 drawSystematics.C:1617
 drawSystematics.C:1618
 drawSystematics.C:1619
 drawSystematics.C:1620
 drawSystematics.C:1621
 drawSystematics.C:1622
 drawSystematics.C:1623
 drawSystematics.C:1624
 drawSystematics.C:1625
 drawSystematics.C:1626
 drawSystematics.C:1627
 drawSystematics.C:1628
 drawSystematics.C:1629
 drawSystematics.C:1630
 drawSystematics.C:1631
 drawSystematics.C:1632
 drawSystematics.C:1633
 drawSystematics.C:1634
 drawSystematics.C:1635
 drawSystematics.C:1636
 drawSystematics.C:1637
 drawSystematics.C:1638
 drawSystematics.C:1639
 drawSystematics.C:1640
 drawSystematics.C:1641
 drawSystematics.C:1642
 drawSystematics.C:1643
 drawSystematics.C:1644
 drawSystematics.C:1645
 drawSystematics.C:1646
 drawSystematics.C:1647
 drawSystematics.C:1648
 drawSystematics.C:1649
 drawSystematics.C:1650
 drawSystematics.C:1651
 drawSystematics.C:1652
 drawSystematics.C:1653
 drawSystematics.C:1654
 drawSystematics.C:1655
 drawSystematics.C:1656
 drawSystematics.C:1657
 drawSystematics.C:1658
 drawSystematics.C:1659
 drawSystematics.C:1660
 drawSystematics.C:1661
 drawSystematics.C:1662
 drawSystematics.C:1663
 drawSystematics.C:1664
 drawSystematics.C:1665
 drawSystematics.C:1666
 drawSystematics.C:1667
 drawSystematics.C:1668
 drawSystematics.C:1669
 drawSystematics.C:1670
 drawSystematics.C:1671
 drawSystematics.C:1672
 drawSystematics.C:1673
 drawSystematics.C:1674
 drawSystematics.C:1675
 drawSystematics.C:1676
 drawSystematics.C:1677
 drawSystematics.C:1678
 drawSystematics.C:1679
 drawSystematics.C:1680
 drawSystematics.C:1681
 drawSystematics.C:1682
 drawSystematics.C:1683
 drawSystematics.C:1684
 drawSystematics.C:1685
 drawSystematics.C:1686
 drawSystematics.C:1687
 drawSystematics.C:1688
 drawSystematics.C:1689
 drawSystematics.C:1690
 drawSystematics.C:1691
 drawSystematics.C:1692
 drawSystematics.C:1693
 drawSystematics.C:1694
 drawSystematics.C:1695
 drawSystematics.C:1696
 drawSystematics.C:1697
 drawSystematics.C:1698
 drawSystematics.C:1699
 drawSystematics.C:1700
 drawSystematics.C:1701
 drawSystematics.C:1702
 drawSystematics.C:1703
 drawSystematics.C:1704
 drawSystematics.C:1705
 drawSystematics.C:1706
 drawSystematics.C:1707
 drawSystematics.C:1708
 drawSystematics.C:1709
 drawSystematics.C:1710
 drawSystematics.C:1711
 drawSystematics.C:1712
 drawSystematics.C:1713
 drawSystematics.C:1714
 drawSystematics.C:1715
 drawSystematics.C:1716
 drawSystematics.C:1717
 drawSystematics.C:1718
 drawSystematics.C:1719
 drawSystematics.C:1720
 drawSystematics.C:1721
 drawSystematics.C:1722
 drawSystematics.C:1723
 drawSystematics.C:1724
 drawSystematics.C:1725
 drawSystematics.C:1726
 drawSystematics.C:1727
 drawSystematics.C:1728
 drawSystematics.C:1729
 drawSystematics.C:1730
 drawSystematics.C:1731
 drawSystematics.C:1732
 drawSystematics.C:1733
 drawSystematics.C:1734
 drawSystematics.C:1735
 drawSystematics.C:1736
 drawSystematics.C:1737
 drawSystematics.C:1738
 drawSystematics.C:1739
 drawSystematics.C:1740
 drawSystematics.C:1741
 drawSystematics.C:1742
 drawSystematics.C:1743
 drawSystematics.C:1744
 drawSystematics.C:1745
 drawSystematics.C:1746
 drawSystematics.C:1747
 drawSystematics.C:1748
 drawSystematics.C:1749
 drawSystematics.C:1750
 drawSystematics.C:1751
 drawSystematics.C:1752
 drawSystematics.C:1753
 drawSystematics.C:1754
 drawSystematics.C:1755
 drawSystematics.C:1756
 drawSystematics.C:1757
 drawSystematics.C:1758
 drawSystematics.C:1759
 drawSystematics.C:1760
 drawSystematics.C:1761
 drawSystematics.C:1762
 drawSystematics.C:1763
 drawSystematics.C:1764
 drawSystematics.C:1765
 drawSystematics.C:1766
 drawSystematics.C:1767
 drawSystematics.C:1768
 drawSystematics.C:1769
 drawSystematics.C:1770
 drawSystematics.C:1771
 drawSystematics.C:1772
 drawSystematics.C:1773
 drawSystematics.C:1774
 drawSystematics.C:1775
 drawSystematics.C:1776
 drawSystematics.C:1777
 drawSystematics.C:1778
 drawSystematics.C:1779
 drawSystematics.C:1780
 drawSystematics.C:1781
 drawSystematics.C:1782
 drawSystematics.C:1783
 drawSystematics.C:1784
 drawSystematics.C:1785
 drawSystematics.C:1786
 drawSystematics.C:1787
 drawSystematics.C:1788
 drawSystematics.C:1789
 drawSystematics.C:1790
 drawSystematics.C:1791
 drawSystematics.C:1792
 drawSystematics.C:1793
 drawSystematics.C:1794
 drawSystematics.C:1795
 drawSystematics.C:1796
 drawSystematics.C:1797
 drawSystematics.C:1798
 drawSystematics.C:1799
 drawSystematics.C:1800
 drawSystematics.C:1801
 drawSystematics.C:1802
 drawSystematics.C:1803
 drawSystematics.C:1804
 drawSystematics.C:1805
 drawSystematics.C:1806
 drawSystematics.C:1807
 drawSystematics.C:1808
 drawSystematics.C:1809
 drawSystematics.C:1810
 drawSystematics.C:1811
 drawSystematics.C:1812
 drawSystematics.C:1813
 drawSystematics.C:1814
 drawSystematics.C:1815
 drawSystematics.C:1816
 drawSystematics.C:1817
 drawSystematics.C:1818
 drawSystematics.C:1819
 drawSystematics.C:1820
 drawSystematics.C:1821
 drawSystematics.C:1822
 drawSystematics.C:1823
 drawSystematics.C:1824
 drawSystematics.C:1825
 drawSystematics.C:1826
 drawSystematics.C:1827
 drawSystematics.C:1828
 drawSystematics.C:1829
 drawSystematics.C:1830
 drawSystematics.C:1831
 drawSystematics.C:1832
 drawSystematics.C:1833
 drawSystematics.C:1834
 drawSystematics.C:1835
 drawSystematics.C:1836
 drawSystematics.C:1837
 drawSystematics.C:1838
 drawSystematics.C:1839
 drawSystematics.C:1840
 drawSystematics.C:1841
 drawSystematics.C:1842
 drawSystematics.C:1843
 drawSystematics.C:1844
 drawSystematics.C:1845
 drawSystematics.C:1846
 drawSystematics.C:1847
 drawSystematics.C:1848
 drawSystematics.C:1849
 drawSystematics.C:1850
 drawSystematics.C:1851
 drawSystematics.C:1852
 drawSystematics.C:1853
 drawSystematics.C:1854
 drawSystematics.C:1855
 drawSystematics.C:1856
 drawSystematics.C:1857
 drawSystematics.C:1858
 drawSystematics.C:1859
 drawSystematics.C:1860
 drawSystematics.C:1861
 drawSystematics.C:1862
 drawSystematics.C:1863
 drawSystematics.C:1864
 drawSystematics.C:1865
 drawSystematics.C:1866
 drawSystematics.C:1867
 drawSystematics.C:1868
 drawSystematics.C:1869
 drawSystematics.C:1870
 drawSystematics.C:1871
 drawSystematics.C:1872
 drawSystematics.C:1873
 drawSystematics.C:1874
 drawSystematics.C:1875
 drawSystematics.C:1876
 drawSystematics.C:1877
 drawSystematics.C:1878
 drawSystematics.C:1879
 drawSystematics.C:1880
 drawSystematics.C:1881
 drawSystematics.C:1882
 drawSystematics.C:1883
 drawSystematics.C:1884
 drawSystematics.C:1885
 drawSystematics.C:1886
 drawSystematics.C:1887
 drawSystematics.C:1888
 drawSystematics.C:1889
 drawSystematics.C:1890
 drawSystematics.C:1891
 drawSystematics.C:1892
 drawSystematics.C:1893
 drawSystematics.C:1894
 drawSystematics.C:1895
 drawSystematics.C:1896
 drawSystematics.C:1897
 drawSystematics.C:1898
 drawSystematics.C:1899
 drawSystematics.C:1900
 drawSystematics.C:1901
 drawSystematics.C:1902
 drawSystematics.C:1903
 drawSystematics.C:1904
 drawSystematics.C:1905
 drawSystematics.C:1906
 drawSystematics.C:1907
 drawSystematics.C:1908
 drawSystematics.C:1909
 drawSystematics.C:1910
 drawSystematics.C:1911
 drawSystematics.C:1912
 drawSystematics.C:1913
 drawSystematics.C:1914
 drawSystematics.C:1915
 drawSystematics.C:1916
 drawSystematics.C:1917
 drawSystematics.C:1918
 drawSystematics.C:1919
 drawSystematics.C:1920
 drawSystematics.C:1921
 drawSystematics.C:1922
 drawSystematics.C:1923
 drawSystematics.C:1924
 drawSystematics.C:1925
 drawSystematics.C:1926
 drawSystematics.C:1927
 drawSystematics.C:1928
 drawSystematics.C:1929
 drawSystematics.C:1930
 drawSystematics.C:1931
 drawSystematics.C:1932
 drawSystematics.C:1933
 drawSystematics.C:1934
 drawSystematics.C:1935
 drawSystematics.C:1936
 drawSystematics.C:1937
 drawSystematics.C:1938
 drawSystematics.C:1939
 drawSystematics.C:1940
 drawSystematics.C:1941
 drawSystematics.C:1942
 drawSystematics.C:1943
 drawSystematics.C:1944
 drawSystematics.C:1945
 drawSystematics.C:1946
 drawSystematics.C:1947
 drawSystematics.C:1948
 drawSystematics.C:1949
 drawSystematics.C:1950
 drawSystematics.C:1951
 drawSystematics.C:1952
 drawSystematics.C:1953
 drawSystematics.C:1954
 drawSystematics.C:1955
 drawSystematics.C:1956
 drawSystematics.C:1957
 drawSystematics.C:1958
 drawSystematics.C:1959
 drawSystematics.C:1960
 drawSystematics.C:1961
 drawSystematics.C:1962
 drawSystematics.C:1963
 drawSystematics.C:1964
 drawSystematics.C:1965
 drawSystematics.C:1966
 drawSystematics.C:1967
 drawSystematics.C:1968
 drawSystematics.C:1969
 drawSystematics.C:1970
 drawSystematics.C:1971
 drawSystematics.C:1972
 drawSystematics.C:1973
 drawSystematics.C:1974
 drawSystematics.C:1975
 drawSystematics.C:1976
 drawSystematics.C:1977
 drawSystematics.C:1978
 drawSystematics.C:1979
 drawSystematics.C:1980
 drawSystematics.C:1981
 drawSystematics.C:1982
 drawSystematics.C:1983
 drawSystematics.C:1984
 drawSystematics.C:1985
 drawSystematics.C:1986
 drawSystematics.C:1987
 drawSystematics.C:1988
 drawSystematics.C:1989
 drawSystematics.C:1990
 drawSystematics.C:1991
 drawSystematics.C:1992
 drawSystematics.C:1993
 drawSystematics.C:1994
 drawSystematics.C:1995
 drawSystematics.C:1996
 drawSystematics.C:1997
 drawSystematics.C:1998
 drawSystematics.C:1999
 drawSystematics.C:2000
 drawSystematics.C:2001
 drawSystematics.C:2002
 drawSystematics.C:2003
 drawSystematics.C:2004
 drawSystematics.C:2005
 drawSystematics.C:2006
 drawSystematics.C:2007
 drawSystematics.C:2008
 drawSystematics.C:2009
 drawSystematics.C:2010
 drawSystematics.C:2011
 drawSystematics.C:2012
 drawSystematics.C:2013
 drawSystematics.C:2014
 drawSystematics.C:2015
 drawSystematics.C:2016
 drawSystematics.C:2017
 drawSystematics.C:2018
 drawSystematics.C:2019
 drawSystematics.C:2020
 drawSystematics.C:2021
 drawSystematics.C:2022
 drawSystematics.C:2023
 drawSystematics.C:2024
 drawSystematics.C:2025
 drawSystematics.C:2026
 drawSystematics.C:2027
 drawSystematics.C:2028
 drawSystematics.C:2029
 drawSystematics.C:2030
 drawSystematics.C:2031
 drawSystematics.C:2032
 drawSystematics.C:2033
 drawSystematics.C:2034
 drawSystematics.C:2035
 drawSystematics.C:2036
 drawSystematics.C:2037
 drawSystematics.C:2038
 drawSystematics.C:2039
 drawSystematics.C:2040
 drawSystematics.C:2041
 drawSystematics.C:2042
 drawSystematics.C:2043
 drawSystematics.C:2044
 drawSystematics.C:2045
 drawSystematics.C:2046
 drawSystematics.C:2047
 drawSystematics.C:2048
 drawSystematics.C:2049
 drawSystematics.C:2050
 drawSystematics.C:2051
 drawSystematics.C:2052
 drawSystematics.C:2053
 drawSystematics.C:2054
 drawSystematics.C:2055
 drawSystematics.C:2056
 drawSystematics.C:2057
 drawSystematics.C:2058
 drawSystematics.C:2059
 drawSystematics.C:2060
 drawSystematics.C:2061
 drawSystematics.C:2062
 drawSystematics.C:2063
 drawSystematics.C:2064
 drawSystematics.C:2065
 drawSystematics.C:2066
 drawSystematics.C:2067
 drawSystematics.C:2068
 drawSystematics.C:2069
 drawSystematics.C:2070
 drawSystematics.C:2071
 drawSystematics.C:2072
 drawSystematics.C:2073
 drawSystematics.C:2074
 drawSystematics.C:2075
 drawSystematics.C:2076
 drawSystematics.C:2077
 drawSystematics.C:2078
 drawSystematics.C:2079
 drawSystematics.C:2080
 drawSystematics.C:2081
 drawSystematics.C:2082
 drawSystematics.C:2083
 drawSystematics.C:2084
 drawSystematics.C:2085
 drawSystematics.C:2086
 drawSystematics.C:2087
 drawSystematics.C:2088
 drawSystematics.C:2089
 drawSystematics.C:2090
 drawSystematics.C:2091
 drawSystematics.C:2092
 drawSystematics.C:2093
 drawSystematics.C:2094
 drawSystematics.C:2095
 drawSystematics.C:2096
 drawSystematics.C:2097
 drawSystematics.C:2098
 drawSystematics.C:2099
 drawSystematics.C:2100
 drawSystematics.C:2101
 drawSystematics.C:2102
 drawSystematics.C:2103
 drawSystematics.C:2104
 drawSystematics.C:2105
 drawSystematics.C:2106
 drawSystematics.C:2107
 drawSystematics.C:2108
 drawSystematics.C:2109
 drawSystematics.C:2110
 drawSystematics.C:2111
 drawSystematics.C:2112
 drawSystematics.C:2113
 drawSystematics.C:2114
 drawSystematics.C:2115
 drawSystematics.C:2116
 drawSystematics.C:2117
 drawSystematics.C:2118
 drawSystematics.C:2119
 drawSystematics.C:2120
 drawSystematics.C:2121
 drawSystematics.C:2122
 drawSystematics.C:2123
 drawSystematics.C:2124
 drawSystematics.C:2125
 drawSystematics.C:2126
 drawSystematics.C:2127
 drawSystematics.C:2128
 drawSystematics.C:2129
 drawSystematics.C:2130
 drawSystematics.C:2131
 drawSystematics.C:2132
 drawSystematics.C:2133
 drawSystematics.C:2134
 drawSystematics.C:2135
 drawSystematics.C:2136
 drawSystematics.C:2137
 drawSystematics.C:2138
 drawSystematics.C:2139
 drawSystematics.C:2140
 drawSystematics.C:2141
 drawSystematics.C:2142
 drawSystematics.C:2143
 drawSystematics.C:2144
 drawSystematics.C:2145
 drawSystematics.C:2146
 drawSystematics.C:2147
 drawSystematics.C:2148
 drawSystematics.C:2149
 drawSystematics.C:2150
 drawSystematics.C:2151
 drawSystematics.C:2152
 drawSystematics.C:2153
 drawSystematics.C:2154
 drawSystematics.C:2155
 drawSystematics.C:2156
 drawSystematics.C:2157
 drawSystematics.C:2158
 drawSystematics.C:2159
 drawSystematics.C:2160
 drawSystematics.C:2161
 drawSystematics.C:2162
 drawSystematics.C:2163
 drawSystematics.C:2164
 drawSystematics.C:2165
 drawSystematics.C:2166
 drawSystematics.C:2167
 drawSystematics.C:2168
 drawSystematics.C:2169
 drawSystematics.C:2170
 drawSystematics.C:2171
 drawSystematics.C:2172
 drawSystematics.C:2173
 drawSystematics.C:2174
 drawSystematics.C:2175
 drawSystematics.C:2176
 drawSystematics.C:2177
 drawSystematics.C:2178
 drawSystematics.C:2179
 drawSystematics.C:2180
 drawSystematics.C:2181
 drawSystematics.C:2182
 drawSystematics.C:2183
 drawSystematics.C:2184
 drawSystematics.C:2185
 drawSystematics.C:2186
 drawSystematics.C:2187
 drawSystematics.C:2188
 drawSystematics.C:2189
 drawSystematics.C:2190
 drawSystematics.C:2191
 drawSystematics.C:2192
 drawSystematics.C:2193