Home | News | Documentation | Download

Associate event to individual instances


Dear ROOT experts,

I have a root file with 1000 events and each event contains instances/particles (of total 3097) characterized by (momentum, energy, charge, …). I use these properties to predict individual particles using saved classifier (Scikit-learn python package) and the classifier outputs 3097 numbers of probabilitites. The problem is that I want to output a root file that contains the classification output with 1000 events not 3097. Is there any way to associate individual particles in each event to event number.

Thank you in advance



do you mean something collecting the classification outputs (3097 of them) in a container (with on average ~3.097 elements), and store it event by event?



yes exactly, but in correspondence with the original input file. That is if input file is for example:
event 1: contains 2 particles.
event 2: contains 3 particles.

so also the output file

thank yo very much


I think the solution to the problem has two aspects, one which is easily provided by ROOT, and one which is entirely on you to solve.

The infrastructure to take your dataset and enrich it with a new column (the one with the container) is TDataFrame and in particular its Snapshot method (here an example).

The preparation of the containers and the association to the events in the tree is on you I think.



Thank you very much for your reply


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