From 2f96c67ea0333d16fa08cc148e78bbb341a8f0bc Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Fri, 21 Jul 2017 19:02:52 +0300 Subject: [PATCH] Parametrization of Spectra() solved. --- Be/BeAnalysis.cpp | 740 +++++++++++++++++----------------- Be/BeAnalysis.h | 49 ++- macros/BeCorrPRC/ES1_7590.cxx | 270 +++++++++++++ 3 files changed, 671 insertions(+), 388 deletions(-) create mode 100644 macros/BeCorrPRC/ES1_7590.cxx diff --git a/Be/BeAnalysis.cpp b/Be/BeAnalysis.cpp index d20ded7..823ad1f 100644 --- a/Be/BeAnalysis.cpp +++ b/Be/BeAnalysis.cpp @@ -11,7 +11,7 @@ #include "TCanvas.h" #include "TGaxis.h" -BeAnalysis::BeAnalysis() : che(0), spectra(1) { +BeAnalysis::BeAnalysis() : che(0), lowExpFile(0), upExpFile(0), spectra(1) { // TODO Auto-generated constructor stub for (Int_t i = 0; i < 6; i++) { @@ -54,14 +54,6 @@ 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; @@ -73,6 +65,10 @@ BeAnalysis::BeAnalysis() : che(0), spectra(1) { kVerbose = 1; kRangeProportionIn = 2.0; + kSaveFigures = 0; + figurePath = ""; + figureFormat = ""; + } BeAnalysis::~BeAnalysis() { @@ -81,80 +77,67 @@ 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"; - -// TChain *chsAl0 = BeWork::OpenChain(chainAl0name.Data(), - chs[0] = BeWork::OpenChain(chainAl0name.Data(), - lowSimFile[0], upSimFile[0], "simbe", 4, "sbeam"); - Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[0]->GetEntries(), chs[0]->GetName()); - ti[0] = BeWork::OpenTree(inputTreeAl0name.Data(), "sbeam", 2); - // tiAl0->SetLineWidth(2); - -// TChain *chsNoAl0 = BeWork::OpenChain(chainNoAl0name.Data(), - 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); - // tiNoAl0->SetLineWidth(2); - // -// TChain *chsAl180 = BeWork::OpenChain(chainAl180name.Data(), - 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); - // tiAl180->SetLineWidth(2); - -// TChain *chsNoAl180 = BeWork::OpenChain(chainNoAl180name.Data(), - 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); - // tiNoAl180->SetLineWidth(2); - -// TChain *chsAl90 = BeWork::OpenChain(chainAl90name.Data(), - 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); - // tiAl90->SetLineWidth(2); - -// TChain *chsNoAl90 = BeWork::OpenChain(chainNoAl90name.Data(), - 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); - // tiNoAl90->SetLineWidth(2); +// 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"); + Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing simulated data", chs[i]->GetEntries(), chs[i]->GetName()); + 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() { - Int_t lowExpFile = 0; - Int_t upExpFile = 40; - //experimental chain - che = BeWork::OpenChain("../../../be/rootdata/correlations/Be.", - lowExpFile, upExpFile, "beonly"); //original file - Info("statesRatioFitting.cxx", "%lld events in chain \"%s\" containing experimental data", + che = BeWork::OpenChain(expFiles.Data(), lowExpFile, upExpFile, "beonly"); //original file + Info("BeAnalysis::OpenExpChain", "%lld events in chain \"%s\" containing experimental data", che->GetEntries(), che->GetName()); } @@ -239,6 +222,7 @@ void BeAnalysis::SetCuts() { void BeAnalysis::SetCMAngularRange(Int_t minAngle, Int_t maxAngle) { kMinAngle = minAngle; kMaxAngle = maxAngle; + SetCMAngularCuts(); } void BeAnalysis::SetChainsToDraw(Bool_t ch0, Bool_t ch1, Bool_t ch2, Bool_t ch3, Bool_t ch4, @@ -258,43 +242,58 @@ void BeAnalysis::SetRangeProportion(Float_t rangeProportion, Bool_t autoRange) { kAutoRange = autoRange; } -void BeAnalysis::SetNoExpEvents() { +void BeAnalysis::SetNoExpEvents(Long64_t *noExpEvents) { eMaxEvents = 5000000; - eEventsAl0 = eMaxEvents; - eEventsNoAl0 = eMaxEvents; - eEventsAl180 = eMaxEvents; - eEventsNoAl180 = eMaxEvents; - eEventsAl90 = eMaxEvents; - eEventsNoAl90 = eMaxEvents; + if (!noExpEvents) { + for (Int_t i = 0; i < 6; i++) { + eEvents[i] = eMaxEvents; + } + Warning("BeAnalysis::SetNoExpEvents", "Default numbers of experimental events were set."); + return; + } - eEvents[0] = eEventsAl0; - eEvents[1] = eEventsNoAl0; - eEvents[2] = eEventsAl180; - eEvents[3] = eEventsNoAl180; - eEvents[4] = eEventsAl90; - eEvents[5] = eEventsNoAl90; + for (Int_t i = 0; i < 6; i++) { + eEvents[i] = noExpEvents[i]; +// cout << eEvents[i] << endl; + } + return; } -void BeAnalysis::SetNoSimEvents() { +void BeAnalysis::SetNoSimEvents(Long64_t *noSimEvents) { sMaxEvents = 3000000; - sEventsAl0 = sMaxEvents; - sEventsNoAl0 = 2700000; - sEventsAl180 = sMaxEvents; - sEventsNoAl180 = 2700000; - sEventsAl90 = 2690000; - sEventsNoAl90 = 2710000; + if (!noSimEvents) { + for (Int_t i = 0; i < 6; i++) { + sEvents[i] = sMaxEvents; + cout << sEvents[i] << endl; + } + Warning("BeAnalysis::SetNoSimEvents", "Default numbers of simulated events were set."); + return; + } - sEvents[0] = sEventsAl0; - sEvents[1] = sEventsNoAl0; - sEvents[2] = sEventsAl180; - sEvents[3] = sEventsNoAl180; - sEvents[4] = sEventsAl90; - sEvents[5] = sEventsNoAl90; + for (Int_t i = 0; i < 6; i++) { + sEvents[i] = noSimEvents[i]; + cout << sEvents[i] << endl; + } + 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; } @@ -318,8 +317,14 @@ void BeAnalysis::SetRatiosGStoEX() { } void BeAnalysis::SetCMAngularCuts() { - cAngles = "fBeThetaCM1>60*TMath::DegToRad() && fBeThetaCM1<75*TMath::DegToRad()"; - crAngles = "f6BeThetaCM1>60*TMath::DegToRad() && f6BeThetaCM1<75*TMath::DegToRad()"; + + TString sAngles, srAngles; + + sAngles.Form("fBeThetaCM1>%d*TMath::DegToRad() && fBeThetaCM1<%d*TMath::DegToRad()", kMinAngle, kMaxAngle); + srAngles.Form("f6BeThetaCM1>%d*TMath::DegToRad() && f6BeThetaCM1<%d*TMath::DegToRad()", kMinAngle, kMaxAngle); + + cAngles = sAngles.Data(); + crAngles = srAngles.Data(); } void BeAnalysis::Spectra() { @@ -328,10 +333,19 @@ void BeAnalysis::Spectra() { return; } - if (!che) return; + if (!che) { + Error("BeAnalysis::Spectra", "Chain with experimental data was not initialized."); + return; + } + + for (Int_t i = 0; i < 6; i++) { + if (!chs[i]) { + Error("BeAnalysis::Spectra", "Chain No. %d with simulated data was not initialized.", i); + return; + } + } TCanvas *cSpectra = new TCanvas(); -// TString canvasTitle; TH1F *hsSpectra[6]; TH1F *heSpectra[6]; @@ -357,7 +371,13 @@ void BeAnalysis::Spectra() { heName.Form("heSpectra%d", j); drawCommand.Form("fBeIM>>%s(200,0,10)", heName.Data()); // che->Draw(drawCommand.Data(), cQ && cBeWork && cAngles, "same", eEvents[j]); + che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]); + +//// cout << drawCommand << "\t" << eEvents[j] << endl; +//// che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]); +// che->Draw("fBeIM", "", ""); +// continue; heSpectra[j] = (TH1F*)gPad->FindObject(heName.Data()); // heSpectra[j]->Draw(""); @@ -378,7 +398,6 @@ void BeAnalysis::Spectra() { if (kAutoRange) { Float_t leftMaxMC = kRangeProportion*hsSpectra[j]->GetMaximum(); Float_t leftMaxE = kRangeProportion*heSpectra[j]->GetMaximum(); - // hsSpectra[j]->GetYaxis()->SetRangeUser(0, leftMaxE); leftMaxMC > leftMaxE ? heSpectra[j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : heSpectra[j]->GetYaxis()->SetRangeUser(0, leftMaxE); } @@ -386,35 +405,16 @@ void BeAnalysis::Spectra() { hSdiff[j] = new TH1F(*heSpectra[j]); hSdiff[j]->Add(hsSpectra[j], -1); hSdiff[j]->SetLineColor(kRed); - // hSdiff[j]->Draw("same"); - - cSpectra->Update(); cout << endl; Info("statesRatioFitting", "MC %d", j+1); - // Info("statesRatioFitting", "ground state: %3.1f (exp)/ %3.1f (sim) = %3.3f", heSpectra[j]->Integral(0,20), hsSpectra[j]->Integral(0,20), heSpectra[j]->Integral(0,20)/hsSpectra[j]->Integral(0,20) ); - // Info("statesRatioFitting", "left slope: %3.1f (exp)/ %3.1f (sim) = %3.3f\n", heSpectra[j]->Integral(20,32), hsSpectra[j]->Integral(20,32), heSpectra[j]->Integral(20,32)/hsSpectra[j]->Integral(20,32) ); - //0-2 MeV, 2-3.1 MeV - // Info("statesRatioFitting", "ground state: %3.1f (exp)/ %3.1f (sim) = %3.3f", heSpectra[j]->Integral(0,40), hsSpectra[j]->Integral(0,40), heSpectra[j]->Integral(0,40)/hsSpectra[j]->Integral(0,40) ); - // Info("statesRatioFitting", "left slope: %3.1f (exp)/ %3.1f (sim) = %3.3f\n", heSpectra[j]->Integral(40,64), hsSpectra[j]->Integral(40,64), heSpectra[j]->Integral(40,64)/hsSpectra[j]->Integral(40,64) ); - //0-2 MeV, 2.5-3.5 MeV Info("statesRatioFitting", "ground state: %3.1f (sim)/ %3.1f (exp) = %3.3f", hsSpectra[j]->Integral(0,40), heSpectra[j]->Integral(0,40), hsSpectra[j]->Integral(0,40)/heSpectra[j]->Integral(0,40) ); 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) ); - //0-1.3 MeV, 2-3.1 MeV - // Info("statesRatioFitting", "ground state: %3.1f (exp)/ %3.1f (sim) = %3.3f", heSpectra[j]->Integral(0,26), hsSpectra[j]->Integral(0,26), heSpectra[j]->Integral(0,26)/hsSpectra[j]->Integral(0,26) ); - // Info("statesRatioFitting", "left slope: %3.1f (exp)/ %3.1f (sim) = %3.3f\n", heSpectra[j]->Integral(40,64), hsSpectra[j]->Integral(40,64), heSpectra[j]->Integral(40,64)/hsSpectra[j]->Integral(40,64) ); }//for j - /*if (savePictures) { - canvasName.Form("%sfigSpectra:%s%s", ppath.Data(), configuration.Data(), pictFormat.Data()); - cout << canvasName.Data() << endl; - cSpectra->SaveAs(canvasName.Data()); - cSpectra->cd(); - cSpectra->Close(); - }//if save pictures*/ - + SaveFigures(cSpectra, "Spectra", 1); Info("sfAngInt_spectra.cxx", "Finished."); @@ -431,92 +431,87 @@ void BeAnalysis::EpsilonT() { TH1F *hieT[noIntervals][6]; if (!epsilonT[i]) continue; -// { - - canEpsilonT[i] = new TCanvas(); - - canvasTitle.Form("epsilon in %s T-system;\t(%d,%d) degrees", (const char*)cBeE[i], kMinAngle, kMaxAngle); - canEpsilonT[i]->SetTitle(canvasTitle.Data()); - canEpsilonT[i]->Divide(2, 3); - - che->SetLineColor(kBlack); - for (Int_t j = 0; j < 6; j++) { //different files - if (!kChains[j]) continue; - canEpsilonT[i]->cd(j+1); - chs[j]->SetLineColor(kGray+1); - chs[j]->SetFillColor(kGray+1); - hsName.Form("hseT%d_%d", i, j); - // drawCommand.Form("fTpp/f6BeIM>>%s(50,0,1)", hsName.Data()); - drawCommand.Form("fTpp/f6BeIM>>%s(30,0,1)", hsName.Data()); - // chs[j]->Draw(drawCommand.Data(), cQ && crBeE[i] && crAngles && sRatio[j], "", sEventsECuts[i][j]); - chs[j]->Draw(drawCommand.Data(), cProtons && cQ && crBeE[i] && crAngles && sRatio[j], "", sEventsECuts[i][j]); - hseT[i][j] = (TH1F*)gPad->FindObject(hsName.Data()); - heName.Form("heeT%d_%d", i, j); - // drawCommand.Form("fTpp/fBeIM>>%s(50,0,1)", heName.Data()); - drawCommand.Form("fTpp/fBeIM>>%s", heName.Data()); - // che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEventsECuts[i][j]); - che->Draw(drawCommand.Data(), cProtons && cQ && cBeE[i] && cAngles, "E same", eEventsECuts[i][j]); - heeT[i][j] = (TH1F*)gPad->FindObject(heName.Data()); - - hseT[i][j]->Draw(); - hseT[i][j]->SetTitle(""); - hseT[i][j]->SetXTitle("\\varepsilon"); - hseT[i][j]->GetXaxis()->SetTitleOffset(0.95); - hseT[i][j]->GetXaxis()->CenterTitle(); - hseT[i][j]->SetYTitle("counts"); - // hseT[i][j]->GetYaxis()->SetTitleOffset(1.09); - hseT[i][j]->GetYaxis()->SetTitleOffset(0.7); - hseT[i][j]->GetYaxis()->CenterTitle(); - heeT[i][j]->Draw("E same"); - if (kAutoRange) { - Float_t leftMaxMC = kRangeProportion*hseT[i][j]->GetMaximum(); - Float_t leftMaxE = kRangeProportion*heeT[i][j]->GetMaximum(); - hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); - leftMaxMC > leftMaxE ? hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); - } - else { - hseT[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]); - } - canEpsilonT[i]->Update(); - - - hiName.Form("hieT%d_%d", i, j); - // drawCommand.Form("sTpp/E_IM>>%s(50,0,1)", hiName.Data()); - drawCommand.Form("sTpp/E_IM>>%s", hiName.Data()); - ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same"); - hieT[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); - Float_t rightmax = kRangeProportionIn*hieT[i][j]->GetMaximum(); - Float_t scale = canEpsilonT[i]->GetPad(j+1)->GetUymax()/rightmax; - hieT[i][j]->SetLineColor(kRed); - hieT[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(); - - canEpsilonT[i]->Update(); - - if (kVerbose) { - Info("sfAngInt_epsilonT.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f", - i, j, heeT[i][j]->Integral(0,heeT[i][j]->GetNbinsX()), - hseT[i][j]->Integral(0,hseT[i][j]->GetNbinsX()), - heeT[i][j]->Integral(0,heeT[i][j]->GetNbinsX())/hseT[i][j]->Integral(0,hseT[i][j]->GetNbinsX()) ); - } - - }//for j - if (kVerbose) cout << endl; - - /*if (savePictures) { + + canEpsilonT[i] = new TCanvas(); + + canvasTitle.Form("epsilon in %s T-system;\t(%d,%d) degrees", (const char*)cBeE[i], kMinAngle, kMaxAngle); + canEpsilonT[i]->SetTitle(canvasTitle.Data()); + canEpsilonT[i]->Divide(2, 3); + + che->SetLineColor(kBlack); + for (Int_t j = 0; j < 6; j++) { //different files + if (!kChains[j]) continue; + canEpsilonT[i]->cd(j+1); + chs[j]->SetLineColor(kGray+1); + chs[j]->SetFillColor(kGray+1); + hsName.Form("hseT%d_%d", i, j); + drawCommand.Form("fTpp/f6BeIM>>%s(30,0,1)", hsName.Data()); + chs[j]->Draw(drawCommand.Data(), cProtons && cQ && crBeE[i] && crAngles && sRatio[j], "", sEventsECuts[i][j]); + hseT[i][j] = (TH1F*)gPad->FindObject(hsName.Data()); + heName.Form("heeT%d_%d", i, j); + drawCommand.Form("fTpp/fBeIM>>%s", heName.Data()); + che->Draw(drawCommand.Data(), cProtons && cQ && cBeE[i] && cAngles, "E same", eEventsECuts[i][j]); + heeT[i][j] = (TH1F*)gPad->FindObject(heName.Data()); + + hseT[i][j]->Draw(); + hseT[i][j]->SetTitle(""); + hseT[i][j]->SetXTitle("\\varepsilon"); + hseT[i][j]->GetXaxis()->SetTitleOffset(0.95); + hseT[i][j]->GetXaxis()->CenterTitle(); + hseT[i][j]->SetYTitle("counts"); + hseT[i][j]->GetYaxis()->SetTitleOffset(0.7); + hseT[i][j]->GetYaxis()->CenterTitle(); + heeT[i][j]->Draw("E same"); + if (kAutoRange) { + Float_t leftMaxMC = kRangeProportion*hseT[i][j]->GetMaximum(); + Float_t leftMaxE = kRangeProportion*heeT[i][j]->GetMaximum(); + hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); + leftMaxMC > leftMaxE ? hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxMC) : hseT[i][j]->GetYaxis()->SetRangeUser(0, leftMaxE); + } + else { + hseT[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]); + } + canEpsilonT[i]->Update(); + + + hiName.Form("hieT%d_%d", i, j); + drawCommand.Form("sTpp/E_IM>>%s", hiName.Data()); + ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same"); + hieT[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); + Float_t rightmax = kRangeProportionIn*hieT[i][j]->GetMaximum(); + Float_t scale = canEpsilonT[i]->GetPad(j+1)->GetUymax()/rightmax; + hieT[i][j]->SetLineColor(kRed); + hieT[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(); + + canEpsilonT[i]->Update(); + + if (kVerbose) { + Info("sfAngInt_epsilonT.cxx", "cut%d; case%d: %3.1f (exp)/ %3.1f (sim) = %3.3f", + i, j, heeT[i][j]->Integral(0,heeT[i][j]->GetNbinsX()), + hseT[i][j]->Integral(0,hseT[i][j]->GetNbinsX()), + heeT[i][j]->Integral(0,heeT[i][j]->GetNbinsX())/hseT[i][j]->Integral(0,hseT[i][j]->GetNbinsX()) ); + } + + }//for j + if (kVerbose) cout << endl; + + SaveFigures(canEpsilonT[i], "epsilonT", i); + + /*if (savePictures) { canvasName.Form("%sfig%depsilonT:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); cout << canvasName.Data() << endl; canEpsilonT[i]->SaveAs(canvasName.Data()); canEpsilonT[i]->cd(); canEpsilonT[i]->Close(); }//if save pictures*/ -// }//if + // }//if }//for i } @@ -596,6 +591,8 @@ void BeAnalysis::CosThetaTk() { }//for j + SaveFigures(cThetaT[i], "cosThetakT", i); + /*if (savePictures) { canvasName.Form("%sfig%dcosThetakT:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); cThetaT[i]->SaveAs(canvasName.Data()); @@ -652,10 +649,6 @@ void BeAnalysis::EpsilonY() { } 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"); @@ -672,8 +665,6 @@ void BeAnalysis::EpsilonY() { axis->SetLabelColor(kRed); axis->Draw(); - - canEpsilonY[i]->Update(); if (kVerbose) { @@ -685,6 +676,8 @@ void BeAnalysis::EpsilonY() { }//for j + SaveFigures(canEpsilonY[i], "EpsilonY", i); + /*if (savePictures) { canvasName.Form("%sfig%dEpsilonY:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); cout << canvasName.Data() << endl; @@ -701,7 +694,7 @@ void BeAnalysis::EpsilonY() { void BeAnalysis::CosThetaYk() { TCanvas *cThetaY[noIntervals]; - for (Int_t i = 0; i>%s(50,-1,1)", heName.Data()); che->Draw(drawCommand.Data(), cQ && cBeE[i] && cAngles, "E same", eEvents[j]); -// TH1F *hecoskY[i][j] = (TH1F*)gPad->FindObject(heName.Data()); hecoskY[i][j] = (TH1F*)gPad->FindObject(heName.Data()); hscoskY[i][j]->Draw(); - // hscoskY[i][j]->GetYaxis()->SetRangeUser(0, coskYRange[i][j]); hecoskY[i][j]->Draw("E same"); if (kAutoRange) { Float_t leftMaxMC = kRangeProportion*hecoskY[i][j]->GetMaximum(); @@ -744,8 +735,6 @@ void BeAnalysis::CosThetaYk() { hscoskY[i][j]->GetYaxis()->SetRangeUser(0, eTRange[i][j]); } - - cThetaY[i]->Update(); hiName.Form("hicoskY%d_%d", i, j); @@ -775,6 +764,10 @@ void BeAnalysis::CosThetaYk() { }//for j + + SaveFigures(cThetaY[i], "cosThetakY", i); + + /*if (savePictures) { canvasName.Form("%sfig%dcosThetakY:%s%s", ppath.Data(), i, configuration.Data(), pictFormat.Data()); cThetaY[i]->SaveAs(canvasName.Data()); @@ -782,181 +775,100 @@ void BeAnalysis::CosThetaYk() { cThetaY[i]->Close(); }*/ // }//if - }//for i + }//for i } -//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) { + if (!thetaAT[i]) continue; + + cThetaAT[i] = new TCanvas(); + + canvasTitle.Form("cos theta alpha in %s T-system;\t(%d,%d) degrees", (const char*)cBeE[i], kMinAngle, kMaxAngle); + cThetaAT[i]->SetTitle(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]->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", 50, 0, 3.14); + 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]->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()); + 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 + + SaveFigures(cThetaAT[i], "thetaAT", i); + /*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 + }//for i } @@ -1023,3 +935,75 @@ void BeAnalysis::EpsilonTRange() { } + +void BeAnalysis::SetFigures(TString figPath, TString figFormat, + Bool_t kSave) { + kSaveFigures = kSave; + figureFormat = figFormat; + figurePath = figPath; +} + +void BeAnalysis::SetExpChain(TString files, Int_t minFnumber, Int_t maxFnumber) { + + lowExpFile = minFnumber; + upExpFile = maxFnumber; + expFiles = files; + +} + +void BeAnalysis::SetSimChains(TString chainAl0name, TString chainNoAl0name, + TString chainAl180name, TString chainNoAl180name, + TString chainAl90name, TString chainNoAl90name) { + + simFiles[0] = chainAl0name; + simFiles[1] = chainNoAl0name; + simFiles[2] = chainAl180name; + simFiles[3] = chainNoAl180name; + simFiles[4] = chainAl90name; + simFiles[5] = chainNoAl90name; + +} + +void BeAnalysis::SetInputChains(TString inputAl0name, TString inputNoAl0name, + TString inputAl180name, TString inputNoAl180name, + TString inputAl90name, TString inputNoAl90name) { + + inputFiles[0] = inputAl0name; + inputFiles[1] = inputNoAl0name; + inputFiles[2] = inputAl180name; + inputFiles[3] = inputNoAl180name; + inputFiles[4] = inputAl90name; + inputFiles[5] = inputNoAl90name; + +} + +void BeAnalysis::SetNoSimFiles(Int_t* minFnumber, Int_t* maxFnumber) { + eMaxEvents = 5000000; + + if (!(minFnumber && maxFnumber)) { + for (Int_t i = 0; i < 6; i++) { + lowSimFile[i] = 0; + upSimFile[i] = 14; + } + Info("BeAnalysis::SetNoSimFiles", "Default numbers of simfiles were set."); + return; + } + + for (Int_t i = 0; i < 6; i++) { + lowSimFile[i] = minFnumber[i]; + upSimFile[i] = maxFnumber[i]; + } + return; +} + +void BeAnalysis::SaveFigures(TCanvas *canvas, TString variable, Int_t interval) { + + if (!kSaveFigures) return; + + canvasName.Form("%sfig%d%s:%d%d%s", figurePath.Data(), interval, variable.Data(), kMinAngle, kMaxAngle, figureFormat.Data()); + canvas->SaveAs(canvasName.Data()); + canvas->cd(); + canvas->Close(); + + +} diff --git a/Be/BeAnalysis.h b/Be/BeAnalysis.h index 97fd3fd..45c5b11 100644 --- a/Be/BeAnalysis.h +++ b/Be/BeAnalysis.h @@ -13,6 +13,7 @@ //#include #include "TChain.h" #include "TCut.h" +#include "TCanvas.h" using std::cout; using std::endl; @@ -23,6 +24,14 @@ public: virtual ~BeAnalysis(); ClassDef(BeAnalysis, 1); + void SetExpChain(TString files, Int_t minFnumber, Int_t maxFnumber); + void SetSimChains(TString chainAl0name, TString chainNoAl0name, + TString chainAl180name, TString chainNoAl180name, + TString chainAl90name, TString chainNoAl90name); + void SetInputChains(TString inputAl0name, TString inputNoAl0name, + TString inputAl180name, TString inputNoAl180name, + TString inputAl90name, TString inputNoAl90name); + void SetNoSimFiles(Int_t *minFnumber = 0, Int_t *maxFnumber = 0); void OpenSimChains(); void OpenExpChain(); @@ -34,11 +43,13 @@ public: void SetCuts(); void SetCMAngularRange(Int_t minAngle, Int_t maxAngle); +private: void SetCMAngularCuts(); +public: void SetRangeProportion(Float_t rangeProportion = 1.1, Bool_t autoRange = 1); - void SetNoExpEvents(); - void SetNoSimEvents(); + void SetNoExpEvents(Long64_t *noExpEvents = 0); + void SetNoSimEvents(Long64_t *noSimEvents = 0); void SetRatiosGStoEX(); void ExpEventsECuts(); void SimEventsECuts(); @@ -49,15 +60,25 @@ public: void CosThetaTk(); void EpsilonY(); void CosThetaYk(); - void ThetaP1T(); void ThetaAT(); + void SetFigures(TString figPath = "figures/", TString figFormat = ".eps", Bool_t kSave = 1); + + // private: TChain *che; //chain with experimental trees TChain *chs[6]; //array of chains with simulation trees TTree *ti[6]; //array of chains with simulation input + Int_t lowExpFile; + Int_t upExpFile; + TString expFiles; + TString simFiles[6]; + TString inputFiles[6]; + Int_t lowSimFile[6]; + Int_t upSimFile[6]; + Int_t kMinAngle; Int_t kMaxAngle; @@ -71,7 +92,6 @@ private: Bool_t *epsilonY; //! Bool_t *cosThetaY; //! -// Bool_t *thetaP1T; //! Bool_t *thetaAT; //! Bool_t kAutoRange; @@ -80,12 +100,12 @@ 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 eEventsAl0; +// Long64_t eEventsNoAl0; +// Long64_t eEventsAl180; +// Long64_t eEventsNoAl180; +// Long64_t eEventsAl90; +// Long64_t eEventsNoAl90; Long64_t eEvents[6]; Long64_t sMaxEvents; @@ -175,8 +195,17 @@ private: TString hsName; TString heName; TString hiName; + + TString canvasName; TString canvasTitle; + Bool_t kSaveFigures; + TString figurePath; + TString figureFormat; + +private: + void SaveFigures(TCanvas *canvas, TString variable, Int_t interval); + }; #endif /* BE_BEANALYSIS_H_ */ diff --git a/macros/BeCorrPRC/ES1_7590.cxx b/macros/BeCorrPRC/ES1_7590.cxx new file mode 100644 index 0000000..e2429f5 --- /dev/null +++ b/macros/BeCorrPRC/ES1_7590.cxx @@ -0,0 +1,270 @@ +void ES1_7590() +{ + //open chain with Be events only and draw E_Be + + //order: al0, noal0, al180, noal180 + + TStopwatch sw; + sw.Start(); + + BeAnalysis ana; + + ana.SetCMAngularRange(75, 90); + + ana.SetChainsToDraw(0, 1, 1, 0, 0, 0); + + ana.SetExpChain("../../../be/rootdata/correlations/v5_exp/Be.", 0, 40); + + const Long64_t eMaxEvents = 5000000; + Long64_t eEvents[6] = {eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents}; + ana.SetNoExpEvents(eEvents); + + const Long64_t sMaxEvents = 3000000; + Long64_t sEvents[6] = {2050000, 2050000, 2050000, 2050000, 1900000, 1950000}; + cout << sEvents << endl; + ana.SetNoSimEvents(sEvents); + + const Int_t lowSimFile[6] = {0, 0, 0, 0, 0, 0}; +// const Int_t upSimFile[6] = {5, 5, 5, 5, 5, 5}; + const Int_t upSimFile[6] = {12, 12, 12, 12, 12, 12}; + ana.SetNoSimFiles(lowSimFile, upSimFile); + ana.SetSimChains("../../../be/rootdata/correlations/v5_7590/Sim_mix_br_al_0_65-100_", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_noal_0_65-100_", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_al_180_65-100_", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_noal_180_65-100_", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_al_90_65-100_", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_noal_90_65-100_"); + + ana.SetInputChains("../../../be/rootdata/correlations/v5_7590/Sim_mix_br_al_0_65-100_000.root", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_noal_0_65-100_000.root", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_al_180_65-100_000.root", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_noal_180_65-100_000.root", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_al_90_65-100_000.root", + "../../../be/rootdata/correlations/v5_7590/Sim_mix_br_noal_90_65-100_000.root"); + + + ana.OpenExpChain(); + ana.OpenSimChains(); + + + ana.Spectra(); + + ana.EpsilonT(); + + sw.Print(); + sw.Continue(); + + return; + + + +// const Int_t kMinAngle = 75; +// const Int_t kMaxAngle = 90; +// +// const Int_t lowfile = 0; +// const Int_t upfile = 40; + +// const Int_t lowSimFile[6] = {0, 0, 0, 0, 0, 0}; +//// const Int_t upSimFile[6] = {5, 5, 5, 5, 5, 5}; +// const Int_t upSimFile[6] = {12, 12, 12, 12, 12, 12}; + + const Bool_t shapeFit = 0; + +// TCut cAngles = "fBeThetaCM1>75*TMath::DegToRad() && fBeThetaCM1<90*TMath::DegToRad()"; +// TCut crAngles = "f6BeThetaCM1>75*TMath::DegToRad() && f6BeThetaCM1<90*TMath::DegToRad()"; + + //simulations + //aligned, 0 degrees +//// TString chainAl0name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_al_0_65-100_"; +// TString inputTreeAl0name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_al_0_65-100_000.root"; +// //isotropic, 0 degrees +//// TString chainNoAl0name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_noal_0_65-100_"; +// TString inputTreeNoAl0name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_noal_0_65-100_000.root"; +// //aligned, 180 degrees +//// TString chainAl180name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_al_180_65-100_"; +// TString inputTreeAl180name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_al_180_65-100_000.root"; +// //isotropic, 180 degrees +//// TString chainNoAl180name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_noal_180_65-100_"; +// TString inputTreeNoAl180name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_noal_180_65-100_000.root"; +// //isotropic, 90 degrees +//// TString chainAl90name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_al_90_65-100_"; +// TString inputTreeAl90name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_al_90_65-100_000.root"; +// //isotropic, 90 degrees +//// TString chainNoAl90name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_noal_90_65-100_"; +// TString inputTreeNoAl90name = "/data2/be/rootdata/correlations/v5_7590/Sim_mix_br_noal_90_65-100_000.root"; + + //open tree with MC simulations +// gROOT->ProcessLine(".x corr_templates/sfAngInt_opensimtree.cxx"); + +// TChain *che = BeWork::OpenChain("/data2/be/rootdata/correlations/v5_exp/Be.", +// lowfile, upfile, "beonly"); //original file +// Info("statesRatioFitting.cxx", "%d events in chain \"%s\" containing experimental data", +// che->GetEntries(), che->GetName()); + +// gROOT->ProcessLine(".x corr_templates/sfAngInt_cuts.cxx"); + + //auxiliary strings + TString drawCommand; + TString hsName; + TString heName; + TString hiName; + + + sw.Print(); + sw.Continue(); + + const Bool_t savePictures = 0; + TString ppath = "pictures/correlations/v5_7590/"; + TString configuration = "v5_7590"; +// TString pictFormat = ".ps"; +// gStyle->SetHistLineWidth(1); + TString pictFormat = ".eps"; +// TString pictFormat = ".gif"; +// TString pictFormat = ".jpg"; + + const Bool_t kVerbose = 1; + const Bool_t kAutoRange = 1; + // const Float_t kRangeProportion = 1.2; + const Float_t kRangeProportion = 1.1; + // const Float_t kRangeProportionIn = 1.1; + const Float_t kRangeProportionIn = 2.0; + + const Bool_t kChains[6] = {0,0,0,1,0,1}; +// const Bool_t kChains[6] = {1,1,1,1,1,1}; + + const Bool_t spectra = 0; + + const Int_t nointervals = 5; + +// const Bool_t cosThetaT[nointervals] = {1,1,1,1,1}; + const Bool_t cosThetaT[nointervals] = {0,0,0,0,0}; + const Bool_t epsilonT[nointervals] = {0,0,1,0,0}; +// const Bool_t epsilonT[nointervals] = {1,1,1,1,1}; + + const Bool_t epsilonY[nointervals] = {0,0,0,0,0}; +// const Bool_t epsilonY[nointervals] = {1,1,1,1,1}; + const Bool_t cosThetaY[nointervals] = {0,0,0,0,0}; +// const Bool_t cosThetaY[nointervals] = {1,1,1,1,1}; + + //quasibinary kinematics + const Bool_t thetaAT[nointervals] = {0,0,0,0,0}; +// const Bool_t thetaAT[nointervals] = {1,1,1,1,1}; + const Bool_t thetaP1T[nointervals] = {0,0,0,0,0}; +// const Bool_t thetaP1T[nointervals] = {1,1,1,1,1}; + const Bool_t thetaP2Y[nointervals] = {0,0,0,0,0}; + + //0-2 MeV, 2-3.1 MeV + TCut sRatioAl0 = "sRatio>0.075 && sRatio<0.125"; + TCut sRatioNoAl0 = "sRatio>0.076 && sRatio<0.126"; + TCut sRatioAl180 = "sRatio>0.070 && sRatio<0.120"; +// TCut sRatioAl180 = "sRatio>0.050 && sRatio<0.100"; + TCut sRatioNoAl180 = "sRatio>0.070 && sRatio<0.120"; +// TCut sRatioNoAl180 = "sRatio>0.010 && sRatio<0.150"; + TCut sRatioAl90 = "sRatio>0.075 && sRatio<0.125"; + TCut sRatioNoAl90 = "sRatio>0.076 && sRatio<0.126"; + TCut sRatio[6] = {sRatioAl0, sRatioNoAl0, sRatioAl180, sRatioNoAl180, sRatioAl90, sRatioNoAl90}; + + //integral fit +// const Long64_t eMaxEvents = 5000000; +// Long64_t eEventsAl0 = eMaxEvents; +// Long64_t eEventsNoAl0 = eMaxEvents; +// Long64_t eEventsAl180 = eMaxEvents; +// Long64_t eEventsNoAl180 = eMaxEvents; +// Long64_t eEventsAl90 = eMaxEvents; +// Long64_t eEventsNoAl90 = eMaxEvents; + + Long64_t eEventsECuts[5][6] = {eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, + eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, + eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, + eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, + eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents, eMaxEvents}; + +// const Long64_t eEvents[6] = {eEventsAl0, eEventsNoAl0, eEventsAl180, eEventsNoAl180, eEventsAl90, eEventsNoAl90}; +// const TChain *chs[6] = {chsAl0, chsNoAl0, chsAl180, chsNoAl180, chsAl90, chsNoAl90}; +// const TTree *ti[6] = {tiAl0, tiNoAl0, tiAl180, tiNoAl180, tiAl90, tiNoAl90}; + +// const Long64_t sMaxEvents = 3000000; +// Long64_t sEventsAl0 = 2050000; +// Long64_t sEventsNoAl0 = 2050000; +// Long64_t sEventsAl180 = 2050000; +// Long64_t sEventsNoAl180 = 2050000; +// Long64_t sEventsAl90 = 1900000; +// Long64_t sEventsNoAl90 = 1950000; +// const Long64_t sEvents[6] = {sEventsAl0, sEventsNoAl0, sEventsAl180, sEventsNoAl180, sEventsAl0, sEventsNoAl0}; + + const Long64_t sMaxEvents = 3000000; + Long64_t sEventsECuts[5][6] = {/*sMaxEvents, sMaxEvents, sMaxEvents, sMaxEvents, sMaxEvents, sMaxEvents,*/ + 2020000, 2040000, 2130000, 2080000, 2060000, 2080000, + 2000000, 2020000, 2000000, 2010000, 1990000, 1970000, + 2320000, 2300000, 2340000, 2310000, 2300000, 2290000, + 2060000, 2070000, 2110000, 2110000, 2070000, 2060000, + 2050000, 2050000, 2110000, 2110000, 2050000, 2050000}; + + TString canvasTitle; + TString canvasName; + + //spectra + const Double_t sRange[6] = {2000, 2000, 2000, 2000, 2000, 2000}; + if (spectra) { + gROOT->ProcessLine(".x corr_templates/sfAngInt_spectra_v5.cxx"); + } + + // "T" system + const Double_t eTRange[5][6] = {280, 280, 280, 280, 280, 280, + 350, 350, 350, 350, 350, 350, + 350, 350, 350, 350, 350, 350, + 630, 630, 630, 630, 630, 630, + 700, 700, 700, 700, 700, 700}; + gROOT->ProcessLine(".x corr_templates/sfAngInt_epsilonT.cxx"); + + const Double_t coskTRange[5][6] = {300, 300, 300, 300, 300, 300, + 350, 350, 350, 350, 350, 350, + 350, 350, 350, 350, 350, 350, + 900, 900, 900, 900, 900, 900, + 1100, 1100, 1100, 1100, 1100, 1100}; + gROOT->ProcessLine(".x corr_templates/sfAngInt_cosThetaTk.cxx"); + + // "Y" system + const Double_t eYRange[5][6] = {350, 350, 350, 350, 350, 350, + 400, 400, 400, 400, 400, 400, + 450, 450, 450, 450, 450, 450, + 1000, 1000, 1000, 1000, 1000, 1000, + 1300, 1300, 1300, 1300, 1300, 1300}; + gROOT->ProcessLine(".x corr_templates/sfAngInt_epsilonY.cxx"); + + const Double_t coskYRange[5][6] = {230, 230, 230, 230, 230, 230, + 350, 350, 350, 350, 350, 350, + 350, 350, 350, 350, 350, 350, + 600, 600, 600, 600, 600, 600, + 650, 650, 650, 650, 650, 650}; + gROOT->ProcessLine(".x corr_templates/sfAngInt_cosThetaYk.cxx"); + + //quasibinary kinematics: diproton + const Double_t tP1Range[5][6] = {80, 80, 80, 80, 80, 80, + 120, 120, 120, 120, 120, 120, + 160, 120, 160, 120, 160, 120, + 250, 200, 250, 200, 250, 200, + 240, 240, 240, 240, 240, 240}; + gROOT->ProcessLine(".x corr_templates/sfAngInt_thetaP1T.cxx"); + + const Double_t tARange[5][6] = {80, 80, 80, 80, 80, 80, + 130, 130, 130, 130, 130, 130, + 200, 120, 200, 120, 200, 120, + 300, 200, 300, 200, 300, 200, + 270, 270, 270, 270, 270, 270}; + gROOT->ProcessLine(".x corr_templates/sfAngInt_thetaAT.cxx"); + + //quasibinary kinematics: 5Li + const Double_t tP2YRange[5][6] = {50, 50, 50, 50, 50, 50, + 75, 75, 75, 75, 75, 75, + 110, 70, 110, 70, 110, 70, + 300, 300, 300, 300, 300, 300, + 200, 200, 200, 200, 200, 200}; + gROOT->ProcessLine(".x corr_templates/sfAngInt_thetaP2Y.cxx"); + + Info("correlations_v5_7590.cxx", "Finished."); + + +} + + -- 2.18.1