def __init__(self): theta_min = 00.0 self.ulim = cos(theta_min * pi / 180.) theta_max = 10.0 self.llim = cos(theta_max * pi / 180.) G4.G4VUserPrimaryGeneratorAction.__init__(self) self.particleGun = G4.G4ParticleGun( 1) # параметр = число генерируемых (за раз) частиц self.particleGun.SetParticleByName("gamma") self.particleGun.SetParticleEnergy(2.614 * MeV) self.particleGun.SetParticlePosition(G4.G4ThreeVector(0.0, 0.0, 180.0))
def __init__(self, conf): g4.G4VUserPrimaryGeneratorAction.__init__(self) self.pg = g4.G4ParticleGun(1) self.conf = conf c = conf['PrimaryGenerator'] p, m = c['PythonGenerator'].rsplit('.', 1) gen_args = [] if 'PythonGeneratorArgs' in c: for x in c['PythonGeneratorArgs']: try: gen_args.append(eval(x)) except: gen_args.append(x) sys.path.append('./') mod = import_module(p) self.generator = getattr(mod, m)(*gen_args)
myPL = TestEm0.PhysicsList() g4.gRunManager.SetUserInitialization(myPL) # set user actions... myPGA = TestEm0.PrimaryGeneratorAction(myDC) g4.gRunManager.SetUserAction(myPGA) myRA = TestEm0.RunAction(myDC, myPGA) # set user action classes g4.gRunManager.SetUserAction(myRA) g4.gRunManager.Initialize() pg = g4.G4ParticleGun() materialList = TestEm0.getMaterialTable() particleList = TestEm0.getParticleTable() enrgyList = ["eV", "keV", "MeV", "GeV", "TeV", "PeV"] cutsList = ["um", "mm", "cm", "m", "km"] # GUI from tkinter import * class App(Frame):