Reading vector branch from .root file and converting it to numpy array on PyRoot

Hi @K.H.Kim ,
do you really need all elements of the vector for all events concatenated in a single one-dimensional numpy array? May I ask what your use case is (i.e. what you need to do with that numpy array)?

Given the vec1 dictionary as per your first snippet of code, you can get what you want this way:

numpy_v = np.concatenate([np.asarray(e) for e in vec1])

The np.asarray(e) converts the RVec with the vector elements of each event into a numpy array, with zero copy, i.e. quickly.
The np.concatenate takes all the numpy arrays with the vector elements of each event and concatenate them into one long numpy array. This will need to alllocate memory and depending on the dataset size it might take a few seconds.

Cheers,
Enrico