Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plotQA_cosmic_mat_XY.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plotQA_cosmic_mat_XY.C
1 #include <string>
2 #include "TString.h"
3 #include "TFile.h"
4 #include "TCanvas.h"
5 #include "TH1F.h"
6 #include "TH3F.h"
7 #include "TLegend.h"
8 
10 {
11  string inputdir = "Cosmic_orig";
12  // string inputdir = "Cosmic_Scint";
13  // string inputdir = "BeamTest_SF_orig";
14  // string inputdir = "BeamTest_SF_Scint";
15  string inputfile_in = Form("./OutPut/SampleFrac/%s/Proto4SampleFrac_HCALIN.root",inputdir.c_str());
16  TFile *File_HCALIN = TFile::Open(inputfile_in.c_str());
17  TH2F *h_in_cal = (TH2F*)File_HCALIN->Get("h_QAG4Sim_HCALIN_G4Hit_Mat_XY_cal");
18  TH2F *h_in_abs = (TH2F*)File_HCALIN->Get("h_QAG4Sim_HCALIN_G4Hit_Mat_XY_abs");
19 
20  string inputfile_out = Form("./OutPut/SampleFrac/%s/Proto4SampleFrac_HCALOUT.root",inputdir.c_str());
21  TFile *File_HCALOUT = TFile::Open(inputfile_out.c_str());
22  TH2F *h_out_cal = (TH2F*)File_HCALOUT->Get("h_QAG4Sim_HCALOUT_G4Hit_Mat_XY_cal");
23  TH2F *h_out_abs = (TH2F*)File_HCALOUT->Get("h_QAG4Sim_HCALOUT_G4Hit_Mat_XY_abs");
24 
25  TH2F *h_cal = (TH2F*)h_in_cal->Clone("h_cal");
26  h_cal->Add(h_out_cal,1.0);
27 
28  TH2F *h_abs = (TH2F*)h_in_abs->Clone("h_abs");
29  h_abs->Add(h_out_abs,1.0);
30 
31  TH1F *h_play = new TH1F("h_play","h_play",500,0,500);
32  for(int i_bin = 0; i_bin < 500; ++i_bin)
33  {
34  h_play->SetBinContent(i_bin+1,-10000.0);
35  h_play->SetBinError(i_bin+1,1.0);
36  }
37  // h_play->SetTitle("G4Hit Display");
38  h_play->SetStats(0);
39  h_play->GetYaxis()->SetRangeUser(-100,100);
40  h_play->GetXaxis()->SetRangeUser(50,350);
41 
42  TCanvas *c_cal = new TCanvas("c_cal","c_cal",10,10,1600,800);
43  c_cal->Divide(2,1);
44  for(int i_pad = 0; i_pad < 2; ++i_pad)
45  {
46  c_cal->cd(i_pad+1)->SetLeftMargin(0.15);
47  c_cal->cd(i_pad+1)->SetBottomMargin(0.15);
48  c_cal->cd(i_pad+1)->SetGrid(0,0);
49  c_cal->cd(i_pad+1)->SetTicks(1,1);
50  }
51 
52  c_cal->cd(1);
53  h_play->SetTitle("Cal G4Hit Display");
54  h_play->DrawCopy("pE");
55  // h_in_cal->Draw("colz same");
56  // h_out_cal->Draw("col same");
57  h_cal->Draw("colz same");
58 
59  c_cal->cd(2);
60  h_play->SetTitle("Abs G4Hit Display");
61  h_play->DrawCopy("pE");
62  // h_in_abs->Draw("colz same");
63  // h_out_abs->Draw("col same");
64  h_abs->Draw("colz same");
65 
66  string output_fig = Form("./figures/c_G4Hit_%s_Mat.eps",inputdir.c_str());
67  c_cal->SaveAs(output_fig.c_str());
68 }