Header Inclusion

#include "B2ActionInitialization.hh" #include "B2PrimaryGeneratorAction.hh" #include "B2RunAction.hh" #include "B2EventAction.hh"

These lines include necessary header files for the classes used in this file.

Class Definition

B2ActionInitialization::B2ActionInitialization() : G4VUserActionInitialization() {}

This is the constructor for the B2ActionInitialization class, which inherits from G4VUserActionInitialization. It's empty, indicating that no specific initialization is needed.

Destructor

B2ActionInitialization::~B2ActionInitialization() {}

This is the destructor for the B2ActionInitialization class. It's also empty, suggesting no special cleanup is required.

Build for Master () Method

void B2ActionInitialization::BuildForMaster() const { SetUserAction(new B2RunAction); }

This method is called only in multi-threaded mode for the master thread. It sets up the B2RunAction for the master thread.

Build() Method

void B2ActionInitialization::Build() const { SetUserAction(new B2PrimaryGeneratorAction); SetUserAction(new B2RunAction); SetUserAction(new B2EventAction); }

This method is called for both master and worker threads in multi-threaded mode, and for the single thread in sequential mode. It sets up three user actions:

The SetUserAction method is used to register these user-defined actions with the Geant4 framework.