79 G4double worldZHalfLength = 0.;
80 auto worldLV = G4LogicalVolumeStore::GetInstance()->GetVolume(
"World");
83 G4Box* worldBox =
nullptr;
85 worldBox =
dynamic_cast<G4Box*
>(worldLV->GetSolid());
89 worldZHalfLength = worldBox->GetZHalfLength();
92 G4ExceptionDescription msg;
93 msg <<
"World volume of box shape not found." << G4endl;
94 msg <<
"Perhaps you have changed geometry." << G4endl;
95 msg <<
"The gun will be place in the center.";
96 G4Exception(
"PrimaryGeneratorAction::GeneratePrimaries()",
97 "MyCode0002", JustWarning, msg);
102 ->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));