Home | News | Documentation | Download

Associate event to individual instances


#1

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


#2

Hi,

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?

Cheers,
D


#3

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


#4

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.

Cheers,
D


#5

Thank you very much for your reply


#6

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