Re: floor function

From: Marc Escalier <escalier_at_lal.in2p3.fr>
Date: Tue, 22 Sep 2009 21:11:34 +0200


thank you very much Rene for the tip, and John for the general method

regards


On Tue, 22 Sep 2009, John Idarraga wrote:

> Hello Marc,
>
> Absolutetly. In a new file write something like this:
>
> #include <TMath.h>
>
> Float_t mytool1(Float val){
>
> val = TMath::Sqrt(val);
>
> return val;
> }
>
> say your file is called tools.C
>
> So you can call rot like this:
>
> $ root -l tools.C++g
>
> ( hint: you can use gdb here if you like :)) attaching to the root.exe
> process)
>
> And you are just ready to go, load your file with your TTree object
>
> [1] f1 = TFile("myfile.rot")
> [2] TTree * T = (TTree*) f1.Get("mytree");
>
> ready to use your new function
>
> [3] T.Draw("mytool1(something.myleaf)")
>
> I am assuming that 'myleaf' is a Float. This does magic ;)
>
> cheers,
>
> John
>
> On Tue, 22 Sep 2009, Marc Escalier wrote:
>
>> Hello,
>>
>> in root, we can have the integer par of a float number by doing
>> something like this
>>
>> (int) 3.14
>> ==> 3
>>
>> floor(3.14)
>> ==> 3
>>
>> but how to do the same within a Draw(), a Project() or a Scan() command ?
>>
>> i mean, let's assume
>>
>> mytree.Scan("myfloat_leaf")
>>
>> makes a scan values of the leaf within the tree
>> (actually, i don't know if the word leaf is the good word, anyway)
>>
>> then
>> mytree.Scan("floor(myfloat_leaf)")
>>
>> doesn't work
>>
>> nor
>>
>> mytree.Scan("(int)(myfloat_leaf)")
>>
>> in a more general way, is it possible to do something like
>>
>> mytree.Scan("complex_function(my_leaf)")
>>
>> thank you
>>
>>
>
Received on Tue Sep 22 2009 - 21:11:46 CEST

This archive was generated by hypermail 2.2.0 : Wed Sep 23 2009 - 05:50:05 CEST