What is nbinsx , xbins?

Hi experts.
I was looking at the description of TH2F. And nbinsx and xbins came out, but i don’t know about this. What’s mean?

TH2F::TH2F ( const char * name,
const char * title,
Int_t nbinsx,
const Double_t * xbins,
Int_t nbinsy,
const Double_t * ybins
)

Also i wanna draw scatter plot. So how can i set the range?

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

How do you draw the scatter plot ? from a TTree ?
If that’s the case you can do:

``````your_tree->Draw("y:x")
``````

In that case the range will be calculate automatically.
One way to fix the range will be:

``````auto h2 = new TH2F("h2","h2",........)
your_tree->Draw("y:x >> h2")
``````

My data comes from a ntp.

What is auto used for? And What is the role of ‘>>’?

I’m the beginner of root. So It’s little hard to understand. nbins is number if bins in x axis? And i can’t understand what is xbins.

• `auto` is C++ used to declare a variable automatically. here a TH2F
• `>>` tells `Draw` to fill the histogram `h2`
``````TH2D::TH2D	(	const char * 	name, // Histogram name
const char * 	title, // Histogram title
Int_t 	nbinsx, // number of bins along X
const Double_t * 	xbins, // A Vector describing the bins along X - dimension is nbinsx+1
Int_t 	nbinsy, // number of bins along Y
const Double_t * 	ybins, // A Vector describing the bins along Y- dimension is nbinsy+1
)
``````

Thanks for reply! It really helps me.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.