From 3edca5dd02562d45c938bda82c408895dc5de926 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Fri, 21 Jul 2017 10:36:30 +0300 Subject: [PATCH] CosThetaTk() and EpsilonY() implemented. --- Be/BeAnalysis.cpp | 187 ++++++++++++++++++++++++++++++++++ Be/BeAnalysis.h | 2 + macros/BeCorrPRC/lib_test.cxx | 6 +- 3 files changed, 194 insertions(+), 1 deletion(-) diff --git a/Be/BeAnalysis.cpp b/Be/BeAnalysis.cpp index b412d78..2e1e7c6 100644 --- a/Be/BeAnalysis.cpp +++ b/Be/BeAnalysis.cpp @@ -30,6 +30,23 @@ BeAnalysis::BeAnalysis() : che(0), spectra(1) { epsilonT[0] = 1; epsilonT[2] = 1; + + cosThetaT = new Bool_t[noIntervals]; + for (Int_t i = 0; i < noIntervals; i++) { + cosThetaT[i] = 0; + } + cosThetaT[0] = 1; + cosThetaT[2] = 1; + cosThetaT[4] = 1; + + epsilonY = new Bool_t[noIntervals]; + for (Int_t i = 0; i < noIntervals; i++) { + epsilonY[i] = 0; + } + epsilonY[0] = 1; + epsilonY[2] = 1; + + kVerbose = 1; kRangeProportionIn = 2.0; @@ -483,9 +500,179 @@ void BeAnalysis::EpsilonT() { void BeAnalysis::CosThetaTk() { + TCanvas *cThetaT[noIntervals]; + for (Int_t i = 0; iSetTitle(canvasTitle.Data()); + cThetaT[i]->Divide(2, 3); + + che->SetLineColor(kBlack); + for (Int_t j = 0; j < 6; j++) { //different files + if (!kChains[j]) continue; + cThetaT[i]->cd(j+1); + chs[j]->SetLineColor(kGray+1); + chs[j]->SetFillColor(kGray+1); + hsName.Form("hscoskT%d_%d", i, j); + drawCommand.Form("fCosThetaTk>>%s(50,-1,1)", hsName.Data()); + chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && sRatio[j], "", sEventsECuts[i][j]); + hscoskT[i][j] = (TH1F*)gPad->FindObject(hsName.Data()); + heName.Form("hecoskT%d_%d", i, j); + drawCommand.Form("fCosThetaTk>>%s(50,-1,1)", heName.Data()); + che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEventsECuts[i][j]); + hecoskT[i][j] = (TH1F*)gPad->FindObject(heName.Data()); + + hscoskT[i][j]->Draw(); + // hscoskT[i][j]->GetYaxis()->SetRangeUser(0, coskTRange[i][j]); + hecoskT[i][j]->Draw("E same"); + if (kAutoRange) { + Float_t leftMaxMC = kRangeProportion*hecoskT[i][j]->GetMaximum(); + Float_t leftMaxE = kRangeProportion*hscoskT[i][j]->GetMaximum(); + hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); + leftMaxMC > leftMaxE ? hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hscoskT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); + } + else { + hscoskT[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]); + } + cThetaT[i]->Update(); + + + hiName.Form("hicoskT%d_%d", i, j); + drawCommand.Form("sCosThetaTk>>%s(50,0,1)", hiName.Data()); + ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same"); + hicoskT[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); + Float_t rightmax = 1.1*hicoskT[i][j]->GetMaximum(); + Float_t scale = cThetaT[i]->GetPad(j+1)->GetUymax()/rightmax; + hicoskT[i][j]->SetLineColor(kRed); + hicoskT[i][j]->Scale(scale); + + //draw an axis on the right side + TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), + gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L"); + axis->SetLineColor(kRed); + axis->SetLabelColor(kRed); + axis->Draw(); + + cThetaT[i]->Update(); + + if (kVerbose) { + Info("sfAngInt_cosThetaTk.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f", + i, j, hecoskT[i][j]->Integral(0,hecoskT[i][j]->GetNbinsX()), + hscoskT[i][j]->Integral(0,hscoskT[i][j]->GetNbinsX()), + hecoskT[i][j]->Integral(0,hecoskT[i][j]->GetNbinsX())/hscoskT[i][j]->Integral(0,hscoskT[i][j]->GetNbinsX()) ); + } + + }//for j + + /*if (savePictures) { + canvasName.Form("%sfig%dcosThetakT:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); + cThetaT[i]->SaveAs(canvasName.Data()); + cThetaT[i]->cd(); + cThetaT[i]->Close(); + }*/ + // }//if + }//for i + } void BeAnalysis::EpsilonY() { + + TCanvas *canEpsilonY[noIntervals]; + for (Int_t i = 0; iSetTitle(canvasTitle.Data()); + canEpsilonY[i]->Divide(2, 3); + + che->SetLineColor(kBlack); + for (Int_t j = 0; j < 6; j++) { //different files + canEpsilonY[i]->cd(j+1); + chs[j]->SetLineColor(kGray+1); + chs[j]->SetFillColor(kGray+1); + hsName.Form("hseY%d_%d", i, j); + drawCommand.Form("fTap/f6BeIM>>%s(50,0,1)", 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()); + che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEvents[j]); + heeY[i][j] = (TH1F*)gPad->FindObject(heName.Data()); + + hseY[i][j]->Draw(); + heeY[i][j]->Draw("E same"); + if (kAutoRange) { + Float_t leftMaxMC = kRangeProportion*heeY[i][j]->GetMaximum(); + Float_t leftMaxE = kRangeProportion*hseY[i][j]->GetMaximum(); + hseY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); + leftMaxMC > leftMaxE ? hseY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hseY[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); + } + else { + hseY[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]); + } + canEpsilonY[i]->Update(); + + + + // ti[j]->Draw("sTap/E_IM", ciBeE[i] && sRatio[j], "same", iEvents[j]); + + hiName.Form("hieY%d_%d", i, j); + drawCommand.Form("sTap/E_IM>>%s(50,0,1)", hiName.Data()); + ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same"); + 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); + hieY[i][j]->Scale(scale); + + //draw an axis on the right side + TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), + gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"+L"); + axis->SetLineColor(kRed); + axis->SetLabelColor(kRed); + axis->Draw(); + + + + canEpsilonY[i]->Update(); + + if (kVerbose) { + Info("sfAngInt_epsilonY.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f", + i, j, heeY[i][j]->Integral(0,heeY[i][j]->GetNbinsX()), + hseY[i][j]->Integral(0,hseY[i][j]->GetNbinsX()), + heeY[i][j]->Integral(0,heeY[i][j]->GetNbinsX())/hseY[i][j]->Integral(0,hseY[i][j]->GetNbinsX()) ); + } + + }//for j + + /*if (savePictures) { + canvasName.Form("%sfig%dEpsilonY:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); + cout << canvasName.Data() << endl; + canEpsilonY[i]->SaveAs(canvasName.Data()); + canEpsilonY[i]->cd(); + canEpsilonY[i]->Close(); + }//if save pictures*/ + // }//if + }//for i + + } void BeAnalysis::CosThetaYk() { diff --git a/Be/BeAnalysis.h b/Be/BeAnalysis.h index 7d656e6..c9caa17 100644 --- a/Be/BeAnalysis.h +++ b/Be/BeAnalysis.h @@ -67,6 +67,8 @@ private: Bool_t kChains[6]; Int_t noIntervals; Bool_t *epsilonT; //! + Bool_t *cosThetaT; //! + Bool_t *epsilonY; //! Bool_t kAutoRange; Float_t kRangeProportion; diff --git a/macros/BeCorrPRC/lib_test.cxx b/macros/BeCorrPRC/lib_test.cxx index b74fa4b..7a8f401 100755 --- a/macros/BeCorrPRC/lib_test.cxx +++ b/macros/BeCorrPRC/lib_test.cxx @@ -16,5 +16,9 @@ void lib_test() { ana.ExpEventsECuts(); ana.SimEventsECuts(); ana.EpsilonTRange(); - ana.EpsilonT(); +// ana.EpsilonT(); + + ana.CosThetaTk(); + + ana.EpsilonY(); } -- 2.18.1