File indexing completed on 2025-08-05 08:13:18
0001 #include "sPhenixStyle.h"
0002 #include "sPhenixStyle.C"
0003
0004
0005 void plot_histos(const char *filename = "output.root", const float jetparameter = 0.4)
0006 {
0007
0008
0009 SetsPhenixStyle();
0010 TH1::SetDefaultSumw2();
0011 TH2::SetDefaultSumw2();
0012
0013 TFile *f = new TFile(filename,"READ");
0014
0015
0016 TH1D *h_nconst = (TH1D*) f->Get("h1d_nConsituents");
0017 TH1D *h_nconst_IHCal = (TH1D*) f->Get("h1d_nConsituents_IHCal");
0018 TH1D *h_nconst_OHCal = (TH1D*) f->Get("h1d_nConsituents_OHCal");
0019 TH1D *h_nconst_EMCal = (TH1D*) f->Get("h1d_nConsituents_EMCal");
0020 TH1D *h_FracEnergy_EMCal = (TH1D*) f->Get("h1d_FracEnergy_EMCal");
0021 TH1D *h_FracEnergy_IHCal = (TH1D*) f->Get("h1d_FracEnergy_IHCal");
0022 TH1D *h_FracEnergy_OHCal = (TH1D*) f->Get("h1d_FracEnergy_OHCal");
0023
0024 TH2D *h_FracEnergy_vs_CaloLayer = (TH2D*) f->Get("h2d_FracEnergy_vs_CaloLayer");
0025 TH2D *h_nConstituent_vs_CaloLayer = (TH2D*) f->Get("h2d_nConstituent_vs_CaloLayer");
0026
0027 TCanvas *c = new TCanvas("c","c");
0028 TLegend *leg = new TLegend(0.5,0.5,0.9,0.9);
0029 leg->SetFillStyle(0);
0030 leg->AddEntry("","#it{#bf{sPHENIX}} Internal","");
0031 leg->AddEntry("","Au+Au #sqrt{s_{NN}}=200 GeV","");
0032 leg->AddEntry("",Form("anti-#it{k}_{#it{t}} #it{R} = %.1f, |#eta| < 1.1",jetparameter),"");
0033 int colors[] = {1,2,4};
0034 string labels[] = {"iHCal","oHCal","EMCal"};
0035
0036 c->SetTitle("Number of Constituents per Calo layer");
0037
0038 h_nconst_IHCal->SetLineColor(colors[0]);
0039 h_nconst_IHCal->SetMarkerColor(colors[0]);
0040
0041 h_nconst_OHCal->SetLineColor(colors[1]);
0042 h_nconst_OHCal->SetMarkerColor(colors[1]);
0043
0044 h_nconst_EMCal->SetLineColor(colors[2]);
0045 h_nconst_EMCal->SetMarkerColor(colors[2]);
0046
0047 leg->AddEntry(h_nconst_IHCal,labels[0].c_str(),"l");
0048 leg->AddEntry(h_nconst_OHCal,labels[1].c_str(),"l");
0049 leg->AddEntry(h_nconst_EMCal,labels[2].c_str(),"l");
0050
0051 h_nconst_IHCal->GetXaxis()->SetTitle("Number of Constituents");
0052 h_nconst_IHCal->GetYaxis()->SetTitle("Counts");
0053
0054
0055 h_nconst_IHCal->Draw("hist");
0056 h_nconst_OHCal->Draw("hist same");
0057 h_nconst_EMCal->Draw("hist same");
0058
0059 leg->Draw("same");
0060
0061 c->Update();
0062 string outputfilename = string(filename);
0063 outputfilename.erase(outputfilename.find(".root"));
0064 c->SaveAs(Form("h_nconst_%s.pdf",outputfilename.c_str()));
0065
0066
0067 TCanvas *c2 = new TCanvas("c2","c2");
0068 TLegend *leg2 = new TLegend(0.5,0.5,0.9,0.9);
0069 leg2->SetFillStyle(0);
0070 leg2->AddEntry("","#it{#bf{sPHENIX}} Internal","");
0071 leg2->AddEntry("","Au+Au #sqrt{s_{NN}}=200 GeV","");
0072 leg2->AddEntry("",Form("anti-#it{k}_{#it{t}} #it{R} = %.1f, |#eta| < 1.1",jetparameter),"");
0073
0074 c2->SetTitle("Fraction of Energy per Calo layer");
0075
0076 h_FracEnergy_IHCal->GetXaxis()->SetTitle("Fraction of Energy");
0077 h_FracEnergy_IHCal->GetYaxis()->SetTitle("Counts");
0078
0079 h_FracEnergy_IHCal->SetLineColor(colors[0]);
0080 h_FracEnergy_IHCal->SetMarkerColor(colors[0]);
0081
0082 h_FracEnergy_OHCal->SetLineColor(colors[1]);
0083 h_FracEnergy_OHCal->SetMarkerColor(colors[1]);
0084
0085 h_FracEnergy_EMCal->SetLineColor(colors[2]);
0086 h_FracEnergy_EMCal->SetMarkerColor(colors[2]);
0087
0088 leg2->AddEntry(h_FracEnergy_IHCal,labels[0].c_str(),"l");
0089 leg2->AddEntry(h_FracEnergy_OHCal,labels[1].c_str(),"l");
0090 leg2->AddEntry(h_FracEnergy_EMCal,labels[2].c_str(),"l");
0091
0092 h_FracEnergy_IHCal->Draw("hist");
0093 h_FracEnergy_OHCal->Draw("hist same");
0094 h_FracEnergy_EMCal->Draw("hist same");
0095
0096 leg2->Draw("same");
0097
0098 c2->Update();
0099
0100 c2->SaveAs(Form("h_FracEnergy_%s.pdf",outputfilename.c_str()));
0101
0102
0103 TCanvas *c3 = new TCanvas("c3","c3");
0104 c3->SetTitle("Total of Constituents");
0105
0106 h_nconst->GetXaxis()->SetTitle("Number of Constituents");
0107 h_nconst->GetYaxis()->SetTitle("Counts");
0108 h_nconst->Draw("hist");
0109
0110 c3->Update();
0111
0112 c3->SaveAs(Form("h_nconst_total_%s.pdf",outputfilename.c_str()));
0113
0114 TCanvas *c4 = new TCanvas("c4","c4");
0115 c4->SetTitle("Fraction of Energy");
0116
0117 h_FracEnergy_vs_CaloLayer->GetXaxis()->SetTitle("Calo Layer");
0118 h_FracEnergy_vs_CaloLayer->GetYaxis()->SetTitle("Fraction of Energy");
0119 h_FracEnergy_vs_CaloLayer->GetXaxis()->SetBinLabel(1,"EMCal");
0120 h_FracEnergy_vs_CaloLayer->GetXaxis()->SetBinLabel(2,"IHCal");
0121 h_FracEnergy_vs_CaloLayer->GetXaxis()->SetBinLabel(3,"OHCal");
0122 h_FracEnergy_vs_CaloLayer->Draw("COLZ");
0123 TLine *line = new TLine(1,0,1,1);
0124 line->SetLineColor(kRed);
0125 line->Draw("same");
0126 TLine *line2 = new TLine(2,0,2,1);
0127 line2->SetLineColor(kRed);
0128 line2->Draw("same");
0129
0130 c4->Update();
0131 c4->SaveAs(Form("h_FracEnergy_vs_calolayer_%s.pdf",outputfilename.c_str()));
0132
0133 TCanvas *c5 = new TCanvas("c5","c5");
0134 c5->SetTitle("Number of Constituents");
0135
0136 h_nConstituent_vs_CaloLayer->GetXaxis()->SetTitle("Calo Layer");
0137 h_nConstituent_vs_CaloLayer->GetYaxis()->SetTitle("Number of Constituents");
0138 h_nConstituent_vs_CaloLayer->GetXaxis()->SetBinLabel(1,"EMCal");
0139 h_nConstituent_vs_CaloLayer->GetXaxis()->SetBinLabel(2,"IHCal");
0140 h_nConstituent_vs_CaloLayer->GetXaxis()->SetBinLabel(3,"OHCal");
0141 h_nConstituent_vs_CaloLayer->Draw("COLZ");
0142 TLine *line3 = new TLine(1,0,1,1);
0143 line3->SetLineColor(kRed);
0144 line3->Draw("same");
0145 TLine *line4 = new TLine(2,0,2,1);
0146 line4->SetLineColor(kRed);
0147 line4->Draw("same");
0148
0149 c5->Update();
0150
0151 c5->SaveAs(Form("h_nconst_vs_calolayer_%s.pdf",outputfilename.c_str()));
0152
0153
0154
0155
0156
0157
0158
0159
0160 }
0161
0162