From a389fc8164f34a38e948087ee6d4a1818c269602 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Fri, 21 Jul 2017 11:34:36 +0300 Subject: [PATCH] ThetaAT() implemented. --- Be/BeAnalysis.cpp | 192 +++++++++++++++++++++++++++++++++- Be/BeAnalysis.h | 3 + macros/BeCorrPRC/lib_test.cxx | 6 +- 3 files changed, 195 insertions(+), 6 deletions(-) diff --git a/Be/BeAnalysis.cpp b/Be/BeAnalysis.cpp index 06e8b5e..d20ded7 100644 --- a/Be/BeAnalysis.cpp +++ b/Be/BeAnalysis.cpp @@ -54,6 +54,22 @@ BeAnalysis::BeAnalysis() : che(0), spectra(1) { cosThetaY[2] = 1; cosThetaY[4] = 1; +// thetaP1T = new Bool_t[noIntervals]; +// for (Int_t i = 0; i < noIntervals; i++) { +// thetaP1T[i] = 0; +// } +// thetaP1T[0] = 1; +// thetaP1T[2] = 1; +// thetaP1T[4] = 1; + + thetaAT = new Bool_t[noIntervals]; + for (Int_t i = 0; i < noIntervals; i++) { + thetaAT[i] = 0; + } + thetaAT[0] = 1; + thetaAT[2] = 1; + thetaAT[4] = 1; + kVerbose = 1; kRangeProportionIn = 2.0; @@ -770,7 +786,178 @@ void BeAnalysis::CosThetaYk() { } -void BeAnalysis::ThetaP1T() { +//void BeAnalysis::ThetaP1T() { +// +// const Double_t tP1Range[5][6] = {90, 90, 90, 90, 90, 90, +// 140, 140, 140, 140, 140, 140, +// 130, 130, 130, 130, 130, 130, +// 190, 190, 190, 190, 190, 190, +// 200, 200, 200, 200, 200, 200}; +// +// +// TCanvas *cThetaP1T[noIntervals]; +// for (Int_t i = 0; iSetTitle(canvasTitle.Data()); +// cThetaP1T[i]->Divide(2, 3); +// +// che->SetLineColor(kBlack); +// for (Int_t j = 0; j < 6; j++) { //different files +// cThetaP1T[i]->cd(j+1); +// chs[j]->SetLineColor(kGray+1); +// chs[j]->SetFillColor(kGray+1); +// hsName.Form("hsthetaP1T%d_%d", i, j); +// drawCommand.Form("fP1ThetaCM>>%s(50,0,3.14)", hsName.Data()); +// chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && crEpsilonT && sRatio[j], "", sEvents[j]); +// hsthetaP1T[i][j] = (TH1F*)gPad->FindObject(hsName.Data()); +// heName.Form("hethetaP1T%d_%d", i, j); +// drawCommand.Form("fP1ThetaCM>>%s(50,0,3.14)", heName.Data()); +// che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles && cEpsilonT, "E same", eEvents[j]); +// hethetaP1T[i][j] = (TH1F*)gPad->FindObject(heName.Data()); +// +// hsthetaP1T[i][j]->Draw(); +// hsthetaP1T[i][j]->GetYaxis()->SetRangeUser(0, tP1Range[i][j]); +// hethetaP1T[i][j]->Draw("E same"); +// cThetaP1T[i]->Update(); +// +// +// hiName.Form("hithetaP1T%d_%d", i, j); +// drawCommand.Form("sP1CM.Theta()>>%s", hiName.Data()); +// ti[j]->Draw(drawCommand.Data(), ciEpsilon && ciBeE[i] && sRatio[j], "same"); +// hithetaP1T[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); +// Float_t rightmax = 1.1*hithetaP1T[i][j]->GetMaximum(); +// Float_t scale = cThetaP1T[i]->GetPad(j+1)->GetUymax()/rightmax; +// hithetaP1T[i][j]->SetLineColor(kRed); +// hithetaP1T[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(); +// +// cThetaP1T[i]->Update(); +// +// +// }//for j +// /*if (savePictures) { +// canvasName.Form("%sfig%dthetaP1T:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); +// cThetaP1T[i]->SaveAs(canvasName.Data()); +// cThetaP1T[i]->cd(); +// cThetaP1T[i]->Close(); +// }*/ +// // }//if +// }//for i +// +//} + +void BeAnalysis::ThetaAT() { + + TCanvas *cThetaAT[noIntervals]; + for (Int_t i = 0; iSetTitle(canvasTitle.Data()); + cThetaAT[i]->Divide(2, 3); + + che->SetLineColor(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", 50, 0, 3.14); + // hsthetaAT[i][j] = new TH1F(hsName.Data(), "title", 50, -1, 1); + hsthetaAT[i][j]->SetLineColor(kGray+1); + hsthetaAT[i][j]->SetFillColor(kGray+1); + drawCommand.Form("fAThetaCM>>%s", hsthetaAT[i][j]->GetName()); + // drawCommand.Form("cos(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", 50, 0, 3.14); + // hethetaAT[i][j] = new TH1F(heName.Data(), "title", 50, -1, 1); + drawCommand.Form("fAThetaCM>>%s", hethetaAT[i][j]->GetName()); + // drawCommand.Form("cos(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]->SetXTitle("\\theta_{\\alpha} [rad]"); + hsthetaAT[i][j]->GetXaxis()->SetTitleOffset(0.95); + hsthetaAT[i][j]->GetXaxis()->CenterTitle(); + hsthetaAT[i][j]->SetYTitle("counts"); + // hsthetaAT[i][j]->GetYaxis()->SetTitleOffset(1.09); + hsthetaAT[i][j]->GetYaxis()->SetTitleOffset(0.7); + hsthetaAT[i][j]->GetYaxis()->CenterTitle(); + + hethetaAT[i][j]->Draw("E same"); + if (kAutoRange) { + Float_t leftMaxMC = kRangeProportion*hethetaAT[i][j]->GetMaximum(); + Float_t leftMaxE = kRangeProportion*hsthetaAT[i][j]->GetMaximum(); + hsthetaAT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); + leftMaxMC > leftMaxE ? hsthetaAT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hsthetaAT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); + } + else { + hsthetaAT[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]); + } + cThetaAT[i]->Update(); + + hiName.Form("hithetaAT%d_%d", i, j); + drawCommand.Form("sACM.Theta()>>%s(50,0,3.14)", hiName.Data()); + // drawCommand.Form("cos(sACM.Theta())>>%s(50,-1,1)", hiName.Data()); + ti[j]->Draw(drawCommand.Data(), ciEpsilon && ciBeE[i] && sRatio[j], "same"); + 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); + hithetaAT[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(); + + cThetaAT[i]->Update(); + + if (kVerbose) { + Info("sfAngInt_thetaAT.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f", + i, j, hethetaAT[i][j]->Integral(0,hethetaAT[i][j]->GetNbinsX()), + hsthetaAT[i][j]->Integral(0,hsthetaAT[i][j]->GetNbinsX()), + hethetaAT[i][j]->Integral(0,hethetaAT[i][j]->GetNbinsX())/hsthetaAT[i][j]->Integral(0,hsthetaAT[i][j]->GetNbinsX()) ); + } + + }//for j + /*if (savePictures) { + canvasName.Form("%sfig%dthetaAT:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); + cThetaAT[i]->SaveAs(canvasName.Data()); + cThetaAT[i]->cd(); + cThetaAT[i]->Close(); + }*/ +// }//if + }//for i + } void BeAnalysis::ExpEventsECuts() { @@ -836,6 +1023,3 @@ void BeAnalysis::EpsilonTRange() { } - -void BeAnalysis::ThetaAT() { -} diff --git a/Be/BeAnalysis.h b/Be/BeAnalysis.h index 0f85191..97fd3fd 100644 --- a/Be/BeAnalysis.h +++ b/Be/BeAnalysis.h @@ -71,6 +71,9 @@ private: Bool_t *epsilonY; //! Bool_t *cosThetaY; //! +// Bool_t *thetaP1T; //! + Bool_t *thetaAT; //! + Bool_t kAutoRange; Float_t kRangeProportion; Bool_t kVerbose; diff --git a/macros/BeCorrPRC/lib_test.cxx b/macros/BeCorrPRC/lib_test.cxx index 62f04aa..9e5b0dd 100755 --- a/macros/BeCorrPRC/lib_test.cxx +++ b/macros/BeCorrPRC/lib_test.cxx @@ -20,6 +20,8 @@ void lib_test() { // ana.EpsilonT(); // ana.CosThetaTk(); - ana.EpsilonY(); - ana.CosThetaYk(); +// ana.EpsilonY(); +// ana.CosThetaYk(); + + ana.ThetaAT(); } -- 2.18.1