# Error in Pythia8 To hepmc To ROOT

**URL:** <https://root-forum.cern.ch/t/error-in-pythia8-to-hepmc-to-root/51264>\
**Category:** Newbie\
**Tags:** tree, python, root\
**Created:** [August 21, 2022, 8:29am UTC](https://root-forum.cern.ch/t/error-in-pythia8-to-hepmc-to-root/51264 "2022-08-21T08:29:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raseeb\_Haroon](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/raseeb_haroon/32/30638_2.png) [@Raseeb\_Haroon](https://root-forum.cern.ch/u/Raseeb_Haroon)\
**Post date:** [August 21, 2022, 8:29am UTC](https://root-forum.cern.ch/t/error-in-pythia8-to-hepmc-to-root/51264/1 "2022-08-21T08:29:03Z")

</div>

I have been trying to plot data from a .hepmc file using ROOT by following a guide, and after the last step, this is what I’m getting. I’m not sure what to do. I’m new to this and any help would be appreciated.

```auto
(pythia8withhepmc2) raseeb@raseeb:~/hepmc2root/bin$ python hepmc2root.py madgraph2/ttbar_test/Events/run_03/tag_1_pythia8_events.hepmc.gz
** hepmc2root.py: can't open file madgraph2/ttbar_test/Events/run_03/tag_1_pythia8_events.hepmc.gz
Exception AttributeError: "hepmc2root instance has no attribute 'tree'" in <bound method hepmc2root. __del__ of < __main__.hepmc2root instance at 0x7f3350156780>> ignored

```

_ROOT Version:_ ROOT 6.26/06  
_Platform:_ Ubuntu 20.04  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [August 22, 2022, 12:52pm UTC](https://root-forum.cern.ch/t/error-in-pythia8-to-hepmc-to-root/51264/2 "2022-08-22T12:52:17Z")

</div>

I guess it cannot open the file you specified? But we don’t maintain `hepmc2root` - maybe you could ask the maintainers?

---

<div class="post-metadata">

**Author:** ![Danny1](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@Danny1](https://root-forum.cern.ch/u/Danny1)\
**Post date:** [September 11, 2022, 11:41am UTC](https://root-forum.cern.ch/t/error-in-pythia8-to-hepmc-to-root/51264/3 "2022-09-11T11:41:53Z")

</div>

Hi Raseeb Firdous Haroon,  
Try following this:

> **[GitHub - hbprosper/hepmc2root: Python program to convert a text file of...](https://github.com/hbprosper/hepmc2root)**
>
> Python program to convert a text file of events in HepMC2 format to a simple ROOT file. - GitHub - hbprosper/hepmc2root: Python program to convert a text file of events in HepMC2 format to a simple...

Cheers,  
Dharmender
