showHistOutput.cxx 1.52 KB
Newer Older
1 2
void showHistOutput()
{
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

	//channel units
	//TString fName = "histOutput.root";
//	TString fName = "histOutput680.root";
	TString fName = "histOutput47.root";

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

	//1e units
//	TString fName = "histOutput1e_HV1000.root";
	//TString fName = "histOutput1e_HV950.root";

//	const Double_t xmin = 0.5;
//	const Double_t xmax = 12.;

	TFile *fr = new TFile(fName.Data());
	if (fr->IsZombie()) {
		Error("showHistOutput.cxx", "Files %s was not open.", fName.Data());
		return;
	}
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

	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;

	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);
	}

}