# Using uproot to read large root file and access PixelCharge/MCParticle

**URL:** <https://allpix-squared-forum.web.cern.ch/t/using-uproot-to-read-large-root-file-and-access-pixelcharge-mcparticle/716>\
**Category:** Issues\
**Created:** [March 24, 2025, 4:54pm UTC](https://allpix-squared-forum.web.cern.ch/t/using-uproot-to-read-large-root-file-and-access-pixelcharge-mcparticle/716 "2025-03-24T16:54:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Linus](https://allpix-squared-forum.web.cern.ch/letter_avatar_proxy/v4/letter/l/f4b2a3/32.png) [@Linus](https://allpix-squared-forum.web.cern.ch/u/Linus)\
**Post date:** [March 24, 2025, 4:54pm UTC](https://allpix-squared-forum.web.cern.ch/t/using-uproot-to-read-large-root-file-and-access-pixelcharge-mcparticle/716/1 "2025-03-24T16:54:41Z")

</div>

Hi,  
I have been trying to read PixelCharge, MCParticle data from a **root** file into **python**.  
I am analysing a large number of events, on the order of a million, at a setup of 6 Timepix detectors.  
The method provided as an example in the allpix-squared docu has worked so far, but it is relatively slow.  
I am trying to use **uproot** , but am stuck trying to load or implement the required library  
libAllpixObjects.so.  
Is there a way to get to the data with uproot ?  
If thats not possible, which methods would you recommend to access large datasets with python ?

Something similar has already been tried a few years ago 2020:

> [@Problems with TStreamer of MCParticle attributes ROOT::Math::XYZPoint](https://allpix-squared-forum.web.cern.ch/t/problems-with-tstreamer-of-mcparticle-attributes-root-xyzpoint/105):
>
> Hi everyone, I am quite enthusiastic about the features provided by your software! I like the RootObjectWriter for output due to the nice compression and file design, but I am not a ROOT person at all, more of a python type. I would prefer using the [uproot package](https://github.com/scikit-hep/uproot) to read the data but it constructs itself surprisingly difficult. Maybe I am just a bit stupid, but I just cannot get it done properly… I would be very happy about some help/ enlightenment… so don’t judge me too hard, if my question d…

Thanks !

---

<div class="post-metadata">

**Author:** ![simonspa](https://allpix-squared-forum.web.cern.ch/user_avatar/allpix-squared-forum.web.cern.ch/simonspa/32/597_2.png) [@simonspa](https://allpix-squared-forum.web.cern.ch/u/simonspa)\
**Post date:** [March 27, 2025, 9:44pm UTC](https://allpix-squared-forum.web.cern.ch/t/using-uproot-to-read-large-root-file-and-access-pixelcharge-mcparticle/716/2 "2025-03-27T21:44:27Z")

</div>

Dear @Linus

unfortunately I have never used uproot myself (yet!) but from what I gather from its documentation, the entire point of it is trying to make loading pre-compiled libraries unnecessary.

Have you tried following a tutorial such as [https://indico.cern.ch/event/1168602/contributions/4907387/attachments/2456778/4210978/Uproot.pdf](https://indico.cern.ch/event/1168602/contributions/4907387/attachments/2456778/4210978/Uproot.pdf) and to directly access the event tree and its objects without loading the library?

If you figure out a way to do this, we would be very gladly accepting an example for the repository such that other users can refer to it!

All the best,  
Simon
