#include <TFile.h>
#include <TGraphErrors.h>
#include <TMultiGraph.h>
#include <TCanvas.h>
#include <TH1.h>
#include <TString.h>
#include <TMath.h>
#include <TLegend.h>

//_________________
void ComparePID() {

  const Char_t *mInFileName[5];
  TFile *mInFile[5];
  for(Int_t iFile=1; iFile<5; iFile++) {
    mInFileName[iFile] = Form("oKaonHBT_auau200_pid%d.root",iFile);
    mInFile[iFile] = TFile::Open(mInFileName[iFile]);
  }

  Int_t mPidColor[5] = {1, 2, 3, 4, 6};
  Double_t mMarkerSize = 1.6;
  Int_t mMarkerStyle[5] = {20, 21, 22, 29, 34};
  
  TGraphErrors *mMultDepGrErr[5][3]; //[pid][charge]

  TMultiGraph *mgMultDep[3];
  TCanvas *cMultDepCanv[3];  //[charge]
  for(Int_t iCharge=0; iCharge<3; iCharge++) {
    mgMultDep[iCharge] = new TMultiGraph;
  }

  TFile *mOutFile = new TFile("oPIDcomparison.root");
  for(Int_t iFile=1; iFile<5; iFile++) {
    for(Int_t iCharge=0; iCharge<3; iCharge++) {

      mMultDepGrErr[iFile][iCharge] = (TGraphErrors*)mInFile[iFile]->
	Get(Form("gMultDepRadiiGrErr_%d",iCharge));
      mMultDepGrErr[iFile][iCharge]->
	SetName(Form("mMultDepGrErr_%d_%d",iFile,iCharge));
      mMultDepGrErr[iFile][iCharge]->SetMarkerStyle(mMarkerStyle[iFile]);
      mMultDepGrErr[iFile][iCharge]->SetMarkerSize(mMarkerSize);
      mMultDepGrErr[iFile][iCharge]->SetLineColor(mPidColor[iFile]);
      mMultDepGrErr[iFile][iCharge]->SetMarkerColor(mPidColor[iFile]);
      mMultDepGrErr[iFile][iCharge]->SetLineWidth(2);
      mgMultDep[iCharge]->Add(mMultDepGrErr[iFile][iCharge]);
    } //for(Int_t iCharge=0; iCharge<3; iCharge++)
  } //for(Int_t iFile=0; iFile<5; iFile++)


  for(Int_t iCharge=0; iCharge<3; iCharge++) {
    cMultDepCanv[iCharge] = new TCanvas(Form("cMultDepCanv%d",iCharge),
					Form("cMultDepCanv%d",iCharge),
					800, 600);
    mgMultDep[iCharge]->Draw("AP");
  } //for(Int_t iCharge=0; iCharge<3; iCharge++)
}
 
