Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:41

0001 // 
0002 // Make combined acceptance plots of all 3 UPC Modes
0003 //
0004 //
0005 
0006 void plot_acceptance()
0007 {
0008   // Open up the 3 files with the saved histograms
0009   // and get the histograms
0010   const int NMODES = 3;
0011   const char* mode_dir[NMODES] = { "PROD1", "PROD2", "PROD4" };
0012   TFile *tfile[NMODES];
0013   TString name;
0014 
0015   TH1 *h_rap[NMODES];
0016   TH1 *h_rap_sphenix[NMODES];
0017   TH1 *h_rap_total;               // all 3 modes summed
0018   TH1 *h_rap_sphenix_total;
0019 
0020   // Loop over the prod_modes
0021   for (int imode=0; imode<NMODES; imode++)
0022   {
0023     // Open up the TFile
0024     name = mode_dir[imode]; name += "/upc_starlight.root";
0025     tfile[imode] = new TFile(name,"READ");
0026 
0027     // Now get the histograms
0028     h_rap[imode] = (TH1*)tfile[imode]->Get("h_rap");
0029     h_rap_sphenix[imode] = (TH1*)tfile[imode]->Get("h_rap_sphenix");
0030   }
0031 
0032   // Create the total histogram (sum of all 3 modes)
0033   h_rap_total = (TH1*)h_rap[0]->Clone("h_rap_total");
0034   h_rap_total->Add( h_rap[1] );
0035   h_rap_total->Add( h_rap[2] );
0036 
0037   h_rap_sphenix_total = (TH1*)h_rap[0]->Clone("h_rap_sphenix_total");
0038   h_rap_sphenix_total->Add( h_rap_sphenix[1] );
0039   h_rap_sphenix_total->Add( h_rap_sphenix[2] );
0040 
0041   // Plot the rapidity acceptance from all 3 modes combined
0042   TCanvas *c_rap = new TCanvas("c_rap","Rapidity",550,425);
0043   h_rap_total->Draw("ehist");
0044   h_rap_sphenix_total->SetLineColor(kBlue);
0045   h_rap_sphenix_total->SetMarkerColor(kBlue);
0046   h_rap_sphenix_total->Draw("ehistsame");
0047 }
0048