Draw problem

Dear all.
i have maybe a problem I guess simple…
I have my tree with branches, something like this:
channelid, field1, field2 and field3

so if I want to plot the field2 of channel 3 I draw field2 with a cut on channelid

myttree.Draw(“field2”,“channelid==3”)

but if I would like to plot the ratio (event by event) between field2 of channel 3 and field2 of channel4… How to do it with the draw? Or is there some other simple way?
Thanks!!

Hi,

Are field1 and channelid ‘arrays’? In which case you can do:mytree.Draw("Sum$(field2*(channelid==3))/Sum$(field3*(channelid==4))")if they are not arrays … then the value for channel 3 and channel 4 are in different TTree entries and this plot can not be done with TTree::Draw

Cheers,
Philippe.

Hi, field1 and channelid are just branch of mytree…

[quote]Hi, field1 and channelid are just branch of mytree…[/quote]yes but of what type? (Seeing the result of mytree->Print(); would in most case tell me this information).

Cheers,
Philippe.

*Br 0 :field1 : Unixtime/I *
*Entries : 4928 : Total Size= 20272 bytes File Size = 2024 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 9.78 *

*Br 1 :Channelid : Channel/I *
*Entries : 4928 : Total Size= 20267 bytes File Size = 279 *
*Baskets : 1 : Basket Size= 32000 bytes Compression= 70.91 *

Hi,

So they are definitively single value. The choice made when creating the file to store the content of a single event across multiple TTree entries makes it impossible for TTree::Draw to accomplish the task you need.[quote](event by event)[/quote]is ‘hard’ since you now first need to find the 2 entries in the TTree that you want to compare.

In order to accomplish this, you will need to use the MakeClass or MakeSelector (or MakeProxy) technique of data analysis (see the references guide for TTree::Make or TTree::MakeSelector (or TTree::MakeProxy) for details) in order to implement your test.

Cheers,
Philippe.

ok thanks a lot!