TBranch::SetFile

Hi Everybody
how we can use TBranch::SetFile to set the file i want to fill the branch from it using any example
thanx

Hi,

What are you trying to accomplish? Usually using a Friend tree is a better choice.

Cheers,
Philippe.

Hi Philippe.
thanks for reply
i have to files one called masses.txt and the other properties.txt each had 3 columns
i am trying to plot 2 histograms on the same canvas the first between column 2 from properties.txt which represent Time at x-axis with the column 2 from masses.txt which represents the Hydrogen masses
the second histogram between column 2 from properties.txt which represent Time at x-axis with the column 3 from masses.txt which represents the Helium masses at y-axis
i had tried many times by building tree and filling these data in the branches but i failed so any help will be appreciated
thanx again

Hi,

Doesn’t:TTree *prop = new TTree("properties",""); prop->ReadFile("properties.txt","Something:TimeX:TimeY"); TTree *mass = new TTree("masses",""); mass->ReadFile("masses.txt","Something:mH:mHe"); prop->AddFriend(mass); prop->Draw("TimeX:mH"); prop->Draw("TimeX:mHe","","SAME"); do what you are looking for?

Cheers,
Philippe.

Hi Philippe
thank you very much for your work, great really.
i had tried your script but the graph still empty, so i searched for AddFriend and made sum modification and still the same problem
here is the try
try4.C (965 Bytes)

Attach both your data files.

My post (now corrected) had a fatal typo in the call to AddFriend. The intent was to pass the address of the TTree:prop->AddFriend(mass);(and not a string).

If this still does not work, please let us know ‘how’ it still fails for you.

Cheers,
Philippe.

Hi Philippe
Sorry for being late to reply , i had a problem in internet connection
I had tried your modification and still the same problem
here are the files
thank you very much
masses.txt (589 Bytes)
properties.txt (1.69 KB)

Hi,

I tried:[code]{
TTree *prop = new TTree(“properties”,"");
prop->ReadFile(“properties.txt”,“Something:TimeX:TimeY:weight”);
TTree *mass = new TTree(“masses”,"");
mass->ReadFile(“masses.txt”,“Something:mH:mHe”);
prop->AddFriend(mass);
prop->Draw(“TimeX:mH”,"",“box”);
prop->Draw(“TimeX:mHe”,"",“SAME box”);
}[code]and it seems to work for me …

Note that if you replace Draw with Scan, you will see a printout of the data.

Note that the dynamic range of your TimeX is extreme … for only 34 values it range (apparently evenly distributed in log) from 10e-21 to 10e+17! This and the low count of entries, might explain why you can not see the dot in the picture (without adding box as an option).

Cheers,
Philippe.