DataMedSci / pymchelper

Python toolkit for SHIELD-HIT12A and FLUKA
http://datamedsci.github.io/pymchelper/
15 stars 7 forks source link

support for new detector in SHIELD-HIT12A : MCPL #628

Closed nbassler closed 1 year ago

nbassler commented 1 year ago

pymchelper could collect bdo files from multiple runs and concat and convert to MCPL format. https://mctools.github.io/mcpl/usage_c/

SH12A development version so far does this:

#define SH_SDET_MCPL           63   /* MC particle list, aka. phase space list */

postprocess is for now set to SH_POSTPROC_NONE but I realize this is not enough, as pymchelper would have to figure out that these are sequential data which should be concatenated from multiple runs. Would be cleaner to mark this on SH side? maybe defining SH_POSTPROC_CONCAT could do this

grzanka commented 1 year ago

I believe new postprocessing (or normalisation) flag should be added. What is the design of the flat array ?

grzanka commented 1 year ago

This one may be helpful: https://github.com/mctools/mcpl/issues/70

nbassler commented 1 year ago

flat array is currently as you mention in the first bullet point: PDG_1,x_1,y_1,z_1,vx_1,vy_1,vz_1, e_kin_1, PDG_2,x_2,y_2,z_2,vx_2,vy_2,vz_2, e_kin_2, ... where v is a normalized vector. I know you prefer the other way, but the first way is nicer during simulation time for memory re-allocation if the number of particles to be scored is unknown at simulation time.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This issue discusses the integration of pymchelper to collect, concatenate, and convert bdo files from multiple runs to the MCPL format. The current SH12A development version has defined data structures for particle data, however, the post-processing is set to SH_POSTPROC_NONE. The user suggests that implementing a new post-processing option, such as SH_POSTPROC_CONCAT, could help pymchelper handle the sequential data more effectively. This would allow for cleaner management of data points and bytes, making it easier for pymchelper to process the data from multiple runs.

grzanka commented 1 year ago

The plan:

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This issue discusses the possibility of allowing pymchelper to collect bdo files from multiple runs, concatenate them, and convert to the MCPL format. The current SH12A development version partially supports this feature by defining SH_SDET_MCPL and storing data in the .bdo file in a page data array. However, the user suggests that it would be cleaner to mark sequential data that should be concatenated from multiple runs on the SH side, perhaps by defining SH_POSTPROC_CONCAT.

nbassler commented 1 year ago

regarding BDO files for testing, you can use test/55_plane_phsp on branch 51-phsp-export in SH12A repo. Should work, and files are small.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This issue suggests adding functionality to pymchelper to collect bdo files from multiple runs, concatenate them, and convert them to the MCPL format. The current SH12A development version stores data in a .bdo file in a data array and saves 8 data elements per particle. It is proposed to improve the postprocess handling by introducing SH_POSTPROC_CONCAT on the SH side to help pymchelper recognize that the data should be concatenated.

grzanka commented 1 year ago

regarding BDO files for testing, you can use test/55_plane_phsp on branch 51-phsp-export in SH12A repo. Should work, and files are small.

I've already did that: https://github.com/DataMedSci/pymchelper/pull/648/files#diff-a1e24cfb400a4ff1713372e6269768b58eb852431829fc86031a667e5cf3f55c

Now I am thinking how to adjust "Estimator" pymchelper data structure to accommodate the necessary info

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This issue is about enhancing pymchelper to collect bdo files from multiple runs, concatenate them, and convert them to MCPL format. The SH12A development version currently stores particle data in a .bdo file, with each particle saving 8 data elements in a flat array. The postprocess is set to SH_POSTPROC_NONE, which may need to be changed to properly handle the sequential data from multiple runs. A potential solution could be defining and using SH_POSTPROC_CONCAT on the SH side to facilitate the concatenation process.