def main(): logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) gdml_template = os.path.join(ROOT_PATH, "template", "cylinder.gdml") values_gdml = { 'height': [0], 'cellHeight': [600], 'fieldValueZ': [0, 3e-4, 10e-4], } values_macros = { "physics": [ "standard", "standard_opt_1", "standard_opt_2", "standard_opt_3", "standard_opt_4", "penelopa", "livermore", "emlowepphysics" ], 'number': [int(1000)], 'energy': [10], 'posZ': [299.9], 'direction': ['0 0 -1'], 'particle': 'e-' } meta = Meta({"macros": values_macros, "gdml": values_gdml}) input_data = general_input_generator(meta, gdml_template, INPUT_TEMPLATE) command = "../build/thunderstorm/geant4-thunderstorm.exe" readers = READERS_CYLINDER_DATA + READERS_TXT multirun_command(input_data, command, post_processor=get_convertor(readers, "./result.hdf5", clear=False)) return 0
def reverse_electron(): gdml_template = os.path.join(ROOT_PATH, "template", "reversed_electron.gdml") values = { 'height': 0, 'fieldValueZ': 8e-4, "cut": 0.05, 'number': 100, } os.makedirs("gdml", exist_ok=True) with open("gdml/reversed_electron.gdml", "w") as fout, open(gdml_template) as fin: text = fin.read() text = Template(text) text = text.substitute(values) fout.write(text) iter = 0 energy_parallel, energy_perpendicular = 1.0, 0.0 step = 0.01 for i in np.arange(0.05, 1.01, 0.05): for j in np.arange(0.05, 1.01, 0.05): input_data = run_simualtion(i, j, INPUT_TEMPLATE, values) readers = get_readers() post_run_processor = get_convertor(readers, "./result.hdf5", clear=True) post_run_processor(input_data)
def test_run(): logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) gdml_template = os.path.join(ROOT_PATH, "..", "..", "simulation_scripts", "thunderstorm", "template", "dwyer2003.gdml") print(gdml_template) values_gdml = { 'height': [5000, 6000], 'fieldValueZ': [2e-4, 1e-4], } values_macros = { 'number': [int(1e2)], 'energy': [i for i in range(1, 3)], 'posZ': [49.5], 'direction': ['0 0 -1', '0.5 0 -0.5'], 'particle': 'e-' } meta = Meta({"macros": values_macros, "gdml": values_gdml}) input_data = general_input_generator(meta, gdml_template, INPUT_TEMPLATE) command = "../build/thunderstorm/geant4-thunderstorm.exe" readers = READERS_CYLINDER_DATA + READERS_TXT multirun_command(input_data, command, post_processor=get_convertor(readers, "./result.hdf5")) return 0
def main(): logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) gdml_template = os.path.join(ROOT_PATH, "template", "cylinder.gdml") values_macros = { "cut": [0.05], 'number': [10], 'energy': [1.0], 'direction': ['0 0 -1'], 'particle': 'e-' } meta = Meta({ "macros": values_macros, }) input_data = input_generator_custom_gdml_dwyer2003(meta, gdml_template, INPUT_TEMPLATE, gdml_generator) command = "../../build/thunderstorm/geant4-thunderstorm.exe" readers = READERS_CYLINDER_ID_DATA + READERS_TXT + READER_TREE_SOCKET_DATA multirun_command(input_data, command, post_processor=get_convertor(readers, "./result.hdf5", clear=True)) return 0
def main(): logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) values_macros = { "type": ["pie"], "physics": ["FTFP_BERT_opt4"], "high": [4225], "low": [3225], "cut": [0.05], 'number': [10], 'posZ': [499.5], 'particle': ['mu-', 'mu+'], 'field_z': [0.0, 200.0, 220.0], } meta = Meta(values_macros) input_data = no_gdmL_input_generator(meta, INPUT_TEMPLATE) command = "../../build/thunderstorm/geant4-thunderstorm.exe" readers = [ ProtoSetReader("particle_detector.bin", ParticleDetectorProtoSet) ] multirun_command(input_data, command, post_processor=get_convertor(readers, "./result.hdf5", clear=True)) return 0
def main(): logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) gdml_template = os.path.join(ROOT_PATH, "template", "cylinder.gdml") values_gdml = { 'height': [0], 'cellHeight': [600], 'fieldValueZ': [10e-4], #np.arange(2,11)*1e-4, } values_macros = { "physics": ["standard_opt_4"], "cut": [0.005], 'number': [int(10)], 'energy': np.arange(), 'posZ': [200], 'direction': ['0 0 -1'], 'particle': 'e-' } meta = Meta({"macros": values_macros, "gdml": values_gdml}) input_data = general_input_generator(meta, gdml_template, INPUT_TEMPLATE) command = "../../build/thunderstorm/geant4-thunderstorm.exe" readers = [ProtoSetReader("stacking_simple.bin", CylinderProtoSet)] multirun_command(input_data, command, post_processor=get_convertor(readers, "./result.hdf5", clear=False)) return 0
def main(): logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) input_data = input_generator_critical_energy() command = "../../build/thunderstorm/geant4-thunderstorm.exe" readers = [ProtoSetReader("stacking_simple.bin", CylinderProtoSet)] multirun_command(input_data, command, post_processor=get_convertor(readers, "./result.hdf5", clear=True), n_cpu_cores=12) return 0
def main(): logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) gdml_template = os.path.join(ROOT_PATH, "template", "cylinder.gdml") values_macros = { "cut": [0.05], "physics": ["standard_opt_4"], 'number': [2], 'energy': [1.0], 'direction': ['0 0 -1'], 'particle': 'e-' } meta = Meta({ "macros": values_macros, }) # fields = [10e-4, 7e-4, 6.0e-4, 5.5e-4, 5.0e-4, 4.5e-4, 4.0e-4] # heights = [200, 300, 400, 400, 500, 700, 1000] fields = [10e-4, 7e-4] heights = [200, 300] ggfh = GGFieldHeigth(fields, heights) input_data = input_generator_custom_gdml_dwyer2003(meta, gdml_template, INPUT_TEMPLATE, ggfh) command = "../../build/thunderstorm/geant4-thunderstorm.exe" readers = [ ProtoSetReader("treeTracking.bin", CylinderProtoSet), ProtoSetReader("gammaSeed.bin", CylinderProtoSet), ProtoSetReader("positronSeed.bin", CylinderProtoSet), ProtoSetReader("histogram.bin", HistogramProtoSet) ] multirun_command(input_data, command, post_processor=get_convertor(readers, "./result.hdf5", clear=True)) return 0
def main(): args = create_parser().parse_args() logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) gdml_path = DEFOULT_PATH physics = "FTFP_BERT_opt4" if args.with_spacecraft: gdml_path = SPACECART_PATH if args.without_standard: physics = "withoutEmStandard" input_data = input_generator_neutron(gdml_path, physics) command = "../../build/thunderstorm/geant4-thunderstorm.exe" readers = [ ProtoSetReader("stacking_simple.bin", CylinderProtoSet), ProtoSetReader("tracking_post.bin", CylinderProtoSet) ] multirun_command(input_data, command, post_processor=get_convertor(readers, args.output, clear=True), n_cpu_cores=12) return 0
def main(): logging.basicConfig(filename="run.log") logging.root.setLevel(logging.DEBUG) OUTPUT_FILE = "result.hdf5" values_macros = { "mode": "single", # or "sum" Сожранение или всех симуляций или среднего значения. "radius": 0.15, # "shift": [0.0, 0.005, 0.016], # "theta": [0.0, 10.0, 20., 30.0, 50.0, 70.0], "shift": 0.0, # Сдвиг относительно центральной оси, может быть списком "theta": 0.0, # Отклонение от центральной оси, может быть списком "theta_unit": "degree", 'energy': np.arange(10.0, 15.1, 1.0), # Набор энергий для симуляции 'number': [100], # Число событий в одной симуляции # 'particle': 'e-' 'particle': 'proton' # Запускаемая частица } meta = Meta({ "macros": values_macros, }) input_data = input_generator_satellite(meta, INPUT_TEMPLATE, init_pos=[0.0, 0.0, 0.1]) command = "../../build/satellite/geant4-satellite.exe" readers = [ ProtoReader("deposit.proto.bin", proto_convertor=convert_satellite_proto) ] multirun_command(input_data, command, post_processor=get_convertor(readers, OUTPUT_FILE, clear=True)) return 0