From d140c06eefbf578d2a5af1391da486da36b04750 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Fri, 1 Jun 2018 18:42:33 +0300 Subject: [PATCH] Scripts for PRC pictures modified --- Be/BeWork.cpp | 4 +- README.md | 5 +- macros/BeCorrPRC/figCorrGS.cxx | 4 ++ macros/BeCorrPRC/figCorrLeftES.cxx | 90 ++++++++++++++++++++++++----- macros/BeCorrPRC/figCorrRightGS.cxx | 52 +++++++++++++---- macros/BeCorrPRC/figSpectra.cxx | 6 +- macros/BeCorrPRC/rootlogon6panels.C | 4 +- 7 files changed, 132 insertions(+), 33 deletions(-) diff --git a/Be/BeWork.cpp b/Be/BeWork.cpp index 38b5ca3..3f861bf 100644 --- a/Be/BeWork.cpp +++ b/Be/BeWork.cpp @@ -25,6 +25,8 @@ BeWork::BeWork() Info("BeWork::BeWork", "Creating TELoss objects ..."); CreateTELosses(); + Info("BeWork", "End of second constructor\n\n"); + } BeWork::BeWork(const char* configfile) @@ -42,7 +44,7 @@ BeWork::BeWork(const char* configfile) CreateTELosses(); // fCalibFile = "/data2/be/parameterfiles"; - Info("BeWork", "End of second constructor\n\n"); + Info("BeWork", "End of constructor\n\n"); } BeWork::BeWork(BeWork &bework) { diff --git a/README.md b/README.md index 73b0680..52a089a 100755 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ +There is no need to install libraries. Working with ROOT 5.32.36 . + + 1) set path in makefile according to your operating system 2) type in terminal: make all make htmldoc - make install +# make install 3) add the install folder to LD_LIBRARY_PATH diff --git a/macros/BeCorrPRC/figCorrGS.cxx b/macros/BeCorrPRC/figCorrGS.cxx index fde558f..287a6a4 100755 --- a/macros/BeCorrPRC/figCorrGS.cxx +++ b/macros/BeCorrPRC/figCorrGS.cxx @@ -68,6 +68,8 @@ void figCorrGS() hSim[i]->Draw(""); hExp[i]->Draw("E same"); hInput[i]->Draw("same"); + + hExp[i]->Chi2Test(hSim[i], "P"); } // c1->SaveAs("figures/GSepsilonT.eps"); @@ -118,6 +120,8 @@ void figCorrGS() hCorrSim[i]->Draw(""); hCorrExp[i]->Draw("E same"); hCorrInput[i]->Draw("same"); + + hCorrExp[i]->Chi2Test(hCorrSim[i], "P"); } // c2->SaveAs("figures/GSotherCorrs.eps"); diff --git a/macros/BeCorrPRC/figCorrLeftES.cxx b/macros/BeCorrPRC/figCorrLeftES.cxx index 26f9c43..5873ecd 100755 --- a/macros/BeCorrPRC/figCorrLeftES.cxx +++ b/macros/BeCorrPRC/figCorrLeftES.cxx @@ -1,4 +1,12 @@ -void figCorrLeftES() +//canvas c1: Fig. 12 in first submitted version +//canvas c2: Fig. 13 in first submitted version +//canvas c3: Fig. 14 in first submitted version +//canvas c4: Fig. 15 in first submitted version + +using std::cout; +using std::endl; + +void figCorrLeftES(Bool_t saveFigs = 0) { TFile *fr = new TFile("figures/PRCepsilonT.root", "READ"); @@ -44,6 +52,7 @@ void figCorrLeftES() c1->SetWindowSize(800, 800); c1->Divide(2, 2, .001, .001); + cout << "Fig. 12" << endl; for (Int_t i = 0; i < 4; i++) { c1->cd(i+1); @@ -63,11 +72,10 @@ void figCorrLeftES() hSim[i]->Draw(""); hExp[i]->Draw("E same"); hInput[i]->Draw("same"); - } - c1->SaveAs("figures/ESepsilonTleft.eps"); - -// return; + hExp[i]->Chi2Test(hSim[i], "P"); + } + c1->Update(); TCanvas *c2 = new TCanvas(); c2->ToggleEditor(); @@ -82,6 +90,8 @@ void figCorrLeftES() TString hName; + cout << "Fig. 13" << endl; + for (Int_t i = 0; i < 6; i++) { c2->cd(i+1); @@ -108,15 +118,16 @@ void figCorrLeftES() hCorrSim[i]->Draw(""); hCorrExp[i]->Draw("E same"); hCorrInput[i]->Draw("same"); - } - c2->SaveAs("figures/ESepsilonT7590left.eps"); + hCorrExp[i]->Chi2Test(hCorrSim[i], "P"); + } + c2->Update(); -// return; TCanvas *c3 = new TCanvas(); c3->ToggleEditor(); - c3->SetWindowSize(800, 1227); +// c3->SetWindowSize(800, 1227); + c3->SetWindowSize(800, 1200); c3->Divide(2, 3, .001, .001); TFile *fr2 = new TFile("figures/PRCthetaA.root"); @@ -124,8 +135,11 @@ void figCorrLeftES() TH1F *hAlphaExp[6]; TH1F *hAlphaSim[6]; TH1F *hAlphaInput[6]; + TH1F *hAlphaInputCorr[6]; - TString hName; + +// TString hName; + cout << "Fig. 14" << endl; for (Int_t i = 0; i < 6; i++) { c3->cd(i+1); @@ -142,6 +156,14 @@ void figCorrLeftES() hCurr = (TH1F*)fr2->Get(hName.Data()); hAlphaInput[i] = new TH1F(*hCurr); + hAlphaInputCorr[i] = new TH1F(*hAlphaInput[i]); + Double_t binContent = 0; + for (Int_t binN = 1; binN <= 15; binN++) { + binContent = hAlphaInputCorr[i]->GetBinContent(binN); + hAlphaInputCorr[i]->SetBinContent(binN, binContent + hAlphaInputCorr[i]->GetBinContent(31-binN)); + hAlphaInputCorr[i]->SetBinContent(31-binN, hAlphaInputCorr[i]->GetBinContent(binN)); + } + hAlphaInput[i]->SetLineWidth(2); hAlphaSim[i]->SetTitle(""); hAlphaSim[i]->GetXaxis()->SetNdivisions(506); @@ -154,12 +176,23 @@ void figCorrLeftES() hAlphaSim[i]->GetYaxis()->SetTitle(""); hAlphaSim[i]->Draw(""); + hAlphaSim[i]->GetXaxis()->SetTitle("#it{#theta}_{#alpha} (rad)"); hAlphaExp[i]->Draw("E same"); - hAlphaInput[i]->Draw("same"); +// hAlphaInput[i]->Draw("same"); + hAlphaInputCorr[i]->SetLineColor(kRed); + hAlphaInputCorr[i]->SetLineWidth(2); + hAlphaInputCorr[i]->Scale(0.5); + hAlphaInputCorr[i]->Smooth(); + hAlphaInputCorr[i]->Draw("same"); + +// cout << "Chi2: " << hAlphaSim[i]->Chi2Test()endl; + hAlphaExp[i]->Chi2Test(hAlphaSim[i], "P"); +// hAlphaSim[i]->Chi2Test(hAlphaInputCorr[i], "P"); + } + c3->Update(); - c3->SaveAs("figures/ESThetaAleft7590.eps"); TCanvas *c4 = new TCanvas(); @@ -172,8 +205,10 @@ void figCorrLeftES() TH1F *hAlphaExp90120[6]; TH1F *hAlphaSim90120[6]; TH1F *hAlphaInput90120[6]; + TH1F *hAlphaInput90120Corr[6]; - TString hName; + + cout << "Fig. 15" << endl; for (Int_t i = 0; i < 6; i++) { c4->cd(i+1); @@ -190,6 +225,14 @@ void figCorrLeftES() hCurr = (TH1F*)fr2->Get(hName.Data()); hAlphaInput90120[i] = new TH1F(*hCurr); + hAlphaInput90120Corr[i] = new TH1F(*hAlphaInput90120[i]); + Double_t binContent = 0; + for (Int_t binN = 1; binN <= 15; binN++) { + binContent = hAlphaInput90120Corr[i]->GetBinContent(binN); + hAlphaInput90120Corr[i]->SetBinContent(binN, binContent + hAlphaInput90120Corr[i]->GetBinContent(31-binN)); + hAlphaInput90120Corr[i]->SetBinContent(31-binN, hAlphaInput90120Corr[i]->GetBinContent(binN)); + } + hAlphaInput90120[i]->SetLineWidth(2); hAlphaSim90120[i]->SetTitle(""); hAlphaSim90120[i]->GetXaxis()->SetNdivisions(506); @@ -198,15 +241,30 @@ void figCorrLeftES() hAlphaSim90120[i]->GetXaxis()->SetTitleSize(0.08); hAlphaSim90120[i]->GetXaxis()->SetTitleOffset(0.74); - hAlphaSim90120[i]->GetYaxis()->SetRangeUser(0., 650.); + hAlphaSim90120[i]->GetYaxis()->SetRangeUser(0., 650.); hAlphaSim90120[i]->GetYaxis()->SetTitle(""); hAlphaSim90120[i]->Draw(""); + hAlphaSim90120[i]->GetXaxis()->SetTitle("#it{#theta}_{#alpha} (rad)"); hAlphaExp90120[i]->Draw("E same"); - hAlphaInput90120[i]->Draw("same"); - } +// hAlphaInput90120[i]->Draw("same"); + hAlphaInput90120Corr[i]->SetLineColor(kRed); + hAlphaInput90120Corr[i]->SetLineWidth(2); + hAlphaInput90120Corr[i]->Scale(0.5); + hAlphaInput90120Corr[i]->Smooth(); + hAlphaInput90120Corr[i]->Draw("same"); + hAlphaExp90120[i]->Chi2Test(hAlphaSim90120[i], "P"); + } + c4->Update(); + c1->Update(); + + if (saveFigs) { +// c1->SaveAs("figures/ESepsilonTleft.eps"); +// c2->SaveAs("figures/ESepsilonT7590left.eps"); + c3->SaveAs("figures/ESThetaAleft7590.eps"); c4->SaveAs("figures/ESThetaAleft90120.eps"); + } } diff --git a/macros/BeCorrPRC/figCorrRightGS.cxx b/macros/BeCorrPRC/figCorrRightGS.cxx index 721cfd4..2ef4636 100755 --- a/macros/BeCorrPRC/figCorrRightGS.cxx +++ b/macros/BeCorrPRC/figCorrRightGS.cxx @@ -1,8 +1,15 @@ +//canvas c1: Fig. 9 in first submitted version +//canvas c2: Fig. 10 in first submitted version +//canvas c3: Fig. 11 in first submitted version + //#include "TFile.h" //#include "TCanvas.h" //#include "TH1F.h" -void figCorrRightGS() +using std::cout; +using std::endl; + +void figCorrRightGS(const Bool_t saveFigs = 0) { TFile *fr1 = new TFile("figures/PRCepsilonT.root", "READ"); @@ -49,6 +56,7 @@ void figCorrRightGS() c1->SetWindowSize(800, 800); c1->Divide(2, 2, .001, .001); + cout << "Fig. 9" << endl; for (Int_t i = 0; i < 4; i++) { c1->cd(i+1); @@ -68,23 +76,23 @@ void figCorrRightGS() hSim[i]->Draw(""); hExp[i]->Draw("E same"); hInput[i]->Draw("same"); + hExp[i]->Chi2Test(hSim[i], "P"); } - - c1->SaveAs("figures/GSepsilonTright.eps"); + c1->Update(); TCanvas *c2 = new TCanvas(); c2->ToggleEditor(); c2->SetWindowSize(800, 1227); c2->Divide(2, 3, .001, .001); -// TFile *fr3 = new TFile("figures/PRCepsilonY.root"); - TH1F *hCorrExp[6]; TH1F *hCorrSim[6]; TH1F *hCorrInput[6]; TString hName; + cout << "Fig. 10" << endl; + for (Int_t i = 0; i < 6; i++) { c2->cd(i+1); @@ -111,9 +119,10 @@ void figCorrRightGS() hCorrSim[i]->Draw(""); hCorrExp[i]->Draw("E same"); hCorrInput[i]->Draw("same"); - } - c2->SaveAs("figures/GSepsilonTright7590.eps"); + hCorrExp[i]->Chi2Test(hCorrSim[i], "P"); + } + c2->Update(); TCanvas *c3 = new TCanvas(); c3->ToggleEditor(); @@ -125,8 +134,9 @@ void figCorrRightGS() TH1F *hAlphaExp[6]; TH1F *hAlphaSim[6]; TH1F *hAlphaInput[6]; + TH1F *hAlphaInputCorr[6]; - TString hName; + cout << "Fig. 11" << endl; for (Int_t i = 0; i < 6; i++) { c3->cd(i+1); @@ -143,6 +153,14 @@ void figCorrRightGS() hCurr = (TH1F*)fr2->Get(hName.Data()); hAlphaInput[i] = new TH1F(*hCurr); + hAlphaInputCorr[i] = new TH1F(*hAlphaInput[i]); + Double_t binContent = 0; + for (Int_t binN = 1; binN <= 15; binN++) { + binContent = hAlphaInputCorr[i]->GetBinContent(binN); + hAlphaInputCorr[i]->SetBinContent(binN, binContent + hAlphaInputCorr[i]->GetBinContent(31-binN)); + hAlphaInputCorr[i]->SetBinContent(31-binN, hAlphaInputCorr[i]->GetBinContent(binN)); + } + hAlphaInput[i]->SetLineWidth(2); hAlphaSim[i]->SetTitle(""); hAlphaSim[i]->GetXaxis()->SetNdivisions(506); @@ -155,11 +173,23 @@ void figCorrRightGS() hAlphaSim[i]->GetYaxis()->SetTitle(""); hAlphaSim[i]->Draw(""); + hAlphaSim[i]->GetXaxis()->SetTitle("#it{#theta}_{#alpha} (rad)"); hAlphaExp[i]->Draw("E same"); - hAlphaInput[i]->Draw("same"); - } +// hAlphaInput[i]->Draw("same"); + hAlphaInputCorr[i]->SetLineColor(kRed); + hAlphaInputCorr[i]->SetLineWidth(2); + hAlphaInputCorr[i]->Scale(0.5); + hAlphaInputCorr[i]->Smooth(); + hAlphaInputCorr[i]->Draw("same"); + hAlphaExp[i]->Chi2Test(hAlphaSim[i], "P"); - c3->SaveAs("figures/GSThetaAright7590.eps"); + } + c3->Update(); + if (saveFigs) { + c1->SaveAs("figures/GSepsilonTright.eps"); + c2->SaveAs("figures/GSepsilonTright7590.eps"); + c3->SaveAs("figures/GSThetaAright7590.eps"); + } } diff --git a/macros/BeCorrPRC/figSpectra.cxx b/macros/BeCorrPRC/figSpectra.cxx index f4784e7..86b4089 100755 --- a/macros/BeCorrPRC/figSpectra.cxx +++ b/macros/BeCorrPRC/figSpectra.cxx @@ -5,7 +5,9 @@ void figSpectra() { - TFile *fr = new TFile("figures/spectra.root", "READ"); +// TFile *fr = new TFile("figures/spectra.root", "READ"); +// TFile *fr = new TFile("figures/spectra100new.root", "READ"); + TFile *fr = new TFile("figures/spectra50new.root", "READ"); // fr->ls(); @@ -77,6 +79,6 @@ void figSpectra() diff[i]->GetYaxis()->SetRangeUser(-100, 3500); } - c2->SaveAs("figures/spectraDiff.eps"); +// c2->SaveAs("figures/spectraDiff.eps"); } diff --git a/macros/BeCorrPRC/rootlogon6panels.C b/macros/BeCorrPRC/rootlogon6panels.C index 67624f9..7a09a06 100644 --- a/macros/BeCorrPRC/rootlogon6panels.C +++ b/macros/BeCorrPRC/rootlogon6panels.C @@ -22,8 +22,8 @@ void rootlogon6panels() gStyle->SetCanvasDefX(85); gStyle->SetCanvasDefY(224); - gStyle->SetCanvasDefW(649); - gStyle->SetCanvasDefH(727); +// gStyle->SetCanvasDefW(649); +// gStyle->SetCanvasDefH(727); //marker attributes gStyle->SetMarkerStyle(20); -- 2.18.1