Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotQA_TowerCalib_Comparison.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plotQA_TowerCalib_Comparison.C
1 #include "TString.h"
2 #include "TFile.h"
3 #include "TCanvas.h"
4 #include "TH1F.h"
5 #include "TLegend.h"
6 
8 {
9  int hbdchanIHC[4][4] = {{16, 12, 8, 4},
10  {15, 11, 7, 3},
11  {14, 10, 6, 2},
12  {13, 9, 5, 1}};
13 
14  string inputfile = "/sphenix/user/xusun/TestBeam/ShowerCalib/Proto4ShowerInfoRAW_0422_CalibTest.root";
15  TFile *File_InPut = TFile::Open(inputfile.c_str());
16 
17  TH1F *h_hcalin_tower_calib_manual[16];
18  TH1F *h_hcalin_tower_calib_produced[16];
19  TH1F *h_hcalout_tower_calib_manual[16];
20  TH1F *h_hcalout_tower_calib_produced[16];
21  for(int i_tower = 0; i_tower < 16; ++i_tower)
22  {
23  string HistName;
24 
25  HistName= Form("h_hcalin_lg_tower_%d_raw",i_tower);
26  h_hcalin_tower_calib_manual[i_tower] = (TH1F*)File_InPut->Get(HistName.c_str())->Clone();
27 
28  HistName= Form("h_hcalin_lg_tower_%d_calib",i_tower);
29  h_hcalin_tower_calib_produced[i_tower] = (TH1F*)File_InPut->Get(HistName.c_str())->Clone();
30 
31  HistName= Form("h_hcalout_lg_tower_%d_raw",i_tower);
32  h_hcalout_tower_calib_manual[i_tower] = (TH1F*)File_InPut->Get(HistName.c_str())->Clone();
33 
34  HistName= Form("h_hcalout_lg_tower_%d_calib",i_tower);
35  h_hcalout_tower_calib_produced[i_tower] = (TH1F*)File_InPut->Get(HistName.c_str())->Clone();
36  }
37 
38  TCanvas *c_hcal_in = new TCanvas("c_hcal_in","c_hcal_in",10,10,1600,1600);
39  c_hcal_in->Divide(4,4);
40  TLegend *leg_in = new TLegend(0.4,0.5,0.8,0.8);
41  leg_in->SetFillColor(0);
42  leg_in->AddEntry(h_hcalin_tower_calib_produced[0], "production", "l");
43  leg_in->AddEntry(h_hcalin_tower_calib_manual[0], "manual", "p");
44  for(int i_row = 0; i_row < 4; ++i_row)
45  {
46  for(int i_col = 0; i_col < 4; ++i_col)
47  {
48  int i_pad = 4*i_row+i_col+1;
49  int i_tower = hbdchanIHC[i_row][i_col]-1;
50  c_hcal_in->cd(i_pad);
51  c_hcal_in->cd(i_pad)->SetLogy();
52  h_hcalin_tower_calib_produced[i_tower]->SetLineColor(1);
53  h_hcalin_tower_calib_produced[i_tower]->SetLineWidth(2);
54  h_hcalin_tower_calib_produced[i_tower]->Draw("hE");
55 
56  h_hcalin_tower_calib_manual[i_tower]->SetMarkerColor(2);
57  h_hcalin_tower_calib_manual[i_tower]->SetMarkerSize(1.5);
58  h_hcalin_tower_calib_manual[i_tower]->SetMarkerStyle(24);
59  h_hcalin_tower_calib_manual[i_tower]->Draw("p same");
60  leg_in->Draw("same");
61  }
62  }
63  c_hcal_in->SaveAs("../figures/HCAL_ShowerCalib/c_hcalin_towercalib_comparison.eps");
64 
65  TCanvas *c_hcal_out = new TCanvas("c_hcal_out","c_hcal_out",10,10,1600,1600);
66  c_hcal_out->Divide(4,4);
67  TLegend *leg_out = new TLegend(0.4,0.5,0.8,0.8);
68  leg_out->SetFillColor(0);
69  leg_out->AddEntry(h_hcalout_tower_calib_produced[0], "production", "l");
70  leg_out->AddEntry(h_hcalout_tower_calib_manual[0], "manual", "p");
71  for(int i_row = 0; i_row < 4; ++i_row)
72  {
73  for(int i_col = 0; i_col < 4; ++i_col)
74  {
75  int i_pad = 4*i_row+i_col+1;
76  int i_tower = hbdchanIHC[i_row][i_col]-1;
77  c_hcal_out->cd(i_pad);
78  c_hcal_out->cd(i_pad)->SetLogy();
79  h_hcalout_tower_calib_produced[i_tower]->SetLineColor(1);
80  h_hcalout_tower_calib_produced[i_tower]->SetLineWidth(2);
81  h_hcalout_tower_calib_produced[i_tower]->Draw("hE");
82 
83  h_hcalout_tower_calib_manual[i_tower]->SetMarkerColor(2);
84  h_hcalout_tower_calib_manual[i_tower]->SetMarkerSize(1.5);
85  h_hcalout_tower_calib_manual[i_tower]->SetMarkerStyle(24);
86  h_hcalout_tower_calib_manual[i_tower]->Draw("p same");
87  leg_out->Draw("same");
88  }
89  }
90  c_hcal_out->SaveAs("../figures/HCAL_ShowerCalib/c_hcalout_towercalib_comparison.eps");
91 }