{
TFile *f1 = new TFile("MinBiasResponseOutput_MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction.root");
TFile *f2 = new TFile("MinBiasResponseOutput_MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction.root");
TFile *f3=new TFile("MinBiasResponseOutput_data_ZeroBias1_Run2015A-27Jan2016-v2.root");

f1->cd("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction");
f2->cd("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction");
f3->cd("data_ZeroBias1_Run2015A-27Jan2016-v2");


TH1D* hdishad01 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin0");
TH1D* hdishad02 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin0");
TH1D* hdishad03 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin0");


TH1D* hdishad11 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin1");
TH1D* hdishad12 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin1");
TH1D* hdishad13 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin1");

TH1D* hdishad21 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin2");
TH1D* hdishad22 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin2");
TH1D* hdishad23 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin2");

TH1D* hdishad31 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin3");
TH1D* hdishad32 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin3");
TH1D* hdishda33 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin3");

TH1D* hdishad41 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin4");
TH1D* hdishad42 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin4");
TH1D* hdishad43 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNd_had_bin4");

TH1D* hdishad51 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin5");
TH1D* hdishad52 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin5");
TH1D* hdishad53 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin5");

TH1D* hdishad61 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin6");
TH1D* hdishad62 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin6");
TH1D* hdishad63 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin6");

TH1D* hdishad71 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin7");
TH1D* hdishad72 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin7");
TH1D* hdishad73 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin7");

TH1D* hdishad81 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin8");
TH1D* hdishad82 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin8");
TH1D* hdishad83 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin8");

TH1D* hdishad91 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin9");
TH1D* hdishad92 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin9");
TH1D* hdishad93 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin9");

TH1D* hdishad101 = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin10");
TH1D* hdishad102 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_bin9");
TH1D* hdishad103 = (TH1D*)f3->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_had_bin9");

//TH1D* hdishad = (TH1D*)f1->Get("MinBias_EPOS_13TeV_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_had_10");
//TH1D* hdisem1 = (TH1D*)f2->Get("MinBias_CUETP8M1_13TeV-pythia8_MagnetOff_CASTORmeasured_newNoise_newVertexReconstruction/dNdE_em_10");
//TH1D* hdishad1 = (TH1D*)f2->Get("data_ZeroBias1_Run2015A-27Jan2016-v2/dNdE_em_10");


TCanvas *c1 = new TCanvas("dNdE_had","dNdE_had");
c1->Divide(4,3,0,0);

c1->cd(1);
gPad->SetLogy(1);
hdishad01->Draw();
hdishad02->Draw("same");
hdishad03->Draw("same");

c1->cd(2);
gPad->SetLogy(1);
hdishad11->Draw();
hdishad12->Draw("same");
hdishad13->Draw("same");

c1->cd(3);
gPad->SetLogy(1);
hdishad21->Draw();
hdishad22->Draw("same");
hdishad23->Draw("same");

c1->cd(4);
gPad->SetLogy(1);
hdishad31->Draw();
hdishad32->Draw("same");
hdishad33->Draw("same");

c1->cd (5);
gPad->SetLogy(1); 
hdishad41->Draw();
hdishad42->Draw("same");
hdishad43->Draw("same");

c1->cd(6);
gPad->SetLogy(1);
hdishad51->Draw();
hdishad52->Draw("same");
hdishad53->Draw("same");

c1->cd(7);
gPad->SetLogy(1);
hdishad61->Draw();
hdishad62->Draw("same");
hdishad63->Draw("same");

c1->cd(8);
gPad->SetLogy(1);
hdishad71->Draw();
hdishad72->Draw("same");
hdishad73->Draw("same");

c1->cd(9);
gPad->SetLogy(1);
hdishad81->Draw();
hdishad82->Draw("same");
hdishad83->Draw("same");

c1->cd(10);
gPad->SetLogy(1);
hdishad91->Draw();
hdishad92->Draw("same");
hdishad93->Draw("same");

c1->cd(11);
gPad->SetLogy(1);
hdishad101->Draw();
hdishad102->Draw("same");
hdishad103->Draw("same");


hdishad01->SetLineWidth(2);
hdishad02->SetLineWidth(2);
hdishad03->SetLineWidth(2);

hdishad11->SetLineWidth(2);
hdishad12->SetLineWidth(2);
hdishad13->SetLineWidth(2);

hdishad21->SetLineWidth(2);
hdishad22->SetLineWidth(2);
hdishad23->SetLineWidth(2);

hdishad31->SetLineWidth(2);
hdishad32->SetLineWidth(2);
hdishad33->SetLineWidth(2); 

hdishad41->SetLineWidth(2);    
hdishad42->SetLineWidth(2); 
hdishad43->SetLineWidth(2);

hdishad51->SetLineWidth(2);    
hdishad52->SetLineWidth(2); 
hdishad53->SetLineWidth(2);

hdishad61->SetLineWidth(2);    
hdishad62->SetLineWidth(2); 
hdishad63->SetLineWidth(2);

hdishad71->SetLineWidth(2);    
hdishad72->SetLineWidth(2); 
hdishad73->SetLineWidth(2);

hdishad81->SetLineWidth(2);    
hdishad82->SetLineWidth(2); 
hdishad83->SetLineWidth(2);

hdishad91->SetLineWidth(2);    
hdishad92->SetLineWidth(2); 
hdishad93->SetLineWidth(2);

hdishad101->SetLineWidth(2);    
hdishad102->SetLineWidth(2); 
hdishad103->SetLineWidth(2);

hdishad01->SetLineColor(kBlue);
hdishad02->SetLineColor(kRed);
hdishad03->SetLineColor(kYellow);

hdishad11->SetLineColor(kBlue);
hdishad12->SetLineColor(kRed);
hdishad13->SetLineColor(kYellow);

hdishad21->SetLineColor(kBlue);
hdishad22->SetLineColor(kRed); 
hdishad23->SetLineColor(kYellow);

hdishad31->SetLineColor(kBlue);
hdishad32->SetLineColor(kRed); 
hdishad33->SetLineColor(kYellow);   //error in this line

hdishad41->SetLineColor(kBlue);
hdishad42->SetLineColor(kRed); 
hdishad43->SetLineColor(kYellow);

hdishad51->SetLineColor(kBlue);
hdishad52->SetLineColor(kRed); 
hdishad53->SetLineColor(kYellow);

hdishad61->SetLineColor(kBlue);
hdishad62->SetLineColor(kRed); 
hdishad63->SetLineColor(kYellow);

hdishad71->SetLineColor(kBlue);
hdishad72->SetLineColor(kRed); 
hdishad73->SetLineColor(kYellow);

hdishad81->SetLineColor(kBlue);
hdishad82->SetLineColor(kRed); 
hdishad83->SetLineColor(kYellow);

hdishad91->SetLineColor(kBlue);
hdishad92->SetLineColor(kRed); 
hdishad93->SetLineColor(kYellow);

hdishad101->SetLineColor(kBlue);
hdishad102->SetLineColor(kRed); 
hdishad103->SetLineColor(kYellow);


hdishad01->SetXTitle("Eta");
hdishad02->SetXTitle("Eta");
hdishad03->SetXTitle("Eta");

hdishad11->SetXTitle("Eta");
hdishad12->SetXTitle("Eta");
hdishad13->SetXTitle("Eta");

hdishad21->SetXTitle("Eta");
hdishad22->SetXTitle("Eta");
hdishad23->SetXTitle("Eta");

hdishad31->SetXTitle("Eta");
hdishad32->SetXTitle("Eta");
hdishad33->SetXTitle("Eta");

hdishad41->SetXTitle("Eta"); 
hdishad42->SetXTitle("Eta");
hdishad43->SetXTitle("Eta");

hdishad51->SetXTitle("Eta"); 
hdishad52->SetXTitle("Eta");
hdishad53->SetXTitle("Eta");

hdishad61->SetXTitle("Eta"); 
hdishad62->SetXTitle("Eta");
hdishad63->SetXTitle("Eta");

hdishad71->SetXTitle("Eta"); 
hdishad72->SetXTitle("Eta");
hdishad73->SetXTitle("Eta");

hdishad81->SetXTitle("Eta"); 
hdishad82->SetXTitle("Eta");
hdishad83->SetXTitle("Eta");

hdishad91->SetXTitle("Eta"); 
hdishad92->SetXTitle("Eta");
hdishad93->SetXTitle("Eta");

hdishad101->SetXTitle("Eta"); 
hdishad102->SetXTitle("Eta");
hdishad103->SetXTitle("Eta");

hdishad01->SetYTitle("Energy_distribution");
hdishad02->SetYTitle("Energy_distribution");
hdishad03->SetYTitle("Energy_distribution");

hdishad11->SetYTitle("Energy_distribution");
hdishad12->SetYTitle("Energy_distribution");
hdishad13->SetYTitle("Energy_distribution");

hdishad21->SetYTitle("Energy_distribution");
hdishad22->SetYTitle("Energy_distribution");
hdishad23->SetYTitle("Energy_distribution");

hdishad31->SetYTitle("Energy_distribution");
hdishad32->SetYTitle("Energy_distribution");
hdishad33->SetYTitle("Energy_distribution");

hdishad41->SetYTitle("Energy_distribution");
hdishad42->SetYTitle("Energy_distribution");
hdishad43->SetYTitle("Energy_distribution");

hdishad41->SetYTitle("Energy_distribution");
hdishad42->SetYTitle("Energy_distribution");
hdishad43->SetYTitle("Energy_distribution");

hdishad51->SetYTitle("Energy_distribution");
hdishad52->SetYTitle("Energy_distribution");
hdishad53->SetYTitle("Energy_distribution");

hdishad61->SetYTitle("Energy_distribution");
hdishad62->SetYTitle("Energy_distribution");
hdishad63->SetYTitle("Energy_distribution");

hdishad71->SetYTitle("Energy_distribution");
hdishad72->SetYTitle("Energy_distribution");
hdishad73->SetYTitle("Energy_distribution");

hdishad81->SetYTitle("Energy_distribution");
hdishad82->SetYTitle("Energy_distribution");
hdishad83->SetYTitle("Energy_distribution");

hdishad91->SetYTitle("Energy_distribution");
hdishad92->SetYTitle("Energy_distribution");
hdishad93->SetYTitle("Energy_distribution");

hdishad101->SetYTitle("Energy_distribution");
hdishad102->SetYTitle("Energy_distribution");
hdishad103->SetYTitle("Energy_distribution");


TLegend *leg = new TLegend(0.5,0.5,0.95,0.95);
leg->SetHeader("Energy_distribution_per_eta");

leg->AddEntry(hdishad01,"EPOS","l");
leg->AddEntry(hdishad02,"PYTHIA8","l");
leg->AddEntry(hdishad03,"Zerobias1","l");

leg->AddEntry(hdishad11,"EPOS","l");
leg->AddEntry(hdishad12,"PYTHIA8","l");
leg->AddEntry(hdishad13,"Zerobias1","l");

leg->AddEntry(hdishad21,"EPOS","l");
leg->AddEntry(hdishad22,"PYTHIA8","l");
leg->AddEntry(hdishad23,"Zerobias1","l");

leg->AddEntry(hdishad31,"EPOS","l");
leg->AddEntry(hdishad32,"PYTHIA8","l");
leg->AddEntry(hdishad33,"Zerobias1","l");

leg->AddEntry(hdishad41,"EPOS","l");
leg->AddEntry(hdishad42,"PYTHIA8","l");
leg->AddEntry(hdishad43,"Zerobias1","l");

leg->AddEntry(hdishad51,"EPOS","l");
leg->AddEntry(hdishad52,"PYTHIA8","l");
leg->AddEntry(hdishad53,"Zerobias1","l");

leg->AddEntry(hdishad61,"EPOS","l");
leg->AddEntry(hdishad62,"PYTHIA8","l");
leg->AddEntry(hdishad63,"Zerobias2","l");

leg->AddEntry(hdishad71,"EPOS","l");
leg->AddEntry(hdishad72,"PYTHIA8","l");
leg->AddEntry(hdishad73,"Zerobias1","l");

leg->AddEntry(hdishad81,"EPOS","l");
leg->AddEntry(hdishad82,"PYTHIA8","l");
leg->AddEntry(hdishad83,"Zerobias1","l");

leg->AddEntry(hdishad91,"EPOS","l");
leg->AddEntry(hdishad92,"PYTHIA8","l");
leg->AddEntry(hdishad93,"Zerobias1","l");

leg->AddEntry(hdishad101,"EPOS","l");
leg->AddEntry(hdishad102,"PYTHIA8","l");
leg->AddEntry(hdishad103,"Zerobias1","l");

gPad->SetLogy(1);
hdishad01->Draw();
hdishad02->Draw("same");
hdishad03->Draw("same");

hdishad11->Draw();
hdishad12->Draw("same");
hdishad13->Draw("same");

hdishad21->Draw();
hdishad22->Draw("same");
hdishad23->Draw("same");

hdishad31->Draw();
hdishad32->Draw("same");
hdishad33->Draw("same");

hdishad41->Draw();
hdishad42->Draw("same");
hdishad43->Draw("same");

hdishad51->Draw();
hdishad52->Draw("same");
hdishad53->Draw("same");

hdishad61->Draw();
hdishad62->Draw("same");
hdishad63->Draw("same");

hdishad71->Draw();
hdishad72->Draw("same");
hdishad73->Draw("same");

hdishad81->Draw();
hdishad82->Draw("same");
hdishad83->Draw("same");

hdishad91->Draw();
hdishad92->Draw("same");
hdishad93->Draw("same"); 

hdishad101->Draw();
hdishad102->Draw("same");
hdishad103->Draw("same"); 

leg->Draw();

c1->SaveAs("plot.pdf");

}