showHistOutput.cxx 1.12 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
void showHistOutput()
{
	TFile *fr = new TFile("histOutput.root");

	TH1D *hch[64];
	TString histName;

	for (Int_t i = 0; i<64; i++) {
		histName.Form("ch%d", i);
		hch[i] = (TH1D*)fr->Get(histName.Data());
	}

	//canvases to show 1D histograms
	TString cName;
	TString cTitle;

	const Int_t pads = 9;
	const Int_t noCanvas = 64/pads+1;

	const Double_t xmin = 100;
	const Double_t xmax = 2000.;

	TCanvas *cWork[noCanvas];
	for (Int_t i = 0; i < noCanvas; i++) {
		cName.Form("can%d", i);
		cTitle.Form("canvas %d", i);
		cWork[i] = new TCanvas(cName.Data(), cTitle.Data(), 0, 0, 960, 700);
		//		cWork[i]->SetName(cName.Data());
		//		cWork[i]->SetTitle(cTitle.Data());
		if (pads == 6) cWork[i]->Divide(2, 3);
		if (pads == 9) cWork[i]->Divide(3, 3);
		cWork[i]->cd(1);
	}

	for (Int_t i = 0; i < 64; i++) {
		histName.Form("ch%d", i);
//		hTitle.Form("channel %d", i);
//		hTemp = h2->ProjectionY(hName.Data(), i+1, i+1);
//		hTemp->SetTitle(hTitle.Data());
//		hTemp->GetXaxis()->SetRangeUser(0, 2000);
		Int_t cNumber = i/pads;
		cWork[cNumber]->cd(i-pads*cNumber+1);
		hch[i]->Draw();
		hch[i]->GetXaxis()->SetRangeUser(xmin, xmax);
	}

}