figSpectraIZV.cxx 2 KB
Newer Older
1 2
//Figure 1 IZV RAS

3 4 5 6 7
#if !defined(__CLING__)

#include "TFile.h"
#include "TCanvas.h"
#include "TH1F.h"
8
#include "TText.h"
9 10 11

#endif

12
void figSpectraIZV(const Bool_t saveFigs = 0)
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
{

//	TFile *fr = new TFile("figures/spectra.root", "READ");
//	TFile *fr = new TFile("figures/spectra100new.root", "READ");
	TFile *fr = new TFile("figures/spectra50new.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);



50
	TCanvas *c1 = new TCanvas("c1", "Fig. 1, IZV RAS");
51 52 53 54 55 56
	c1->ToggleEditor();
//	c1->SetWindowSize(800, 1200);
//	c1->SetWindowSize(800, 800);
	c1->SetWindowSize(1333, 787);
	c1->Divide(2, 2, .001, .001);

57 58 59
	TText *t1[4];
	TString panel[4] = {"a)", "b)", "c)", "d)"};

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

	for (Int_t i = 0; i < 4; i++) {
		c1->cd(i+1);

		hExp[i]->SetTitle("");
		hSim[i]->SetTitle("");

		hSim[i]->SetXTitle("#it{E}, MeV");
		hSim[i]->Smooth();
		hExp[i]->SetLineWidth(2);
		hSim[i]->SetLineColor(kGray+1);



		hSim[i]->Draw("");
		hExp[i]->Draw("E same");

		if (i==0) hSim[i]->GetYaxis()->SetRangeUser(0,13000);
78

79 80
//		t1[i] = new TText(0.18,0.87,panel[i].Data());
		t1[i] = new TText(0.5,0.92,panel[i].Data());
81
		t1[i]->SetNDC();
82
		t1[i]->SetTextFont(12);
83 84
		t1[i]->SetTextSize(0.07);
		t1[i]->Draw();
85 86
	}

87 88 89
//	c1->Update();
//	c1->Update();

90 91
	if (saveFigs) {
//		c2->SaveAs("figures/PresGSepsilonTright7590.png");
92

93 94 95
		c1->SaveAs("figures/Fig1izvSpectra.png");
		c1->SaveAs("figures/Fig1izvSpectra.eps");
	}
96

97
	return;
98
}