Tips for scoring & analysis

Hello Geant4 friends!
I was wondering if there are easier ways of scoring and analyzing data in Geant4?

For example, in MCNP code one can use Tallies to score everything it wants. Is anything of this kind in Geant4 too?

Geant4 has mainly 2 systems of scoring.
1- via UserAction classes, a user has the hand during the tracking of each particle. He can then registered what he want, in the format he want. In other words : complete freedom …
2- SensitiveDetector, Hits Collections, Scorers, Mesh commands are more close to what MCNP does.

Analysis classes are to define, fill and draw histograms and ntuples.

These various approaches are illustrated in examples/basic/B4 and, indeed, in all examples …

1 Like

Ty so much for this clear respond.

Btw, by User Action classes you mean Event Action, Step Action and things like these?

And in SD, can I create source macros?

1 - yes
2- I do not understand what you mean

With sensitive detector am I able to create score macro? I saw in the book and it will be easier for me to have a macro because it feels like mcnp.

A sensitive detector (SD) is a C++ class you write, and you attach it to the volume where you want to record information. You can certainly also write a Messenger class to define your own macro commands configure your SD, but it’s fundamentally compiled C++ code.

Geant4 does provide macro-based scorers if that’s what you prefer, but then you are llimited to recording the quantities that have already been pre-programmed into the scorer code (C++).

1 Like