Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:19

0001 #include "sPhenixStyle.h"
0002 #include "sPhenixStyle.C"
0003 #include <iostream>
0004 #include "utilities.h"
0005 #include <TGraphErrors.h>
0006 #include <TRandom3.h>
0007 
0008 void High_pt_bins() 
0009 {
0010 
0011 
0012   SetsPhenixStyle();
0013   TH1::SetDefaultSumw2();
0014   TH2::SetDefaultSumw2();
0015 
0016   using namespace std;{
0017 
0018     gStyle->SetOptStat();
0019 
0020   
0021     TFile * fin = TFile::Open("../macro/condorTest/output_data3cut.root");  
0022     TH1F * _h_R04_z_g_10_20 = (TH1F*)fin->Get("R04_z_g_10_20");
0023     _h_R04_z_g_10_20->Sumw2(); // Enable Sumw2 for this histogram
0024     TH1F * _h_R04_theta_g_10_20 = (TH1F*)fin->Get("R04_theta_g_10_20");
0025     _h_R04_theta_g_10_20->Sumw2(); // Enable Sumw2 for this histogram
0026     //    TFile * fun = TFile::Open("../macro/condorTest/EMTree_0000.root");  
0027     TH1F * _h_R04_z_sj_10_20 = (TH1F*)fin->Get("R04_z_sj_10_20");
0028     _h_R04_z_sj_10_20->Sumw2(); // Enable Sumw2 for this histogram
0029     TH1F * _h_R04_theta_sj_10_20 = (TH1F*)fin->Get("R04_theta_sj_10_20");
0030     _h_R04_theta_sj_10_20->Sumw2(); // Enable Sumw2 for this histogram
0031     TH2D * correlation_theta_10_20 = (TH2D*)fin->Get("correlation_theta_10_20");
0032     TH2D * correlation_z_10_20 = (TH2D*)fin->Get("correlation_z_10_20");
0033 
0034     std::cout << "number of jets:" << _h_R04_z_sj_10_20->Integral() << std::endl;
0035     // Normalize 10-20 hists                                                                                                                                            
0036     _h_R04_z_sj_10_20->Scale(1./_h_R04_z_sj_10_20->Integral());                                                                                                         
0037     _h_R04_theta_sj_10_20->Scale(1./_h_R04_theta_sj_10_20->Integral());
0038     _h_R04_z_sj_10_20->Scale(1./0.05);  
0039     _h_R04_theta_sj_10_20->Scale(1./0.05);                                                                                                                                 
0040     //SoftDrop Normalization                                                                                                                                            
0041     // Normalize 10-20 hists                                                                                                                                            
0042     _h_R04_z_g_10_20->Scale(1./_h_R04_z_g_10_20->Integral());                                                                                                           
0043     _h_R04_theta_g_10_20->Scale(1./_h_R04_theta_g_10_20->Integral());                                                                                                  
0044     _h_R04_z_g_10_20->Scale(1./0.05);   
0045     _h_R04_theta_g_10_20->Scale(1./0.05); 
0046 
0047   TCanvas * Spectra04 = new TCanvas("Spectra04", " ", 500, 500);
0048 
0049   gStyle->SetErrorX();
0050   gPad->SetTickx();
0051   gPad->SetTicky();
0052    
0053     _h_R04_z_sj_10_20->SetMarkerStyle(20);
0054     _h_R04_z_sj_10_20->SetMarkerColor(4);
0055     _h_R04_z_sj_10_20->SetTitle("Momentum Fraction z_{sj} Between Subjets");
0056     _h_R04_z_sj_10_20->SetXTitle("z_{sj}");
0057     _h_R04_z_sj_10_20->SetYTitle("(1/N_{jet}) dN/dz_{sj}");
0058     _h_R04_z_sj_10_20->GetXaxis()->SetTitleSize(0.05);
0059     _h_R04_z_sj_10_20->GetXaxis()->CenterTitle(true);
0060     _h_R04_z_sj_10_20->GetXaxis()->SetLabelSize(0.03);
0061     _h_R04_z_sj_10_20->GetYaxis()->SetLabelSize(0.03);
0062     _h_R04_z_sj_10_20->GetXaxis()->SetTitleSize(0.05);
0063     _h_R04_z_sj_10_20->SetAxisRange(0, 15, "Y");
0064     _h_R04_z_sj_10_20->SetAxisRange(0, 0.5, "X");
0065     _h_R04_z_sj_10_20->SetMarkerSize(1.0);
0066     _h_R04_z_sj_10_20->Draw("p E1 same");
0067     //    _h_R04_z_sj_10_20->Draw(" ");
0068   
0069     drawText("Au+Au #sqrt{s} = 200 GeV", 0.25, 0.87, 14);
0070     drawText("anti-k_{T} R=0.4 jets, |#eta_{jet}| < 0.6", 0.25, 0.84, 14);
0071     drawText("R_{sj}=0.1", 0.25, 0.81, 14);
0072     drawText("10 < p_{T} < 20 [GeV/c]", 0.25, 0.77, 14);
0073     drawText("#it{#bf{sPHENIX}} Preliminary", 0.25, 0.74, 14);
0074     // Create a TGraphErrors for error bars
0075     int nbins30 = _h_R04_z_sj_10_20->GetNbinsX();
0076     double* x30 = new double[nbins30];
0077     double* y30 = new double[nbins30];
0078     double* ex30 = new double[nbins30];
0079     double* ey30 = new double[nbins30];
0080     for (int i = 1; i <= nbins30; ++i) {
0081       x30[i - 1] = _h_R04_z_sj_10_20->GetBinCenter(i);
0082       y30[i - 1] = _h_R04_z_sj_10_20->GetBinContent(i);
0083       ex30[i - 1] = 0.0; // Assumes uniform bin width
0084       ey30[i - 1] = _h_R04_z_sj_10_20->GetBinError(i);
0085     }
0086     TGraphErrors* errorGraph30 = new TGraphErrors(nbins30, x30, y30, ex30, ey30);
0087     errorGraph30->SetMarkerStyle(20);
0088     errorGraph30->SetMarkerColor(4);
0089     errorGraph30->Draw("p same");
0090     Spectra04->SaveAs("Momentum_Frac_10_20_R04_data.pdf", "RECREATE");
0091 
0092 
0093 
0094     TCanvas * Theta_sj = new TCanvas("Theta_sj", " ", 500, 500);
0095    
0096     gStyle->SetErrorX(0);
0097     gPad->SetTickx();
0098     gPad->SetTicky();
0099     _h_R04_theta_sj_10_20->SetMarkerStyle(20);
0100     _h_R04_theta_sj_10_20->SetMarkerColor(4);
0101     _h_R04_theta_sj_10_20->SetMarkerSize(1.0);
0102     _h_R04_theta_sj_10_20->SetTitle("Opening Angle #theta_{sj} Between Subjets ");
0103     _h_R04_theta_sj_10_20->SetYTitle("(1/N_{jet}) dN/d#theta_{sj}");
0104     _h_R04_theta_sj_10_20->SetXTitle("#theta_{sj}");
0105     _h_R04_theta_sj_10_20->GetXaxis()->SetTitleSize(0.05);
0106     _h_R04_theta_sj_10_20->GetXaxis()->CenterTitle(true);
0107     _h_R04_theta_sj_10_20->GetXaxis()->SetLabelSize(0.03);
0108     _h_R04_theta_sj_10_20->GetYaxis()->SetLabelSize(0.03);
0109     _h_R04_theta_sj_10_20->GetXaxis()->SetTitleSize(0.05);
0110     _h_R04_theta_sj_10_20->SetAxisRange(0, 6.5, "Y");
0111     _h_R04_theta_sj_10_20->SetAxisRange(0, 0.5, "X");
0112     _h_R04_theta_sj_10_20->Draw("p E1 same");
0113     // _h_R04_theta_sj_10_20->Draw(" ");
0114     drawText("Au+Au #sqrt{s} = 200 GeV", 0.25, 0.87, 14);
0115     drawText("anti-k_{T} R=0.4 jets, |#eta_{jet}| < 0.6", 0.25, 0.84, 14);
0116     drawText("R_{sj}=0.1", 0.25, 0.81, 14);
0117     drawText("10 < p_{T} < 20 [GeV/c]", 0.25, 0.77, 14);
0118     drawText("#it{#bf{sPHENIX}} Preliminary", 0.25, 0.74, 14);
0119     // Create a TGraphErrors for error bars
0120     int nbins30t = _h_R04_theta_sj_10_20->GetNbinsX();
0121     double* x30t = new double[nbins30t];
0122     double* y30t = new double[nbins30t];
0123     double* ex30t = new double[nbins30t];
0124     double* ey30t = new double[nbins30t];
0125     for (int i = 1; i <= nbins30t; ++i) {
0126       x30t[i - 1] = _h_R04_theta_sj_10_20->GetBinCenter(i);
0127       y30t[i - 1] = _h_R04_theta_sj_10_20->GetBinContent(i);
0128       ex30t[i - 1] = 0.0; // Assumes uniform bin width
0129       ey30t[i - 1] = _h_R04_theta_sj_10_20->GetBinError(i);
0130     }
0131     TGraphErrors* errorGraph30t = new TGraphErrors(nbins30t, x30t, y30t, ex30t, ey30t);
0132     errorGraph30t->SetMarkerStyle(20);
0133     errorGraph30t->SetMarkerColor(4);
0134     errorGraph30t->Draw("p same");
0135 
0136   
0137     Theta_sj->SaveAs("Radius_sj_10_20_R04_data.pdf", "RECREATE");
0138 
0139     TCanvas * Groomed_frac = new TCanvas("Groomed_frac"," ", 500, 500);
0140     
0141     gStyle->SetErrorX(0);
0142     gPad->SetTickx();
0143     gPad->SetTicky();
0144     _h_R04_z_g_10_20->SetMarkerStyle(20);
0145     _h_R04_z_g_10_20->SetMarkerColor(2);
0146     _h_R04_z_g_10_20->SetTitle("Groomed Momentum Fraction Between Subjets");
0147     _h_R04_z_g_10_20->SetXTitle("z_{g}");
0148     _h_R04_z_g_10_20->SetYTitle("(1/N_{jet}) dN/dz_{g}");;
0149     _h_R04_z_g_10_20->GetXaxis()->SetTitleSize(0.05);
0150     _h_R04_z_g_10_20->GetXaxis()->CenterTitle(true);
0151     _h_R04_z_g_10_20->GetXaxis()->SetLabelSize(0.03);
0152     _h_R04_z_g_10_20->GetYaxis()->SetLabelSize(0.03);
0153     _h_R04_z_g_10_20->GetXaxis()->SetTitleSize(0.05);
0154     _h_R04_z_g_10_20->SetAxisRange(0, 4.5, "Y");
0155     _h_R04_z_g_10_20->SetAxisRange(0, 0.5, "X");
0156     _h_R04_z_g_10_20->SetMarkerSize(1.0);
0157     _h_R04_z_g_10_20->Draw("p E1 same");
0158     // _h_R04_z_g_10_20->Draw(" ");
0159   
0160     drawText("Au+Au #sqrt{s} = 200 GeV", 0.25, 0.87, 14);
0161     drawText("anti-k_{T} R=0.4 jets, |#eta_{jet}| < 0.6", 0.25, 0.84, 14);
0162     drawText("#beta=2.0, z_{cut}=0.3", 0.25, 0.81, 14);
0163     drawText("10 < p_{T} < 20 [GeV/c]", 0.25, 0.77, 14);
0164     drawText("#it{#bf{sPHENIX}} Preliminary", 0.25, 0.74, 14);
0165     // Create a TGraphErrors for error bars
0166     int nbins30zg = _h_R04_z_g_10_20->GetNbinsX();
0167     double* x30zg = new double[nbins30zg];
0168     double* y30zg = new double[nbins30zg];
0169     double* ex30zg = new double[nbins30zg];
0170     double* ey30zg = new double[nbins30zg];
0171     for (int i = 1; i <= nbins30zg; ++i) {
0172       x30zg[i - 1] = _h_R04_z_g_10_20->GetBinCenter(i);
0173       y30zg[i - 1] = _h_R04_z_g_10_20->GetBinContent(i);
0174       ex30zg[i - 1] = 0.0; // Assumes uniform bin width
0175       ey30zg[i - 1] = _h_R04_z_g_10_20->GetBinError(i);
0176     }
0177     TGraphErrors* errorGraph30zg = new TGraphErrors(nbins30zg, x30zg, y30zg, ex30zg, ey30zg);
0178     errorGraph30zg->SetMarkerStyle(20);
0179     errorGraph30zg->SetMarkerColor(2);
0180     errorGraph30zg->Draw("p same");
0181 
0182     Groomed_frac->SaveAs("Groomed_frac_10_20_R04_data.pdf","RECREATE");
0183 
0184 
0185     TCanvas * Groomed_rad = new TCanvas("Groomed_rad"," ", 500, 500);
0186     gStyle->SetErrorX(0);
0187     gPad->SetTickx();
0188     gPad->SetTicky();
0189     _h_R04_theta_g_10_20->SetMarkerStyle(20);
0190     _h_R04_theta_g_10_20->SetMarkerColor(2);
0191     _h_R04_theta_g_10_20->SetMarkerSize(1.0);
0192     _h_R04_theta_g_10_20->SetTitle("Groomed Radius R_{g} Between Subjets");
0193     _h_R04_theta_g_10_20->SetYTitle("(1/N_{jet}) dN/d#theta_{g}");
0194     _h_R04_theta_g_10_20->SetXTitle("R_{g}");
0195     _h_R04_theta_g_10_20->GetXaxis()->SetTitleSize(0.05);
0196     _h_R04_theta_g_10_20->GetXaxis()->CenterTitle(true);
0197     _h_R04_theta_g_10_20->GetXaxis()->SetLabelSize(0.03);
0198     _h_R04_theta_g_10_20->GetYaxis()->SetLabelSize(0.03);
0199     _h_R04_theta_g_10_20->GetXaxis()->SetTitleSize(0.05);
0200     _h_R04_theta_g_10_20->SetAxisRange(0, 6.5, "Y");
0201     _h_R04_theta_g_10_20->SetAxisRange(0, 0.5, "X");
0202     _h_R04_theta_g_10_20->Draw("p E1 same");
0203      // _h_R04_theta_g_10_20->Draw(" ");
0204     drawText("Au+Au #sqrt{s} = 200 GeV", 0.25, 0.87, 14);
0205     drawText("anti-k_{T} R=0.4 jets, |#eta_{jet}| < 0.6", 0.25, 0.84, 14);
0206     drawText("#beta=2.0, z_{cut}=0.3", 0.25, 0.81, 14);
0207     drawText("10 < p_{T} < 20 GeV/c", 0.25, 0.77, 14);
0208     drawText("#it{#bf{sPHENIX}} Preliminary", 0.25, 0.74, 14);
0209 
0210     // Create a TGraphErrors for error bars
0211     int nbins30tgt = _h_R04_theta_g_10_20->GetNbinsX();
0212     double* x30gt = new double[nbins30tgt];
0213     double* y30gt = new double[nbins30tgt];
0214     double* ex30gt = new double[nbins30tgt];
0215     double* ey30gt = new double[nbins30tgt];
0216     for (int i = 1; i <= nbins30tgt; ++i) {
0217       x30gt[i - 1] = _h_R04_theta_g_10_20->GetBinCenter(i);
0218       y30gt[i - 1] = _h_R04_theta_g_10_20->GetBinContent(i);
0219       // ex30tt[i - 1] = _h_R04_theta_g_10_20->GetBinWidth(i) / 2.0; // Assumes uniform bin width
0220       ex30gt[i - 1] = 0.0;
0221       ey30gt[i - 1] = _h_R04_theta_g_10_20->GetBinError(i);
0222     }
0223     TGraphErrors* errorGraph30gt = new TGraphErrors(nbins30tgt, x30gt, y30gt, ex30gt, ey30gt);
0224     errorGraph30gt->SetMarkerStyle(20);
0225     errorGraph30gt->SetMarkerColor(2);
0226     errorGraph30gt->Draw("p same");
0227     Groomed_rad->SaveAs("Groomed_rad_10_20_R04_data.pdf", "RECREATE");
0228 
0229     TCanvas * canvas = new TCanvas("canvas", " ", 500, 500);
0230     gStyle->SetErrorX(0);
0231     gPad->SetTickx();
0232     gPad->SetTicky();   
0233     correlation_z_10_20->SetMarkerStyle(20);
0234     correlation_z_10_20->SetMarkerColor(2);
0235     correlation_z_10_20->SetMarkerSize(1.0);
0236     correlation_z_10_20->GetXaxis()->SetTitleSize(0.05);
0237     correlation_z_10_20->GetXaxis()->CenterTitle(true);
0238     correlation_z_10_20->GetXaxis()->SetLabelSize(0.03);
0239     correlation_z_10_20->GetYaxis()->SetLabelSize(0.03);
0240     correlation_z_10_20->GetXaxis()->SetTitleSize(0.05);
0241     correlation_z_10_20->SetAxisRange(0, 0.6, "Y");
0242     correlation_z_10_20->SetAxisRange(0, 0.5, "X");
0243     correlation_z_10_20->SetXTitle("z_{g}");
0244     correlation_z_10_20->SetYTitle("z_{sj}");
0245     correlation_z_10_20->SetTitle("Correlation Between z_{sj} & z_{g} ");
0246     correlation_z_10_20->Draw("colz"); // Use "colz" option to draw the color map
0247     drawText("Au+Au #sqrt{s} = 200 GeV", 0.2, 0.30, 14);
0248     drawText("anti-k_{T} R=0.4 jets, |#eta_{jet}| < 0.6", 0.2, 0.27, 14);
0249     drawText("#beta=2.0, z_{cut}=0.3", 0.2, 0.24, 14);
0250     drawText("10 < p_{T} < 20 GeV/c", 0.2, 0.21, 14);
0251     drawText("#it{#bf{sPHENIX}} Preliminary", 0.2, 0.17, 14);
0252 
0253     canvas->SaveAs("Correlation_moment_fracR04_data.pdf","RECREATE");
0254 
0255     TCanvas * canvas1 = new TCanvas("canvas1"," ", 500, 500);
0256     gStyle->SetErrorX(0);
0257     gPad->SetTickx();
0258     gPad->SetTicky();
0259    
0260     correlation_theta_10_20->SetMarkerStyle(20);
0261     correlation_theta_10_20->SetMarkerColor(2);
0262     correlation_theta_10_20->SetMarkerSize(1.0);
0263     correlation_theta_10_20->SetTitle(" ");
0264     correlation_theta_10_20->GetXaxis()->SetTitleSize(0.05);
0265     correlation_theta_10_20->GetXaxis()->CenterTitle(true);
0266     correlation_theta_10_20->GetXaxis()->SetLabelSize(0.03);
0267     correlation_theta_10_20->GetYaxis()->SetLabelSize(0.03);
0268     correlation_theta_10_20->SetAxisRange(0, 0.5, "Y");
0269     correlation_theta_10_20->SetAxisRange(0, 0.5, "X");
0270     correlation_theta_10_20->SetXTitle("R_{g}");
0271     // correlation_theta_10_20->SetYTitle("#theta_{sj}");
0272     correlation_theta_10_20->SetTitle("Correlation Between #theta_{sj} & R_{g}");
0273     correlation_theta_10_20->Draw("colz"); // Use "colz" option to draw the color map
0274     drawText("Au+Au #sqrt{s} = 200 GeV", 0.2, 0.89, 14);
0275     drawText("anti-k_{T} R=0.4 jets, |#eta_{jet}| < 0.6", 0.2, 0.86, 14);
0276     drawText("#beta=2.0, z_{cut}=0.3", 0.2, 0.83, 14);
0277     drawText("10 < p_{T} < 20 GeV/c", 0.2, 0.80, 14);
0278     drawText("#it{#bf{sPHENIX}} Preliminary", 0.2, 0.76, 14);
0279    
0280     canvas1->SaveAs("Corellation_radialR04_data.pdf", "RECREATE");
0281    
0282   }
0283 
0284 }
0285