| Message: G4GPSasPrimaryGeneratorAction? | Not Logged In (login) |
|
Hi there, Could it be possible to add a "generic PrimaryGeneratorAction" for the GPS in order not to have to create a PrimaryGeneratorAction.hh file and a PrimaryGeneratorAction.cc file each time one wants to create a simulation with only the GPS as a primary generator action. The only thing to do would then be to call it in the main.cc: > #include "G4GPSasPrimaryGeneratorAction.hh" > // ... > runManager->SetUserInitialization ( new (G4GPSasPrimaryGeneratorAction()) ) ; Cheers, Mathieu PS: The implementation (somewhere in G4) should look like this... ******************************************************************************** * "G4GPSasPrimaryGeneratorAction.hh" ******************************************************************************** #ifndef G4GPSasPrimaryGeneratorAction_hh #define G4GPSasPrimaryGeneratorAction_hh #include "G4VUserPrimaryGeneratorAction.hh" #include "G4GeneralParticleSource.hh" #include "G4Event.hh" class G4GPSasPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction { private : G4GeneralParticleSource* fGeneralParticleSource ; public : G4GPSasPrimaryGeneratorAction () ; ~G4GPSasPrimaryGeneratorAction () ; void GeneratePrimaries (G4Event* anEvent) ; } ; #endif ******************************************************************************** * "G4GPSasPrimaryGeneratorAction.cc" ******************************************************************************** #include "G4GPSasPrimaryGeneratorAction.hh" G4GPSasPrimaryGeneratorAction::G4GPSasPrimaryGeneratorAction () { fGeneralParticleSource = new G4GeneralParticleSource () ; } G4GPSasPrimaryGeneratorAction::~G4GPSasPrimaryGeneratorAction () { delete fGeneralParticleSource ; fGeneralParticleSource = NULL ; } void G4GPSasPrimaryGeneratorAction::GeneratePrimaries (G4Event* anEvent) { fGeneralParticleSource->GeneratePrimaryVertex (anEvent) ; return ; } |
|
to: |