21 #include "sPhenixStyle.C"
27 const char *qa_file_name_new =
28 "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root",
29 const char *qa_file_name_ref =
30 "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root")
37 TVirtualFitter::SetDefaultFitter(
"Minuit2");
39 TFile *qa_file_new =
new TFile(qa_file_name_new);
40 assert(qa_file_new->IsOpen());
42 TFile *qa_file_ref = NULL;
45 qa_file_ref =
new TFile(qa_file_name_ref);
46 assert(qa_file_ref->IsOpen());
50 double Nevent_new = 1;
51 double Nevent_ref = 1;
54 double Ntrack_new = 0;
55 double Ntrack_ref = 0;
59 TH1D *h_norm = (TH1D *) qa_file_new->GetObjectChecked(
60 TString(
"h_QAG4Sim_CalorimeterSum_Normalization"),
"TH1D");
63 Nevent_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(
"Event"));
64 Ntrack_new = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(
"Track"));
68 TH1D *h_norm = (TH1D *) qa_file_ref->GetObjectChecked(
69 TString(
"h_QAG4Sim_CalorimeterSum_Normalization"),
"TH1D");
72 Nevent_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(
"Event"));
73 Ntrack_ref = h_norm->GetBinContent(h_norm->GetXaxis()->FindBin(
"Track"));
76 vector<string> subsystems;
77 subsystems.push_back(
"CEMC");
78 subsystems.push_back(
"HCALIN");
79 subsystems.push_back(
"HCALOUT");
81 TCanvas *
c1 =
new TCanvas(
"QA_Draw_Calorimeter_Sum_TrackProj",
82 "QA_Draw_Calorimeter_Sum_TrackProj", 1100, 1100);
87 for (
int i = 0; i < subsystems.size(); ++i)
89 const TString subsystem(subsystems[i].c_str());
91 p = (TPad *) c1->cd(idx++);
95 TH2F *h_QAG4Sim_CalorimeterSum_TrackProj =
96 (TH2F *) qa_file_new->GetObjectChecked(
97 "h_QAG4Sim_CalorimeterSum_" + subsystem +
"_TrackProj",
"TH2F");
98 assert(h_QAG4Sim_CalorimeterSum_TrackProj);
99 h_QAG4Sim_CalorimeterSum_TrackProj->GetYaxis()->SetTitleOffset(1.5);
100 h_QAG4Sim_CalorimeterSum_TrackProj->Draw(
"COLZ");
102 TH2F *h_QAG4Sim_CalorimeterSum_TrackProj_Ref = NULL;
105 h_QAG4Sim_CalorimeterSum_TrackProj_Ref =
106 (TH2F *) qa_file_ref->GetObjectChecked(
107 "h_QAG4Sim_CalorimeterSum_" + subsystem +
"_TrackProj",
109 assert(h_QAG4Sim_CalorimeterSum_TrackProj);
112 p = (TPad *) c1->cd(idx++);
118 TH1 *h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString(
"_px"));
120 h_new->Scale(1. / Ntrack_new);
123 if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref)
125 h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionX(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString(
"_px_ref"));
127 h_ref->Scale(1. / Ntrack_ref);
130 h_new->GetXaxis()->SetTitleOffset(1.05);
131 h_new->GetYaxis()->SetTitle(
"Energy / track / bin");
136 p = (TPad *) c1->cd(idx++);
142 TH1 *h_new = h_QAG4Sim_CalorimeterSum_TrackProj->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString(
"_py"));
144 h_new->Scale(1. / Ntrack_new);
147 if (h_QAG4Sim_CalorimeterSum_TrackProj_Ref)
149 h_ref = h_QAG4Sim_CalorimeterSum_TrackProj_Ref->ProjectionY(h_QAG4Sim_CalorimeterSum_TrackProj->GetName() + TString(
"_py_ref"));
151 h_ref->Scale(1. / Ntrack_ref);
154 h_new->GetXaxis()->SetTitleOffset(1.05);
155 h_new->GetYaxis()->SetTitle(
"Energy / track / bin");
163 SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()),
true);