Re: TH2 scater plot

From: Tadeusz Pytlos (pytlos@fizwe5.fic.uni.lodz.pl)
Date: Thu Oct 08 1998 - 16:54:32 MEST


On Thu, 8 Oct 1998, Rene Brun wrote:

> Tadeusz Pytlos wrote:
> > 
> > Dear Rooters,
> > I seems to be silly, but I cannot understand how the points
> > are drawing by TH2F. I've a lot of integer numbers (points)
> > to draw, so TH2 seems to be the only way.
> > In TH1F it works well
> > 
> > root [0] TH1F *h1=new TH1F("h1","h1",5,-0.5,4.5)
> > root [1] h1.Fill(0)
> > root [2] h1.SetMarkerStyle(8)
> > root [3] h1.Draw()
> > Warning in <MakeDefCanvas>: creating a default canvas with name c1
> > root [4] h1.Draw("P")
> > root [6] c1.SetGrid()
> > root [7] h1.Draw("P")
> > 
> > but in TH2F
> > root [0] TH2F *h2=new TH2F("h2","h2",5,-0.5,4.5,5,-0.5,4.5)
> > root [1] h2.SetMarkerStyle(8)
> > root [2] h2.Fill(0,2)
> > root [3] h2.Draw()
> > Warning in <MakeDefCanvas>: creating a default canvas with name c1
> > root [4] h2.Fill(2,2)
> > root [5] h2.Draw()
> > root [6] c1.SetGrid()
> > root [7] h2.Draw()
> > 
> > I cannot find any possibility to receive the right position
> > of points. TH2S cannot help as well (is any reason for its
> > existance?).
> > Thanks for your time,
> >                   Tadeusz
> > 
> 
> Tadeusz,
> You use the wrong class to solve your problem.
> I understand that you want simply to draw polymarkers.
> Use TPolyMarker class.
> You can use a TH2F dummy object to draw the frame, tehn
> draw the TPolyMarker object inside this frame.
> 
> The TH2S creates a 2-d histogram with an array of shorts
> instead of floats in TH2F. For many problems, TH2S is sufficient
> if your cell contents are integers and integers fitting in 16 bits.
> TH2C is the same for integers less than 256.
> TH2C saves a factor 2 in memory and TH2C a factor 4 compared to TH2F.
> 
> Rene Brun
> 
Rene,
Thank you for your remarks. Maybe this thing is not worth
to discuss, but in fact my problem is aesthetic nature. 
I calculated many TH2S("h2","h2",m,0,m)
histos of integer and write them to file. 
Next I displayed them and saw that the positions pairs of integers
are not integer!. I calculated TH2S("h2","h2",m+1,0,m) - the same. 
I thought that taking TH2F with right ranges
could solve the problem, but it failed. 
Of course main reasons for these histos are next calculation,
so I don't want to lost advantages of TH2.
I didn't use TPolyMarker yet and I'm a little afraid whether
it has the similar functionality.
Is any reason that (my above examples) it's possible
to draw point in TH1F as integer in the middle of class,
but it's impossible to draw pairs of integer in TH2F in the same way?
I'm not quite sure, but the same problem had been in PAW as well.
Best wishes,
            Tadeusz 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET