mctools / simplebuild-dgcode

dgcode: the Geant4-based simulation framework of the ESS Detector Group. Provided as simple-build-system bundles.
https://mctools.github.io/simplebuild-dgcode/
Other
2 stars 1 forks source link

Make convenient utilities based on exprparser #28

Open tkittel opened 6 months ago

tkittel commented 6 months ago

use g4exprparser to add convenient --print and --plot options, for instance:

sb_xxx_sim --print="step.pre.ekin/meV:step,trk.is_primary where trk.is_neutron and step.volname=='Sample'"

To get on-the-fly lines printed from the simulation for neutrons stepping through volumes named Sample of two variables: kinetic energy in meV and a number indication that the particle is primary (1) or secondary (0).

We could also extract .shist files in this manner!

tkittel commented 6 months ago

more thoughts:

A similar plotting capability could be made for inspecting contents of mcpl files (here we might decide based on nparticles to simply run through the file twice for optimal hist ranges).

or 2d hists of two quantities of course..

We could of course also have a --plot option which would instead create a 1d histogram of specified quantity (maybe it would delay booking until after the first 100000 entries to get automatic histogram ranges).

It would mean on-the-fly debugging workflow similar to the workflow one experienced when sitting at a PAW prompt and selecting variables in an ntuple