Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Read in pre generated hepmc? #22

Closed
BFord94 opened this issue Sep 16, 2019 · 17 comments
Closed

Read in pre generated hepmc? #22

BFord94 opened this issue Sep 16, 2019 · 17 comments

Comments

@BFord94
Copy link

BFord94 commented Sep 16, 2019

Hi,
Just wondering if it is possible to read in a pre generated hepmc file (in my case from madgraph5+pythia8)? I try the hepmc_read() function and get an error

ERROR::ReaderAscii: too few or too many particles were parsed
ERROR::ReaderAscii: too few or too many vertices were parsed
ERROR::ReaderAscii: event parsing failed. Returning empty event
DEBUG(1)::Parsing failed at line:
E 0 -1 -1.0000000000000000e+00 -1.0000000000000000e+00 -1.0000000000000000e+00 0 0 180 1 2 0 1 2.3174000000000004e-02

Best regards,
Billy Ford

@eduardo-rodrigues
Copy link
Member

Hi @ndawe, can you try and help, please?

@eduardo-rodrigues
Copy link
Member

Thank you for the interest and the email.

I’m no expert – others may be able to help more - but that function should indeed do the job, see https://github.com/scikit-hep/numpythia/blob/master/numpythia/__init__.py.
What version of HepMC are you using in your workflow? Could that be the issue since numpythia expects 3.0.0? Note that you can use hepmc_write to write some events out and compare with the format of your pre-generated file ...

@BFord94
Copy link
Author

BFord94 commented Sep 30, 2019

Thanks all, apologies for the delay. I can now verify the issue was that I was using files generated in the HepMC2 format, using HepMC3 fixed the issue.

Note that there is a conversion script included in the HepMC3 package that you can use to convert between the two, in case like me you use software which is configured only with HepMC2 (MadGraph5 in this case).

Thanks again, Billy.

@BFord94 BFord94 closed this as completed Sep 30, 2019
@BFord94
Copy link
Author

BFord94 commented Oct 1, 2019

Sorry to reopen. Now running with a converted HepMC3 file, I can only partially read in my file. I have 10k events, however only 12 seem to be read in before failing, with the error:

ERROR::ReaderAscii: too few or too many particles were parsed
ERROR::ReaderAscii: too few or too many vertices were parsed
ERROR::ReaderAscii: event parsing failed. Returning empty event
DEBUG(1)::Parsing failed at line:
V -100 0 [172,218].

Cheers,
Billy

@BFord94 BFord94 reopened this Oct 1, 2019
@eduardo-rodrigues
Copy link
Member

Hi, sorry to hear that. At this point I think you should try with a smaller file and attach it here, for testing. Have you by change tried to read it with the C++ code to make sure the file is actually fine. It seems odd to have such an error.

@BFord94
Copy link
Author

BFord94 commented Oct 1, 2019

The issue looks like it's in the ReaderAscii module within HepMC3, so maybe it is the file? Although the conversion example script has no issue parsing events so I am stumped.

I had a flick through the source code in HepMC3 and there is mention of a bug "HepMC2 files produced with Pythia8 are known to have wrong information about number of particles in vertex", but as said no such issue arises when reading the original HepMC2 file.

I've cut down the file to 50 events, however can't seem to attach?

@eduardo-rodrigues
Copy link
Member

Oops, you're right, you cannot attach. Anything that is too big to be pasted here would need to be given a link to an external page, at least temporarily.

In the end the python code calls the C++ so I would be tempted to say that you won't manage to read the file with the C++ either, in which case the issue is either the file or the C++ code. Maybe worth filing an issue on the HepMC repository so that an expert takes a look?

@BFord94
Copy link
Author

BFord94 commented Oct 1, 2019

No worries, as I suspect it is indeed a deeper issue with the C++ code. Unfortunately I cannot as HepMC is hosted on GitLab and so adding an issue requires a CERN account, however I may be able to come up with a work around for this. I'll update if I do manage to get in touch with them and find a solution.

@eduardo-rodrigues
Copy link
Member

Ah, right. Thanks for the follow-up. Hopefully you will be able to get in touch via email.
Good luck.

@kratsg
Copy link
Collaborator

kratsg commented Oct 2, 2019

That's ok, we can ask @agbuckley to help.

@eduardo-rodrigues
Copy link
Member

Good point, @kratsg.

@BFord94
Copy link
Author

BFord94 commented Oct 2, 2019

Thanks guys! A collaborator of mine has a CERN so could ask on my behalf, shall I hold fire in hope Andy will chime in?

@eduardo-rodrigues
Copy link
Member

I would do both things in parallel. Changes of success are likely to double ;-).

@agbuckley
Copy link

Hi all, sorry for the delay... snowed under as usual. I'm not sure when I'll get a chance to look at this, but if you contact the HepMC developer mailing list, then someone should get back to you: most likely Andrii Verbyitskyi, who's doing a lot of HepMC3 work at the moment.

@eduardo-rodrigues
Copy link
Member

@BFord94, did you ever chase the issue and managed to sort the problem out? Anything to get back to us on? Else I would be tempted to close this at this point.

@eduardo-rodrigues
Copy link
Member

Hi everyone, this issue went idle for a while. I suspect it can be closed at this point but feel free to reopen if necessary,

@heatherrussell
Copy link

heatherrussell commented Jul 7, 2021

Hi, I'm having this problem too, reading in a pre-generated hepmc file - I think it's related to numpythia using hepmc3.0.0 as opposed to a more recent verison, e.g. 3.2.3.

ERROR::ReaderAscii: too few or too many particles were parsed
ERROR::ReaderAscii: too few or too many vertices were parsed
ERROR::ReaderAscii: event parsing failed. Returning empty event
DEBUG(1)::Parsing failed at line:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants