19 #include "sPhenixStyle.C" 
   25     const char *qa_file_name_new =
 
   26         "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root",
 
   27     const char *qa_file_name_ref =
 
   28         "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root")
 
   31   TVirtualFitter::SetDefaultFitter(
"Minuit2");
 
   33   TFile *qa_file_new = 
new TFile(qa_file_name_new);
 
   34   assert(qa_file_new->IsOpen());
 
   36   TFile *qa_file_ref = NULL;
 
   39     qa_file_ref = 
new TFile(qa_file_name_ref);
 
   40     assert(qa_file_ref->IsOpen());
 
   43   TCanvas *
c1 = 
new TCanvas(
"QA_Draw_HCALOUT_TowerCluster",
 
   44                             "QA_Draw_HCALOUT_TowerCluster", 1800, 900);
 
   49   p = (TPad *) c1->cd(idx++);
 
   55     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
   56         "h_QAG4Sim_HCALOUT_Tower_1x1", 
"TH1F");
 
   59     h_new->Scale(1. / h_new->GetSum());
 
   64       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
   65           "h_QAG4Sim_HCALOUT_Tower_1x1", 
"TH1F");
 
   68       h_ref->Scale(1. / h_ref->GetSum());
 
   71     h_new->GetYaxis()->SetTitleOffset(1.5);
 
   72     h_new->GetYaxis()->SetTitle(
"Normalized tower count per bin");
 
   78   p = (TPad *) c1->cd(idx++);
 
   84     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
   85         "h_QAG4Sim_HCALOUT_Tower_3x3", 
"TH1F");
 
   88     h_new->Scale(1. / h_new->GetSum());
 
   93       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
   94           "h_QAG4Sim_HCALOUT_Tower_3x3", 
"TH1F");
 
   97       h_ref->Scale(1. / h_ref->GetSum());
 
  100     h_new->GetYaxis()->SetTitleOffset(1.5);
 
  101     h_new->GetYaxis()->SetTitle(
"Normalized tower count per bin");
 
  107   p = (TPad *) c1->cd(idx++);
 
  113     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
  114         "h_QAG4Sim_HCALOUT_Tower_1x1_max", 
"TH1F");
 
  119     h_new->Scale(1. / h_new->GetSum());
 
  124       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
  125           "h_QAG4Sim_HCALOUT_Tower_1x1_max", 
"TH1F");
 
  129       h_ref->Scale(1. / h_ref->GetSum());
 
  132     h_new->GetYaxis()->SetTitleOffset(1.5);
 
  133     h_new->GetYaxis()->SetTitle(
"Probability per bin");
 
  139   p = (TPad *) c1->cd(idx++);
 
  145     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
  146         "h_QAG4Sim_HCALOUT_Tower_4x4_max", 
"TH1F");
 
  151     h_new->Scale(1. / h_new->GetSum());
 
  156       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
  157           "h_QAG4Sim_HCALOUT_Tower_4x4_max", 
"TH1F");
 
  161       h_ref->Scale(1. / h_ref->GetSum());
 
  164     h_new->GetYaxis()->SetTitleOffset(1.5);
 
  165     h_new->GetYaxis()->SetTitle(
"Probability per bin");
 
  171   p = (TPad *) c1->cd(idx++);
 
  175   TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection =
 
  176       (TH2F *) qa_file_new->GetObjectChecked(
 
  177           "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", 
"TH2F");
 
  178   assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection);
 
  179   h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset(
 
  185   h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->Draw(
"COLZ");
 
  187   p = (TPad *) c1->cd(idx++);
 
  192     TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection =
 
  193         (TH2F *) qa_file_new->GetObjectChecked(
 
  194             "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", 
"TH2F");
 
  195     assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection);
 
  198         h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX(
 
  199             "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px");
 
  202     proj_new->Scale(1. / proj_new->GetSum());
 
  204     TH1D *proj_ref = NULL;
 
  207       TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection =
 
  208           (TH2F *) qa_file_ref->GetObjectChecked(
 
  209               "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", 
"TH2F");
 
  210       assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection);
 
  213           h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionX(
 
  214               "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_px");
 
  216       proj_ref->Scale(1. / proj_ref->GetSum());
 
  219     proj_new->GetYaxis()->SetTitleOffset(1.);
 
  220     proj_new->GetXaxis()->SetTitleOffset(1.);
 
  221     proj_new->GetYaxis()->SetTitle(
"Normalized energy distribution");
 
  227   p = (TPad *) c1->cd(idx++);
 
  232     TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection =
 
  233         (TH2F *) qa_file_new->GetObjectChecked(
 
  234             "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", 
"TH2F");
 
  235     assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection);
 
  238         h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY(
 
  239             "qa_file_new_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py");
 
  242     proj_new->Scale(1. / proj_new->GetSum());
 
  244     TH1D *proj_ref = NULL;
 
  247       TH2F *h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection =
 
  248           (TH2F *) qa_file_ref->GetObjectChecked(
 
  249               "h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection", 
"TH2F");
 
  250       assert(h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection);
 
  253           h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection->ProjectionY(
 
  254               "qa_file_ref_h_QAG4Sim_HCALOUT_Cluster_LateralTruthProjection_py");
 
  256       proj_ref->Scale(1. / proj_ref->GetSum());
 
  259     proj_new->GetYaxis()->SetTitleOffset(1.);
 
  260     proj_new->GetXaxis()->SetTitleOffset(1.);
 
  261     proj_new->GetYaxis()->SetTitle(
"Normalized energy distribution");
 
  267   p = (TPad *) c1->cd(idx++);
 
  271     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
  272         "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", 
"TH1F");
 
  277     h_new->Scale(1. / h_new->GetSum());
 
  282       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
  283           "h_QAG4Sim_HCALOUT_Cluster_BestMatchERatio", 
"TH1F");
 
  287       h_ref->Scale(1. / h_ref->GetSum());
 
  290     h_new->GetYaxis()->SetTitleOffset(1.5);
 
  291     h_new->GetYaxis()->SetTitle(
"Probability per bin");
 
  298   SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), 
true);