Creating Event List with Weights


I am trying to create event list using TTree::Draw(">>myList", “selection”). The problem is that I have some events with negative weight and also, I want to scale entry by arbitary number. If I was just drawing, TTree::Draw(“value”, “weight*(cut)”) has always worked but creating event list doesn’t seem to work quite the same way. For instance,

num2=tree->Draw(">>list", "2*(cut)")

and then I would want every event to be scaled by 2 in the second one but these two are actually the same. Of course if all I want to do is just scale the whole thing by two I can just do num*2 but weights are different event by event and I really need this weighting feature which is available for TTree::Draw when used for drawing histograms…

Is it possible to do weighting when creating event list?

Currently we do not have a container with a TEventlist and a weight associated at each event. It is up to you to manage such an object and organize your event loop accordingly.


Hi Rene,

Thank you for you comment.

In that case, could you give me an advice on how the best I can do it? I have a TEventList and I have a tree variable called eventWeight. I don’t use event loop since TTree::Draw is very nice and simple and I’d rather not do event loop just for this…


One possibility is to create a new tree with one branch containing
the event weights.
TTree *T; //the original Tree
TTree *TW; //the new Tree with the weights (branch “w”)


Actually the feature you need is already implemented (I think). Do:

num=tree->Draw(">>list1","cut"); list1->SetReapplyCut(kTRUE); num2=tree->Draw(">>list2", "2");Cheers,