#include "ActionInitialization.h"
#include "PrimaryGeneratorAction.h"
#include <time.h>

#include "Randomize.hh"

extern G4String particleType;
class G4GeneralParticleSource;
class G4ParticleGun;

ActionInitialization::ActionInitialization() {
    G4long seed = time(NULL);
    CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine());
    CLHEP::HepRandom::setTheSeed(seed);
}

ActionInitialization::~ActionInitialization() {}

void ActionInitialization::BuildForMaster() const {}

void ActionInitialization::Build() const {
    if (particleType == "TE")
        SetUserAction(new PrimaryGeneratorAction<G4GeneralParticleSource>);
    else
        SetUserAction(new PrimaryGeneratorAction<G4ParticleGun>);
}
