Re: convert ntuple to histogram

From: <jhkim_at_physics.utexas.edu>
Date: Mon, 13 Sep 2010 21:57:06 -0500


Hi Suvayu,

How can I fit the 2d histogram after I convert into 2d histogram? Only x is independent variable and y is a dependent variable.

Best,

Jeehoon

Quoting suvayu ali <fatkasuvayu_at_gmail.com>:

> Hi jeehoon,
>
> You forgot to hit reply all. ;)
>
> On 13 September 2010 13:30, <jhkim_at_physics.utexas.edu> wrote:
>> Hi Suvayu,
>>
>> Thank you so much for help.
>>
>> I have two variables, x and y, in the ntuple plot (ntuple->Draw("x:y")).
>> How can I convert this 2d like plot into histogram?
>>
>
> If you refer to the html documentation page I pointed to earlier
> you'll see that you can specify binning of the histogram with the Draw
> command.
>
> So try something like this,
>
> ntuple->Draw("x:y>>htemp(100,0,1000,50,0,500)");
>
> This will create a 2D histogram with xrange from 0,1000 with 100 bins
> and yrange 0,500 with 50 bins.
>
> Read the html page I cited earlier, TTree::Draw() is a very versatile
> method. You can do many other cool tricks with it.
>
>> Best,
>>
>> jeehoon
>>
>
> GL
>
>>
>> Quoting suvayu ali <fatkasuvayu_at_gmail.com>:
>>
>>> On 13 September 2010 11:15,  <jhkim_at_physics.utexas.edu> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Is there any way to directly convert ntuple into histogram?
>>>>
>>>
>>> Can't you just use,
>>>
>>> myTNtuple->Draw("var1>>htemp");
>>> TH1F* histo =  (TH1F*)gPad->GetPrimitive("htemp");
>>>
>>> You can see http://root.cern.ch/root/html/TTree.html#TTree:Draw for
>>> more details.
>>>
>>>> Best,
>>>>
>>>> Jeehoon
>>>>
>>>
>>> --
>>> Suvayu
>>>
>>> Open source is the future. It sets us free.
>>>
>>
>>
>>
>>
>
>
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
>
>
Received on Tue Sep 14 2010 - 04:57:20 CEST

This archive was generated by hypermail 2.2.0 : Tue Sep 14 2010 - 05:50:02 CEST