Tree::Draw and multiple loops with two arrays

Hi

I have a branch with an object Spectrometer, which has two object of type Detector. The Detector has 2 arrays *fX and fY with fNhits elements. I need to plot a TH2F histogram where for each X[i] all the Y[j] (j=0;j<fNhit) are plotted. I have looked at the TTree::Draw documentation and the forum but could not find anything that seems quick and easy to use. The closest solution I found seems to be using MakeProxy, but we don’t want (if possible) to have separate files with scripts spread around.

Thanks.

Luiz

This is documented with several examples in the Users Guide.
do, eg
T.Draw(“det1.fY:det1.fX”)

Rene

Thas is not exactly what I want. This will plot the pairs:
y[0]:x[0]
y[1]:x[1]
y[2]:x[2]
y[3]:x[3]

but what I need is:

y[0]:x[0]
y[0]:x[1]
y[0]:x[2]

y[1]:x[0]
y[1]:x[1]

Unless I completely misunderstood the manual.

Thanks

Luiz

Hi Luiz,

Indeed TTree::Draw does not have syntax (expect if using a separate scrip) to implement what you need directly.

The closest should be the following (inefficient) trick:

for (int i=0;i<max_x_size,++i) { tree->Draw(Form("X[%d]:Y>>+myhist",i)); }

Cheers,
Philippe.