From 1679e74c938892d69918d76517411dc11c8b6a88 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Thu, 3 Aug 2017 16:38:00 +0300 Subject: [PATCH] SaveThetaAHist() implemented --- Be/BeAnalysis.cpp | 57 ++++++++++++++++++++++++++++++++++++++--------- Be/BeAnalysis.h | 10 ++++++++- 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/Be/BeAnalysis.cpp b/Be/BeAnalysis.cpp index 68af630..a6800c1 100644 --- a/Be/BeAnalysis.cpp +++ b/Be/BeAnalysis.cpp @@ -24,6 +24,7 @@ BeAnalysis::BeAnalysis() : che(0), lowExpFile(0), upExpFile(0), spectra(0) { SetNoBinsSpectra(); SetNoBinsCorrelations(); + SetNoBinsThetaA(); InitHistos(); @@ -246,6 +247,10 @@ void BeAnalysis::InitHistos() { hseY[i][j] = 0; heeY[i][j] = 0; hieY[i][j] = 0; + + hethetaAT[i][j] = 0; + hsthetaAT[i][j] = 0; + hithetaAT[i][j] = 0; } } @@ -274,9 +279,9 @@ void BeAnalysis::SaveSpectrumHist(Int_t chain) { } -void BeAnalysis::SaveEpsilonTHist(Int_t interval, Int_t chain) { +void BeAnalysis::SaveEpsilonTHist(Int_t interval, Int_t chain, TString outfilename) { - TFile fw("figures/epsilonT.root", "UPDATE"); + TFile fw(outfilename.Data(), "UPDATE"); TString hName; @@ -351,6 +356,34 @@ void BeAnalysis::SaveEpsilonYHist(Int_t interval, Int_t chain) { } +void BeAnalysis::SaveThetaAHist(Int_t interval, Int_t chain) { + + TFile fw("figures/thetaA.root", "UPDATE"); + + TString hName; + + if (hethetaAT[interval][chain] != 0) { + hName.Form("hethetaAT%d_%d_%d%d", interval, chain, kMinAngle, kMaxAngle); + hethetaAT[interval][chain]->SetName(hName.Data()); + hethetaAT[interval][chain]->Write(); + Info("BeAnalysis::SaveThetaAHist", "Histogram saved."); + } + if (hsthetaAT[interval][chain] != 0) { + hName.Form("hsthetaAT%d_%d_%d%d", interval, chain, kMinAngle, kMaxAngle); + hsthetaAT[interval][chain]->SetName(hName.Data()); + hsthetaAT[interval][chain]->Write(); + Info("BeAnalysis::SaveThetaAHist", "Histogram saved."); + } + if (hithetaAT[interval][chain] != 0) { + hName.Form("hithetaAT%d_%d_%d%d", interval, chain, kMinAngle, kMaxAngle); + hithetaAT[interval][chain]->SetName(hName.Data()); + hithetaAT[interval][chain]->Write(); + Info("BeAnalysis::SaveThetaAHist", "Histogram saved."); + } + fw.Close(); + +} + void BeAnalysis::SetCMAngularCuts() { TString sAngles, srAngles; @@ -905,9 +938,9 @@ void BeAnalysis::ThetaAT() { TCanvas *cThetaAT[noIntervals]; for (Int_t i = 0; iSetLineColor(kBlack); for (Int_t j = 0; j < 6; j++) { //different files if (!kChains[j]) continue; + cThetaAT[i]->cd(j+1); + hsName.Form("hsthetaAT%d_%d", i, j); - hsthetaAT[i][j] = new TH1F(hsName.Data(), "title", 30, 0, 3.14); + hsthetaAT[i][j] = new TH1F(hsName.Data(), cAngles.GetTitle(), noBinsThetaA, 0, TMath::Pi()); hsthetaAT[i][j]->SetLineColor(kGray+1); hsthetaAT[i][j]->SetFillColor(kGray+1); drawCommand.Form("fAThetaCM>>%s", hsthetaAT[i][j]->GetName()); chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && crEpsilonT && sRatio[j], "goff", sEventsECuts[i][j]); + heName.Form("hethetaAT%d_%d", i, j); - hethetaAT[i][j] = new TH1F(heName.Data(), "title", 30, 0, 3.14); + hethetaAT[i][j] = new TH1F(heName.Data(), cAngles.GetTitle(), noBinsThetaA, 0, TMath::Pi()); drawCommand.Form("fAThetaCM>>%s", hethetaAT[i][j]->GetName()); che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles && cEpsilonT, "goff", eEventsECuts[i][j]); hsthetaAT[i][j]->Draw(); - hsthetaAT[i][j]->SetTitle(""); +// hsthetaAT[i][j]->SetTitle(""); hsthetaAT[i][j]->SetXTitle("\\theta_{\\alpha} (rad)"); // hsthetaAT[i][j]->GetXaxis()->SetTitleOffset(0.95); hsthetaAT[i][j]->GetXaxis()->CenterTitle(); @@ -956,9 +992,10 @@ void BeAnalysis::ThetaAT() { cThetaAT[i]->Update(); hiName.Form("hithetaAT%d_%d", i, j); - drawCommand.Form("sACM.Theta()>>%s(30,0,3.14)", hiName.Data()); + hithetaAT[i][j] = new TH1F(hiName.Data(), cAngles.GetTitle(), noBinsThetaA, 0, TMath::Pi()); + drawCommand.Form("sACM.Theta()>>%s", hiName.Data()); ti[j]->Draw(drawCommand.Data(), ciEpsilon && ciBeE[i] && sRatio[j], "same"); - hithetaAT[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); +// hithetaAT[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); Float_t rightmax = 1.1*hithetaAT[i][j]->GetMaximum(); Float_t scale = cThetaAT[i]->GetPad(j+1)->GetUymax()/rightmax; hithetaAT[i][j]->SetLineColor(kRed); diff --git a/Be/BeAnalysis.h b/Be/BeAnalysis.h index ad4f5f8..fc78f33 100644 --- a/Be/BeAnalysis.h +++ b/Be/BeAnalysis.h @@ -40,6 +40,7 @@ public: void SetNoBinsSpectra(Int_t noBins = 100) {noBinsSpectra = noBins;}; void SetNoBinsCorrelations(Int_t noBins = 30) {noBinsCorr = noBins;}; + void SetNoBinsThetaA(Int_t noBins = 30) {noBinsThetaA = noBins;}; TChain* GetExpChain() {return che;}; TChain* GetSimChain(Int_t i) {return chs[i];}; @@ -79,11 +80,13 @@ public: void SaveSpectrumHist(Int_t chain); - void SaveEpsilonTHist(Int_t interval, Int_t chain); + void SaveEpsilonTHist(Int_t interval, Int_t chain, TString outfilename = "figures/epsilonT.root"); void SaveCosThetaTHist(Int_t interval, Int_t chain); void SaveEpsilonYHist(Int_t interval, Int_t chain); + void SaveThetaAHist(Int_t interval, Int_t chain); + // private: @@ -102,6 +105,7 @@ private: Int_t noBinsSpectra; Int_t noBinsCorr; + Int_t noBinsThetaA; Int_t kMinAngle; Int_t kMaxAngle; @@ -123,6 +127,10 @@ private: TH1F *heeY[5][6]; TH1F *hieY[5][6]; + TH1F *hsthetaAT[5][6]; + TH1F *hethetaAT[5][6]; + TH1F *hithetaAT[5][6]; + //cuts TCut cAngles; TCut crAngles; -- 2.18.1