Dear all,
As my title, I want to read an IAEA Phasespace file as a source. I tried to read the file as an example code but it did not work. Please help me.
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4Event;
class G4IAEAphspReader;
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction();
void GeneratePrimaries(G4Event*);
private:
// Phase space reader
G4IAEAphspReader* theIAEAReader;
};
#endif
#include "PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4IAEAphspReader.hh"
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
G4String fileName = "PSF";
theIAEAReader = new G4IAEAphspReader(fileName);
}
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
if (theIAEAReader) delete theIAEAReader;
}
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
theIAEAReader->GeneratePrimaryVertex(anEvent);
}