Re: [ROOT] project a sub range of a histogram

From: ddas@veccal.ernet.in
Date: Wed Dec 01 2004 - 15:47:03 MET


Hi rene


thanks, I am using linux 7.3 ------------

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)

with this version of gcc. will it work?
earlier i had problems in indtalling 4.00 and so still working with 3.10 the old version.
regards

> To use the [cut] option in Projections, you must use a recent 
> version like
> 4.01/04
> 
> Rene Brun
> 
> ddas@veccal.ernet.in wrote:
> > 
> >  Hello
> >  does anybody know how to project subrange of a 2D histogram.
> >  I tried using TCutG but somehow could not get the result.
> >  I wanted to change by Projection X from value1 to value2 and 
> then plot that part only.
> >  Also if somebody can explain what this SetPoint means.
> > 
> >  Example:
> > 
> >  {
> >     TCanvas *c = new TCanvas("c","example",0,0,700,600);
> >     c->Divide(1,2);
> > 
> >     TCutG *gcut = new TCutG("gcut",8);
> >     gcut->SetPoint(0,-0.646552,0.932203);
> >     gcut->SetPoint(1,-1.26437,0.105932);
> >     gcut->SetPoint(2,-0.574713,-1.10169);
> >     gcut->SetPoint(3,0.948276,-0.338983);
> >     gcut->SetPoint(4,1.07759,0.720339);
> >     gcut->SetPoint(5,-0.316092,-0.0847458);
> >     gcut->SetPoint(6,-0.45977,0.402542);
> >     gcut->SetPoint(7,-0.646552,0.932203);
> > 
> >     TFile f("hsimple.root")
> >     TH2F *hpxpy = (TH2F*)f.Get("hpxpy");
> >     TH1D *hppx = hpxpy->ProjectionX("",1,40,"[gcut]");
> > 
> >     c->cd(1);
> >     hpxpy->SetFillColor(kBlue);
> >     hpxpy->DrawCopy("box");
> >     hpxpy->SetFillColor(kRed);
> >     hpxpy->Draw("same box [gcut]");
> > 
> >     c->cd(2);
> >     hppx->Draw();
> >  }
> > 
> >  thanks again
> >  debasish.
> > 
> >
> 
> 



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