Subtraction of Tree leaf from another Tree leaf

Dear ROOTers,

I have made two Trees, one for data and another for background. Now I want to subtract a leaf of background tree from a leaf of data tree. By filling histograms I can do this but then result is histogram(attachment) and cannot open by StartViewer(), I want to store result as new tree leaf because I want to use CUTG. can I directly subtract one tree leaf from another tree leaf?

Thanks,
sub.C (1.01 KB)

Could you explain what you mean by subtracting two branches of a tree?
Do they have the same number of entries?

Rene

I have two leaves TOF1 and ZCO1 in Tree “t1” of Cf_source.root and two leaves bTOF1 and bZCO1 in Tree “t2” of Cf_background.root, now I want to subtract bTOF1 from TOF1 and bZCO1 from ZCO1. after subtraction, can I store resultant TOF1 and ZCO1 as leaves of a new tree ( not as histograms)? entries are not same in leaves.

Hi,

In order to fill a new tree you would need to loop over the entries. So you would need to do something like $ROOTSYS/tutorials/tree/copytree3.C with 2 input trees instead of one.

Cheers,
Philippe.