From 59525b132784fa86af028a2043fd1335b4a6d3a0 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Thu, 27 Jul 2017 13:49:57 +0300 Subject: [PATCH] Bug with input histogram solved. --- Be/BeAnalysis.cpp | 177 +++++++--------------------------- Be/BeAnalysis.h | 47 ++------- macros/BeCorrPRC/lib_test.cxx | 27 ------ 3 files changed, 46 insertions(+), 205 deletions(-) delete mode 100755 macros/BeCorrPRC/lib_test.cxx diff --git a/Be/BeAnalysis.cpp b/Be/BeAnalysis.cpp index a349250..bae2210 100644 --- a/Be/BeAnalysis.cpp +++ b/Be/BeAnalysis.cpp @@ -22,53 +22,15 @@ BeAnalysis::BeAnalysis() : che(0), lowExpFile(0), upExpFile(0), spectra(0) { SetCuts(); SetChainsToDraw(); - epsilonT = 0; + SetNoBinsSpectra(); noIntervals = 5; -// epsilonT = new Bool_t[noIntervals]; -// for (Int_t i = 0; i < noIntervals; i++) { -// epsilonT[i] = 0; -// } -// epsilonT[0] = 1; -// epsilonT[2] = 1; - + epsilonT = 0; cosThetaT = 0; - -// 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 = 0; - -// epsilonY = new Bool_t[noIntervals]; -// for (Int_t i = 0; i < noIntervals; i++) { -// epsilonY[i] = 0; -// } -// epsilonY[0] = 1; -// epsilonY[2] = 1; - cosThetaY = 0; -// cosThetaY = new Bool_t[noIntervals]; -// for (Int_t i = 0; i < noIntervals; i++) { -// cosThetaY[i] = 0; -// } -// cosThetaY[0] = 1; -// cosThetaY[2] = 1; -// cosThetaY[4] = 1; - thetaAT = 0; -// 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; @@ -85,28 +47,6 @@ BeAnalysis::~BeAnalysis() { void BeAnalysis::OpenSimChains() { -// const Int_t lowSimFile[6] = {0, 0, 0, 0, 0, 0}; -// const Int_t upSimFile[6] = {14, 14, 14, 14, 14, 14}; -// -// TString chainAl0name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_0_50-85_"; -// TString inputTreeAl0name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_0_50-85_000.root"; -// //isotropic, 0 degrees -// TString chainNoAl0name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_0_50-85_"; -// TString inputTreeNoAl0name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_0_50-85_000.root"; -// //aligned, 180 degrees -// TString chainAl180name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_180_50-85_"; -// TString inputTreeAl180name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_180_50-85_000.root"; -// //isotropic, 180 degrees -// TString chainNoAl180name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_180_50-85_"; -// TString inputTreeNoAl180name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_180_50-85_000.root"; -// //isotropic, 90 degrees -// TString chainAl90name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_90_50-85_"; -// TString inputTreeAl90name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_al_90_50-85_000.root"; -// //isotropic, 90 degrees -// TString chainNoAl90name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_90_50-85_"; -// TString inputTreeNoAl90name = "../../../be/rootdata/correlations/v5_6075/Sim_mix_br_noal_90_50-85_000.root"; - - for (Int_t i = 0; i < 6; i++) { chs[i] = BeWork::OpenChain(simFiles[i].Data(), lowSimFile[i], upSimFile[i], "simbe", 4, "sbeam"); @@ -114,31 +54,6 @@ void BeAnalysis::OpenSimChains() { ti[i] = BeWork::OpenTree(inputFiles[i].Data(), "sbeam", 2); } -// chs[1] = BeWork::OpenChain(chainNoAl0name.Data(), -// lowSimFile[1], upSimFile[1], "simbe", 4, "sbeam"); -// Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[1]->GetEntries(), chs[1]->GetName()); -// ti[1] = BeWork::OpenTree(inputTreeNoAl0name.Data(), "sbeam", 2); -// -// chs[2] = BeWork::OpenChain(chainAl180name.Data(), -// lowSimFile[2], upSimFile[2], "simbe", 4, "sbeam"); -// Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[2]->GetEntries(), chs[2]->GetName()); -// ti[2] = BeWork::OpenTree(inputTreeAl180name.Data(), "sbeam", 2); -// -// chs[3] = BeWork::OpenChain(chainNoAl180name.Data(), -// lowSimFile[3], upSimFile[3], "simbe", 4, "sbeam"); -// Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[3]->GetEntries(), chs[3]->GetName()); -// ti[3] = BeWork::OpenTree(inputTreeNoAl180name.Data(), "sbeam", 2); -// -// chs[4] = BeWork::OpenChain(chainAl90name.Data(), -// lowSimFile[4], upSimFile[4], "simbe", 4, "sbeam"); -// Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[4]->GetEntries(), chs[4]->GetName()); -// ti[4] = BeWork::OpenTree(inputTreeAl90name.Data(), "sbeam", 2); -// -// chs[5] = BeWork::OpenChain(chainNoAl90name.Data(), -// lowSimFile[5], upSimFile[5], "simbe", 4, "sbeam"); -// Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[5]->GetEntries(), chs[5]->GetName()); -// ti[5] = BeWork::OpenTree(inputTreeNoAl90name.Data(), "sbeam", 2); - } void BeAnalysis::OpenExpChain() { @@ -155,9 +70,9 @@ void BeAnalysis::SetCuts() { cBe3 = "fBeIM>0 && fBeIM<3"; cBeWork = "fBeIM>0 && fBeIM<10"; - cBe0_14 = "fBeIM>0 && fBeIM<1.4"; - // TCut cBe0_14 = "fBeIM>0 && fBeIM<1.6"; - // TCut cBe0_14 = "fBeIM>0 && fBeIM<1.20"; + /*TCut */cBe0_14 = "fBeIM>0 && fBeIM<1.4"; + //cBe0_14 = "fBeIM>0 && fBeIM<1.6"; + //cBe0_14 = "fBeIM>0 && fBeIM<1.20"; cBe14_19 = "fBeIM>1.4 && fBeIM<1.9"; cBe19_25 = "fBeIM>1.9 && fBeIM<2.5"; cBe25_31 = "fBeIM>2.5 && fBeIM<3.1"; @@ -170,8 +85,8 @@ void BeAnalysis::SetCuts() { cBeE[4] = cBe31_37; cEpsilonT = "fTpp/fBeIM<0.2"; - // TCut cEpsilonT = "fTpp/fBeIM<1."; - // TCut cEpsilonY = "fTap/fBeIM<0.5"; + //cEpsilonT = "fTpp/fBeIM<1."; + //cEpsilonY = "fTap/fBeIM<0.5"; cEpsilonY = "fTap/fBeIM>0.7"; //raw files @@ -181,8 +96,8 @@ void BeAnalysis::SetCuts() { crBeWork = "f6BeIM>0 && f6BeIM<10"; crBe0_14 = "f6BeIM>0 && f6BeIM<1.4"; - // TCut crBe0_14 = "f6BeIM>0 && f6BeIM<1.6"; - // TCut crBe0_14 = "f6BeIM>0.5 && f6BeIM<1.20"; + //crBe0_14 = "f6BeIM>0 && f6BeIM<1.6"; + //crBe0_14 = "f6BeIM>0.5 && f6BeIM<1.20"; crBe14_19 = "f6BeIM>1.4 && f6BeIM<1.9"; crBe19_25 = "f6BeIM>1.9 && f6BeIM<2.5"; crBe25_31 = "f6BeIM>2.5 && f6BeIM<3.1"; @@ -196,35 +111,35 @@ void BeAnalysis::SetCuts() { //angular cuts - // TCut crEpsilonT = "fTpp/f6BeIM>0.8"; + //crEpsilonT = "fTpp/f6BeIM>0.8"; crEpsilonT = "fTpp/f6BeIM<0.2"; - // TCut crEpsilonT = "fTpp/f6BeIM<1."; - // TCut crEpsilonY = "fTap/f6BeIM<0.5"; + //crEpsilonT = "fTpp/f6BeIM<1."; + //crEpsilonY = "fTap/f6BeIM<0.5"; crEpsilonY = "fTap/f6BeIM>0.7"; //simulation input - ciBe0_14 = "E_IM>0 && E_IM<1.4"; - // TCut ciBe0_14 = "E_IM>0 && E_IM<1.6"; - // TCut ciBe0_14 = "E_IM>0.5 && E_IM<1.20"; - ciBe14_19 = "E_IM>1.4 && E_IM<1.9"; - ciBe19_25 = "E_IM>1.9 && E_IM<2.5"; - ciBe25_31 = "E_IM>2.5 && E_IM<3.1"; - ciBe31_37 = "E_IM>3.1 && E_IM<3.7"; + TCut ciBe0_14 = "E_IM>0 && E_IM<1.4"; + //ciBe0_14 = "E_IM>0 && E_IM<1.6"; + //ciBe0_14 = "E_IM>0.5 && E_IM<1.20"; + TCut ciBe14_19 = "E_IM>1.4 && E_IM<1.9"; + TCut ciBe19_25 = "E_IM>1.9 && E_IM<2.5"; + TCut ciBe25_31 = "E_IM>2.5 && E_IM<3.1"; + TCut ciBe31_37 = "E_IM>3.1 && E_IM<3.7"; //array: - ciBeE[5] = ciBe0_14; - ciBeE[5] = ciBe14_19; - ciBeE[5] = ciBe19_25; - ciBeE[5] = ciBe25_31; - ciBeE[5] = ciBe31_37; + ciBeE[0] = ciBe0_14; + ciBeE[1] = ciBe14_19; + ciBeE[2] = ciBe19_25; + ciBeE[3] = ciBe25_31; + ciBeE[4] = ciBe31_37; ciEpsilon = "sTpp/E_IM<0.2"; - // TCut ciEpsilon = "sTpp/E_IM<1."; - // TCut ciEpsilonY = "sTap/E_IM<0.5"; + //ciEpsilon = "sTpp/E_IM<1."; + //ciEpsilonY = "sTap/E_IM<0.5"; ciEpsilonY = "sTap/E_IM>0.7"; cQ = "TMath::Abs(fQLiP)<10"; cProtons = "fP1Lab.fE-938.272<50 && fP2Lab.fE-938.272<50"; - // TCut cProtons = "fP1Lab.fE-938.272<34 && fP2Lab.fE-938.272<34 && fP1Lab.fE-938.272>1 && fP2Lab.fE-938.272>1"; + //cProtons = "fP1Lab.fE-938.272<34 && fP2Lab.fE-938.272<34 && fP1Lab.fE-938.272>1 && fP2Lab.fE-938.272>1"; } void BeAnalysis::SetCMAngularRange(Int_t minAngle, Int_t maxAngle) { @@ -264,8 +179,8 @@ void BeAnalysis::SetNoExpEvents(Long64_t *noExpEvents) { for (Int_t i = 0; i < 6; i++) { eEvents[i] = noExpEvents[i]; -// cout << eEvents[i] << endl; } + return; } @@ -289,34 +204,12 @@ void BeAnalysis::SetNoSimEvents(Long64_t *noSimEvents) { } return; -// sEventsAl0 = sMaxEvents; -// sEventsNoAl0 = 2700000; -// sEventsAl180 = sMaxEvents; -// sEventsNoAl180 = 2700000; -// sEventsAl90 = 2690000; -// sEventsNoAl90 = 2710000; -// -// sEvents[0] = sEventsAl0; -// sEvents[1] = sEventsNoAl0; -// sEvents[2] = sEventsAl180; -// sEvents[3] = sEventsNoAl180; -// sEvents[4] = sEventsAl90; -// sEvents[5] = sEventsNoAl90; - } void BeAnalysis::SetRatiosGStoEX(TString sRatioAl0, TString sRatioNoAl0, TString sRatioAl180, TString sRatioNoAl180, TString sRatioAl90, TString sRatioNoAl90) { -// sRatioAl0 = "sRatio>0.051 && sRatio<0.101"; -// // TCut sRatioAl0 = "sRatio>0.060 && sRatio<0.110"; -// sRatioNoAl0 = "sRatio>0.050 && sRatio<0.100"; -// sRatioAl180 = "sRatio>0.047 && sRatio<0.097"; -// sRatioNoAl180 = "sRatio>0.048 && sRatio<0.098"; -// sRatioAl90 = "sRatio>0.051 && sRatio<0.101"; -// sRatioNoAl90 = "sRatio>0.051 && sRatio<0.101"; - sRatio[0] = sRatioAl0; sRatio[1] = sRatioNoAl0; sRatio[2] = sRatioAl180; @@ -375,12 +268,16 @@ void BeAnalysis::Spectra() { chs[j]->SetLineColor(kBlue); chs[j]->SetFillColor(kWhite); hsName.Form("hsSpectra%d", j); - drawCommand.Form("f6BeIM>>%s(200,0,10)", hsName.Data()); + hsSpectra[j] = new TH1F(hsName.Data(), "title", noBinsSpectra, 0, 10); +// drawCommand.Form("f6BeIM>>%s(200,0,10)", hsName.Data()); + drawCommand.Form("f6BeIM>>%s", hsName.Data()); // chs[j]->Draw(drawCommand.Data(), cQ && crBeWork && crAngles && sRatio[j], "", sEvents[j]); chs[j]->Draw(drawCommand.Data(), cProtons && cQ && crBeWork && crAngles && sRatio[j], "", sEvents[j]); - hsSpectra[j] = (TH1F*)gPad->FindObject(hsName.Data()); +// hsSpectra[j] = (TH1F*)gPad->FindObject(hsName.Data()); heName.Form("heSpectra%d", j); - drawCommand.Form("fBeIM>>%s(200,0,10)", heName.Data()); + heSpectra[j] = new TH1F(heName.Data(), "title", noBinsSpectra, 0, 10); +// drawCommand.Form("fBeIM>>%s(200,0,10)", heName.Data()); + drawCommand.Form("fBeIM>>%s", heName.Data()); // che->Draw(drawCommand.Data(), cQ && cBeWork && cAngles, "same", eEvents[j]); che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]); @@ -389,7 +286,7 @@ void BeAnalysis::Spectra() { //// che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]); // che->Draw("fBeIM", "", ""); // continue; - heSpectra[j] = (TH1F*)gPad->FindObject(heName.Data()); +// heSpectra[j] = (TH1F*)gPad->FindObject(heName.Data()); // heSpectra[j]->Draw(""); heSpectra[j]->Draw("E"); @@ -425,7 +322,7 @@ void BeAnalysis::Spectra() { Info("statesRatioFitting", "left slope: %3.1f (sim)/ %3.1f (exp) = %3.3f\n", hsSpectra[j]->Integral(50,70), heSpectra[j]->Integral(50,70), hsSpectra[j]->Integral(50,70)/heSpectra[j]->Integral(50,70) ); }//for j - SaveFigures(cSpectra, "Spectra", 1); + SaveFigures(cSpectra, "Spectra", 0); Info("sfAngInt_spectra.cxx", "Finished."); diff --git a/Be/BeAnalysis.h b/Be/BeAnalysis.h index 1ad1688..9bde6c4 100644 --- a/Be/BeAnalysis.h +++ b/Be/BeAnalysis.h @@ -36,6 +36,8 @@ public: void OpenSimChains(); void OpenExpChain(); + void SetNoBinsSpectra(Int_t noBins = 100) {noBinsSpectra = noBins;}; + TChain* GetExpChain() {return che;}; TChain* GetSimChain(Int_t i) {return chs[i];}; void SetChainsToDraw(Bool_t ch0 = 1, Bool_t ch1 = 1, Bool_t ch2 = 1, Bool_t ch3 = 1, Bool_t ch4 = 1, Bool_t ch5 = 1); @@ -92,6 +94,8 @@ private: Int_t lowSimFile[6]; Int_t upSimFile[6]; + Int_t noBinsSpectra; + Int_t kMinAngle; Int_t kMaxAngle; @@ -113,29 +117,11 @@ private: Float_t kRangeProportionIn; Long64_t eMaxEvents; -// Long64_t eEventsAl0; -// Long64_t eEventsNoAl0; -// Long64_t eEventsAl180; -// Long64_t eEventsNoAl180; -// Long64_t eEventsAl90; -// Long64_t eEventsNoAl90; Long64_t eEvents[6]; Long64_t sMaxEvents; - Long64_t sEventsAl0; - Long64_t sEventsNoAl0; - Long64_t sEventsAl180; - Long64_t sEventsNoAl180; - Long64_t sEventsAl90; - Long64_t sEventsNoAl90; Long64_t sEvents[6]; - TCut sRatioAl0; - TCut sRatioNoAl0; - TCut sRatioAl180; - TCut sRatioNoAl180; - TCut sRatioAl90; - TCut sRatioNoAl90; TCut sRatio[6]; Long64_t eEventsECuts[5][6]; //! @@ -147,8 +133,6 @@ private: TCut cBe3; TCut cBeWork; TCut cBe0_14; - // TCut cBe0_14 = "fBeIM>0 && fBeIM<1.6"; - // TCut cBe0_14 = "fBeIM>0 && fBeIM<1.20"; TCut cBe14_19; TCut cBe19_25; TCut cBe25_31; @@ -156,8 +140,6 @@ private: TCut cBeE[5]; TCut cEpsilonT; - // TCut cEpsilonT = "fTpp/fBeIM<1."; - // TCut cEpsilonY = "fTap/fBeIM<0.5"; TCut cEpsilonY; //raw files @@ -166,8 +148,6 @@ private: TCut crBe3; TCut crBeWork; TCut crBe0_14; - // TCut crBe0_14 = "f6BeIM>0 && f6BeIM<1.6"; - // TCut crBe0_14 = "f6BeIM>0.5 && f6BeIM<1.20"; TCut crBe14_19; TCut crBe19_25; TCut crBe25_31; @@ -175,31 +155,22 @@ private: TCut crBeE[5]; //angular cuts - - // TCut crEpsilonT = "fTpp/f6BeIM>0.8"; TCut crEpsilonT; - // TCut crEpsilonT = "fTpp/f6BeIM<1."; - // TCut crEpsilonY = "fTap/f6BeIM<0.5"; TCut crEpsilonY; //simulation input - TCut ciBe0_14; - // TCut ciBe0_14 = "E_IM>0 && E_IM<1.6"; - // TCut ciBe0_14 = "E_IM>0.5 && E_IM<1.20"; - TCut ciBe14_19; - TCut ciBe19_25; - TCut ciBe25_31; - TCut ciBe31_37; +// TCut ciBe0_14; +// TCut ciBe14_19; +// TCut ciBe19_25; +// TCut ciBe25_31; +// TCut ciBe31_37; TCut ciBeE[5]; TCut ciEpsilon; - // TCut ciEpsilon = "sTpp/E_IM<1."; - // TCut ciEpsilonY = "sTap/E_IM<0.5"; TCut ciEpsilonY; TCut cQ; TCut cProtons; - // TCut cProtons = "fP1Lab.fE-938.272<34 && fP2Lab.fE-938.272<34 && fP1Lab.fE-938.272>1 && fP2Lab.fE-938.272>1"; Bool_t spectra; diff --git a/macros/BeCorrPRC/lib_test.cxx b/macros/BeCorrPRC/lib_test.cxx deleted file mode 100755 index 9e5b0dd..0000000 --- a/macros/BeCorrPRC/lib_test.cxx +++ /dev/null @@ -1,27 +0,0 @@ -void lib_test() { - BeAnalysis ana; - ana.OpenExpChain(); - ana.OpenSimChains(); - - ana.SetCMAngularRange(60, 75); - ana.SetCMAngularCuts(); - - ana.SetRangeProportion(); - ana.SetNoExpEvents(); - ana.SetNoSimEvents(); - ana.SetRatiosGStoEX(); - -// ana.Spectra(); - - ana.ExpEventsECuts(); - ana.SimEventsECuts(); - ana.EpsilonTRange(); - -// ana.EpsilonT(); -// ana.CosThetaTk(); - -// ana.EpsilonY(); -// ana.CosThetaYk(); - - ana.ThetaAT(); -} -- 2.18.1