From 162c9f3e959264a657995f8ac5b98fbed4119b9d Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Tue, 1 Aug 2017 18:44:21 +0300 Subject: [PATCH] SaveEpsilonYHist() implemented --- Be/BeAnalysis.cpp | 65 +++++++++++++++++++++++++++++++++++++---------- Be/BeAnalysis.h | 5 +++- 2 files changed, 55 insertions(+), 15 deletions(-) diff --git a/Be/BeAnalysis.cpp b/Be/BeAnalysis.cpp index 4f1c260..d4fbdaa 100644 --- a/Be/BeAnalysis.cpp +++ b/Be/BeAnalysis.cpp @@ -252,11 +252,24 @@ void BeAnalysis::InitHistos() { } -void BeAnalysis::SaveSpectrumHist(Int_t i) { +void BeAnalysis::SaveSpectrumHist(Int_t chain) { TFile fw("figures/spectra.root", "UPDATE"); - if (heSpectra[i] != 0) heSpectra[i]->Write(); - if (hsSpectra[i] != 0) hsSpectra[i]->Write(); + + TString hName; + + if (heSpectra[chain] != 0) { + hName.Form("heSpectrum%d%d", kMinAngle, kMaxAngle); + heSpectra[chain]->SetName(hName.Data()); + heSpectra[chain]->Write(); + Info("BeAnalysis::SaveSpectrumHist", "Histogram saved."); + } + if (hsSpectra[chain] != 0) { + hName.Form("hsSpectrum%d%d", kMinAngle, kMaxAngle); + hsSpectra[chain]->SetName(hName.Data()); + hsSpectra[chain]->Write(); + Info("BeAnalysis::SaveSpectrumHist", "Histogram saved."); + } fw.Close(); } @@ -302,6 +315,26 @@ void BeAnalysis::SaveCosThetaTHist(Int_t interval, Int_t chain) { } +void BeAnalysis::SaveEpsilonYHist(Int_t interval, Int_t chain) { + + TFile fw("figures/epsilonY.root", "UPDATE"); + + if (heeY[interval][chain] != 0) { + heeY[interval][chain]->Write(); + Info("BeAnalysis::SaveEpsilonYHist", "Histogram saved."); + } + if (hseY[interval][chain] != 0) { + hseY[interval][chain]->Write(); + Info("BeAnalysis::SaveEpsilonYHist", "Histogram saved."); + } + if (hieY[interval][chain] != 0) { + hieY[interval][chain]->Write(); + Info("BeAnalysis::SaveEpsilonYHist", "Histogram saved."); + } + fw.Close(); + +} + void BeAnalysis::SetCMAngularCuts() { TString sAngles, srAngles; @@ -349,8 +382,8 @@ void BeAnalysis::Spectra() { if (!kChains[j]) continue; // cout << kChains[j] << endl; cSpectra->cd(j+1); - chs[j]->SetLineColor(kBlue); - chs[j]->SetFillColor(kWhite); +// chs[j]->SetLineColor(kBlue); +// chs[j]->SetFillColor(kWhite); hsName.Form("hsSpectra%d", j); hsSpectra[j] = new TH1F(hsName.Data(), cAngles.GetTitle(), noBinsSpectra, 0, 10); // drawCommand.Form("f6BeIM>>%s(200,0,10)", hsName.Data()); @@ -593,7 +626,7 @@ void BeAnalysis::CosThetaTk() { // hecoskT[i][j] = (TH1F*)gPad->FindObject(heName.Data()); hscoskT[i][j]->Draw(); - hscoskT[i][j]->SetTitle(""); +// hscoskT[i][j]->SetTitle(""); hscoskT[i][j]->SetXTitle("\\cos \\theta_k"); // hseT[i][j]->GetXaxis()->SetTitleOffset(0.95); // hseT[i][j]->GetXaxis()->SetTitleSize(0.11); @@ -679,20 +712,23 @@ void BeAnalysis::EpsilonY() { for (Int_t j = 0; j < 6; j++) { //different files if (!kChains[j]) continue; canEpsilonY[i]->cd(j+1); - chs[j]->SetLineColor(kGray+1); - chs[j]->SetFillColor(kGray+1); + hsName.Form("hseY%d_%d", i, j); hseY[i][j] = new TH1F(hsName.Data(), cAngles.GetTitle(), noBinsCorr, 0., 1.); - drawCommand.Form("fTap/f6BeIM>>%s(50,0,1)", hsName.Data()); + hseY[i][j]->SetLineColor(kGray+1); + hseY[i][j]->SetFillColor(kGray+1); + drawCommand.Form("fTap/f6BeIM>>%s", hsName.Data()); chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && sRatio[j], "", sEvents[j]); // hseY[i][j] = (TH1F*)gPad->FindObject(hsName.Data()); + heName.Form("heeY%d_%d", i, j); - drawCommand.Form("fTap/fBeIM>>%s(50,0,1)", heName.Data()); + heeY[i][j] = new TH1F(heName.Data(), cAngles.GetTitle(), noBinsCorr, 0., 1.); + drawCommand.Form("fTap/fBeIM>>%s", heName.Data()); che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEvents[j]); - heeY[i][j] = (TH1F*)gPad->FindObject(heName.Data()); +// heeY[i][j] = (TH1F*)gPad->FindObject(heName.Data()); hseY[i][j]->Draw(); - hseY[i][j]->SetTitle(""); +// hseY[i][j]->SetTitle(""); hseY[i][j]->SetXTitle("\\varepsilon"); // hseT[i][j]->GetXaxis()->SetTitleOffset(0.95); // hseT[i][j]->GetXaxis()->SetTitleSize(0.11); @@ -714,9 +750,10 @@ void BeAnalysis::EpsilonY() { canEpsilonY[i]->Update(); hiName.Form("hieY%d_%d", i, j); - drawCommand.Form("sTap/E_IM>>%s(50,0,1)", hiName.Data()); + hieY[i][j] = new TH1F(hiName.Data(), cAngles.GetTitle(), noBinsCorr, 0., 1.); + drawCommand.Form("sTap/E_IM>>%s", hiName.Data()); ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same"); - hieY[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); +// hieY[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); Float_t rightmax = 1.1*hieY[i][j]->GetMaximum(); Float_t scale = canEpsilonY[i]->GetPad(j+1)->GetUymax()/rightmax; hieY[i][j]->SetLineColor(kRed); diff --git a/Be/BeAnalysis.h b/Be/BeAnalysis.h index 85cd83c..ad4f5f8 100644 --- a/Be/BeAnalysis.h +++ b/Be/BeAnalysis.h @@ -77,10 +77,13 @@ public: void SetFigures(TString figPath = "figures/", TString figFormat = ".eps", Bool_t kSave = 1); - void SaveSpectrumHist(Int_t i); + void SaveSpectrumHist(Int_t chain); + void SaveEpsilonTHist(Int_t interval, Int_t chain); void SaveCosThetaTHist(Int_t interval, Int_t chain); + void SaveEpsilonYHist(Int_t interval, Int_t chain); + // private: -- 2.18.1