Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plot_acceptance.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plot_acceptance.C
1 //
2 // Make combined acceptance plots of all 3 UPC Modes
3 //
4 //
5 
7 {
8  // Open up the 3 files with the saved histograms
9  // and get the histograms
10  const int NMODES = 3;
11  const char* mode_dir[NMODES] = { "PROD1", "PROD2", "PROD4" };
12  TFile *tfile[NMODES];
13  TString name;
14 
15  TH1 *h_rap[NMODES];
16  TH1 *h_rap_sphenix[NMODES];
17  TH1 *h_rap_total; // all 3 modes summed
18  TH1 *h_rap_sphenix_total;
19 
20  // Loop over the prod_modes
21  for (int imode=0; imode<NMODES; imode++)
22  {
23  // Open up the TFile
24  name = mode_dir[imode]; name += "/upc_starlight.root";
25  tfile[imode] = new TFile(name,"READ");
26 
27  // Now get the histograms
28  h_rap[imode] = (TH1*)tfile[imode]->Get("h_rap");
29  h_rap_sphenix[imode] = (TH1*)tfile[imode]->Get("h_rap_sphenix");
30  }
31 
32  // Create the total histogram (sum of all 3 modes)
33  h_rap_total = (TH1*)h_rap[0]->Clone("h_rap_total");
34  h_rap_total->Add( h_rap[1] );
35  h_rap_total->Add( h_rap[2] );
36 
37  h_rap_sphenix_total = (TH1*)h_rap[0]->Clone("h_rap_sphenix_total");
38  h_rap_sphenix_total->Add( h_rap_sphenix[1] );
39  h_rap_sphenix_total->Add( h_rap_sphenix[2] );
40 
41  // Plot the rapidity acceptance from all 3 modes combined
42  TCanvas *c_rap = new TCanvas("c_rap","Rapidity",550,425);
43  h_rap_total->Draw("ehist");
44  h_rap_sphenix_total->SetLineColor(kBlue);
45  h_rap_sphenix_total->SetMarkerColor(kBlue);
46  h_rap_sphenix_total->Draw("ehistsame");
47 }
48