Message: G4GPSasPrimaryGeneratorAction? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea G4GPSasPrimaryGeneratorAction? 

Forum: Event and Track Management
Date: 29 Sep, 2009
From: Mathieu Trocmé <Mathieu Trocmé>

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 ;
}

 Add Message Add Message
to: "G4GPSasPrimaryGeneratorAction?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]