#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.
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.
B2ActionInitialization::~B2ActionInitialization() {}
This is the destructor for the B2ActionInitialization
class. It's also empty, suggesting no special cleanup is required.
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.
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:
B2PrimaryGeneratorAction
: Likely responsible for generating primary particles in the simulation.B2RunAction
: Handles run-related tasks.B2EventAction
: Manages event-related tasks.The SetUserAction method is used to register these user-defined actions with the Geant4 framework.