Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // plot the total (signal plus bkg) that we expect, where signal = UPC (starlight) and background = Au+Au collisions (Hijing)
0002 
0003 
0004 void plot_total_plusbkg()
0005 {
0006   gStyle->SetOptStat(0);
0007 
0008   TFile *upcfile = new TFile("AcceptanceMRP.root","READ");
0009   TH1 *h_InvMass_smeared_sphenix_total = (TH1*)upcfile->Get("h_InvMass_smeared_sphenix_total");
0010   TH1 *h_pt_sphenix_total = (TH1*)upcfile->Get("h_pt_sphenix_total");
0011   TH1 *h_rapt_sphenix_total = (TH1*)upcfile->Get("h_rapt_sphenix_total");
0012 
0013   TFile *hijbkgfile = new TFile("hijbkg_results.root","READ");
0014   TH1 *he_mass = (TH1*)hijbkgfile->Get("he_mass");
0015   TH1 *he_eta = (TH1*)hijbkgfile->Get("he_eta");      // should be rapidity
0016   TH1 *he_pt = (TH1*)hijbkgfile->Get("he_pt");
0017 
0018   // Scale to integ lumi = 4.7/nb
0019   double nevt_hij = 3333315. + 3716246. + 3313128.;   // number of hijing events simulated
0020   double sigma_auau = 7.2;      // au+au cross-section [barns]
0021   double integ_lumi = 4.7e9;   // target integrated luminosity
0022   double lumi_scale = (sigma_auau*integ_lumi)/nevt_hij;
0023   cout << "lumi scaled " << lumi_scale << endl;
0024   he_mass->Sumw2();
0025   he_mass->Scale( lumi_scale );
0026 
0027   float markersize = 0.7;
0028   
0029   // Kludge - take out the first 0.6 GeV of mass
0030   int minbin = he_mass->FindBin( 0.6 );
0031   for ( int ibin=1; ibin<=minbin; ibin++ )
0032   {
0033     he_mass->SetBinContent( ibin, 0. );
0034   }
0035 
0036   // Add the UPC total to the background
0037   TH1 *h_InvMass_smeared_sphenix_totalbkg = (TH1*)h_InvMass_smeared_sphenix_total->Clone("h_InvMass_smeared_sphenix_totalbkg");
0038   h_InvMass_smeared_sphenix_totalbkg->Add( he_mass );
0039 
0040   TCanvas *c_mass_total = new TCanvas("c_mass_total","Invariant Mass",550,425);
0041   h_InvMass_smeared_sphenix_totalbkg->SetLineColor(kBlack);
0042   h_InvMass_smeared_sphenix_totalbkg->SetMarkerColor(kBlack);
0043   h_InvMass_smeared_sphenix_totalbkg->SetMarkerStyle(20);
0044   h_InvMass_smeared_sphenix_totalbkg->SetMarkerSize( markersize );
0045   h_InvMass_smeared_sphenix_totalbkg->Draw("ehist");
0046 
0047   he_mass->SetLineColor(kRed);
0048   he_mass->SetMarkerColor(kRed);
0049   he_mass->SetMarkerSize( markersize );
0050   he_mass->SetMarkerStyle( 20 );
0051   he_mass->Draw( "ecsame" );
0052 
0053   h_InvMass_smeared_sphenix_total->SetLineColor(kBlue);
0054   h_InvMass_smeared_sphenix_total->SetMarkerColor(kBlue);
0055   h_InvMass_smeared_sphenix_total->SetMarkerStyle( 20 );
0056   h_InvMass_smeared_sphenix_total->SetMarkerSize( markersize );
0057   h_InvMass_smeared_sphenix_total->SetFillStyle( 1001 );
0058   h_InvMass_smeared_sphenix_total->SetFillColor( 7 );
0059   h_InvMass_smeared_sphenix_total->Draw("ehistsame");
0060 
0061   h_InvMass_smeared_sphenix_totalbkg->Draw("ehistsame");
0062   //gPad->SetLogy( 1 );
0063 
0064   // Calculate the total counts in the j/psi mass windows
0065   int minjbin = he_mass->FindBin( 3.2 );
0066   int maxjbin = he_mass->FindBin( 3.31 );
0067   double upcj = 0.;     // num upc j/psi
0068   double upcjerr = 0.;  // err on upc j/psi counts
0069   double hijj = 0.;     // num hij with 2 tracks in j/psi mass window
0070   double hijjerr = 0.;  // err on hij counts
0071 
0072   for (int ibin=minjbin; ibin<=maxjbin; ibin++)
0073   {
0074     upcj += h_InvMass_smeared_sphenix_total->GetBinContent( ibin );
0075     upcjerr += h_InvMass_smeared_sphenix_total->GetBinError( ibin )*he_mass->GetBinError( ibin );
0076 
0077     hijj += he_mass->GetBinContent( ibin );
0078     hijjerr += he_mass->GetBinError( ibin )*he_mass->GetBinError( ibin );
0079   }
0080 
0081   upcjerr = sqrt(upcjerr);
0082   hijjerr = sqrt(hijjerr);
0083   cout << "upcj\tupcjerr\thijj\thijjerr" << endl;
0084   cout << upcj << "\t" << upcjerr << "\t" << hijj << "\t" << hijjerr << endl;
0085   cout << "S/N = " << upcj/hijj << endl;
0086 }
0087