Better labels and stat boxes.

This commit is contained in:
redford_s
2017-11-30 14:03:57 +01:00
parent a632e3272f
commit 1458edfbda

View File

@ -7,6 +7,7 @@
#include "TH2F.h" #include "TH2F.h"
#include "TCanvas.h" #include "TCanvas.h"
#include "TF1.h" #include "TF1.h"
#include "TPaveText.h"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
jungfrauStyle(); jungfrauStyle();
@ -108,15 +109,28 @@ int main(int argc, char* argv[]) {
} }
c1->cd(); c1->cd();
diff_g0overg1_hist->GetXaxis()->SetTitle("(G0 / G1)_{DB} - (G0 / G1)_{BP}"); diff_g0overg1_hist->GetXaxis()->SetTitle("G0/G1_{DB} - G0/G1_{BP}");
c1->SetLogy(); c1->SetLogy();
diff_g0overg1_hist->Draw(); diff_g0overg1_hist->Draw();
sprintf(savename,"plots/M%s/BP_DB_Comp/diff_g0overg1_hist_log.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/diff_g0overg1_hist_log_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
c1->SetLogy(0); c1->SetLogy(0);
diff_g0overg1_hist->Fit("gaus"); diff_g0overg1_hist->Fit("gaus");
diff_g0overg1_hist->Draw(); diff_g0overg1_hist->Draw();
sprintf(savename,"plots/M%s/BP_DB_Comp/diff_g0overg1_hist.png", module_str.c_str()); c1->Update();
TPaveText *pave = new TPaveText(0.6,0.8,0.94,0.94,"blNDC");
pave->SetBorderSize(0);
pave->SetFillStyle(0);
pave->SetTextSize(0.04);
pave->SetTextAlign(32);
TF1* diff_hist_gaus = diff_g0overg1_hist->GetFunction("gaus");
sprintf(savename,"Mean %0.2f #pm %0.2f", diff_hist_gaus->GetParameter(1), diff_hist_gaus->GetParError(1));
pave->AddText((const char *)(savename));
sprintf(savename,"Sigma %0.2f #pm %0.2f", diff_hist_gaus->GetParameter(2), diff_hist_gaus->GetParError(2));
pave->AddText((const char *)(savename));
pave->Draw();
diff_g0overg1_hist->SetStats(kFALSE);
sprintf(savename,"plots/M%s/BP_DB_Comp/diff_g0overg1_hist_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
mapcanvas->cd(); mapcanvas->cd();
@ -125,14 +139,23 @@ int main(int argc, char* argv[]) {
diff_g0overg1_map->GetYaxis()->SetTitleOffset(0.7); diff_g0overg1_map->GetYaxis()->SetTitleOffset(0.7);
diff_g0overg1_map->Draw("colz"); diff_g0overg1_map->Draw("colz");
diff_g0overg1_map->GetZaxis()->SetRangeUser(-5,5); diff_g0overg1_map->GetZaxis()->SetRangeUser(-5,5);
sprintf(savename,"plots/M%s/BP_DB_Comp/diff_g0overg1_map.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/diff_g0overg1_map_M%s.png", module_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename)); mapcanvas->SaveAs((const char *)(savename));
c1->cd(); c1->cd();
pull_hist->GetXaxis()->SetTitle("(G0 / G1)_{DB} - (G0 / G1)_{BP} / #sigma_{(G0 / G1)_{DB}}"); pull_hist->GetXaxis()->SetTitle("G0/G1_{DB} - G0/G1_{BP} / #sigma_{DB}");
pull_hist->Fit("gaus"); pull_hist->Fit("gaus");
pull_hist->Draw(); pull_hist->Draw();
sprintf(savename,"plots/M%s/BP_DB_Comp/pull_hist.png", module_str.c_str()); c1->Update();
TF1* pull_hist_gaus = pull_hist->GetFunction("gaus");
pave->Clear();
sprintf(savename,"Mean %0.2f #pm %0.2f", pull_hist_gaus->GetParameter(1), pull_hist_gaus->GetParError(1));
pave->AddText((const char *)(savename));
sprintf(savename,"Sigma %0.2f #pm %0.2f", pull_hist_gaus->GetParameter(2), pull_hist_gaus->GetParError(2));
pave->AddText((const char *)(savename));
pave->Draw();
pull_hist->SetStats(kFALSE);
sprintf(savename,"plots/M%s/BP_DB_Comp/pull_hist_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
diff_g0overg1_e->SetLineColor(kBlue); diff_g0overg1_e->SetLineColor(kBlue);
@ -148,14 +171,14 @@ int main(int argc, char* argv[]) {
diff_g0overg1_q->Scale(1./diff_g0overg1_q->GetEntries()); diff_g0overg1_q->Scale(1./diff_g0overg1_q->GetEntries());
diff_g0overg1_b->Scale(1./diff_g0overg1_b->GetEntries()); diff_g0overg1_b->Scale(1./diff_g0overg1_b->GetEntries());
diff_g0overg1_d->GetXaxis()->SetTitle("(G0 / G1)_{DB} - (G0 / G1)_{BP}"); diff_g0overg1_d->GetXaxis()->SetTitle("G0/G1_{DB} - G0/G1_{BP}");
diff_g0overg1_d->Draw(); diff_g0overg1_d->Draw();
diff_g0overg1_e->Draw("same"); diff_g0overg1_e->Draw("same");
diff_g0overg1_ie->Draw("same"); diff_g0overg1_ie->Draw("same");
diff_g0overg1_b->Draw("same"); diff_g0overg1_b->Draw("same");
diff_g0overg1_ntd->Draw("same"); diff_g0overg1_ntd->Draw("same");
//diff_g0overg1_q->Draw("same"); //diff_g0overg1_q->Draw("same");
sprintf(savename,"plots/M%s/BP_DB_Comp/diff_g0overg1_hist_byType.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/diff_g0overg1_hist_byType_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
c1->SetRightMargin(0.2); c1->SetRightMargin(0.2);
@ -163,67 +186,67 @@ int main(int argc, char* argv[]) {
TF1 *diag = new TF1("diag","[0]*x",-35,-25); TF1 *diag = new TF1("diag","[0]*x",-35,-25);
diag->SetParameter(0,1); diag->SetParameter(0,1);
scat->GetXaxis()->SetTitle("(G0 / G1)_{DB}"); scat->GetXaxis()->SetTitle("G0/G1_{DB}");
scat->GetYaxis()->SetTitle("(G0 / G1)_{BP}"); scat->GetYaxis()->SetTitle("G0/G1_{BP}");
scat->GetYaxis()->SetTitleOffset(1.3); scat->GetYaxis()->SetTitleOffset(1.3);
scat->Draw("colz"); scat->Draw("colz");
diag->Draw("same"); diag->Draw("same");
sprintf(savename,"plots/M%s/BP_DB_Comp/scat.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/scat_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
scat_e->GetXaxis()->SetTitle("(G0 / G1)_{DB}"); scat_e->GetXaxis()->SetTitle("G0/G1_{DB}");
scat_e->GetYaxis()->SetTitle("(G0 / G1)_{BP}"); scat_e->GetYaxis()->SetTitle("G0/G1_{BP}");
scat_e->GetYaxis()->SetTitleOffset(1.3); scat_e->GetYaxis()->SetTitleOffset(1.3);
scat_e->Draw("colz"); scat_e->Draw("colz");
diag->Draw("same"); diag->Draw("same");
sprintf(savename,"plots/M%s/BP_DB_Comp/scat_e.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/scat_e_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
scat_d->GetXaxis()->SetTitle("(G0 / G1)_{DB}"); scat_d->GetXaxis()->SetTitle("G0/G1_{DB}");
scat_d->GetYaxis()->SetTitle("(G0 / G1)_{BP}"); scat_d->GetYaxis()->SetTitle("G0/G1_{BP}");
scat_d->GetYaxis()->SetTitleOffset(1.3); scat_d->GetYaxis()->SetTitleOffset(1.3);
scat_d->Draw("colz"); scat_d->Draw("colz");
diag->Draw("same"); diag->Draw("same");
sprintf(savename,"plots/M%s/BP_DB_Comp/scat_d.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/scat_d_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
scat_ntd->GetXaxis()->SetTitle("(G0 / G1)_{DB}"); scat_ntd->GetXaxis()->SetTitle("G0/G1_{DB}");
scat_ntd->GetYaxis()->SetTitle("(G0 / G1)_{BP}"); scat_ntd->GetYaxis()->SetTitle("G0/G1_{BP}");
scat_ntd->GetYaxis()->SetTitleOffset(1.3); scat_ntd->GetYaxis()->SetTitleOffset(1.3);
scat_ntd->Draw("colz"); scat_ntd->Draw("colz");
diag->Draw("same"); diag->Draw("same");
sprintf(savename,"plots/M%s/BP_DB_Comp/scat_ntd.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/scat_ntd_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
scat_q->GetXaxis()->SetTitle("(G0 / G1)_{DB}"); scat_q->GetXaxis()->SetTitle("G0/G1_{DB}");
scat_q->GetYaxis()->SetTitle("(G0 / G1)_{BP}"); scat_q->GetYaxis()->SetTitle("G0/G1_{BP}");
scat_q->GetYaxis()->SetTitleOffset(1.3); scat_q->GetYaxis()->SetTitleOffset(1.3);
scat_q->Draw("colz"); scat_q->Draw("colz");
diag->Draw("same"); diag->Draw("same");
sprintf(savename,"plots/M%s/BP_DB_Comp/scat_q.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/scat_q_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
scat_ie->GetXaxis()->SetTitle("(G0 / G1)_{DB}"); scat_ie->GetXaxis()->SetTitle("G0/G1_{DB}");
scat_ie->GetYaxis()->SetTitle("(G0 / G1)_{BP}"); scat_ie->GetYaxis()->SetTitle("G0/G1_{BP}");
scat_ie->GetYaxis()->SetTitleOffset(1.3); scat_ie->GetYaxis()->SetTitleOffset(1.3);
scat_ie->Draw("colz"); scat_ie->Draw("colz");
diag->Draw("same"); diag->Draw("same");
sprintf(savename,"plots/M%s/BP_DB_Comp/scat_ie.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/scat_ie_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
scat_b->GetXaxis()->SetTitle("(G0 / G1)_{DB}"); scat_b->GetXaxis()->SetTitle("G0/G1_{DB}");
scat_b->GetYaxis()->SetTitle("(G0 / G1)_{BP}"); scat_b->GetYaxis()->SetTitle("G0/G1_{BP}");
scat_b->GetYaxis()->SetTitleOffset(1.3); scat_b->GetYaxis()->SetTitleOffset(1.3);
scat_b->Draw("colz"); scat_b->Draw("colz");
diag->Draw("same"); diag->Draw("same");
sprintf(savename,"plots/M%s/BP_DB_Comp/scat_b.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/scat_b_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
diff_DBer->GetXaxis()->SetTitle("(G0 / G1)_{DB} - (G0 / G1)_{BP}"); diff_DBer->GetXaxis()->SetTitle("G0/G1_{DB} - G0/G1_{BP}");
diff_DBer->GetYaxis()->SetTitle("#sigma_{(G0 / G1)_{DB}}"); diff_DBer->GetYaxis()->SetTitle("#sigma_{G0/G1_{DB}}");
diff_DBer->GetYaxis()->SetTitleOffset(1.3); diff_DBer->GetYaxis()->SetTitleOffset(1.3);
diff_DBer->Draw("colz"); diff_DBer->Draw("colz");
sprintf(savename,"plots/M%s/BP_DB_Comp/diff_DBer.png", module_str.c_str()); sprintf(savename,"plots/M%s/BP_DB_Comp/diff_DBer_M%s.png", module_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename)); c1->SaveAs((const char *)(savename));
} }