Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotQA_Linearity.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plotQA_Linearity.C
1 #include <string>
2 #include "TString.h"
3 #include "TFile.h"
4 #include "TH2F.h"
5 #include "TH1F.h"
6 #include "TCanvas.h"
7 #include "TGraphAsymmErrors.h"
8 #include "TLegend.h"
9 
11 {
12  // 2018 pion with outer hcal only
13  string input_2018_ohcal = "/sphenix/user/xusun/TestBeam/ShowerCalibAna/T1044_2018_pion_hcalout.root";
14  TFile *File_2018_ohcal = TFile::Open(input_2018_ohcal.c_str());
15  TGraphAsymmErrors *g_linearity_2018_pion_hcalout = (TGraphAsymmErrors*)File_2018_ohcal->Get("g_linearity_2018_pion_hcalout");
16 
17  // 2018 electron
18  string input_2018_electron = "/sphenix/user/xusun/TestBeam/ShowerCalibAna/T1044_2018_electron.root";
19  TFile *File_2018_electron = TFile::Open(input_2018_electron.c_str());
20  TGraphAsymmErrors *g_linearity_2018_electron = (TGraphAsymmErrors*)File_2018_electron->Get("g_linearity_2018_electron");
21 
22  // 2018 pion
23  string input_2018_pion = "/sphenix/user/xusun/TestBeam/ShowerCalibAna/T1044_2018_pion.root";
24  TFile *File_2018_pion = TFile::Open(input_2018_pion.c_str());
25  TGraphAsymmErrors *g_linearity_2018_pion = (TGraphAsymmErrors*)File_2018_pion->Get("g_linearity_2018_pion");
26 
27  // 2017 pion
28  string input_2017_pion = "/sphenix/user/xusun/TestBeam/ShowerCalibAna/T1044_2017_pion.root";
29  TFile *File_2017_pion = TFile::Open(input_2017_pion.c_str());
30  TGraphAsymmErrors *g_linearity_2017_pion = (TGraphAsymmErrors*)File_2017_pion->Get("g_linearity_2017_pion");
31 
32  TCanvas *c_Linearity = new TCanvas("c_Linearity","c_Linearity",10,10,800,800);
33  c_Linearity->cd();
34  c_Linearity->cd()->SetLeftMargin(0.15);
35  c_Linearity->cd()->SetBottomMargin(0.15);
36  c_Linearity->cd()->SetTicks(1,1);
37  c_Linearity->cd()->SetGrid(0,0);
38 
39  TH1F *h_play = new TH1F("h_play","h_play",100,0.0,100.0);
40  for(int i_bin = 0; i_bin < 100; ++i_bin)
41  {
42  h_play->SetBinContent(i_bin+1,-10.0);
43  h_play->SetBinError(i_bin+1,1.0);
44  }
45  h_play->SetTitle("");
46  h_play->SetStats(0);
47  h_play->GetXaxis()->SetTitle("input Energy (GeV)");
48  h_play->GetXaxis()->CenterTitle();
49  h_play->GetXaxis()->SetNdivisions(505);
50  h_play->GetXaxis()->SetRangeUser(0.0,40.0);
51 
52  h_play->GetYaxis()->SetTitle("Tower Calibrated Energy (GeV)");
53  h_play->GetYaxis()->CenterTitle();
54  h_play->GetYaxis()->SetRangeUser(0.0,40.0);
55  h_play->DrawCopy("pE");
56 
57  TLine *l_unity = new TLine(1.0,1.0,39.0,39.0);
58  l_unity->SetLineColor(4);
59  l_unity->SetLineStyle(2);
60  l_unity->SetLineWidth(2);
61  l_unity->Draw("l same");
62 
63  g_linearity_2017_pion->SetMarkerStyle(21);
64  g_linearity_2017_pion->SetMarkerColor(2);
65  g_linearity_2017_pion->SetMarkerSize(2.0);
66  g_linearity_2017_pion->Draw("pE same");
67 
68  g_linearity_2018_pion->SetMarkerStyle(20);
69  g_linearity_2018_pion->SetMarkerColor(kGray+2);
70  g_linearity_2018_pion->SetMarkerSize(2.0);
71  g_linearity_2018_pion->Draw("pE same");
72 
73  g_linearity_2018_pion_hcalout->SetMarkerStyle(34);
74  g_linearity_2018_pion_hcalout->SetMarkerColor(6);
75  g_linearity_2018_pion_hcalout->SetMarkerSize(2.0);
76  g_linearity_2018_pion_hcalout->Draw("pE same");
77 
78  g_linearity_2018_electron->SetMarkerStyle(20);
79  g_linearity_2018_electron->SetMarkerColor(4);
80  g_linearity_2018_electron->SetMarkerSize(2.0);
81  g_linearity_2018_electron->Draw("pE same");
82 
83  TLegend *leg_linear = new TLegend(0.2,0.6,0.5,0.8);
84  leg_linear->SetBorderSize(0);
85  leg_linear->SetFillColor(0);
86  leg_linear->AddEntry(g_linearity_2017_pion,"#pi- T1044-2017","p");
87  leg_linear->AddEntry(g_linearity_2018_pion,"#pi- T1044-2018","p");
88  leg_linear->AddEntry(g_linearity_2018_pion_hcalout,"#pi- T1044-2018 & OHCal","p");
89  leg_linear->AddEntry(g_linearity_2018_electron,"e- T1044-2018","p");
90  leg_linear->AddEntry(l_unity,"unity","l");
91  leg_linear->Draw("same");
92 
93  c_Linearity->SaveAs("../figures/HCAL_ShowerCalib/c_Linearity.eps");
94 }