Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plot_total_plusbkg.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plot_total_plusbkg.C
1 // plot the total (signal plus bkg) that we expect, where signal = UPC (starlight) and background = Au+Au collisions (Hijing)
2 
3 
5 {
6  gStyle->SetOptStat(0);
7 
8  TFile *upcfile = new TFile("AcceptanceMRP.root","READ");
9  TH1 *h_InvMass_smeared_sphenix_total = (TH1*)upcfile->Get("h_InvMass_smeared_sphenix_total");
10  TH1 *h_pt_sphenix_total = (TH1*)upcfile->Get("h_pt_sphenix_total");
11  TH1 *h_rapt_sphenix_total = (TH1*)upcfile->Get("h_rapt_sphenix_total");
12 
13  TFile *hijbkgfile = new TFile("hijbkg_results.root","READ");
14  TH1 *he_mass = (TH1*)hijbkgfile->Get("he_mass");
15  TH1 *he_eta = (TH1*)hijbkgfile->Get("he_eta"); // should be rapidity
16  TH1 *he_pt = (TH1*)hijbkgfile->Get("he_pt");
17 
18  // Scale to integ lumi = 4.7/nb
19  double nevt_hij = 3333315. + 3716246. + 3313128.; // number of hijing events simulated
20  double sigma_auau = 7.2; // au+au cross-section [barns]
21  double integ_lumi = 4.7e9; // target integrated luminosity
22  double lumi_scale = (sigma_auau*integ_lumi)/nevt_hij;
23  cout << "lumi scaled " << lumi_scale << endl;
24  he_mass->Sumw2();
25  he_mass->Scale( lumi_scale );
26 
27  float markersize = 0.7;
28 
29  // Kludge - take out the first 0.6 GeV of mass
30  int minbin = he_mass->FindBin( 0.6 );
31  for ( int ibin=1; ibin<=minbin; ibin++ )
32  {
33  he_mass->SetBinContent( ibin, 0. );
34  }
35 
36  // Add the UPC total to the background
37  TH1 *h_InvMass_smeared_sphenix_totalbkg = (TH1*)h_InvMass_smeared_sphenix_total->Clone("h_InvMass_smeared_sphenix_totalbkg");
38  h_InvMass_smeared_sphenix_totalbkg->Add( he_mass );
39 
40  TCanvas *c_mass_total = new TCanvas("c_mass_total","Invariant Mass",550,425);
41  h_InvMass_smeared_sphenix_totalbkg->SetLineColor(kBlack);
42  h_InvMass_smeared_sphenix_totalbkg->SetMarkerColor(kBlack);
43  h_InvMass_smeared_sphenix_totalbkg->SetMarkerStyle(20);
44  h_InvMass_smeared_sphenix_totalbkg->SetMarkerSize( markersize );
45  h_InvMass_smeared_sphenix_totalbkg->Draw("ehist");
46 
47  he_mass->SetLineColor(kRed);
48  he_mass->SetMarkerColor(kRed);
49  he_mass->SetMarkerSize( markersize );
50  he_mass->SetMarkerStyle( 20 );
51  he_mass->Draw( "ecsame" );
52 
53  h_InvMass_smeared_sphenix_total->SetLineColor(kBlue);
54  h_InvMass_smeared_sphenix_total->SetMarkerColor(kBlue);
55  h_InvMass_smeared_sphenix_total->SetMarkerStyle( 20 );
56  h_InvMass_smeared_sphenix_total->SetMarkerSize( markersize );
57  h_InvMass_smeared_sphenix_total->SetFillStyle( 1001 );
58  h_InvMass_smeared_sphenix_total->SetFillColor( 7 );
59  h_InvMass_smeared_sphenix_total->Draw("ehistsame");
60 
61  h_InvMass_smeared_sphenix_totalbkg->Draw("ehistsame");
62  //gPad->SetLogy( 1 );
63 
64  // Calculate the total counts in the j/psi mass windows
65  int minjbin = he_mass->FindBin( 3.2 );
66  int maxjbin = he_mass->FindBin( 3.31 );
67  double upcj = 0.; // num upc j/psi
68  double upcjerr = 0.; // err on upc j/psi counts
69  double hijj = 0.; // num hij with 2 tracks in j/psi mass window
70  double hijjerr = 0.; // err on hij counts
71 
72  for (int ibin=minjbin; ibin<=maxjbin; ibin++)
73  {
74  upcj += h_InvMass_smeared_sphenix_total->GetBinContent( ibin );
75  upcjerr += h_InvMass_smeared_sphenix_total->GetBinError( ibin )*he_mass->GetBinError( ibin );
76 
77  hijj += he_mass->GetBinContent( ibin );
78  hijjerr += he_mass->GetBinError( ibin )*he_mass->GetBinError( ibin );
79  }
80 
81  upcjerr = sqrt(upcjerr);
82  hijjerr = sqrt(hijjerr);
83  cout << "upcj\tupcjerr\thijj\thijjerr" << endl;
84  cout << upcj << "\t" << upcjerr << "\t" << hijj << "\t" << hijjerr << endl;
85  cout << "S/N = " << upcj/hijj << endl;
86 }
87