From 63dd95f1c51a8e3bbdcc09962fbf6ba4bb87f6b9 Mon Sep 17 00:00:00 2001 From: Sophie Redford Date: Mon, 28 Nov 2016 18:27:53 +0100 Subject: [PATCH] Better plot axis labels and sizes, to preserve style across all files. --- JFMC_CalibWriter.cpp | 49 ++++++++++++++++++++++++++++---------- JFMC_CuFluoPeakFit.cpp | 15 ++++++++---- JFMC_CurrentSourceScan.cpp | 15 ++---------- JFMC_DirectBeamScan.cpp | 8 ++++--- 4 files changed, 53 insertions(+), 34 deletions(-) diff --git a/JFMC_CalibWriter.cpp b/JFMC_CalibWriter.cpp index 1939cb2..e08d897 100644 --- a/JFMC_CalibWriter.cpp +++ b/JFMC_CalibWriter.cpp @@ -64,6 +64,10 @@ int main(int argc, char* argv[]) { TH1F* g1histall = new TH1F("g1histall","",100,-4,0); TH1F* g2histall = new TH1F("g2histall","",100,-0.5,0); + TH1F* g0ferhistall = new TH1F("g0ferhistall","",100,0,0.005); + TH1F* g1ferhistall = new TH1F("g1ferhistall","",100,0,0.05); + TH1F* g2ferhistall = new TH1F("g2ferhistall","",100,0,0.05); + TH1F* g0histcut = new TH1F("g0histcut","",100,20,60); TH1F* g1histcut = new TH1F("g1histcut","",100,-4,0); TH1F* g2histcut = new TH1F("g2histcut","",100,-0.5,0); @@ -117,16 +121,19 @@ int main(int argc, char* argv[]) { if (FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0) { g0fermapall->SetBinContent((i%NC)+1,(i/NC)+1,FL_peaker_map->GetBinContent((i%NC)+1,(i/NC)+1)/FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1)); + g0ferhistall->Fill(FL_peaker_map->GetBinContent((i%NC)+1,(i/NC)+1)/FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1)); } if (FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0 && DB_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0) { g1fermapall->SetBinContent((i%NC)+1,(i/NC)+1, sqrt(pow((FL_peaker_map->GetBinContent((i%NC)+1,(i/NC)+1)/FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1)),2) + pow((DB_ratioer_map->GetBinContent((i%NC)+1,(i/NC)+1)/DB_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1)),2))); + g1ferhistall->Fill(sqrt(pow((FL_peaker_map->GetBinContent((i%NC)+1,(i/NC)+1)/FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1)),2) + pow((DB_ratioer_map->GetBinContent((i%NC)+1,(i/NC)+1)/DB_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1)),2))); } if (FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0 && DB_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0 && CS_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0) { g2fermapall->SetBinContent((i%NC)+1,(i/NC)+1, sqrt(pow((FL_peaker_map->GetBinContent((i%NC)+1,(i/NC)+1)/FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1)),2) + pow((DB_ratioer_map->GetBinContent((i%NC)+1,(i/NC)+1)/DB_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1)),2) + pow((CS_ratioer_map->GetBinContent((i%NC)+1,(i/NC)+1)/CS_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1)),2))); + g2ferhistall->Fill(sqrt(pow((FL_peaker_map->GetBinContent((i%NC)+1,(i/NC)+1)/FL_peak_map->GetBinContent((i%NC)+1,(i/NC)+1)),2) + pow((DB_ratioer_map->GetBinContent((i%NC)+1,(i/NC)+1)/DB_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1)),2) + pow((CS_ratioer_map->GetBinContent((i%NC)+1,(i/NC)+1)/CS_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1)),2))); } } @@ -220,7 +227,6 @@ int main(int argc, char* argv[]) { sprintf(savename,"plots/M%s/gain2fer_all_M%s.png", module_str.c_str(), module_str.c_str()); mapcanvas->SaveAs((const char *)(savename)); - g0mapcut->GetXaxis()->SetTitle("Column"); g0mapcut->GetYaxis()->SetTitle("Row"); g0mapcut->GetYaxis()->SetTitleOffset(0.7); @@ -259,6 +265,8 @@ int main(int argc, char* argv[]) { sprintf(savename,"plots/M%s/maskmap_M%s.png", module_str.c_str(), module_str.c_str()); mapcanvas->SaveAs((const char *)(savename)); + TCanvas* c1 = new TCanvas("c1",""); + g0histcut->SetLineColor(kRed); g1histcut->SetLineColor(kRed); g2histcut->SetLineColor(kRed); @@ -267,30 +275,45 @@ int main(int argc, char* argv[]) { g0histcut->Draw(); g0histall->Draw("same"); sprintf(savename,"plots/M%s/g0hist_M%s.png", module_str.c_str(), module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); - mapcanvas->SetLogy(); + c1->SaveAs((const char *)(savename)); + c1->SetLogy(); sprintf(savename,"plots/M%s/g0hist_log_M%s.png", module_str.c_str(), module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); - mapcanvas->SetLogy(0); + c1->SaveAs((const char *)(savename)); + c1->SetLogy(0); g1histcut->GetXaxis()->SetTitle("Gain G1 [ADU/keV]"); g1histcut->Draw(); g1histall->Draw("same"); sprintf(savename,"plots/M%s/g1hist_M%s.png", module_str.c_str(), module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); - mapcanvas->SetLogy(); + c1->SaveAs((const char *)(savename)); + c1->SetLogy(); sprintf(savename,"plots/M%s/g1hist_log_M%s.png", module_str.c_str(), module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); - mapcanvas->SetLogy(0); + c1->SaveAs((const char *)(savename)); + c1->SetLogy(0); g2histcut->GetXaxis()->SetTitle("Gain G2 [ADU/keV]"); g2histcut->Draw(); g2histall->Draw("same"); sprintf(savename,"plots/M%s/g2hist_M%s.png", module_str.c_str(), module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); - mapcanvas->SetLogy(); + c1->SaveAs((const char *)(savename)); + c1->SetLogy(); sprintf(savename,"plots/M%s/g2hist_log_M%s.png", module_str.c_str(), module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); - mapcanvas->SetLogy(0); + c1->SaveAs((const char *)(savename)); + c1->SetLogy(0); + + g0ferhistall->GetXaxis()->SetTitle("Gain G0 frac uncert"); + g0ferhistall->Draw(); + sprintf(savename,"plots/M%s/g0ferhist_M%s.png", module_str.c_str(), module_str.c_str()); + c1->SaveAs((const char *)(savename)); + + g1ferhistall->GetXaxis()->SetTitle("Gain G1 frac uncert"); + g1ferhistall->Draw(); + sprintf(savename,"plots/M%s/g1ferhist_M%s.png", module_str.c_str(), module_str.c_str()); + c1->SaveAs((const char *)(savename)); + + g2ferhistall->GetXaxis()->SetTitle("Gain G2 frac uncert"); + g2ferhistall->Draw(); + sprintf(savename,"plots/M%s/g2ferhist_M%s.png", module_str.c_str(), module_str.c_str()); + c1->SaveAs((const char *)(savename)); } diff --git a/JFMC_CuFluoPeakFit.cpp b/JFMC_CuFluoPeakFit.cpp index 322ec74..d285542 100644 --- a/JFMC_CuFluoPeakFit.cpp +++ b/JFMC_CuFluoPeakFit.cpp @@ -36,7 +36,6 @@ int main(int argc, char* argv[]) { char histoname[128]; char savename[128]; TCanvas* c1 = new TCanvas("c1",""); - c1->SetLogy(); sprintf(savename,"%s_ana_M%s/Fluo_comb.root", data_loc.c_str(), module_str.c_str()); TFile* comb_file = new TFile((const char *)(savename),"READ"); @@ -95,6 +94,7 @@ int main(int argc, char* argv[]) { proj->Draw(); fittedfun->Draw("same"); c1->Update(); + proj->GetXaxis()->SetTitle("Pedestal corrected ADC [ADU]"); TPaveStats *st = (TPaveStats*)proj->FindObject("stats"); st->SetX1NDC(0.22); st->SetX2NDC(0.55); @@ -103,6 +103,10 @@ int main(int argc, char* argv[]) { st->SetBorderSize(0); sprintf(savename,"plots/M%s/CuFluo/proj_test%d.png",module_str.c_str(),i); c1->SaveAs((const char *)(savename)); + c1->SetLogy(); + sprintf(savename,"plots/M%s/CuFluo/proj_test%d_log.png",module_str.c_str(),i); + c1->SaveAs((const char *)(savename)); + c1->SetLogy(0); } delete thiscalibration; @@ -133,15 +137,16 @@ int main(int argc, char* argv[]) { sprintf(savename,"plots/M%s/CuFluo/peak_fit_poserr_2d.png",module_str.c_str()); mapcanvas->SaveAs((const char *)(savename)); - peak_fit_pos->GetXaxis()->SetTitle("Peak position [ADC]"); + c1->cd(); + peak_fit_pos->GetXaxis()->SetTitle("Peak position [ADU]"); peak_fit_pos->Draw(); sprintf(savename,"plots/M%s/CuFluo/peak_fit_pos.png",module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); + c1->SaveAs((const char *)(savename)); - peak_fit_poserr->GetXaxis()->SetTitle("Peak position uncert [ADC]"); + peak_fit_poserr->GetXaxis()->SetTitle("Peak position uncert [ADU]"); peak_fit_poserr->Draw(); sprintf(savename,"plots/M%s/CuFluo/peak_fit_poserr.png",module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); + c1->SaveAs((const char *)(savename)); sprintf(savename,"data/M%s/CuF_peakpos_M%s.root", module_str.c_str(), module_str.c_str()); TFile* saved_file = new TFile((const char *)(savename),"RECREATE"); diff --git a/JFMC_CurrentSourceScan.cpp b/JFMC_CurrentSourceScan.cpp index 1be4806..fd1f545 100644 --- a/JFMC_CurrentSourceScan.cpp +++ b/JFMC_CurrentSourceScan.cpp @@ -267,7 +267,6 @@ int main(int argc, char* argv[]) { } c1->cd(); gain_avg->GetXaxis()->SetTitle("Average gain"); - gain_avg->GetYaxis()->SetTitle("Pixels"); gain_avg->GetXaxis()->SetTitleOffset(1.1); gain_avg->GetYaxis()->SetTitleOffset(1.5); gain_avg->Draw(); @@ -283,7 +282,6 @@ int main(int argc, char* argv[]) { c1->cd(); adc_avg_g1->GetXaxis()->SetTitle("Average G1 ADC"); - adc_avg_g1->GetYaxis()->SetTitle("Pixels"); adc_avg_g1->GetXaxis()->SetTitleOffset(1.1); adc_avg_g1->GetYaxis()->SetTitleOffset(1.5); adc_avg_g1->Draw(); @@ -300,7 +298,6 @@ int main(int argc, char* argv[]) { c1->cd(); adc_avg_g2->GetXaxis()->SetTitle("Average G2 ADC"); - adc_avg_g2->GetYaxis()->SetTitle("Pixels"); adc_avg_g2->GetXaxis()->SetTitleOffset(1.1); adc_avg_g2->GetYaxis()->SetTitleOffset(1.5); adc_avg_g2->Draw(); @@ -513,11 +510,9 @@ int main(int argc, char* argv[]) { grap_g2->SetMinimum(0); grap_g2->SetMaximum(16000); grap_g1->GetXaxis()->SetTitle("Integration time [#mus]"); - grap_g1->GetYaxis()->SetTitle("ADC"); grap_g1->GetXaxis()->SetTitleOffset(1.1); grap_g1->GetYaxis()->SetTitleOffset(1.5); grap_g2->GetXaxis()->SetTitle("Integration time [#mus]"); - grap_g2->GetYaxis()->SetTitle("ADC"); grap_g2->GetXaxis()->SetTitleOffset(1.1); grap_g2->GetYaxis()->SetTitleOffset(1.5); @@ -578,7 +573,6 @@ int main(int argc, char* argv[]) { c1->cd(); g1_avg->GetXaxis()->SetTitle("G1 gradient"); - g1_avg->GetYaxis()->SetTitle("Pixels"); g1_avg->GetXaxis()->SetTitleOffset(1.1); g1_avg->GetYaxis()->SetTitleOffset(1.5); g1_avg->Draw(); @@ -586,23 +580,20 @@ int main(int argc, char* argv[]) { c1->SaveAs((const char *)(savename)); g2_avg->GetXaxis()->SetTitle("G2 gradient"); - g2_avg->GetYaxis()->SetTitle("Pixels"); g2_avg->GetXaxis()->SetTitleOffset(1.1); g2_avg->GetYaxis()->SetTitleOffset(1.5); g2_avg->Draw(); sprintf(savename,"plots/M%s/CurrentSource/module_g2_avg.png", module_str.c_str()); c1->SaveAs((const char *)(savename)); - g1overg2->GetXaxis()->SetTitle("G1/G2 gradient"); - g1overg2->GetYaxis()->SetTitle("Pixels"); + g1overg2->GetXaxis()->SetTitle("G1 / G2"); g1overg2->GetXaxis()->SetTitleOffset(1.1); g1overg2->GetYaxis()->SetTitleOffset(1.5); g1overg2->Draw(); sprintf(savename,"plots/M%s/CurrentSource/module_g1overg2.png", module_str.c_str()); c1->SaveAs((const char *)(savename)); - g1overg2er->GetXaxis()->SetTitle("G1/G2 uncertainty"); - g1overg2er->GetYaxis()->SetTitle("Pixels"); + g1overg2er->GetXaxis()->SetTitle("G1 / G2 uncert"); g1overg2er->GetXaxis()->SetTitleOffset(1.1); g1overg2er->GetYaxis()->SetTitleOffset(1.5); g1overg2er->Draw(); @@ -610,7 +601,6 @@ int main(int argc, char* argv[]) { c1->SaveAs((const char *)(savename)); g1_fit_er->GetXaxis()->SetTitle("Fitted G1 uncert"); - g1_fit_er->GetYaxis()->SetTitle("Pixels"); g1_fit_er->GetXaxis()->SetTitleOffset(1.1); g1_fit_er->GetYaxis()->SetTitleOffset(1.5); g1_fit_er->Draw(); @@ -618,7 +608,6 @@ int main(int argc, char* argv[]) { c1->SaveAs((const char *)(savename)); g2_fit_er->GetXaxis()->SetTitle("Fitted G2 uncert"); - g2_fit_er->GetYaxis()->SetTitle("Pixels"); g2_fit_er->GetXaxis()->SetTitleOffset(1.1); g2_fit_er->GetYaxis()->SetTitleOffset(1.5); g2_fit_er->Draw(); diff --git a/JFMC_DirectBeamScan.cpp b/JFMC_DirectBeamScan.cpp index aff311d..47c761d 100644 --- a/JFMC_DirectBeamScan.cpp +++ b/JFMC_DirectBeamScan.cpp @@ -47,7 +47,7 @@ int main(int argc, char* argv[]) { char savename[128]; - int createHistoFile = 1; + int createHistoFile = 0; // open pede file /* KEEP shows where 1M data is @@ -759,15 +759,17 @@ int main(int argc, char* argv[]) { sprintf(savename,"plots/M%s/DirectBeam/g0overg1ermap.png", module_str.c_str()); mapcanvas->SaveAs((const char *)(savename)); + TCanvas* c1 = new TCanvas("c1",""); + g0overg1hist->GetXaxis()->SetTitle("G0 / G1"); g0overg1hist->Draw(); sprintf(savename,"plots/M%s/DirectBeam/g0overg1hist.png", module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); + c1->SaveAs((const char *)(savename)); g0overg1erhist->GetXaxis()->SetTitle("G0 / G1 uncert"); g0overg1erhist->Draw(); sprintf(savename,"plots/M%s/DirectBeam/g0overg1erhist.png", module_str.c_str()); - mapcanvas->SaveAs((const char *)(savename)); + c1->SaveAs((const char *)(savename)); /* KEEP links to data if (runAnalysis == 3 || runAnalysis == 4) {