diff --git a/Be/BeAnalysis.cpp b/Be/BeAnalysis.cpp index 99ba4c9e9fce5bef0625d329d72214b980e868ee..32897afea7059c1e34fd04f96cc1330a7db2af12 100644 --- a/Be/BeAnalysis.cpp +++ b/Be/BeAnalysis.cpp @@ -23,6 +23,7 @@ BeAnalysis::BeAnalysis() : che(0), lowExpFile(0), upExpFile(0), spectra(0) { SetChainsToDraw(); SetNoBinsSpectra(); + SetSpectraRange(); SetNoBinsCorrelations(); SetNoBinsThetaA(); @@ -257,9 +258,9 @@ void BeAnalysis::InitHistos() { } -void BeAnalysis::SaveSpectrumHist(Int_t chain) { +void BeAnalysis::SaveSpectrumHist(Int_t chain, TString outfilename) { - TFile fw("figures/spectra.root", "UPDATE"); + TFile fw(outfilename.Data(), "UPDATE"); TString hName; @@ -267,13 +268,13 @@ void BeAnalysis::SaveSpectrumHist(Int_t chain) { hName.Form("heSpectrum%d%d", kMinAngle, kMaxAngle); heSpectra[chain]->SetName(hName.Data()); heSpectra[chain]->Write(); - Info("BeAnalysis::SaveSpectrumHist", "Histogram saved."); + Info("BeAnalysis::SaveSpectrumHist", "Histogram (exp) 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."); + Info("BeAnalysis::SaveSpectrumHist", "Histogram (sim) saved."); } fw.Close(); @@ -434,14 +435,14 @@ void BeAnalysis::Spectra() { // chs[j]->SetLineColor(kBlue); // chs[j]->SetFillColor(kWhite); hsName.Form("hsSpectra%d", j); - hsSpectra[j] = new TH1F(hsName.Data(), cAngles.GetTitle(), noBinsSpectra, 0, 10); + hsSpectra[j] = new TH1F(hsName.Data(), cAngles.GetTitle(), noBinsSpectra, minSpectraEnergy, maxSpectraEnergy); // 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()); heName.Form("heSpectra%d", j); - heSpectra[j] = new TH1F(heName.Data(), cAngles.GetTitle(), noBinsSpectra, 0, 10); + heSpectra[j] = new TH1F(heName.Data(), cAngles.GetTitle(), noBinsSpectra, minSpectraEnergy, maxSpectraEnergy); // 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]); @@ -488,7 +489,7 @@ void BeAnalysis::Spectra() { cSpectra->Update(); Int_t intLowLimit, IntHighLimit; - const Double_t binToMeV = 10./(Double_t)noBinsSpectra; + const Double_t binToMeV = (maxSpectraEnergy - minSpectraEnergy)/(Double_t)noBinsSpectra; Info("statesRatioFitting", "MC %d", j+1); intLowLimit = (Int_t)0./binToMeV; diff --git a/Be/BeAnalysis.h b/Be/BeAnalysis.h index 0429139b80edc8cb4b4109cf3e587ea0f31f8342..3445c1a963e068bb2d85368a34e0155f9a9b0f48 100644 --- a/Be/BeAnalysis.h +++ b/Be/BeAnalysis.h @@ -39,6 +39,8 @@ public: void OpenExpChain(); void SetNoBinsSpectra(Int_t noBins = 100) {noBinsSpectra = noBins;}; + void SetSpectraRange(Double_t minEnergy = 0., Double_t maxEnergy = 10.) + {minSpectraEnergy = minEnergy; maxSpectraEnergy = maxEnergy;}; void SetNoBinsCorrelations(Int_t noBins = 30) {noBinsCorr = noBins;}; void SetNoBinsThetaA(Int_t noBins = 30) {noBinsThetaA = noBins;}; @@ -79,7 +81,7 @@ public: void SetFigures(TString figPath = "figures/", TString figFormat = ".eps", Bool_t kSave = 1); - void SaveSpectrumHist(Int_t chain); + void SaveSpectrumHist(Int_t chain, TString outfilename = "figures/spectra.root"); void SaveEpsilonTHist(Int_t interval, Int_t chain, TString outfilename = "figures/epsilonT.root"); void SaveCosThetaTHist(Int_t interval, Int_t chain); @@ -105,6 +107,8 @@ private: Int_t upSimFile[6]; Int_t noBinsSpectra; + Double_t minSpectraEnergy; + Double_t maxSpectraEnergy; Int_t noBinsCorr; Int_t noBinsThetaA; diff --git a/macros/BeCorrPRC/ES1_4560.cxx b/macros/BeCorrPRC/ES1_4560.cxx index 26557f253aec88cace446717365ae687422f3300..8c9f86c378eb0fe7d48e997432c44e6965346a68 100644 --- a/macros/BeCorrPRC/ES1_4560.cxx +++ b/macros/BeCorrPRC/ES1_4560.cxx @@ -21,20 +21,21 @@ void ES1_4560() // ana.SetChainsToDraw(0, 0, 0, 0, 1, 1); ana.SetChainsToDraw(); - Bool_t epsilonT[6] = {0,1,0,0,0}; - Bool_t cosThetaT[6] = {1,0,0,0,0}; + Bool_t epsilonT[6] = {0,0,0,0,1}; + Bool_t cosThetaT[6] = {0,0,0,0,1}; Bool_t epsilonY[6] = {0,0,1,0,0}; Bool_t cosThetaY[6] = {0,0,1,0,0}; - Bool_t thetaAT[6] = {0,1,0,0,0}; + Bool_t thetaAT[6] = {0,0,0,0,1}; TString simEt[5] = {"", "f6BeIM>1.6 && f6BeIM<2.1", "", "", ""}; // TString simEt[5]; ana.SetSimCuts(simEt); -// ana.SetNoBinsSpectra(200); -// ana.SetSpectra(); - ana.SetEpsilonTintervals(epsilonT); + ana.SetNoBinsSpectra(10); + ana.SetSpectraRange(0., 10.); + ana.SetSpectra(); +// ana.SetEpsilonTintervals(epsilonT); // ana.SetEpsilonTintervals(); // ana.SetCosThetaTkIntervals(cosThetaT); // ana.SetCosThetaTkIntervals(); @@ -116,6 +117,11 @@ void ES1_4560() /////////////////////////////////////////////////////////////////////////////////// ana.Spectra(); + sw.Print(); + sw.Continue(); + + ana.SaveSpectrumHist(0, "figures/spectra1MeV.root"); +// ana.SaveSpectrumHist(0, "figures/spectra15MeV.root"); ana.EpsilonT(); @@ -145,6 +151,8 @@ void ES1_4560() if (saveHists) { // ana.SaveSpectrumHist(0); ana.SaveEpsilonTHist(0, 0); + ana.SaveEpsilonTHist(1, 2); + ana.SaveEpsilonTHist(3, 5); ana.SaveCosThetaTHist(0, 3); } diff --git a/macros/BeCorrPRC/ES1_6075.cxx b/macros/BeCorrPRC/ES1_6075.cxx index 18c4c0ad4d363e4ee47a1396525f1f8fa0f4a459..76cee46db3cd7faf5fe8d58f81252a5b2c3930b7 100644 --- a/macros/BeCorrPRC/ES1_6075.cxx +++ b/macros/BeCorrPRC/ES1_6075.cxx @@ -17,30 +17,32 @@ void ES1_6075() ana.SetChainsToDraw(); - Bool_t epsilonT[6] = {0,0,0,1,0}; - Bool_t cosThetaT[6] = {1,0,0,0,0}; - Bool_t epsilonY[6] = {1,0,0,0,0}; - Bool_t cosThetaY[6] = {0,0,1,0,0}; - Bool_t thetaAT[6] = {0,0,1,0,0}; + Bool_t epsilonT[6] = {0,0,0,0,1}; + Bool_t cosThetaT[6] = {0,0,0,0,1}; + Bool_t epsilonY[6] = {0,0,0,0,1}; + Bool_t cosThetaY[6] = {0,0,0,0,1}; + Bool_t thetaAT[6] = {0,0,0,0,1}; TString simEt[5] = {"", "f6BeIM>1.5 && f6BeIM<2.0", "", "f6BeIM>2.4 && f6BeIM<3.1", ""}; TString inEt[5] = {"", "E_IM>1.5 && E_IM<2.0", "", "E_IM>2.4 && E_IM<3.1", ""}; ana.SetSimCuts(simEt); ana.SetInputCuts(inEt); -// ana.SetSpectra(); - ana.SetEpsilonTintervals(epsilonT); + ana.SetNoBinsSpectra(10); + ana.SetSpectraRange(0., 10.); + ana.SetSpectra(); +// ana.SetEpsilonTintervals(epsilonT); // ana.SetEpsilonTintervals(); // ana.SetCosThetaTkIntervals(cosThetaT); // ana.SetCosThetaTkIntervals(); // ana.SetEpsilonYintervals(epsilonY); // ana.SetEpsilonYintervals(); -//// ana.SetCosThetaYkIntervals(cosThetaY); +// ana.SetCosThetaYkIntervals(cosThetaY); // ana.SetCosThetaYkIntervals(); // ana.SetThetaATintervals(thetaAT); // ana.SetThetaATintervals(); - ana.SetNoBinsSpectra(200); +// ana.SetNoBinsSpectra(200); ana.SetExpChain("../../../be/rootdata/correlations/v5_exp/Be.", 0, 40); @@ -105,6 +107,11 @@ void ES1_6075() /////////////////////////////////////////////////////////////////////////////////// ana.Spectra(); + sw.Print(); + sw.Continue(); + + ana.SaveSpectrumHist(0, "figures/spectra1MeV.root"); +// ana.SaveSpectrumHist(0, "figures/spectra15MeV.root"); ana.EpsilonT(); @@ -135,6 +142,7 @@ void ES1_6075() ana.SaveSpectrumHist(0); ana.SaveEpsilonTHist(0, 5); ana.SaveEpsilonTHist(1, 2); + ana.SaveEpsilonTHist(3, 5); } Info("ES1_6075.cxx", "Finished."); diff --git a/macros/BeCorrPRC/ES1_7590.cxx b/macros/BeCorrPRC/ES1_7590.cxx index 86abae710401fca22529e99f4da47a030b8900a2..640f50cc0f7eaa6d44dd8aa9a72829ed75f69bd5 100644 --- a/macros/BeCorrPRC/ES1_7590.cxx +++ b/macros/BeCorrPRC/ES1_7590.cxx @@ -15,17 +15,19 @@ void ES1_7590() // ana.SetChainsToDraw(0, 0, 0, 0, 1, 1); ana.SetChainsToDraw(); - Bool_t epsilonT[6] = {0,1,0,0,0}; - Bool_t cosThetaT[6] = {1,0,0,0,0}; - Bool_t epsilonY[6] = {1,0,0,0,0}; - Bool_t cosThetaY[6] = {0,0,1,0,0}; - Bool_t thetaAT[6] = {0,0,1,0,0}; + Bool_t epsilonT[6] = {0,0,0,0,1}; + Bool_t cosThetaT[6] = {0,0,0,0,1}; + Bool_t epsilonY[6] = {0,0,0,0,0}; + Bool_t cosThetaY[6] = {0,0,0,0,0}; + Bool_t thetaAT[6] = {0,0,0,0,1}; TString simEt[5] = {"", "f6BeIM>1.5 && f6BeIM<2.0", "", "", ""}; ana.SetSimCuts(simEt); -// ana.SetSpectra(); - ana.SetEpsilonTintervals(epsilonT); + ana.SetNoBinsSpectra(10); + ana.SetSpectraRange(0., 10.); + ana.SetSpectra(); +// ana.SetEpsilonTintervals(epsilonT); // ana.SetEpsilonTintervals(); // ana.SetCosThetaTkIntervals(cosThetaT); // ana.SetCosThetaTkIntervals(); @@ -89,10 +91,11 @@ void ES1_7590() const Long64_t sMaxEvents = 3000000; Long64_t sEventsECuts[5][6] = {2020000, 2040000, 2130000, 2080000, 2060000, 2080000, -// 2000000, 2020000, 2000000, 2010000, 1990000, 1970000, - 2300000, 2300000, 2300000, 2300000, 2300000, 2300000, + 2220000, 2240000, 2240000, 2280000, 2210000, 2210000, +// 2300000, 2300000, 2300000, 2300000, 2300000, 2300000, 2320000, 2300000, 2340000, 2310000, 2300000, 2290000, - 2060000, 2070000, 2110000, 2110000, 2070000, 2060000, +// 2060000, 2070000, 2110000, 2110000, 2070000, 2060000, + 2050000, 2050000, 2050000, 2050000, 2050000, 2050000, 2050000, 2050000, 2110000, 2110000, 2050000, 2050000}; ana.SimEventsECuts(sEventsECuts); @@ -104,6 +107,9 @@ void ES1_7590() sw.Print(); sw.Continue(); + ana.SaveSpectrumHist(0, "figures/spectra1MeV.root"); +// ana.SaveSpectrumHist(0, "figures/spectra15MeV.root"); + ana.EpsilonT(); sw.Print(); sw.Continue(); @@ -129,6 +135,16 @@ void ES1_7590() ana.SaveEpsilonTHist(0, 5); ana.SaveCosThetaTHist(0, 0); ana.SaveEpsilonYHist(0, 0); + + + for (Int_t i = 0; i < 6; i++) { + ana.SaveEpsilonTHist(1, i); + ana.SaveEpsilonTHist(3, i); + + ana.SaveThetaAHist(1, i); + ana.SaveThetaAHist(3, i); + } + } Info("ES1_7590.cxx", "Finished."); diff --git a/macros/BeCorrPRC/ES1_90120.cxx b/macros/BeCorrPRC/ES1_90120.cxx index 90e2becb2660c917de5243dd5cc32061ac39bd3b..fe9eb4a9d4ee50a62d44342d048801a223df66a6 100644 --- a/macros/BeCorrPRC/ES1_90120.cxx +++ b/macros/BeCorrPRC/ES1_90120.cxx @@ -15,17 +15,20 @@ void ES1_90120() // ana.SetChainsToDraw(0, 0, 0, 0, 1, 1); ana.SetChainsToDraw(); - Bool_t epsilonT[6] = {0,1,0,0,0}; - Bool_t cosThetaT[6] = {0,0,1,0,0}; +// Bool_t epsilonT[6] = {1,1,0,1,0}; + Bool_t epsilonT[6] = {0,0,0,0,1}; + Bool_t cosThetaT[6] = {0,0,0,0,1}; Bool_t epsilonY[6] = {0,0,1,0,0}; Bool_t cosThetaY[6] = {0,0,1,0,0}; - Bool_t thetaAT[6] = {0,0,1,0,0}; + Bool_t thetaAT[6] = {0,0,0,0,1}; TString simEt[5] = {"", "f6BeIM>1.40 && f6BeIM<1.95", "", "", ""}; ana.SetSimCuts(simEt); -// ana.SetSpectra(); - ana.SetEpsilonTintervals(epsilonT); + ana.SetNoBinsSpectra(10); + ana.SetSpectraRange(0., 10.); + ana.SetSpectra(); +// ana.SetEpsilonTintervals(epsilonT); // ana.SetEpsilonTintervals(); // ana.SetCosThetaTkIntervals(cosThetaT); // ana.SetCosThetaTkIntervals(); @@ -89,7 +92,8 @@ void ES1_90120() // 2260000, 2270000, 2010000, 2280000, 2280000, 2280000, 2280000, 2280000, 2280000, 2280000, 2280000, 2280000, sMaxEvents, sMaxEvents, 2290000, sMaxEvents, sMaxEvents, sMaxEvents, - 3270000, sMaxEvents, sMaxEvents, sMaxEvents, sMaxEvents, sMaxEvents, +// 3270000, sMaxEvents, sMaxEvents, sMaxEvents, sMaxEvents, sMaxEvents, + 2260000, 2260000, 2260000, 2260000, 2260000, 2260000, 2320000, 2330000, 2100000, 2340000, 2370000, 2340000}; ana.SimEventsECuts(sEventsECuts); @@ -101,6 +105,9 @@ void ES1_90120() sw.Print(); sw.Continue(); + ana.SaveSpectrumHist(0, "figures/spectra1MeV.root"); +// ana.SaveSpectrumHist(0, "figures/spectra15MeV.root"); + ana.EpsilonT(); sw.Print(); sw.Continue(); @@ -124,6 +131,12 @@ void ES1_90120() if (saveHists) { ana.SaveSpectrumHist(0); ana.SaveEpsilonTHist(0, 0); + ana.SaveEpsilonTHist(1, 2); + ana.SaveEpsilonTHist(3, 5); + + for (Int_t i = 0; i < 6; i++) { + ana.SaveThetaAHist(3, i); + } } Info("ES1_90120.cxx", "Finished."); diff --git a/macros/BeCorrPRC/figSpectraDiff.cxx b/macros/BeCorrPRC/figSpectraDiff.cxx new file mode 100755 index 0000000000000000000000000000000000000000..c23f2ef67d9e66a68398b929351002829dfaf7c5 --- /dev/null +++ b/macros/BeCorrPRC/figSpectraDiff.cxx @@ -0,0 +1,98 @@ +//#include "TFile.h" +//#include "TCanvas.h" +//#include "TH1F.h" + +void figSpectraDiff() +{ + +// TFile *fr = new TFile("figures/PRCspectra15MeV.root", "READ"); + TFile *fr = new TFile("figures/PRCspectra1MeV.root", "READ"); + +// fr->ls(); + + TH1F *hExp[4]; + TH1F *hSim[4]; + + TH1F *hCurr = 0; + + TString heName; + TString hsName; + + hCurr = (TH1F*)fr->Get("heSpectrum4560"); + hExp[0] = new TH1F(*hCurr); + hCurr = (TH1F*)fr->Get("heSpectrum6075"); + hExp[1] = new TH1F(*hCurr); + hCurr = (TH1F*)fr->Get("heSpectrum7590"); + hExp[2] = new TH1F(*hCurr); + hCurr = (TH1F*)fr->Get("heSpectrum90120"); + hExp[3] = new TH1F(*hCurr); + + + hCurr = (TH1F*)fr->Get("hsSpectrum4560"); + hSim[0] = new TH1F(*hCurr); + hCurr = (TH1F*)fr->Get("hsSpectrum6075"); + hSim[1] = new TH1F(*hCurr); + hCurr = (TH1F*)fr->Get("hsSpectrum7590"); + hSim[2] = new TH1F(*hCurr); + hCurr = (TH1F*)fr->Get("hsSpectrum90120"); + hSim[3] = new TH1F(*hCurr); + + + + /*TCanvas *c1 = new TCanvas(); + c1->ToggleEditor(); +// c1->SetWindowSize(800, 1200); + c1->SetWindowSize(800, 800); + c1->Divide(2, 2, .001, .001); + + + for (Int_t i = 0; i < 4; i++) { + c1->cd(i+1); + + hExp[i]->SetTitle(""); + hSim[i]->SetTitle(""); + + hSim[i]->Draw(""); + hExp[i]->Draw("E same"); + + TLine *l[4]; + TLine *l[0] = new TLine(1.4, 0., 1.4, 40000); + TLine *l[1] = new TLine(1.9, 0., 1.9, 40000); + TLine *l[2] = new TLine(2.5, 0., 2.5, 40000); + TLine *l[3] = new TLine(3.1, 0., 3.1, 40000); + + for (Int_t j = 0; j < 4; j++) { + l[j]->SetLineColor(kRed); + l[j]->SetLineWidth(2); + l[j]->Draw("same"); + } + + }*/ + +// c1->SaveAs("figures/spectra.eps"); + + + TCanvas *c2 = new TCanvas(); + c2->ToggleEditor(); + c2->SetWindowSize(800, 800); + c2->Divide(2, 2, .001, .001); + + TH1F *diff[4]; + + for (Int_t i = 0; i < 4; i++) { + c2->cd(i+1); + + diff[i] = new TH1F(*hExp[i]); + diff[i]->Add(hSim[i], -1); + diff[i]->Draw(""); + diff[i]->SetTitle(""); + diff[i]->GetXaxis()->SetTitle(""); + diff[i]->GetYaxis()->SetTitle(""); + diff[i]->GetYaxis()->SetLabelSize(0.06); +// Double_t max = diff[i]->GetYaxis()->GetXmax(); +// diff[i]->GetYaxis()->SetRangeUser(-100, 3500); + } + + c2->SaveAs("figures/spectraDiff1.eps"); + +}