#include #include #include #include #include #include #include TH1* hBB1; TH1* hBB2; TH1* hBB3; void setMystyle(TH1D* h1,TH1D* h2,TH1D* h3); TCanvas * DrawHistogramOnCanvas(TH1D* h1,TH1D* h2,TH1D* h3,TH1D* h4,TH1D* h5,TH1D* h6,TH1D* h7,TH1D* h8,TH1D* h9, const char* canvasName); void CreateDir(const Char_t* dirName); TH1D* Pol0functionppbPi(TH1D * obj,Int_t i); TH1D* Pol0functionppbAS(TH1D * obj,Int_t i); TH1D* Pol0functionppbNS(TH1D * obj,Int_t i); TCanvas * Draw3HistogramOnCanvas2pads(TH1D* h1, TH1D* h2, TH1D* h3, TH1D* h4, TH1D* h5, TH1D* h6,TH1D* h21, TH1D* h22, TH1D* h23, TH1D* h24, TH1D* h25, TH1D* h26,TH1D* h31, TH1D* h32, TH1D* h33, TH1D* h34, TH1D* h35, TH1D* h36, const char* canvasName, int cen); TCanvas * Draw3HistogramNoPads(TH1D* h1, TH1D* h2, TH1D* h3, TH1D* h4, TH1D* h5, TH1D* h6,TH1D* h21, TH1D* h22, TH1D* h23, TH1D* h24, TH1D* h25, TH1D* h26,TH1D* h31, TH1D* h32, TH1D* h33, TH1D* h34, TH1D* h35, TH1D* h36, const char* canvasName, int cen); void SaveHistogramAsText(TH1D* histogram, const char* canvasName,const Char_t * outFile); TCanvas *DrawHistogramsForCentrality1(int centrality, TH1D* h1, TH1D* h2, TH1D* h3,TH1D* h4, TH1D* h5, TH1D* h6,const char* canvasName); void DrawHistogramsForCentrality8(int centrality, TH1D* h1, TH1D* h2, TH1D* h3,TH1D* h4, TH1D* h5, TH1D* h6,const char* canvasName); TH1D * RebinNewHistograms(TH1D* MCPri,const char* canvasName); struct FitResults { TH1D* hLambdaPlus_cent0; TH1D* hKPlus_cent0; TH1D* hXiPlus_cent0; TH1D* hALambda_cent0; TH1D* hKMinus_cent0; TH1D* hXiMinus_cent0; }; // Function to normalize histograms TH1D* NormKharra(TH1D* hist, double nEvt) { auto const dy = 0.2; TH1D* hist_Norm = static_cast(hist->Clone(Form("%s_Norm", hist->GetName()))); hist_Norm->Reset(); for (int i = 1; i < hist_Norm->GetNbinsX(); i++) { //auto pT = hist->GetBinCenter(i); auto pT = hist->GetBinWidth(i); auto binCont = hist->GetBinContent(i); auto binErr = hist->GetBinError(i); //std::cout << "pT center " << i << ": " << pT << "\n"; if (binCont == 0 || binErr == 0) continue; hist_Norm->SetBinContent(i, binCont/pT ); auto binErr_rel = sqrt(binErr) / binErr * binCont; // std::cout << "pT binErr_rel " << i << ": " << binErr_rel << "\n"; // std::cout << "pT binErr " << i << ": " << binErr << "\n"; hist_Norm->SetBinError(i, binErr_rel); // pt_integ[j] = hK0s->Integral(ptmin,ptmax); if(pt_integ[j]==0) continue; // yield[j] = pt_integ[j] / x[j] / dy / dpt[j] / Events / (2*TMath::Pi()); // staterr[j] = sqrt(pt_integ[j]) / pt_integ[j] * yield[j]; // cout << pt_integ[j] << '\t' << yield[j] << '\t' << staterr[j] << "\n" << endl; // fout <Scale(1 / (nEvt *TMath::TwoPi() ), "width"); //*TMath::TwoPi() return hist_Norm; } void DrawAndNormalizeHistograms(TFile** f_energy, const int numFiles) { const int numCentralityBins = 9; // Assuming there are 9 centrality bins (0 to 8) const Char_t * outFile="WS_test_20"; CreateDir(outFile); FitResults results; // Arrays to store histograms TH1D* hLambdaPlus_energy[numFiles][numCentralityBins]; TH1D* hKPlus_energy[numFiles][numCentralityBins]; TH1D* hXiPlus_energy[numFiles][numCentralityBins]; TH1D* hALambda_energy[numFiles][numCentralityBins]; TH1D* hKMinus_energy[numFiles][numCentralityBins]; TH1D* hXiMinus_energy[numFiles][numCentralityBins]; // TH1D* hrefmult_energy[numFiles]; // double nEvt_[numFiles]; TH1D* hrefmult_energy[numFiles][numCentralityBins]; double nEvt_[numFiles][numCentralityBins]; double Int_Pi_[numFiles][numCentralityBins]; double tInt_Pi_[numFiles][numCentralityBins]; // Loop over files for (int i = 0; i < numFiles; ++i) { // Loop over centrality bins for (int cen = 0; cen < numCentralityBins; ++cen) { hLambdaPlus_energy[i][cen] = static_cast(f_energy[i]->Get(Form("hLambdaPlus_Spectra_Cen%d", cen))); hKPlus_energy[i][cen] = static_cast(f_energy[i]->Get(Form("hKPlus_Spectra_Cen%d", cen))); hXiPlus_energy[i][cen] = static_cast(f_energy[i]->Get(Form("hProton_Spectra_Cen%d", cen))); hALambda_energy[i][cen] = static_cast(f_energy[i]->Get(Form("hALambda_Spectra_Cen%d", cen))); hKMinus_energy[i][cen] = static_cast(f_energy[i]->Get(Form("hKMinus_Spectra_Cen%d", cen))); hXiMinus_energy[i][cen] = static_cast(f_energy[i]->Get(Form("hAProton_Spectra_Cen%d", cen))); hrefmult_energy[i][cen] = static_cast(f_energy[i]->Get(Form("hEvnAnalysed_Cen%d", cen))); nEvt_[i][cen] = hrefmult_energy[i][cen]->GetEntries(); if (!hLambdaPlus_energy[i][cen]) { std::cerr << "Error: hLambdaPlus_energy[" << i << "][" << cen << "] is null!" << std::endl; } else { Int_Pi_[i][cen] = hLambdaPlus_energy[i][cen]->Integral(); } std::cout << "Nmult " << i << ": " <Integral(); std::cout << "integraal " << i << ": " <SaveAs(Form("%s/%s.pdf",outFile,"all_random_cent0")); TCanvas * cCent_8 =DrawHistogramsForCentrality1(8, hLambdaPlus_energy[i][7], hKPlus_energy[i][7], hXiPlus_energy[i][7],hALambda_energy[i][7], hKMinus_energy[i][7], hXiMinus_energy[i][7],Form("AllPlus_Cen%d",8)); cCent_8->SaveAs(Form("%s/%s.pdf",outFile,"all_random_cent8")); TCanvas * cCent_4 =DrawHistogramsForCentrality1(4, hLambdaPlus_energy[i][4], hKPlus_energy[i][4], hXiPlus_energy[i][4],hALambda_energy[i][4], hKMinus_energy[i][4], hXiMinus_energy[i][4],Form("AllPlus_Cen%d",4)); cCent_4->SaveAs(Form("%s/%s.pdf",outFile,"all_random_cent4")); // results.hLambdaPlus_cent0 = hLambdaPlus_energy[i][0]; // results.hKPlus_cent0 = hKPlus_energy[i][0]; // results.hXiPlus_cent0 = hXiPlus_energy[i][0]; // results.hALambda_cent0 = hALambda_energy[i][0]; // results.hKMinus_cent0 = hKMinus_energy[i][0]; // results.hXiMinus_cent0 = hXiMinus_energy[i][0]; // Set line colors and styles // hLambdaPlus_energy[i][cen]->SetLineColor(colorLambdaPlus); // hLambdaPlus_energy[i][cen]->SetLineStyle(1); // hLambdaPlus_energy[i][cen]->SetLineWidth(lineSize); // hLambdaPlus_energy[i][cen]->SetMarkerStyle(markerStyle); // hLambdaPlus_energy[i][cen]->SetMarkerSize(markerSize); // hLambdaPlus_energy[i][cen]->SetMarkerColor(colorLambdaPlus); // hKPlus_energy[i][cen]->SetLineColor(colorKPlus); // hKPlus_energy[i][cen]->SetLineStyle(2); // hKPlus_energy[i][cen]->SetLineWidth(lineSize); // hKPlus_energy[i][cen]->SetMarkerStyle(markerStyle); // hKPlus_energy[i][cen]->SetMarkerSize(markerSize); // hKPlus_energy[i][cen]->SetMarkerColor(colorKPlus); // hXiPlus_energy[i][cen]->SetLineColor(colorXiPlus); // hXiPlus_energy[i][cen]->SetLineStyle(3); // hXiPlus_energy[i][cen]->SetLineWidth(lineSize); // hXiPlus_energy[i][cen]->SetMarkerStyle(markerStyle); // hXiPlus_energy[i][cen]->SetMarkerSize(markerSize); // hXiPlus_energy[i][cen]->SetMarkerColor(colorXiPlus); // // Draw histograms in the respective canvases // canvasLambdaPlus->cd(); // if (cen == 0) hLambdaPlus_energy[i][cen]->Draw(); // else hLambdaPlus_energy[i][cen]->Draw("SAME"); // canvasKPlus->cd(); // if (cen == 0) hKPlus_energy[i][cen]->Draw(); // else hKPlus_energy[i][cen]->Draw("SAME"); // canvasXiPlus->cd(); // if (cen == 0) hXiPlus_energy[i][cen]->Draw(); // else hXiPlus_energy[i][cen]->Draw("SAME"); } // TCanvas * cLambdaPlus =DrawHistogramOnCanvas(hLambdaPlus_energy[i][0],hLambdaPlus_energy[i][1],hLambdaPlus_energy[i][2],hLambdaPlus_energy[i][3],hLambdaPlus_energy[i][4],hLambdaPlus_energy[i][5],hLambdaPlus_energy[i][6],hLambdaPlus_energy[i][7],hLambdaPlus_energy[i][8], Form("Canvas_LambdaPlus_Cen%d",i)); // TCanvas * cALambda =DrawHistogramOnCanvas(hALambda_energy[i][0],hALambda_energy[i][1],hALambda_energy[i][2],hALambda_energy[i][3],hALambda_energy[i][4],hALambda_energy[i][5],hALambda_energy[i][6],hALambda_energy[i][7],hALambda_energy[i][8], Form("Canvas_ALambda_Cen%d",i)); // TCanvas * cKPlus =DrawHistogramOnCanvas(hKPlus_energy[i][0],hKPlus_energy[i][1],hKPlus_energy[i][2],hKPlus_energy[i][3],hKPlus_energy[i][4],hKPlus_energy[i][5],hKPlus_energy[i][6],hKPlus_energy[i][7],hKPlus_energy[i][8], Form("Canvas_KPlus_Cen%d",i)); // TCanvas * cKMinus =DrawHistogramOnCanvas(hKMinus_energy[i][0],hKMinus_energy[i][1],hKMinus_energy[i][2],hKMinus_energy[i][3],hKMinus_energy[i][4],hKMinus_energy[i][5],hKMinus_energy[i][6],hKMinus_energy[i][7],hKMinus_energy[i][8], Form("Canvas_KMinus_Cen%d",i)); // TCanvas * cXiPlus =DrawHistogramOnCanvas(hXiPlus_energy[i][0],hXiPlus_energy[i][1],hXiPlus_energy[i][2],hXiPlus_energy[i][3],hXiPlus_energy[i][4],hXiPlus_energy[i][5],hXiPlus_energy[i][6],hXiPlus_energy[i][7],hXiPlus_energy[i][8], Form("Canvas_XiPlus_Cen%d",i)); // TCanvas * cXiMinus =DrawHistogramOnCanvas(hXiMinus_energy[i][0],hXiMinus_energy[i][1],hXiMinus_energy[i][2],hXiMinus_energy[i][3],hXiMinus_energy[i][4],hXiMinus_energy[i][5],hXiMinus_energy[i][6],hXiMinus_energy[i][7],hXiMinus_energy[i][8], Form("Canvas_XiMinus_Cen%d",i)); // TCanvas * cRatio_2pads =Draw3HistogramOnCanvas2pads(hLambdaPlus_energy[i][0], hKPlus_energy[i][0], hXiPlus_energy[i][0],hALambda_energy[i][0], hKMinus_energy[i][0], hXiMinus_energy[i][0],hLambdaPlus_energy[i][4], hKPlus_energy[i][4], hXiPlus_energy[i][4],hALambda_energy[i][4], hKMinus_energy[i][4], hXiMinus_energy[i][4],hLambdaPlus_energy[i][7], hKPlus_energy[i][7], hXiPlus_energy[i][7],hALambda_energy[i][7], hKMinus_energy[i][7], hXiMinus_energy[i][7],Form("twopads_ratio_Cen%d_3",0),0); //Draw3HistogramOnCanvas2pads TCanvas * cRatio_2pads =Draw3HistogramNoPads(hLambdaPlus_energy[i][0], hKPlus_energy[i][0], hXiPlus_energy[i][0],hALambda_energy[i][0], hKMinus_energy[i][0], hXiMinus_energy[i][0],hLambdaPlus_energy[i][4], hKPlus_energy[i][4], hXiPlus_energy[i][4],hALambda_energy[i][4], hKMinus_energy[i][4], hXiMinus_energy[i][4],hLambdaPlus_energy[i][7], hKPlus_energy[i][7], hXiPlus_energy[i][7],hALambda_energy[i][7], hKMinus_energy[i][7], hXiMinus_energy[i][7],Form("twopads_ratio_Cen%d_3",0),0); // Create legends // TLegend* legendLambdaPlus = new TLegend(0.7, 0.7, 0.9, 0.9); // legendLambdaPlus->AddEntry(hLambdaPlus_energy[i][0], "Cen 0", "l"); // legendLambdaPlus->AddEntry(hLambdaPlus_energy[i][1], "Cen 1", "l"); // // Add entries for other centralities as needed // TLegend* legendKPlus = new TLegend(0.7, 0.7, 0.9, 0.9); // legendKPlus->AddEntry(hKPlus_energy[i][0], "Cen 0", "l"); // legendKPlus->AddEntry(hKPlus_energy[i][1], "Cen 1", "l"); // // Add entries for other centralities as needed // TLegend* legendXiPlus = new TLegend(0.7, 0.7, 0.9, 0.9); // legendXiPlus->AddEntry(hXiPlus_energy[i][0], "Cen 0", "l"); // legendXiPlus->AddEntry(hXiPlus_energy[i][1], "Cen 1", "l"); // // Add entries for other centralities as needed // Draw legends // canvasLambdaPlus->cd(); // legendLambdaPlus->Draw(); // canvasKPlus->cd(); // legendKPlus->Draw(); // canvasXiPlus->cd(); // legendXiPlus->Draw(); // Save canvases as images or display them // canvasLambdaPlus->SaveAs(Form("Canvas_LambdaPlus_%d.png", i)); // canvasKPlus->SaveAs(Form("Canvas_KPlus_%d.png", i)); // canvasXiPlus->SaveAs(Form("Canvas_XiPlus_%d.png", i)); } // return results; } int main() { const int numFiles = 1; // Change this to the actual number of files you have gStyle->SetOptStat(0); // Open the ROOT file TFile* f_energy[numFiles]; // f_energy[0] = new TFile("/home/zeeshan/root/ResultOut_0allPbPb5p02.root", "READ"); // Change the file name accordingly ResultOut //ResultOut-ws_nohydro_new.root f_energy[0] = new TFile("/home/zeeshan/root/ResultOut_0allPbPb5p02.root", "READ"); // Change the file name accordingly // Call the function DrawAndNormalizeHistograms(f_energy, numFiles); // Close the ROOT file // for (int i = 0; i < numFiles; ++i) { // f_energy[i]->Close(); // delete f_energy[i]; // } return 0; } TCanvas * DrawHistogramOnCanvas(TH1D* h1,TH1D* h2,TH1D* h3,TH1D* h4,TH1D* h5,TH1D* h6,TH1D* h7,TH1D* h8,TH1D* h9, const char* canvasName) { TCanvas* cBB1 = new TCanvas(canvasName, "", 800, 600); cBB1->SetLogy(1); hBB1 = cBB1->DrawFrame(0,0.001,2.6,10000); hBB1->SetXTitle("#it{p}_{T} (GeV/#it{c})"); hBB1->SetYTitle("#frac{1}{2#pi#it{p}_{T}} #frac{d^{2}N}{d#it{p}_{T}dy}(GeV/#it{c})^{-2}"); h1->Draw("same"); //70-100 h2->Draw("same"); //60-70 h3->Draw("same"); //50-60 h4->Draw("same"); //40-50 h5->Draw("same"); //30-40 h6->Draw("same"); //20-30 h7->Draw("same"); //10-20 h8->Draw("same"); //5-10 h9->Draw("same"); //0-5 // h4->Scale(20.0); // h2->Scale(10.0); // setMystyle(h2,h4,h9); // h4->Scale(1); // h3->Scale(1/0.5); // h2->Scale(1/5); h1->SetLineColor(kBlue); h1->SetMarkerColor(kBlue); h1->SetLineWidth(1); h1->SetMarkerSize(1.5); h1->SetMarkerStyle(20); h2->SetLineColor(kRed); h2->SetMarkerColor(kRed); h2->SetLineWidth(1); h2->SetMarkerSize(1.5); h2->SetMarkerStyle(20); h3->SetLineColor(kCyan+2); h3->SetMarkerColor(kCyan+2); h3->SetLineWidth(1); h3->SetMarkerSize(1.5); h3->SetMarkerStyle(20); h4->SetLineColor(kBlue+4); h4->SetMarkerColor(kBlue+4); h4->SetLineWidth(1); h4->SetMarkerSize(1.5); h4->SetMarkerStyle(20); h5->SetLineColor(kRed+2); h5->SetMarkerColor(kRed+2); h5->SetLineWidth(1); h5->SetMarkerSize(1.5); h5->SetMarkerStyle(20); h6->SetLineColor(kCyan+3); h6->SetMarkerColor(kCyan+3); h6->SetLineWidth(1); h6->SetMarkerSize(1.5); h6->SetMarkerStyle(20); h7->SetLineColor(kBlue+3); h7->SetMarkerColor(kBlue+3); h7->SetLineWidth(1); h7->SetMarkerSize(1.5); h7->SetMarkerStyle(20); h8->SetLineColor(kRed+3); h8->SetMarkerColor(kRed+3); h8->SetLineWidth(1); h8->SetMarkerSize(1.5); h8->SetMarkerStyle(20); h9->SetLineColor(kCyan-1); h9->SetMarkerColor(kCyan-1); h9->SetLineWidth(1); h9->SetMarkerSize(1.5); h9->SetMarkerStyle(20); cBB1->Draw(); TLegend* legendLambdaPlus = new TLegend(0.1478697,0.12,0.3483709,0.4608696,NULL,"brNDC"); legendLambdaPlus->SetFillStyle(0); legendLambdaPlus->SetTextSize(0.045); legendLambdaPlus->SetBorderSize(0); legendLambdaPlus->SetLineColor(0); legendLambdaPlus->SetFillColor(0); legendLambdaPlus->SetTextFont(42); legendLambdaPlus->SetHeader("Pb-Pb, #sqrt{#it{s}_{NN}} = 5.02 TeV"); // if(canvasName=="Canvas_LambdaPlus_Cen0"){ legendLambdaPlus->AddEntry(h1, "0-5 %", "pl"); legendLambdaPlus->AddEntry(h2, "5-10 %", "pl"); legendLambdaPlus->AddEntry(h3, "10-20 %", "pl"); legendLambdaPlus->AddEntry(h4, "20-30 %", "pl"); legendLambdaPlus->AddEntry(h5, "30-40 %", "pl"); legendLambdaPlus->AddEntry(h6, "40-50 %", "pl"); legendLambdaPlus->AddEntry(h7, "50-60 %", "pl"); legendLambdaPlus->AddEntry(h8, "60-80 %", "pl"); legendLambdaPlus->AddEntry(h9, "80-100 %", "pl"); legendLambdaPlus->Draw(); return cBB1; } TH1* scale(TH1*hBB2) { hBB2->GetYaxis()->SetTitleSize(0.035); hBB2->GetYaxis()->SetTitleFont(42); hBB2->GetYaxis()->SetTitleOffset(1.65); // Absolute font size in pixel (precision 3) hBB2->GetYaxis()->SetLabelSize(0.03); hBB2->GetYaxis()->SetLabelFont(42); hBB2->GetYaxis()->SetLabelOffset(0.010); // hBB2->GetYaxis()->CenterTitle(); // X axis ratio plot settings // hBB2->GetXaxis()->SetTitle("#it{p}_{T}^{trig} (TeV/#it{c})"); hBB2->GetXaxis()->SetLabelOffset(0.005); hBB2->GetXaxis()->SetLabelSize(0.03); hBB2->GetXaxis()->SetLabelFont(42); // hBB2->GetXaxis()->CenterTitle(); hBB2->GetXaxis()->SetTitleSize(0.035); hBB2->GetXaxis()->SetTitleFont(42); hBB2->GetXaxis()->SetTitleOffset(0.91); //histo->SetPadTickX(1); //histo->SetPadTickY(1); return hBB2; } void setMystyle(TH1D* h1,TH1D* h2,TH1D* h3){ h1->SetLineColor(kBlue); h1->SetMarkerColor(kBlue); h1->SetLineWidth(1); h1->SetMarkerSize(1.5); h1->SetMarkerStyle(20); //h1->GetXaxis()->SetRangeUser(0.512,39.98); h2->SetLineColor(kRed); h2->SetMarkerColor(kRed); h2->SetLineWidth(1); h2->SetMarkerSize(1.5); h2->SetMarkerStyle(24); h3->SetLineColor(kCyan+2); h3->SetMarkerColor(kCyan+2); h3->SetLineWidth(1); h3->SetMarkerSize(1.5); h3->SetMarkerStyle(21); } void SaveHistogramAsText(TH1D* histogram, const char* canvasName,const Char_t * outFile) { // TCanvas* canvas = new TCanvas(canvasName, "", 800, 600); // histogram->Draw(); // canvas->Draw(); const char* directoryPath; // mkdir(directoryPath); TString fileName = Form("%s/%s.txt",outFile,canvasName); std::ofstream outputFile(fileName.Data()); TString histogramName = histogram->GetName(); // Print histogram name on terminal std::cout << "Saving histogram: " << histogramName.Data() << std::endl; outputFile << "HistogramName: " << histogramName << "\n"; // outputFile << "Centrality: " << centrality << "\n"; outputFile << "BinCenter\tBinContent\tBinError\n"; for (int i = 1; i <= histogram->GetNbinsX(); ++i) { outputFile << histogram->GetBinCenter(i) << "\t" << histogram->GetBinContent(i) << "\t" << histogram->GetBinError(i) << "\n"; } outputFile.close(); } TH1D* Pol0functionppbPi(TH1D * obj,Int_t i) { // obj->Draw(); // obj->Fit("pol2", "", "", 0.5, 1.8); obj->Fit("expo", "0", "o", 1.4, 2.0); TH1D * nobj = (TH1D*)obj->Clone("nobj"); for (Int_t bin=obj->GetXaxis()->FindBin(1.4); bin <= obj->GetNbinsX(); bin++){ double bincount = nobj->GetBinError(bin); //std::cout << "bin error before : " << bincount << std::endl; obj->SetBinContent(bin, obj->GetFunction("expo")->Eval(obj->GetXaxis()->GetBinCenter(bin))); double bincount_obj = obj->GetBinError(bin); //std::cout << "bin error after: " << bincount_obj << std::endl; obj->SetBinError(bin, bincount/500);} return obj; } TH1D* Pol0functionppbAS(TH1D * obj,Int_t i) { obj->Fit("expo", "0", "o", 0.6, 6.4); TH1D * nobj = (TH1D*)obj->Clone("nobj"); for (Int_t bin=obj->GetXaxis()->FindBin(0.5); bin <= obj->GetXaxis()->FindBin(2.6); bin++){ double bincount = nobj->GetBinError(bin); //std::cout << "bin error before : " << bincount << std::endl; obj->SetBinContent(bin, obj->GetFunction("expo")->Eval(obj->GetXaxis()->GetBinCenter(bin))); double bincount_obj = obj->GetBinError(bin); //std::cout << "bin error after: " << bincount_obj << std::endl; obj->SetBinError(bin, bincount/500); } return obj; } TH1D* Pol0functionppbNS(TH1D * obj,Int_t i) { obj->Fit("expo", "0", "o", 0.4, 6.5); TH1D * nobj = (TH1D*)obj->Clone("nobj"); for (Int_t bin=obj->GetXaxis()->FindBin(0.7); bin <= obj->GetXaxis()->FindBin(2.6); bin++){ double bincount = nobj->GetBinError(bin); //std::cout << "bin error before : " << bincount << std::endl; obj->SetBinContent(bin, obj->GetFunction("expo")->Eval(obj->GetXaxis()->GetBinCenter(bin))); double bincount_obj = obj->GetBinError(bin); //std::cout << "bin error after: " << bincount_obj << std::endl; obj->SetBinError(bin, bincount/500); } return obj; } TCanvas * DrawHistogramsForCentrality1(int centrality, TH1D* h11, TH1D* h22, TH1D* h33,TH1D* h44, TH1D* h55, TH1D* h66,const char* canvasName) { // Create a canvas TCanvas* cBB1 = new TCanvas(canvasName, "", 800, 600); cBB1->SetLogy(1); cBB1->SetLeftMargin(0.1378446); hBB2 = cBB1->DrawFrame(0,10e-4,3,10000); hBB2->SetXTitle("#it{p}_{T} (GeV/#it{c})"); hBB2->SetYTitle("#frac{1}{#it{N}_{ev}2#pi#it{p}_{T}} #frac{d^{2}N}{d#it{p}_{T}dy}(GeV/#it{c})^{-2}"); //2#pi hBB2=scale(hBB2); // Draw the histograms for plus and minus particles // hLambdaPlus->SetLineColor(kRed); h11->Draw("same"); h44->Draw("same"); h11->SetMarkerSize(1.5); h11->SetLineColor(kBlue); h11->SetMarkerColor(kBlue); h11->SetMarkerStyle(20); h44->SetLineColor(kBlue); h44->SetMarkerColor(kBlue); h44->SetMarkerSize(1.5); h44->SetMarkerStyle(24); // hKPlus->SetLineColor(kBlue); h22->Draw("same"); h55->Draw("same"); h22->SetMarkerSize(1.5); h22->SetLineColor(kRed); h22->SetMarkerColor(kRed); h22->SetMarkerStyle(20); h55->SetLineColor(kRed); h55->SetMarkerColor(kRed); h55->SetMarkerSize(1.5); h55->SetMarkerStyle(24); // hXiPlus->SetLineColor(kCyan); h33->Draw("same"); h66->Draw("same"); h33->SetMarkerSize(1.5); h33->SetLineColor(kCyan+2); h33->SetMarkerColor(kCyan+2); h33->SetMarkerStyle(20); h66->SetLineColor(kCyan+2); h66->SetMarkerColor(kCyan+2); h66->SetMarkerSize(1.5); h66->SetMarkerStyle(24); // hALambda->SetLineColor(kMagenta); // hALambda->Draw("same"); // hKMinus->SetLineColor(kCyan); // hKMinus->Draw("same"); // hXiMinus->SetLineColor(kOrange); // hXiMinus->Draw("same"); // Customize the plot if needed // For example, set title and labels // hLambdaPlus->SetTitle(Form("Energy Histograms for Centrality %d", centrality)); // hLambdaPlus->GetXaxis()->SetTitle("Energy"); // hLambdaPlus->GetYaxis()->SetTitle("Counts"); // Add a legend // TLegend* legend = new TLegend(0.2431078,0.173913,0.5250627,0.373913,NULL,"brNDC"); // TLegend* legend = new TLegend(0.4924812,0.6226087,0.7744361,0.8226087,NULL,"brNDC"); // legend->SetFillStyle(0); // legend->SetTextSize(0.045); // legend->SetBorderSize(0); // legend->SetLineColor(0); // legend->SetFillColor(0); // legend->SetTextFont(42); // legend->SetNColumns(2); if(centrality ==0){ TLegend* legend = new TLegend(0.2431078,0.173913,0.5250627,0.373913,NULL,"brNDC"); legend->SetFillStyle(0); legend->SetTextSize(0.045); legend->SetBorderSize(0); legend->SetLineColor(0); legend->SetFillColor(0); legend->SetTextFont(42); legend->SetNColumns(2); legend->SetHeader("#it{Pb-Pb}, #sqrt{#it{s}_{NN}} = 5.02 TeV, 0#minus5%"); legend->AddEntry(h11, "#lambda^{+} + #lambda^{-}", "pl"); legend->AddEntry(h22, "#Xi^{+} + #Xi^{-}", "pl"); legend->AddEntry(h33, "k^{o}", "pl"); legend->Draw(); } else if(centrality ==4){ TLegend* legend = new TLegend(0.2431078,0.173913,0.5250627,0.373913,NULL,"brNDC"); legend->SetFillStyle(0); legend->SetTextSize(0.045); legend->SetBorderSize(0); legend->SetLineColor(0); legend->SetFillColor(0); legend->SetTextFont(42); legend->SetNColumns(2); legend->SetHeader("#it{Pb-Pb}, #sqrt{#it{s}_{NN}} = 5.02 TeV, 30#minus40%"); legend->AddEntry(h11, "#lambda^{+} + #lambda^{-}", "pl"); legend->AddEntry(h22, "#Xi^{+} + #Xi^{-}", "pl"); legend->AddEntry(h33, "k^{o}", "pl"); legend->Draw(); } else if(centrality ==8){ TLegend* legend = new TLegend(0.4924812,0.6226087,0.7744361,0.8226087,NULL,"brNDC"); legend->SetFillStyle(0); legend->SetTextSize(0.045); legend->SetBorderSize(0); legend->SetLineColor(0); legend->SetFillColor(0); legend->SetTextFont(42); legend->SetNColumns(2); legend->SetHeader("#it{Pb-Pb}, #sqrt{#it{s}_{NN}} = 5.02 TeV, 60#minus80%"); legend->AddEntry(h11, "#lambda^{+} + #lambda^{-}", "pl"); legend->AddEntry(h22, "#Xi^{+} + #Xi^{-}", "pl"); legend->AddEntry(h33, "k^{o}", "pl"); legend->Draw(); } // legend->AddEntry(hALambda, "ALambda", "l"); // legend->AddEntry(hKMinus, "KMinus", "l"); // legend->AddEntry(hXiMinus, "XiMinus", "l"); // legend->Draw(); TLegend* legend2 = new TLegend(0.1716792,0.7426087,0.4536341,0.9426087,NULL,"brNDC"); legend2->SetFillStyle(0); legend2->SetTextSize(0.045); legend2->SetBorderSize(0); legend2->SetLineColor(0); legend2->SetFillColor(0); legend2->SetTextFont(42); legend2->SetNColumns(2); // legend2->SetHeader("#alpha_Cluster"); //legend2->SetHeader("Woods_Saxon"); // legend2->SetHeader("Harmonic_Oscillator"); legend2->Draw(); // Save the plot // TString plotName = Form("EnergyHistograms_Centrality%d.png", centrality); // canvas->SaveAs(plotName); // Clean up // delete canvas; // delete legend; return cBB1; } void DrawHistogramsForCentrality8(int centrality, TH1D* h1, TH1D* h2, TH1D* h3,TH1D* h4, TH1D* h5, TH1D* h6,const char* canvasName) { // Create a canvas TCanvas* cBB1 = new TCanvas(canvasName, "", 800, 600); cBB1->SetLogy(1); hBB2 = cBB1->DrawFrame(0,0.0001,2.6,10000); hBB2->SetXTitle("#it{p}_{T} (GeV/#it{c})"); hBB2->SetYTitle("#frac{1}{#it{N}_{ev}2#pi#it{p}_{T}} #frac{d^{2}N}{d#it{p}_{T}dy}(GeV/#it{c})^{-2}"); // Draw the histograms for plus and minus particles // hLambdaPlus->SetLineColor(kRed); h1->Draw("same"); h4->Draw("same"); h1->SetMarkerSize(1.5); h4->SetLineColor(kBlue); h4->SetMarkerColor(kBlue); h4->SetMarkerSize(1.5); h4->SetMarkerStyle(24); // hKPlus->SetLineColor(kBlue); h2->Draw("same"); h5->Draw("same"); h2->SetMarkerSize(1.5); h5->SetLineColor(kRed); h5->SetMarkerColor(kRed); h5->SetMarkerSize(1.5); h5->SetMarkerStyle(24); // hXiPlus->SetLineColor(kCyan); h3->Draw("same"); h6->Draw("same"); h3->SetMarkerSize(1.5); h6->SetLineColor(kCyan+2); h6->SetMarkerColor(kCyan+2); h6->SetMarkerSize(1.5); h6->SetMarkerStyle(24); // hALambda->SetLineColor(kMagenta); // hALambda->Draw("same"); // hKMinus->SetLineColor(kCyan); // hKMinus->Draw("same"); // hXiMinus->SetLineColor(kOrange); // hXiMinus->Draw("same"); // Customize the plot if needed // For example, set title and labels // hLambdaPlus->SetTitle(Form("Energy Histograms for Centrality %d", centrality)); // hLambdaPlus->GetXaxis()->SetTitle("Energy"); // hLambdaPlus->GetYaxis()->SetTitle("Counts"); // Add a legend TLegend* legend = new TLegend(0.4749373,0.2173913,0.7568922,0.4173913,NULL,"brNDC"); legend->SetFillStyle(0); legend->SetTextSize(0.045); legend->SetBorderSize(0); legend->SetLineColor(0); legend->SetFillColor(0); legend->SetTextFont(42); legend->SetNColumns(2); if(centrality ==0){ legend->SetHeader("Pb-Pb, #sqrt{#it{s}_{NN}} = 5.02 TeV, 0-5%"); legend->AddEntry(h1, "#lambda^{+} + #lambda^{-}", "pl"); legend->AddEntry(h2, "#Xi^{+} + #Xi^{-}", "pl"); legend->AddEntry(h3, "k^{o}", "pl"); } else if(centrality ==8){ legend->SetHeader("Pb-Pb, #sqrt{#it{s}_{NN}} = 5.02 TeV, 60-80%"); legend->AddEntry(h1, "#lambda^{+} + #lambda^{-}", "pl"); legend->AddEntry(h2, "#Xi^{+} + #Xi^{-}", "pl"); legend->AddEntry(h3, "k^{o}", "pl"); } // legend->AddEntry(hALambda, "ALambda", "l"); // legend->AddEntry(hKMinus, "KMinus", "l"); // legend->AddEntry(hXiMinus, "XiMinus", "l"); legend->Draw(); // Save the plot // TString plotName = Form("EnergyHistograms_Centrality%d.png", centrality); // canvas->SaveAs(plotName); // Clean up // delete canvas; // delete legend; } void CreateDir(const Char_t* dirName) { TString pwd(gSystem->pwd()); gSystem->cd(pwd.Data()); if(gSystem->cd(dirName)) { gSystem->cd(pwd.Data()); } else { gSystem->mkdir(dirName, kTRUE); // kTRUE means recursive } } TCanvas * Draw3HistogramOnCanvas2pads(TH1D* h1, TH1D* h2, TH1D* h3, TH1D* h4, TH1D* h5, TH1D* h6,TH1D* h21, TH1D* h22, TH1D* h23, TH1D* h24, TH1D* h25, TH1D* h26,TH1D* h31, TH1D* h32, TH1D* h33, TH1D* h34, TH1D* h35, TH1D* h36, const char* canvasName, int cen) { TCanvas* cBB1 = new TCanvas(canvasName, "", 650, 850); // cBB1->SetMargin(0, 0, 0, 0); cBB1->SetLeftMargin(0); // Define Pad1 (Top) // TPad* pad1 = new TPad("pad1", "pad1", 0.01, 0.67, 0.99, 0.99); //TPad* pad1 = new TPad("pad1", "pad1", 0.01, 0.01, 0.367, 1.0); TPad* pad1 = new TPad("pad1", "pad1", 0.01, 0.01,1.0, 0.367); // pad1->SetMargin(0, 0, 0, 0); pad1->SetLeftMargin(0.12); pad1->SetRightMargin(0.1); pad1->SetBottomMargin(0.14); pad1->SetTopMargin(0); pad1->SetLogy(1); pad1->Draw(); pad1->cd(); hBB1 = pad1->DrawFrame(0,1e-3,3.0,9e3); hBB1=scale(hBB1); hBB1->SetXTitle("#it{p}_{T} (GeV/#it{c})"); // hBB1->SetYTitle("Ratio"); // hBB1->SetYTitle("#frac{1}{2#pi#it{p}_{T}} #frac{d^{2}N}{d#it{p}_{T}dy}(TeV/#it{c})^{-2} "); // h1->Draw("same"); // h2->Draw("same"); // h3->Draw("same"); // h4->Draw("same"); // h5->Draw("same"); // h6->Draw("same"); h31->Draw("same"); h32->Draw("same"); h33->Draw("same"); h34->Draw("same"); h35->Draw("same"); h36->Draw("same"); TLegend* legend1 = new TLegend(0.2767178,0.785335,0.4746851,0.985936,NULL,"brNDC"); legend1->SetFillStyle(0); legend1->SetTextSize(0.045); legend1->SetBorderSize(0); legend1->SetLineColor(0); legend1->SetFillColor(0); legend1->SetTextFont(42); legend1->SetNColumns(2); legend1->AddEntry(h2, "c)", ""); legend1->AddEntry(h1, "60#minus80%", ""); // legend1->AddEntry(h2, "Label2", "l"); legend1->Draw(); // Define Pad2 (Middle) cBB1->cd(); // TPad* pad2 = new TPad("pad2", "pad2", 0.01, 0.34, 0.99, 0.66); //TPad* pad2 = new TPad("pad2", "pad2", 0.367, 0.01, 0.665, 1.0); TPad* pad2 = new TPad("pad2", "pad2",0.01, 0.367,1.0, 0.665); // pad2->SetMargin(0, 0, 0, 0); pad2->SetLeftMargin(0.12); pad2->SetRightMargin(0.1); pad2->SetBottomMargin(0); pad2->SetTopMargin(0); pad2->SetLogy(1); pad2->Draw(); pad2->cd(); hBB2 = pad2->DrawFrame(0.01,7e-2,2.999,9e3); hBB2=scale(hBB2); // hBB2->SetXTitle("#it{p}_{T} (TeV/#it{c})"); // hBB2->SetYTitle("Ratio"); h21->Draw("same"); h22->Draw("same"); h23->Draw("same"); h24->Draw("same"); h25->Draw("same"); h26->Draw("same"); TLegend* legend2 = new TLegend(0.2767178,0.7521672,0.4746851,0.95316,NULL,"brNDC"); legend2->SetFillStyle(0); legend2->SetTextSize(0.045); legend2->SetBorderSize(0); legend2->SetLineColor(0); legend2->SetFillColor(0); legend2->SetTextFont(42); legend2->SetNColumns(2); legend2->AddEntry(h2, "b)", ""); legend2->AddEntry(h1, "30#minus40%", ""); // legend1->AddEntry(h2, "Label2", "l"); legend2->Draw(); // Define Pad3 (upper) cBB1->cd(); // TPad* pad3 = new TPad("pad3", "pad3", 0.01, 0.01, 0.99, 0.33); // TPad* pad3 = new TPad("pad3", "pad3", 0.665, 0.01, 0.985, 1.0); TPad* pad3 = new TPad("pad3", "pad3",0.01, 0.665, 1.0, 0.983); // pad3->SetMargin(0, 0, 0, 0); pad3->SetLeftMargin(0.12); pad3->SetRightMargin(0.1); pad3->SetBottomMargin(0); pad3->SetTopMargin(0); pad3->SetLogy(1); pad3->Draw(); pad3->cd(); hBB3 = pad3->DrawFrame(0.01,7e-2,2.991,9e3); hBB3=scale(hBB3); hBB3->SetXTitle("#it{p}_{T} (GeV/#it{c})"); hBB3->SetYTitle("#frac{1}{#it{N}_{ev}2#pi#it{p}_{T}} #frac{d^{2}N}{d#it{p}_{T}dy}(GeV/#it{c})^{-2} "); // hBB3->SetYTitle("Ratio"); // h31->Draw("same"); // h32->Draw("same"); // h33->Draw("same"); // h34->Draw("same"); // h35->Draw("same"); // h36->Draw("same"); h1->Draw("same"); h2->Draw("same"); h3->Draw("same"); h4->Draw("same"); h5->Draw("same"); h6->Draw("same"); TLegend* legend3 = new TLegend(0.5089787,0.5702961,0.845679,0.8814858,NULL,"brNDC"); legend3->SetFillStyle(0); legend3->SetTextSize(0.045); legend3->SetBorderSize(0); legend3->SetLineColor(0); legend3->SetFillColor(0); legend3->SetTextFont(42); legend3->SetNColumns(2); legend3->SetHeader("Pb-Pb, #sqrt{#it{s}_{NN}} = 5.02 TeV, |y| < 0.5"); legend3->AddEntry(h1, "#lambda^{+} + #lambda^{-}", "pl"); legend3->AddEntry(h2, "#Xi^{+} + #Xi^{-}", "pl"); legend3->AddEntry(h3, "k^{o}", "pl"); legend3->Draw(); TLegend* legend4 = new TLegend(0.2767178,0.766837,0.4746851,0.9674725,NULL,"brNDC"); legend4->SetFillStyle(0); legend4->SetTextSize(0.045); legend4->SetBorderSize(0); legend4->SetLineColor(0); legend4->SetFillColor(0); legend4->SetTextFont(42); legend4->SetNColumns(2); legend4->AddEntry(h2, "a)", ""); legend4->AddEntry(h1, "0#minus5%", ""); // legend1->AddEntry(h2, "Label2", "l"); legend4->Draw(); return cBB1; } TH1D * RebinNewHistograms(TH1D* MCPri,const char* canvasName){ TH1D* RawPi=(TH1D*)MCPri->Clone(Form("%s", canvasName)); double dca_bins[100]; for (int i = 0; i <= 30; i++) dca_bins[i] = 0.1 * i; for (int i = 1; i <= 30; i++) dca_bins[30 + i] = 3 + 0.12 * i; for (int i = 1; i <= 40; i++) dca_bins[60 + i] = 6.6 + 0.15 * i; int nbins_dca = sizeof(dca_bins) / sizeof(*dca_bins) - 1; TH1D *hNewbin = new TH1D("hNewbin", "pT; pT ; Events", nbins_dca, dca_bins); //hm->AddHistogram(histClass, "Mass_Pt_QuadDCAsigXYZ", "", false, nbins_mee, mee_bins, VarManager::kMass, nbins_ptee, ptee_bins, VarManager::kPt, nbins_dca, dca_bins, VarManager::kQuadDCAsigXYZ); for (int j=1 ; j <=RawPi->GetNbinsX();j++) { double x = MCPri->GetBinContent(j); // double z = MCMaterial->GetBinContent(j); double xerror = MCPri->GetBinError(j); //double t =x+y; // double terror =TMath::Sqrt(xerror*xerror+yerror*yerror); // cout<< " primaries ****"<SetBinContent(j,x); hNewbin->SetBinError(j,xerror); } return hNewbin; } TCanvas * Draw3HistogramNoPads(TH1D* h1, TH1D* h2, TH1D* h3, TH1D* h4, TH1D* h5, TH1D* h6,TH1D* h21, TH1D* h22, TH1D* h23, TH1D* h24, TH1D* h25, TH1D* h26,TH1D* h31, TH1D* h32, TH1D* h33, TH1D* h34, TH1D* h35, TH1D* h36, const char* canvasName, int cen) { TCanvas* cBB1 = new TCanvas(canvasName, "", 600, 800); cBB1->SetLogy(1); // cBB1->SetLeftMargin(0.1378446); // cBB1->SetFillColor(0); // cBB1->SetBorderMode(0); // cBB1->SetBorderSize(2); // cBB1->SetLogy(); // cBB1->SetLeftMargin(0.141604); // cBB1->SetRightMargin(0.03007519); // cBB1->SetTopMargin(0.01037037); // cBB1->SetBottomMargin(0.1362963); // cBB1->SetFrameBorderMode(0); // cBB1->SetFrameBorderMode(0); cBB1->SetRightMargin(0.01003344); cBB1->SetTopMargin(0.01003344); cBB1->SetBottomMargin(0.1068744); cBB1->SetLeftMargin(0.1688963); // Define Pad1 (Top) // TPad* pad1 = new TPad("pad1", "pad1", 0.01, 0.67, 0.99, 0.99); //TPad* pad1 = new TPad("pad1", "pad1", 0.01, 0.01, 0.367, 1.0); // TPad* pad1 = new TPad("pad1", "pad1", 0.01, 0.01,1.0, 0.367); // // pad1->SetMargin(0, 0, 0, 0); // pad1->SetLeftMargin(0.12); // pad1->SetRightMargin(0.1); // pad1->SetBottomMargin(0.14); // pad1->SetTopMargin(0); // pad1->SetLogy(1); // pad1->Draw(); // pad1->cd(); hBB1 = cBB1->DrawFrame(0,3e-6,3.199,9e7); hBB1=scale(hBB1); hBB1->SetXTitle("#it{p}_{T} (GeV/#it{c})"); // hBB1->SetYTitle("Ratio"); hBB1->SetYTitle("#frac{1}{2#pi#it{p}_{T}} #frac{d^{2}#it{N}}{d#it{p}_{T}d#it{y}} (GeV/#it{c})^{-2} "); // h1->Draw("same"); // h2->Draw("same"); // h3->Draw("same"); // h4->Draw("same"); // h5->Draw("same"); // h6->Draw("same"); h31->Draw("same"); h32->Draw("same"); h33->Draw("same"); h34->Draw("same"); h35->Draw("same"); h36->Draw("same"); h31->GetXaxis()->SetRangeUser(0,3); h32->GetXaxis()->SetRangeUser(0,3); h33->GetXaxis()->SetRangeUser(0,3); h34->GetXaxis()->SetRangeUser(0,3); h35->GetXaxis()->SetRangeUser(0,3); h36->GetXaxis()->SetRangeUser(0,3); h31->Scale(0.001); h32->Scale(0.001); h33->Scale(0.001); h34->Scale(0.001); h35->Scale(0.001); h36->Scale(0.001); TLegend* legend1 = new TLegend(0.632107,0.1760104,0.8143813,0.3767927,NULL,"brNDC"); legend1->SetFillStyle(0); legend1->SetTextSize(0.035); legend1->SetBorderSize(0); legend1->SetLineColor(0); legend1->SetFillColor(0); legend1->SetTextFont(42); // legend1->SetNColumns(2); // legend1->AddEntry(h2, "c)", ""); legend1->AddEntry(h1, "60#minus80% (#times 10^{-3})", ""); // legend1->AddEntry(h2, "Label2", "l"); legend1->Draw(); // Define Pad2 (Middle) // cBB1->cd(); // // TPad* pad2 = new TPad("pad2", "pad2", 0.01, 0.34, 0.99, 0.66); // //TPad* pad2 = new TPad("pad2", "pad2", 0.367, 0.01, 0.665, 1.0); // TPad* pad2 = new TPad("pad2", "pad2",0.01, 0.367,1.0, 0.665); // // pad2->SetMargin(0, 0, 0, 0); // pad2->SetLeftMargin(0.12); // pad2->SetRightMargin(0.1); // pad2->SetBottomMargin(0); // pad2->SetTopMargin(0); // pad2->SetLogy(1); // pad2->Draw(); // pad2->cd(); // hBB2 = pad2->DrawFrame(0.01,7e-2,2.999,9e3); // hBB2=scale(hBB2); // hBB2->SetXTitle("#it{p}_{T} (TeV/#it{c})"); // hBB2->SetYTitle("Ratio"); h21->Draw("same"); h22->Draw("same"); h23->Draw("same"); h24->Draw("same"); h25->Draw("same"); h26->Draw("same"); h21->GetXaxis()->SetRangeUser(0,3); h22->GetXaxis()->SetRangeUser(0,3); h23->GetXaxis()->SetRangeUser(0,3); h24->GetXaxis()->SetRangeUser(0,3); h25->GetXaxis()->SetRangeUser(0,3); h26->GetXaxis()->SetRangeUser(0,3); // h21->Scale(0.01); // h22->Scale(0.01); // h23->Scale(0.01); // h24->Scale(0.01); // h25->Scale(0.01); // h26->Scale(0.01); TLegend* legend2 = new TLegend(0.632107,0.4146023,0.8143813,0.6166884,NULL,"brNDC"); legend2->SetFillStyle(0); legend2->SetTextSize(0.035); legend2->SetBorderSize(0); legend2->SetLineColor(0); legend2->SetFillColor(0); legend2->SetTextFont(42); // legend2->SetNColumns(2); // legend2->AddEntry(h2, "b)", ""); legend2->AddEntry(h1, "30#minus40%", ""); // legend1->AddEntry(h2, "Label2", "l"); legend2->Draw(); // Define Pad3 (upper) // cBB1->cd(); // // TPad* pad3 = new TPad("pad3", "pad3", 0.01, 0.01, 0.99, 0.33); // // TPad* pad3 = new TPad("pad3", "pad3", 0.665, 0.01, 0.985, 1.0); // TPad* pad3 = new TPad("pad3", "pad3",0.01, 0.665, 1.0, 0.983); // // pad3->SetMargin(0, 0, 0, 0); // pad3->SetLeftMargin(0.12); // pad3->SetRightMargin(0.1); // pad3->SetBottomMargin(0); // pad3->SetTopMargin(0); // pad3->SetLogy(1); // pad3->Draw(); // pad3->cd(); // hBB3 = pad3->DrawFrame(0.01,7e-2,2.991,9e3); // hBB3=scale(hBB3); // hBB3->SetXTitle("#it{p}_{T} (TeV/#it{c})"); // hBB3->SetYTitle("#frac{1}{#it{N}_{ev}2#pi#it{p}_{T}} #frac{d^{2}N}{d#it{p}_{T}dy}(TeV/#it{c})^{-2} "); // hBB3->SetYTitle("Ratio"); // h31->Draw("same"); // h32->Draw("same"); // h33->Draw("same"); // h34->Draw("same"); // h35->Draw("same"); // h36->Draw("same"); h1->Draw("same"); h2->Draw("same"); h3->Draw("same"); h4->Draw("same"); h5->Draw("same"); h6->Draw("same"); h1->Scale(1000); h2->Scale(1000); h3->Scale(1000); h4->Scale(1000); h5->Scale(1000); h6->Scale(1000); h1->GetXaxis()->SetRangeUser(0,3); h2->GetXaxis()->SetRangeUser(0,3); h3->GetXaxis()->SetRangeUser(0,3); h4->GetXaxis()->SetRangeUser(0,3); h5->GetXaxis()->SetRangeUser(0,3); h6->GetXaxis()->SetRangeUser(0,3); TLegend* legend3 = new TLegend(0.5351171,0.8372703,0.8712375,0.9685039,NULL,"brNDC"); legend3->SetFillStyle(0); legend3->SetTextSize(0.035); legend3->SetBorderSize(0); legend3->SetLineColor(0); legend3->SetFillColor(0); legend3->SetTextFont(42); legend3->SetNColumns(2); legend3->SetHeader("#it{Pb-Pb}, #sqrt{#it{s}_{NN}} = 5.02 TeV, #left|#it{y}#right| < 0.5"); //#left|#eta#right| legend3->AddEntry(h1, "#lambda^{+} + #lambda^{-}", "pl"); legend3->AddEntry(h2, "#Xi^{+} + #Xi^{-}", "pl"); legend3->AddEntry(h3, "k^{o}", "pl"); legend3->Draw(); TLegend* legend4 = new TLegend(0.632107,0.6453716,0.8143813,0.8461538,NULL,"brNDC"); legend4->SetFillStyle(0); legend4->SetTextSize(0.035); legend4->SetBorderSize(0); legend4->SetLineColor(0); legend4->SetFillColor(0); legend4->SetTextFont(42); // legend4->SetNColumns(2); // legend4->AddEntry(h2, "a)", ""); legend4->AddEntry(h1, "0#minus5% (#times 20)", ""); // legend1->AddEntry(h2, "Label2", "l"); legend4->Draw(); return cBB1; }