SNEWS2 / sntools

Event generator for supernova burst neutrinos
BSD 3-Clause "New" or "Revised" License
11 stars 11 forks source link

Added "mcformat" option to allow for RATPAC output #13

Closed yschnellbach closed 3 years ago

yschnellbach commented 3 years ago

This output format is a HEPEVT-style record for the outgoing particles only and uses GeV, mm and ns as relevant units; currently only setup for e+/e-, gammas and neutrons as possible outgoing particles (HEPEVT requires masses)

JostMigenda commented 3 years ago

This looks good, thank you!

Is there a web page where this format is documented? I’m aware of this page on the original HEPEVT format, but there appear to be some differences. In particular, that page says the time comes after the production vertex, whereas you have it before the vertex in this PR – which might be a bit confusing …

If so, it would be good if we could add this to doc/documentation.tex. (If not, maybe just add a mention of this command line option and refer to the code for details of the format?)

yschnellbach commented 3 years ago

RATPAC (and the original RAT it was forked from) is using that slightly modified version as referenced in the RAT documentation.

That page also lists the units used and is the reason why I named the format "RATPAC" to ensure there's no confusion with the regular HEPEVT records.

EDIT: Reading the documentation for RAT in detail again also made me realise that it specifically refers to DT as time delta to the previous vertex, while my PR will write absolute times, this will require fixing (I didn't noticed in tests as I didn't use the time directly).

yschnellbach commented 3 years ago

Suggested changes look good, let me check whether RAT-PAC uses them as expected, I'll give you the all-clear if it does. I'll run the tests tomorrow (18th Nov) and comment then.

yschnellbach commented 3 years ago

Following tests + the rat manual, the dt printed in the output is the time delta to the previous line, not the previous event. As a result, the second particle was delayed by the full dt. This commit avoids this by only using the dt to the previous event for the first line of each event.

Hopefully, doing it via enumerate is a reasonably pythonic way compared to setting a boolean outside the loop.

JostMigenda commented 3 years ago

Looks good, thanks a lot for contributing this code!