Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotQA_LevelingEnergy.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plotQA_LevelingEnergy.C
1 #include <string>
2 #include <TString.h>
3 #include <TFile.h>
4 #include <TH2F.h>
5 #include <TH1F.h>
6 #include <TF1.h>
7 #include <TCanvas.h>
8 #include <TGraphAsymmErrors.h>
9 #include <TProfile.h>
10 #include <TLine.h>
11 
13 {
14  string input_5GeV = "/sphenix/user/xusun/TestBeam/ShowerCalibAna/Proto4ShowerInfoRAW_1087.root"; // 5 GeV
15  TFile *File_5GeV = TFile::Open(input_5GeV.c_str());
16  TH2F *h_mAsymmEnergy_pion_5GeV = (TH2F*)File_5GeV->Get("h_mAsymmEnergy_pion");
17  TH1F *h_mEnergy_pion_5GeV = (TH1F*)h_mAsymmEnergy_pion_5GeV->ProjectionY()->Clone();
18  TH2F *h_mAsymmEnergy_pion_leveling_5GeV = (TH2F*)File_5GeV->Get("h_mAsymmEnergy_pion_leveling");
19  TH1F *h_mEnergy_pion_leveling_5GeV = (TH1F*)h_mAsymmEnergy_pion_leveling_5GeV->ProjectionY()->Clone();
20 
21  string input_8GeV = "/sphenix/user/xusun/TestBeam/ShowerCalibAna/Proto4ShowerInfoRAW_0422.root"; // 8 GeV
22  TFile *File_8GeV = TFile::Open(input_8GeV.c_str());
23  TH2F *h_mAsymmEnergy_pion_8GeV = (TH2F*)File_8GeV->Get("h_mAsymmEnergy_pion");
24  TH1F *h_mEnergy_pion_8GeV = (TH1F*)h_mAsymmEnergy_pion_8GeV->ProjectionY()->Clone();
25  TH2F *h_mAsymmEnergy_pion_leveling_8GeV = (TH2F*)File_8GeV->Get("h_mAsymmEnergy_pion_leveling");
26  TH1F *h_mEnergy_pion_leveling_8GeV = (TH1F*)h_mAsymmEnergy_pion_leveling_8GeV->ProjectionY()->Clone();
27 
28  string input_12GeV = "/sphenix/user/xusun/TestBeam/ShowerCalibAna/Proto4ShowerInfoRAW_0571.root"; // 12 GeV
29  TFile *File_12GeV = TFile::Open(input_12GeV.c_str());
30  TH2F *h_mAsymmEnergy_pion_12GeV = (TH2F*)File_12GeV->Get("h_mAsymmEnergy_pion");
31  TH1F *h_mEnergy_pion_12GeV = (TH1F*)h_mAsymmEnergy_pion_12GeV->ProjectionY()->Clone();
32  TH2F *h_mAsymmEnergy_pion_leveling_12GeV = (TH2F*)File_12GeV->Get("h_mAsymmEnergy_pion_leveling");
33  TH1F *h_mEnergy_pion_leveling_12GeV = (TH1F*)h_mAsymmEnergy_pion_leveling_12GeV->ProjectionY()->Clone();
34 
35  TCanvas *c_AsymmEnergy_energy = new TCanvas("c_AsymmEnergy_energy","c_AsymmEnergy_energy",1500,500);
36  c_AsymmEnergy_energy->Divide(3,1);
37  for(int i_pad = 0; i_pad < 3; ++i_pad)
38  {
39  c_AsymmEnergy_energy->cd(i_pad+1);
40  c_AsymmEnergy_energy->cd(i_pad+1)->SetLeftMargin(0.15);
41  c_AsymmEnergy_energy->cd(i_pad+1)->SetBottomMargin(0.15);
42  c_AsymmEnergy_energy->cd(i_pad+1)->SetTicks(1,1);
43  c_AsymmEnergy_energy->cd(i_pad+1)->SetGrid(0,0);
44  }
45 
46  c_AsymmEnergy_energy->cd(1);
47  h_mEnergy_pion_5GeV->SetLineColor(1);
48  h_mEnergy_pion_5GeV->Draw("h");
49  h_mEnergy_pion_leveling_5GeV->SetLineColor(2);
50  h_mEnergy_pion_leveling_5GeV->Draw("h same");
51 
52  TLegend *leg_5GeV = new TLegend(0.55,0.7,0.75,0.85);
53  leg_5GeV->SetBorderSize(0);
54  leg_5GeV->SetFillColor(10);
55  leg_5GeV->AddEntry(h_mEnergy_pion_5GeV,"before leveling","h");
56  leg_5GeV->AddEntry(h_mEnergy_pion_leveling_5GeV,"after leveling","h");
57  leg_5GeV->Draw();
58 
59  c_AsymmEnergy_energy->cd(2);
60  h_mEnergy_pion_8GeV->SetLineColor(1);
61  h_mEnergy_pion_8GeV->Draw("h");
62  h_mEnergy_pion_leveling_8GeV->SetLineColor(2);
63  h_mEnergy_pion_leveling_8GeV->Draw("h same");
64 
65  TLegend *leg_8GeV = new TLegend(0.55,0.7,0.75,0.85);
66  leg_8GeV->SetBorderSize(0);
67  leg_8GeV->SetFillColor(10);
68  leg_8GeV->AddEntry(h_mEnergy_pion_8GeV,"before leveling","h");
69  leg_8GeV->AddEntry(h_mEnergy_pion_leveling_8GeV,"after leveling","h");
70  leg_8GeV->Draw();
71 
72  c_AsymmEnergy_energy->cd(3);
73  h_mEnergy_pion_12GeV->SetLineColor(1);
74  h_mEnergy_pion_12GeV->Draw("h");
75  h_mEnergy_pion_leveling_12GeV->SetLineColor(2);
76  h_mEnergy_pion_leveling_12GeV->Draw("h same");
77 
78  TLegend *leg_12GeV = new TLegend(0.55,0.7,0.75,0.85);
79  leg_12GeV->SetBorderSize(0);
80  leg_12GeV->SetFillColor(10);
81  leg_12GeV->AddEntry(h_mEnergy_pion_12GeV,"before leveling","h");
82  leg_12GeV->AddEntry(h_mEnergy_pion_leveling_12GeV,"after leveling","h");
83  leg_12GeV->Draw();
84 
85 }