#!/usr/bin/env python3 import os import sys import shutil dataDir = sys.argv[1] hydraConfigPath = "/lustre/cbm/users/slebedev/hades/trunk/hydra2/defall.sh" hydraDir = "/lustre/cbm/users/slebedev/hades/trunk/hydra2/" macroDir = "/lustre/cbm/users/slebedev/hades/trunk/hydra2/rich/scripts/digi_par_creator/" taskId = os.environ.get('SLURM_ARRAY_TASK_ID') jobId = os.environ.get('SLURM_ARRAY_JOB_ID') print("dataDir:" + dataDir) print("taskId:" + taskId) print("hydraConfigPath:" + hydraConfigPath) os.system(("source {}").format(hydraConfigPath)) workDir = dataDir + "/workdir/" + jobId + "_" + taskId + "/" if os.path.exists(workDir): shutil.rmtree(workDir) os.makedirs(workDir) os.chdir(workDir) # this is needed to set root parameters shutil.copy2('/lustre/cbm/users/slebedev/hades/trunk/hydra2/rich/scripts/.rootrc', workDir) runAscii = False runGeant = False runDst = False runDigiParEvents = True nofTriggers = 500000 plutoFile = ('{}/2020.pluto.ascii.{}.evt').format(dataDir, taskId) templateIniFile = hydraDir + 'rich/scripts/digi_par_creator/hgeant_config.dat' outputIniFile = hydraDir + ('rich/scripts/digi_par_creator/hgeant_config_output/hgeant_config_output_{}.dat').format(taskId) geomPath = hydraDir + 'scripts/rich700/geom/' outputGeantRootFile = ('{}/2020.rich_params.hgeant.e.{}.root').format(dataDir, taskId) geantFile=('{}/2020.rich_params.hgeant.e.{}1.root').format(dataDir, taskId) dstFile=('{}/2020.rich_params.dst.e.{}.root').format(dataDir, taskId) histFile=('{}/2020.rich_params.hist.e.{}.root').format(dataDir, taskId) if runAscii: print("runAscii") os.system( ('root -l -b -q {}/run_ascii.C\(\\"{}\\",{}\)').format(macroDir, plutoFile, nofTriggers) ) if runGeant: print("runGeant") os.system( ('perl {}scripts/batch/GE/hgeant/replaceIniDat.pl -t {} -d {} -i {} -p {} -o {} -n {}').format(hydraDir, templateIniFile, outputIniFile, plutoFile, geomPath, outputGeantRootFile,nofTriggers) ) os.system( ('/lustre/cbm/users/slebedev/hades/trunk/hgeant2/install/hgeant -b -c -f {}').format(outputIniFile) ) if runDst: print("runDst") os.system( ('root -l -b -q {}/run_rich_dst.C\(\\"{}\\",\\"{}\\",{}\)').format(macroDir, geantFile, dstFile, nofTriggers) ) if runDigiParEvents: print("runDigiParEvents") os.system( ('root -l -b -q {}/run_rich_digi_par_event.C\(\\"{}\\",\\"{}\\",{}\)').format(macroDir, dstFile, histFile, nofTriggers) )