figSpectraIntegral.cxx 4.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
#include "TCanvas.h"

void figSpectraIntegral()
{
	TStopwatch sw;
	sw.Start();

	const Int_t lowfile = 0;
	const Int_t upfile = 40;

	const Int_t lowrfile = 0;
	const Int_t uprfile = 0;

//	TChain *che = BeWork::OpenChain("/data2/be/rootdata/correlations/Be.",
	TChain *che = BeWork::OpenChain("../../../be/rootdata/correlations/v5_exp/Be.",
			lowfile, upfile, "beonly");										//original file
	Info("figSpectraIntegral", "%lld events in chain \"%s\" containing experimental data",
			che->GetEntries(), che->GetName());
//
//	TChain *cheRaw = BeWork::OpenChain("/data2/be/rootdata/correlations/Exp.", lowfile, upfile, "be", kBlack);
//
//	TChain *chraw = BeWork::OpenChain("/data2/be/rootdata/correlations/Exp.",
//			lowrfile, uprfile, "be");										//original file
//	Info("statesRatioFitting.cxx", "%d events in chain \"%s\" containing experimental data",
//			chraw->GetEntries(), chraw->GetName());

	const Bool_t savePictures = 0;
	TString pictureName;
	TString picturePath = "figures/";
//	TString pictFormat = ".jpg";
	TString pictFormat = ".eps";
//	TString pictFormat = ".gif";

	Int_t wtopx = 0, wtopy = 0;
	UInt_t ww = 0, wh = 0;


//	if (kspectrum1D) {
	TCanvas *cSpectrum = new TCanvas("spectrumIntegral", "spectrum up to 16 MeV");
	cSpectrum->Divide(1,2, 0., 0.);
//	cSpectrum->SetBottomMargin(0.15);

	cSpectrum->cd(1);
	che->Draw("fBeIM>>hBe(200,0,7.9)", "fBeIM<7.9");
	TH1F *hBe = (TH1F*)gPad->FindObject("hBe");
	hBe->SetTitle("");
	hBe->SetLineColor(kGray+2);
	hBe->SetFillColor(kGray+2);
	hBe->SetXTitle("E_{T} (MeV)");
	hBe->GetXaxis()->SetTitleOffset(0.71);
	hBe->GetXaxis()->SetLabelSize(0.05);
	hBe->GetXaxis()->SetTitleSize(0.09);
	hBe->GetXaxis()->CenterTitle();
	hBe->SetYTitle("Counts");
	hBe->GetYaxis()->SetTitleOffset(0.75);
	hBe->GetYaxis()->SetLabelSize(0.05);
	hBe->GetYaxis()->SetTitleSize(0.09);
	hBe->GetYaxis()->CenterTitle();
	hBe->GetYaxis()->SetRangeUser(0,19000);
	hBe->GetXaxis()->SetNdivisions(516);

//	TLine *lineE[4];
//
//	lineE[0] = new TLine(3, 45, 3, 120);
//	lineE[1] = new TLine(0, 45, 0, 120);
//	lineE[2] = new TLine(0, 120, 3, 120);
//	lineE[3] = new TLine(0, 45, 3, 45);


	cSpectrum->cd(2);
	che->Draw("fBeThetaCM1*TMath::RadToDeg():fBeIM>>hBe2D(100,0,7.9, 100,0,179)", "fBeIM<7.9", "cont");
	TH2F *hBe2D = (TH2F*)gPad->FindObject("hBe2D");
	hBe2D->SetTitle("");
	hBe2D->SetLineColor(kGray+2);
	hBe2D->SetFillColor(kGray+2);
	hBe2D->SetXTitle("E_{T} (MeV)");
	hBe2D->GetXaxis()->SetTitleOffset(0.71);
	hBe2D->GetXaxis()->SetLabelSize(0.05);
	hBe2D->GetXaxis()->SetTitleSize(0.09);
	hBe2D->GetXaxis()->CenterTitle();
	hBe2D->SetYTitle("\\theta_{Be} (deg.)");
	hBe2D->GetYaxis()->SetTitleOffset(0.60);
	hBe2D->GetYaxis()->SetLabelSize(0.05);
	hBe2D->GetYaxis()->SetTitleSize(0.09);
	hBe2D->GetYaxis()->CenterTitle();
	hBe2D->GetXaxis()->SetNdivisions(516);

	TLine *line[4];

	line[0] = new TLine(3, 45, 3, 120);
	line[1] = new TLine(0, 45, 0, 120);
	line[2] = new TLine(0, 120, 3, 120);
	line[3] = new TLine(0, 45, 3, 45);

	for (Int_t i = 0; i < 4; i++) {
		line[i]->SetLineWidth(3);
		line[i]->SetLineColor(kRed);
		line[i]->Draw("same");
	}

	if (savePictures) {
		pictureName.Form("%s%s%s", picturePath.Data(), cSpectrum->GetName(), pictFormat.Data());
		cSpectrum->SaveAs(pictureName.Data());
		cSpectrum->cd();
		cSpectrum->Close();
	}





	//	}

	//	if (kThetaLab) {
	//		TCanvas *cThetas = new TCanvas("thetaLab", "really measured thetas in lab frame");
	//		che->Draw("fAThetaLab*TMath::RadToDeg()>>hATheta(500,0,27)", "");
	//		che->Draw("fP1ThetaLab*TMath::RadToDeg()>>hAP1(100,0,27)", "", "same goff");
	//		che->Draw("fP2ThetaLab*TMath::RadToDeg()>>hAP2(100,0,27)", "", "same goff");
	//		TH1F *hATheta = (TH1F*)gPad->FindObject("hATheta");
	//		hATheta->SetTitle("");
	////		hATheta->SetLineColor(kGray+2);
	////		hATheta->SetFillColor(kGray+2);
//		hATheta->SetXTitle("\\theta_{lab} [\\circ]");
//		hATheta->GetXaxis()->SetTitleOffset(0.95);
//		hATheta->GetXaxis()->CenterTitle();
//		hATheta->SetYTitle("Events");
//		hATheta->GetYaxis()->SetTitleOffset(1.1);
//		hATheta->GetYaxis()->CenterTitle();
//		hATheta->SetLineColor(kRed);
//		hATheta->SetFillColor(kRed);
//		hATheta->SetFillStyle(3005);
//
//		TH1F hP(*hAP2);
//		hP.Add(hAP1);
//		hP.SetLineColor(kBlue);
//		hP.SetFillColor(kBlue);
//		hP.SetFillStyle(3004);
//		hP.Draw("same");
//
//		if (savePictures) {
//			pictureName.Form("%s%s%s", picturePath.Data(), cThetas->GetName(), pictFormat.Data());
//			cThetas->SaveAs(pictureName.Data());
//			cThetas->cd();
//			cThetas->Close();
//		}
//	}

}