Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:16

0001 
0002 void Summary(const char *input_root_name = "g4fwdtrack_fastsim_eval.root") {
0003 
0004     TFile* in_file = TFile::Open(input_root_name,"read");
0005 
0006     TH2D* _h2d_Delta_mom_vs_truth_mom = (TH2D*) in_file->Get("_h2d_Delta_mom_vs_truth_mom");
0007     TH2D* _h2d_Delta_mom_vs_truth_eta = (TH2D*) in_file->Get("_h2d_Delta_mom_vs_truth_eta");
0008 
0009 
0010     TCanvas *c0 = new TCanvas("c0","c0");
0011     //c0->Divide(2,1);
0012 
0013     //c0->cd(1);
0014     _h2d_Delta_mom_vs_truth_mom->FitSlicesY();
0015     TH1D *h1d_mom_resolution_vs_truth_mom = (TH1D*)  gDirectory->Get("_h2d_Delta_mom_vs_truth_mom_2");
0016 
0017     h1d_mom_resolution_vs_truth_mom->SetTitle("#sigma_{p}/p; momentum [GeV/c]; #sigma_{p}/p");
0018     h1d_mom_resolution_vs_truth_mom->SetMarkerStyle(20);
0019     h1d_mom_resolution_vs_truth_mom->SetMarkerColor(kBlack);
0020     h1d_mom_resolution_vs_truth_mom->SetLineColor(kBlack);
0021     h1d_mom_resolution_vs_truth_mom->Draw("e");
0022     h1d_mom_resolution_vs_truth_mom->GetYaxis()->SetTitleOffset(1.5);
0023 
0024     TF1 *tf_pT_resolution = new TF1("tf_pT_resolution",
0025             "sqrt([0]*[0] + x*x*[1]*[1])", 0, 40);
0026     h1d_mom_resolution_vs_truth_mom->Fit(tf_pT_resolution, "s");
0027 
0028     TH1D* h1d_mom_offset_vs_truth_mom = (TH1D*)  gDirectory->Get("_h2d_Delta_mom_vs_truth_mom_1");
0029     h1d_mom_offset_vs_truth_mom->Draw("e,same");
0030     h1d_mom_offset_vs_truth_mom->SetMarkerStyle(20);
0031     h1d_mom_offset_vs_truth_mom->SetMarkerColor(kGray);
0032     h1d_mom_offset_vs_truth_mom->SetLineColor(kGray);
0033 
0034     h1d_mom_offset_vs_truth_mom->Fit("pol0","s");
0035 
0036     double y_max = h1d_mom_resolution_vs_truth_mom->GetMaximum();
0037     double y_min = h1d_mom_offset_vs_truth_mom->GetMinimum();
0038 
0039     h1d_mom_resolution_vs_truth_mom->GetYaxis()->SetRangeUser(y_min-0.01, y_max+0.01);
0040 
0041     c0->Update();
0042 
0043     gStyle->SetOptFit();
0044     gStyle->SetOptStat(000000000);
0045 
0046 }