19 #include "sPhenixStyle.C" 
   24     const char *qa_file_name_new =
 
   25         "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root",
 
   26     const char *qa_file_name_ref =
 
   27         "/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_CEMC_TowerCluster", 
"QA_Draw_CEMC_TowerCluster", 1800, 900);
 
   48   p = (TPad *) c1->cd(idx++);
 
   54     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
   55         "h_QAG4Sim_CEMC_Tower_1x1", 
"TH1F");
 
   58     h_new->Scale(1. / h_new->GetSum());
 
   63       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
   64           "h_QAG4Sim_CEMC_Tower_1x1", 
"TH1F");
 
   67       h_ref->Scale(1. / h_ref->GetSum());
 
   70     h_new->GetYaxis()->SetTitleOffset(1.5);
 
   71     h_new->GetYaxis()->SetTitle(
"Normalized tower count per bin");
 
   77   p = (TPad *) c1->cd(idx++);
 
   83     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
   84         "h_QAG4Sim_CEMC_Tower_3x3", 
"TH1F");
 
   87     h_new->Scale(1. / h_new->GetSum());
 
   92       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
   93           "h_QAG4Sim_CEMC_Tower_3x3", 
"TH1F");
 
   96       h_ref->Scale(1. / h_ref->GetSum());
 
   99     h_new->GetYaxis()->SetTitleOffset(1.5);
 
  100     h_new->GetYaxis()->SetTitle(
"Normalized tower count per bin");
 
  106   p = (TPad *) c1->cd(idx++);
 
  112     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
  113         "h_QAG4Sim_CEMC_Tower_1x1_max", 
"TH1F");
 
  118     h_new->Scale(1. / h_new->GetSum());
 
  123       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
  124           "h_QAG4Sim_CEMC_Tower_1x1_max", 
"TH1F");
 
  128       h_ref->Scale(1. / h_ref->GetSum());
 
  131     h_new->GetYaxis()->SetTitleOffset(1.5);
 
  132     h_new->GetYaxis()->SetTitle(
"Probability per bin");
 
  138   p = (TPad *) c1->cd(idx++);
 
  144     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
  145         "h_QAG4Sim_CEMC_Tower_4x4_max", 
"TH1F");
 
  150     h_new->Scale(1. / h_new->GetSum());
 
  155       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
  156           "h_QAG4Sim_CEMC_Tower_4x4_max", 
"TH1F");
 
  160       h_ref->Scale(1. / h_ref->GetSum());
 
  163     h_new->GetYaxis()->SetTitleOffset(1.5);
 
  164     h_new->GetYaxis()->SetTitle(
"Probability per bin");
 
  170   p = (TPad *) c1->cd(idx++);
 
  174   TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection =
 
  175       (TH2F *) qa_file_new->GetObjectChecked(
 
  176           "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", 
"TH2F");
 
  177   assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection);
 
  178   h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetYaxis()->SetTitleOffset(
 
  180   h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetXaxis()->SetRangeUser(-5,
 
  182   h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->GetYaxis()->SetRangeUser(-5,
 
  184   h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->Draw(
"COLZ");
 
  186   p = (TPad *) c1->cd(idx++);
 
  191     TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection =
 
  192         (TH2F *) qa_file_new->GetObjectChecked(
 
  193             "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", 
"TH2F");
 
  194     assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection);
 
  197         h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX(
 
  198             "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px");
 
  200     proj_new->Scale(1. / proj_new->GetSum());
 
  202     TH1D *proj_ref = NULL;
 
  205       TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection =
 
  206           (TH2F *) qa_file_ref->GetObjectChecked(
 
  207               "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", 
"TH2F");
 
  208       assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection);
 
  210       proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionX(
 
  211           "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_px");
 
  212       proj_ref->Scale(1. / proj_ref->GetSum());
 
  215     proj_new->GetYaxis()->SetTitleOffset(1.);
 
  216     proj_new->GetXaxis()->SetTitleOffset(1.);
 
  217     proj_new->GetYaxis()->SetTitle(
"Normalized energy distribution");
 
  218     proj_new->GetXaxis()->SetRangeUser(-10, 10);
 
  223   p = (TPad *) c1->cd(idx++);
 
  228     TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection =
 
  229         (TH2F *) qa_file_new->GetObjectChecked(
 
  230             "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", 
"TH2F");
 
  231     assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection);
 
  234         h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY(
 
  235             "qa_file_new_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py");
 
  237     proj_new->Scale(1. / proj_new->GetSum());
 
  239     TH1D *proj_ref = NULL;
 
  242       TH2F *h_QAG4Sim_CEMC_Cluster_LateralTruthProjection =
 
  243           (TH2F *) qa_file_ref->GetObjectChecked(
 
  244               "h_QAG4Sim_CEMC_Cluster_LateralTruthProjection", 
"TH2F");
 
  245       assert(h_QAG4Sim_CEMC_Cluster_LateralTruthProjection);
 
  247       proj_ref = h_QAG4Sim_CEMC_Cluster_LateralTruthProjection->ProjectionY(
 
  248           "qa_file_ref_h_QAG4Sim_CEMC_Cluster_LateralTruthProjection_py");
 
  249       proj_ref->Scale(1. / proj_ref->GetSum());
 
  252     proj_new->GetYaxis()->SetTitleOffset(1.);
 
  253     proj_new->GetXaxis()->SetTitleOffset(1.);
 
  254     proj_new->GetYaxis()->SetTitle(
"Normalized energy distribution");
 
  255     proj_new->GetXaxis()->SetRangeUser(-10, 10);
 
  260   p = (TPad *) c1->cd(idx++);
 
  265     TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
 
  266         "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", 
"TH1F");
 
  271     h_new->Scale(1. / h_new->GetSum());
 
  276       h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
 
  277           "h_QAG4Sim_CEMC_Cluster_BestMatchERatio", 
"TH1F");
 
  281       h_ref->Scale(1. / h_ref->GetSum());
 
  284     h_new->GetYaxis()->SetTitleOffset(1.5);
 
  285     h_new->GetYaxis()->SetTitle(
"Probability per bin");
 
  292   SaveCanvas(c1, TString(qa_file_name_new) + TString(c1->GetName()), 
true);