[ROOT] CutG and Projection of TH2F

From: Frank Delaunay (delaunay@nscl.msu.edu)
Date: Fri Dec 10 2004 - 01:22:18 MET


Dear Rooters,

I am running ROOT version 4.00.08 on intel 686 with Linux.

I want to make a Projection of a TH2F histogram using a TCutG to project
only a small region of the histogram.
The TH2F is in file, which I first open. I draw the TH2F and draw the
TCutG. I retrieve the cut in the interpreter and change its name.
Then I make a ProjectionX using the name of the cut in the option, and I
draw the TH1D projection. Nothing crashes, but the drawn TH1D is actually
the projection of the whole TH2F and not only the region enclosed in the
TCutG.

The series of commands is:

root [0] f = new TFile("../root-files/mcp1_yvsx_run1.root")
(class TFile*)0x8de9e30
root [1] mcp1_xvsy->Draw()
<TCanvas::MakeDefCanvas>: created default TCanvas with name c1
root [2] TCutG *cut = (TCutG*)c1->FindObject("CUTG")
root [3] cut->SetName("cut")
root [4] TH1D *px
root [5] px = mcp1_xvsy->ProjectionX("px",0,1024,"[cut]")
(const class TH1D*)0x903ed60
root [6] px->Draw()

Thanks for any help,
Franck Delaunay



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET