def _init_geometry(self): '''Initialize geant geometry''' self._geom = MyDetectorConstruction(materials=self._materials, detX=self._detX, detY=self._detY, detZ=self._detZ) gRunManager.SetUserInitialization(self._geom) return
def _init_physics_list(self): '''Initialize the physics list''' # Use standard physics list if self._physlist_name == 'FTFP_BERT': self._physics_list = FTFP_BERT() elif self._physlist_name == 'QGSP_BERT': self._physics_list = QGSP_BERT() elif self._physlist_name == 'QGSP_BERT_HP': self._physics_list = QGSP_BERT_HP() else: raise ValueError( "Invalid physics list: \'%r\'. Please choose from:FTFP_BERT, QGSP_BERT, QGSP_BERT_HP" % self._physlist_name) #self._physics_list.RegisterPhysics(G4MyStepLimiterPhysics()) gRunManager.SetUserInitialization(self._physics_list) return
log.info('Using the following configuration:') log.info(config) rand_engine = G4.Ranlux64Engine() HepRandom.setTheEngine(rand_engine) seed = config['seed'] if seed == 0: seed = random.randint(1, 65536) log.warning('Using random seed %d', seed) else: log.info('Using seed %d', seed) HepRandom.setTheSeed(seed) detector = VlenfDetectorConstruction(field_polarity=config['polarity']) gRunManager.SetUserInitialization(detector) physics_list = G4.G4physicslists.QGSP_BERT() gRunManager.SetUserInitialization(physics_list) physics_list.SetDefaultCutValue(1.0 * mm) physics_list.SetCutsWithDefault() # # Generator actions # pos = [] width = rc['width'] * rc['bars'] pos.append(uniform(loc=-width / 2, scale=width)) pos.append(uniform(loc=-width / 2, scale=width))