File indexing completed on 2024-11-15 08:59:27
0001
0002
0003
0004
0005
0006 import numpy as np
0007 import math as m
0008 import sys, os, json, subprocess, shlex, re
0009
0010
0011 athenaDir = 'athena'
0012 compactInName = 'compact/drich_orig.xml'
0013 compactInFile = open(athenaDir+'/'+compactInName,'r')
0014
0015
0016 def sep(): print('-'*40)
0017 def dictPrint(d): print(json.dumps(d,indent=4))
0018 it = {}
0019 i=0
0020 it['tuneX1'] = list(np.linspace( 50, 80, 4 ))
0021 it['tuneX2'] = list(np.linspace( 50, 80, 4 ))
0022 it['tuneZ1'] = list(np.linspace( -100, -40, 4 ))
0023 it['tuneZ2'] = list(np.linspace( -60, 0, 4 ))
0024 dictPrint(it)
0025 sep()
0026 print('i testName [tuneZ1, tuneX1,tuneZ2, tuneX2]')
0027
0028 for tuneX1 in it['tuneX1']:
0029 for tuneZ1 in it['tuneZ1']:
0030 for tuneX2 in it['tuneX2']:
0031 for tuneZ2 in it['tuneZ2']:
0032
0033
0034 if tuneX1==tuneX2 and tuneZ1==tuneZ2: continue
0035
0036
0037 testName = 'focus'
0038 varList = [tuneX1,tuneZ1,tuneX2,tuneZ2]
0039 for v in varList: testName += f'__{round(v,1)}'
0040 print(i,testName,varList)
0041 outRoot = "out/"+testName+".root"
0042
0043
0044 compactOutName = 'compact/drich.xml'
0045 compactOutFile = open(athenaDir+'/'+compactOutName,'w')
0046
0047
0048 compactInFile.seek(0,0)
0049 for line in compactInFile.readlines():
0050 line = re.sub('XXX1',f'{tuneX1}',line)
0051 line = re.sub('XXX2',f'{tuneX2}',line)
0052 line = re.sub('ZZZ1',f'{tuneZ1}',line)
0053 line = re.sub('ZZZ2',f'{tuneZ2}',line)
0054 compactOutFile.write(line)
0055 compactOutFile.close()
0056
0057
0058 def execute(l): subprocess.call(shlex.split(l))
0059 os.system(f"exit | ./simulate.py -t12 -v -i svg -o {outRoot}")
0060
0061
0062 i+=1
0063
0064 compactInFile.close()