Filling the Tree's entry with weight (not using histo)


ROOT Version: 6.14.06
Platform: Ubuntu16.04
Compiler: gcc630


Hi, I have questions about filling the tree.

As you can see in the picture below, I have a histogram with # of entries 4192.

I want the exact same Mean, Shape, Std, but want the number of entries to be increased by a factor of 2.

I know it is easy to use histogram’s Fill(data,weight), but I should know how I may do it in filling the tree level.

tree->FIll(2) results in error, and tree->SetWeight(2) has not changed anything in the number of entries. I appreciate your help.

Thank you!

So I guess tree is a TH1F/D ?
Something like that should divide the number of entries by 2:

tree->Fill(val, 0.5);

val being the values you are histogramming .

When I fill the tree, I use tree->Fill() no argument…

I am not sure how to add weight in such case…

You need a weight branch that you set to the appropriate weight. The TBrowser histogram of a branch will always be unweighted.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.