Normalizing a branch

Hi Rooters,
I am trying to make a new root file with a tree from and old root file. Is it possible that while making this new tree I can normalize the old branches in the old tree by cross section and then dump it to the new tree in the new root file. I hope I was able to put my question properly

When you copy an “old” tree into a “new” one, you do it on an event by event basis. So, you read one event from the “old” tree, then you are free to modify the values of it’s “leaves”, and then you write it to the “new” one (so that the modified values are saved in the “new” tree).

Hi,

[quote=“sircar”]Hi Rooters,
I am trying to make a new root file with a tree from and old root file. Is it possible that while making this new tree I can normalize the old branches in the old tree by cross section and then dump it to the new tree in the new root file. I hope I was able to put my question properly[/quote]

Let me see if I understand your question. In your tree, for example, you have the pT of your lepton. What you want is to for

to plot the lepton Pt, but you want the integral of this plot to represent the number of expected events you would get for a given integrated luminosity (say 40/pb) right?

In cases like this, what you need to do is calculate a weight for each event and add a branch called weight (where the weight is the integrated luminosity you are trying to match multipled by the cross section of the sample).

If you have successfully added this weight, you can then

which will have the effect I believe you are looking for.

Cheers,
Charles

Hi Charles,
I guess you are more or less close to what I want to achieve. My main aim is that I have a root file in that I have a tree . From that root file I want to fill my desired branches tau by tau instead of event by event basis. Now I want to dump the branches after normalizing them by some weight , where Weight = cross section / number of events.

My question is should I do the thing which you told me ,to add a branch called weight but how to include it to the existing branch. i am posting my code for your reference. Thank you

Anirvan
flatnner_tau.C (8.97 KB)

Hi Anirvan,

[quote=“sircar”]I guess you are more or less close to what I want to achieve. My main aim is that I have a root file in that I have a tree . From that root file I want to fill my desired branches tau by tau instead of event by event basis. Now I want to dump the branches after normalizing them by some weight , where Weight = cross section / number of events.

My question is should I do the thing which you told me ,to add a branch called weight but how to include it to the existing branch.[/quote]

It sounds like you are confusing event weights and ‘tau’ weights. The event weight applies to the whole event, so it should be simply added as a new branch.

If you are plotting tau Pt, for example, you still just use the event weight each time you make the plot even though you may have two taus in one event.

Hope this helps,
Charles