McCode icon indicating copy to clipboard operation
McCode copied to clipboard

MCPL file

Open Rohit-Raut opened this issue 1 year ago • 4 comments

Hi, I have been trying to learn MCPL file format and file conversion. The neutron data are in root , but could not find any way for the conversion to mcpl file format. I am looking for any documentation for cmd line for converter.

Thank you so much.

Rohit-Raut avatar Jul 12 '23 21:07 Rohit-Raut

Hello @Rohit-Raut,

For documentation on MCPL, the best place to look is in fact over at https://mctools.github.io/mcpl/ . Looking at https://mctools.github.io/mcpl/hooks/ however, I don't think we have a readily available solution for ROOT.

That being said there are python developments recently contributed (see https://github.com/mctools/mcpl/issues/70) that may allow you to do a small, dedicated conversion tool yourself?

Also @tkittel might have points of view when he is back from vacation and @ebknudsen may have a hack "up his sleeve".

willend avatar Jul 13 '23 07:07 willend

I don't think a general converter from "data in ROOT" is possible, since a ROOT file (like an HDF5 file, or a tar-ball) allows you to put anything inside, and we would have no way to automatically the particle data.

So yes, you need to write a custom converter. Since you are working in ROOT, I suggest you use the C/C++ API:

https://mctools.github.io/mcpl/usage_c/#creating-mcpl-files

ps. MCPL issues/questions would more naturally go to the MCPL issue tracker, since this question does not appear to have anything to do with McCode.

tkittel avatar Jul 13 '23 08:07 tkittel

Thank you so much, I wrote a converter for root2mcpl, worked for me.

Rohit-Raut avatar Jul 17 '23 17:07 Rohit-Raut

Great! If you wish, you can share it here - as inspiration for other people with a similar need in the future.

Cheers, Thomas

tkittel avatar Jul 17 '23 18:07 tkittel