Commit cc87a0d7 authored by Vratislav Chudoba's avatar Vratislav Chudoba

SaveEpsilonTHist() implemented.

parent e7924428
...@@ -23,6 +23,9 @@ BeAnalysis::BeAnalysis() : che(0), lowExpFile(0), upExpFile(0), spectra(0) { ...@@ -23,6 +23,9 @@ BeAnalysis::BeAnalysis() : che(0), lowExpFile(0), upExpFile(0), spectra(0) {
SetChainsToDraw(); SetChainsToDraw();
SetNoBinsSpectra(); SetNoBinsSpectra();
SetNoBinsCorrelations();
InitHistos();
noIntervals = 5; noIntervals = 5;
...@@ -138,7 +141,7 @@ void BeAnalysis::SetCuts() { ...@@ -138,7 +141,7 @@ void BeAnalysis::SetCuts() {
ciEpsilon = "sTpp/E_IM<0.2"; ciEpsilon = "sTpp/E_IM<0.2";
//ciEpsilon = "sTpp/E_IM<1."; //ciEpsilon = "sTpp/E_IM<1.";
//ciEpsilonY = "sTap/E_IM<0.5"; //ciEpsilonY = "sTap/E_IM<0.5";
ciEpsilonY = "sTap/E_IM>0.7"; // ciEpsilonY = "sTap/E_IM>0.7";
cQ = "TMath::Abs(fQLiP)<10"; cQ = "TMath::Abs(fQLiP)<10";
cProtons = "fP1Lab.fE-938.272<50 && fP2Lab.fE-938.272<50"; cProtons = "fP1Lab.fE-938.272<50 && fP2Lab.fE-938.272<50";
...@@ -222,6 +225,53 @@ void BeAnalysis::SetRatiosGStoEX(TString sRatioAl0, TString sRatioNoAl0, ...@@ -222,6 +225,53 @@ void BeAnalysis::SetRatiosGStoEX(TString sRatioAl0, TString sRatioNoAl0,
} }
void BeAnalysis::InitHistos() {
for (Int_t i = 0; i < 6; i++) {
hsSpectra[i] = 0;
heSpectra[i] = 0;
hSdiff[i] = 0;
}
for (Int_t i = 0; i < 5; i++) {
for (Int_t j = 0; j < 6; j++) {
hseT[i][j] = 0;
heeT[i][j] = 0;
hieT[i][j] = 0;
}
}
}
void BeAnalysis::SaveSpectrumHist(Int_t i) {
TFile fw("figures/spectra.root", "UPDATE");
if (heSpectra[i] != 0) heSpectra[i]->Write();
if (hsSpectra[i] != 0) hsSpectra[i]->Write();
fw.Close();
}
void BeAnalysis::SaveEpsilonTHist(Int_t interval, Int_t chain) {
TFile fw("figures/epsilonT.root", "UPDATE");
if (heeT[interval][chain] != 0) {
heeT[interval][chain]->Write();
Info("BeAnalysis::SaveEpsilonTHist", "Histogram saved.");
}
if (hseT[interval][chain] != 0) {
Info("BeAnalysis::SaveEpsilonTHist", "Histogram saved.");
hseT[interval][chain]->Write();
}
if (hieT[interval][chain] != 0) {
Info("BeAnalysis::SaveEpsilonTHist", "Histogram saved.");
hieT[interval][chain]->Write();
}
fw.Close();
}
void BeAnalysis::SetCMAngularCuts() { void BeAnalysis::SetCMAngularCuts() {
TString sAngles, srAngles; TString sAngles, srAngles;
...@@ -236,6 +286,7 @@ void BeAnalysis::SetCMAngularCuts() { ...@@ -236,6 +286,7 @@ void BeAnalysis::SetCMAngularCuts() {
void BeAnalysis::Spectra() { void BeAnalysis::Spectra() {
if (!spectra) { if (!spectra) {
Error("BeAnalysis::Spectra", "kSpectra was to zero.");
return; return;
} }
...@@ -253,9 +304,9 @@ void BeAnalysis::Spectra() { ...@@ -253,9 +304,9 @@ void BeAnalysis::Spectra() {
TCanvas *cSpectra = new TCanvas(); TCanvas *cSpectra = new TCanvas();
TH1F *hsSpectra[6]; // TH1F *hsSpectra[6];
TH1F *heSpectra[6]; // TH1F *heSpectra[6];
TH1F *hSdiff[6]; // TH1F *hSdiff[6];
canvasTitle.Form("energy spectra fitting;\t(%d,%d) degrees", kMinAngle, kMaxAngle); canvasTitle.Form("energy spectra fitting;\t(%d,%d) degrees", kMinAngle, kMaxAngle);
cSpectra->SetTitle(canvasTitle.Data()); cSpectra->SetTitle(canvasTitle.Data());
...@@ -271,19 +322,22 @@ void BeAnalysis::Spectra() { ...@@ -271,19 +322,22 @@ void BeAnalysis::Spectra() {
chs[j]->SetLineColor(kBlue); chs[j]->SetLineColor(kBlue);
chs[j]->SetFillColor(kWhite); chs[j]->SetFillColor(kWhite);
hsName.Form("hsSpectra%d", j); hsName.Form("hsSpectra%d", j);
hsSpectra[j] = new TH1F(hsName.Data(), "title", noBinsSpectra, 0, 10); hsSpectra[j] = new TH1F(hsName.Data(), cAngles.GetTitle(), noBinsSpectra, 0, 10);
// drawCommand.Form("f6BeIM>>%s(200,0,10)", hsName.Data()); // drawCommand.Form("f6BeIM>>%s(200,0,10)", hsName.Data());
drawCommand.Form("f6BeIM>>%s", 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(), cQ && crBeWork && crAngles && sRatio[j], "", sEvents[j]);
chs[j]->Draw(drawCommand.Data(), cProtons && 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); heName.Form("heSpectra%d", j);
heSpectra[j] = new TH1F(heName.Data(), "title", noBinsSpectra, 0, 10); heSpectra[j] = new TH1F(heName.Data(), cAngles.GetTitle(), noBinsSpectra, 0, 10);
// drawCommand.Form("fBeIM>>%s(200,0,10)", heName.Data()); // drawCommand.Form("fBeIM>>%s(200,0,10)", heName.Data());
drawCommand.Form("fBeIM>>%s", heName.Data()); drawCommand.Form("fBeIM>>%s", heName.Data());
// che->Draw(drawCommand.Data(), cQ && cBeWork && cAngles, "same", eEvents[j]); // che->Draw(drawCommand.Data(), cQ && cBeWork && cAngles, "same", eEvents[j]);
che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]); che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]);
// TString histTitle;
// histTitle.Form("%s", cAngles.GetTitle());
// heSpectra[j]->SetTitle(cAngles.GetTitle());
//// cout << drawCommand << "\t" << eEvents[j] << endl; //// cout << drawCommand << "\t" << eEvents[j] << endl;
//// che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]); //// che->Draw(drawCommand.Data(), cProtons && cQ && cBeWork && cAngles, "", eEvents[j]);
...@@ -294,16 +348,18 @@ void BeAnalysis::Spectra() { ...@@ -294,16 +348,18 @@ void BeAnalysis::Spectra() {
// heSpectra[j]->Draw(""); // heSpectra[j]->Draw("");
heSpectra[j]->Draw("E"); heSpectra[j]->Draw("E");
heSpectra[j]->SetLineColor(1); heSpectra[j]->SetLineColor(1);
heSpectra[j]->SetTitle(""); // heSpectra[j]->SetTitle("");
heSpectra[j]->SetXTitle("E_{T} (MeV)"); heSpectra[j]->SetXTitle("E_{T} (MeV)");
// heSpectra[j]->GetXaxis()->SetTitleOffset(0.95); // heSpectra[j]->GetXaxis()->SetTitleOffset(0.95);
heSpectra[j]->GetXaxis()->CenterTitle(); heSpectra[j]->GetXaxis()->CenterTitle();
heSpectra[j]->SetYTitle("counts"); heSpectra[j]->SetYTitle("counts");
// heSpectra[j]->GetYaxis()->SetTitleOffset(0.7); // heSpectra[j]->GetYaxis()->SetTitleOffset(0.7);
heSpectra[j]->GetYaxis()->CenterTitle(); heSpectra[j]->GetYaxis()->CenterTitle();
hsSpectra[j]->SetLineColor(kGray+1); hsSpectra[j]->SetLineColor(kGray+1);
hsSpectra[j]->SetFillColor(kGray+1); hsSpectra[j]->SetFillColor(kGray+1);
hsSpectra[j]->Draw("same"); hsSpectra[j]->Draw("same");
heSpectra[j]->Draw("same E"); heSpectra[j]->Draw("same E");
if (kAutoRange) { if (kAutoRange) {
...@@ -353,9 +409,9 @@ void BeAnalysis::EpsilonT() { ...@@ -353,9 +409,9 @@ void BeAnalysis::EpsilonT() {
TCanvas *canEpsilonT[noIntervals]; TCanvas *canEpsilonT[noIntervals];
for (Int_t i = 0; i<noIntervals; i++) { //energy intervals (canvases) for (Int_t i = 0; i<noIntervals; i++) { //energy intervals (canvases)
TH1F *hseT[noIntervals][6]; // TH1F *hseT[noIntervals][6];
TH1F *heeT[noIntervals][6]; // TH1F *heeT[noIntervals][6];
TH1F *hieT[noIntervals][6]; // TH1F *hieT[noIntervals][6];
if (!epsilonT[i]) continue; if (!epsilonT[i]) continue;
...@@ -382,20 +438,26 @@ void BeAnalysis::EpsilonT() { ...@@ -382,20 +438,26 @@ void BeAnalysis::EpsilonT() {
// cout << eEventsECuts[i][j] << endl; // cout << eEventsECuts[i][j] << endl;
canEpsilonT[i]->cd(j+1); canEpsilonT[i]->cd(j+1);
chs[j]->SetLineColor(kGray+1); // chs[j]->SetLineColor(kGray+1);
chs[j]->SetFillColor(kGray+1); // chs[j]->SetFillColor(kGray+1);
hsName.Form("hseT%d_%d", i, j); hsName.Form("hseT%d_%d", i, j);
drawCommand.Form("fTpp/f6BeIM>>%s(30,0,1)", hsName.Data()); // hsSpectra[j] = new TH1F(hsName.Data(), cAngles.GetTitle(), noBinsSpectra, 0, 10);
hseT[i][j] = new TH1F(hsName.Data(), cAngles.GetTitle(), noBinsCorr, 0, 1.);
hseT[i][j]->SetLineColor(kGray+1);
hseT[i][j]->SetFillColor(kGray+1);
// drawCommand.Form("fTpp/f6BeIM>>%s(30,0,1)", hsName.Data());
drawCommand.Form("fTpp/f6BeIM>>%s", hsName.Data());
chs[j]->Draw(drawCommand.Data(), cProtons && 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()); // hseT[i][j] = (TH1F*)gPad->FindObject(hsName.Data());
heName.Form("heeT%d_%d", i, j); heName.Form("heeT%d_%d", i, j);
heeT[i][j] = new TH1F(heName.Data(), cAngles.GetTitle(), noBinsCorr, 0, 1.);
drawCommand.Form("fTpp/fBeIM>>%s", heName.Data()); drawCommand.Form("fTpp/fBeIM>>%s", heName.Data());
che->Draw(drawCommand.Data(), cProtons && 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()); // heeT[i][j] = (TH1F*)gPad->FindObject(heName.Data());
// continue; // continue;
hseT[i][j]->Draw(); hseT[i][j]->Draw();
hseT[i][j]->SetTitle(""); // hseT[i][j]->SetTitle("");
hseT[i][j]->SetXTitle("\\varepsilon"); hseT[i][j]->SetXTitle("\\varepsilon");
// hseT[i][j]->GetXaxis()->SetTitleOffset(0.95); // hseT[i][j]->GetXaxis()->SetTitleOffset(0.95);
// hseT[i][j]->GetXaxis()->SetTitleSize(0.11); // hseT[i][j]->GetXaxis()->SetTitleSize(0.11);
...@@ -418,8 +480,9 @@ void BeAnalysis::EpsilonT() { ...@@ -418,8 +480,9 @@ void BeAnalysis::EpsilonT() {
hiName.Form("hieT%d_%d", i, j); hiName.Form("hieT%d_%d", i, j);
drawCommand.Form("sTpp/E_IM>>%s", hiName.Data()); drawCommand.Form("sTpp/E_IM>>%s", hiName.Data());
hieT[i][j] = new TH1F(hiName.Data(), cAngles.GetTitle(), noBinsCorr, 0, 1.);
ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same"); ti[j]->Draw(drawCommand.Data(), ciBeE[i] && sRatio[j], "same");
hieT[i][j] = (TH1F*)gPad->FindObject(hiName.Data()); // hieT[i][j] = (TH1F*)gPad->FindObject(hiName.Data());
Float_t rightmax = kRangeProportionIn*hieT[i][j]->GetMaximum(); Float_t rightmax = kRangeProportionIn*hieT[i][j]->GetMaximum();
Float_t scale = canEpsilonT[i]->GetPad(j+1)->GetUymax()/rightmax; Float_t scale = canEpsilonT[i]->GetPad(j+1)->GetUymax()/rightmax;
hieT[i][j]->SetLineColor(kRed); hieT[i][j]->SetLineColor(kRed);
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include "TCut.h" #include "TCut.h"
#include "TCanvas.h" #include "TCanvas.h"
#define NOINTERVALS 5;
using std::cout; using std::cout;
using std::endl; using std::endl;
...@@ -37,20 +39,16 @@ public: ...@@ -37,20 +39,16 @@ public:
void OpenExpChain(); void OpenExpChain();
void SetNoBinsSpectra(Int_t noBins = 100) {noBinsSpectra = noBins;}; void SetNoBinsSpectra(Int_t noBins = 100) {noBinsSpectra = noBins;};
void SetNoBinsCorrelations(Int_t noBins = 30) {noBinsCorr = noBins;};
TChain* GetExpChain() {return che;}; TChain* GetExpChain() {return che;};
TChain* GetSimChain(Int_t i) {return chs[i];}; 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); 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);
private:
void SetCuts();
public:
void SetSimCuts(TString sEt[5]/*, TString sET0 = "", TString sET1 = "", TString sET2 = "", TString sET3 = "", TString sET4 = ""*/); void SetSimCuts(TString sEt[5]/*, TString sET0 = "", TString sET1 = "", TString sET2 = "", TString sET3 = "", TString sET4 = ""*/);
void SetCMAngularRange(Int_t minAngle, Int_t maxAngle); void SetCMAngularRange(Int_t minAngle, Int_t maxAngle);
private:
void SetCMAngularCuts();
public:
void SetRangeProportion(Float_t rangeProportion = 1.1, Bool_t autoRange = 1); void SetRangeProportion(Float_t rangeProportion = 1.1, Bool_t autoRange = 1);
void SetNoExpEvents(Long64_t *noExpEvents = 0); void SetNoExpEvents(Long64_t *noExpEvents = 0);
...@@ -58,9 +56,7 @@ public: ...@@ -58,9 +56,7 @@ public:
void SetRatiosGStoEX(TString sRatioAl0, TString sRatioNoAl0, void SetRatiosGStoEX(TString sRatioAl0, TString sRatioNoAl0,
TString sRatioAl180, TString sRatioNoAl180, TString sRatioAl180, TString sRatioNoAl180,
TString sRatioAl90, TString sRatioNoAl90); TString sRatioAl90, TString sRatioNoAl90);
// void ExpEventsECuts(Long64_t **noExpEvents = 0);
// void ExpEventsECuts(Int_t (&noExpEvents)[5][6]);
// void ExpEventsECuts(Int_t (*noExpEvents)[5][6]);
void ExpEventsECuts(Long64_t noExpEvents[5][6] = 0); void ExpEventsECuts(Long64_t noExpEvents[5][6] = 0);
void SimEventsECuts(Long64_t noSimEvents[5][6] = 0); void SimEventsECuts(Long64_t noSimEvents[5][6] = 0);
void EpsilonTRange(); void EpsilonTRange();
...@@ -81,9 +77,12 @@ public: ...@@ -81,9 +77,12 @@ public:
void SetFigures(TString figPath = "figures/", TString figFormat = ".eps", Bool_t kSave = 1); void SetFigures(TString figPath = "figures/", TString figFormat = ".eps", Bool_t kSave = 1);
void SaveSpectrumHist(Int_t i);
void SaveEpsilonTHist(Int_t interval, Int_t chain);
// //
//private: private:
TChain *che; //chain with experimental trees TChain *che; //chain with experimental trees
TChain *chs[6]; //array of chains with simulation trees TChain *chs[6]; //array of chains with simulation trees
TTree *ti[6]; //array of chains with simulation input TTree *ti[6]; //array of chains with simulation input
...@@ -98,10 +97,25 @@ private: ...@@ -98,10 +97,25 @@ private:
Int_t upSimFile[6]; Int_t upSimFile[6];
Int_t noBinsSpectra; Int_t noBinsSpectra;
Int_t noBinsCorr;
Int_t kMinAngle; Int_t kMinAngle;
Int_t kMaxAngle; Int_t kMaxAngle;
//histograms
TH1F *hsSpectra[6];
TH1F *heSpectra[6];
TH1F *hSdiff[6];
TH1F *hseT[5][6];
TH1F *heeT[5][6];
TH1F *hieT[5][6];
// TH1F *hscoskT[noIntervals][6];
// TH1F *hecoskT[noIntervals][6];
// TH1F *hicoskT[noIntervals][6];
//cuts
TCut cAngles; TCut cAngles;
TCut crAngles; TCut crAngles;
...@@ -132,14 +146,7 @@ private: ...@@ -132,14 +146,7 @@ private:
Double_t eTRange[5][6]; //! Double_t eTRange[5][6]; //!
//cuts //cuts
// TCut cBe20;
// TCut cBe3;
TCut cBeWork; TCut cBeWork;
// TCut cBe0_14;
// TCut cBe14_19;
// TCut cBe19_25;
// TCut cBe25_31;
// TCut cBe31_37;
TCut cBeE[5]; TCut cBeE[5];
TCut cEpsilonT; TCut cEpsilonT;
...@@ -147,14 +154,7 @@ private: ...@@ -147,14 +154,7 @@ private:
//raw files //raw files
//energy cuts //energy cuts
// TCut crBe20;
// TCut crBe3;
TCut crBeWork; TCut crBeWork;
// TCut crBe0_14;
// TCut crBe14_19;
// TCut crBe19_25;
// TCut crBe25_31;
// TCut crBe31_37;
TCut crBeE[5]; TCut crBeE[5];
//angular cuts //angular cuts
...@@ -165,7 +165,7 @@ private: ...@@ -165,7 +165,7 @@ private:
TCut ciBeE[5]; TCut ciBeE[5];
TCut ciEpsilon; TCut ciEpsilon;
TCut ciEpsilonY; // TCut ciEpsilonY;
TCut cQ; TCut cQ;
TCut cProtons; TCut cProtons;
...@@ -186,9 +186,15 @@ private: ...@@ -186,9 +186,15 @@ private:
TString figureFormat; TString figureFormat;
private: private:
void InitHistos();
void SaveFigures(TCanvas *canvas, TString variable, Int_t interval); void SaveFigures(TCanvas *canvas, TString variable, Int_t interval);
void CanvasDivision(TCanvas *c); void CanvasDivision(TCanvas *c);
void SetCuts();
void SetCMAngularCuts();
}; };
#endif /* BE_BEANALYSIS_H_ */ #endif /* BE_BEANALYSIS_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment