24 twiss_energy =
'%1.1fTeV'%(
float(flags.Sim.TwissEnergy)*0.000001)
25 twiss_beta =
'%07.2fm'%(0.001*flags.Sim.TwissFileBeta)
26 if not (flags.Sim.TwissFileNomReal
and flags.Sim.TwissFileVersion):
27 msg.error(f
"buildTwissFilePath: Need to either provide file names or set file name (currently {filename}) and file version flags (currently flags.Sim.TwissFileNomReal = {flags.Sim.TwissFileNomReal} and flags.Sim.TwissFileVersion = {flags.Sim.TwissFileVersion}.")
28 raise Exception(
'Not enough information to locate Twiss files. Need to either provide file names or set file name and file version flags.')
29 twiss_nomreal = flags.Sim.TwissFileNomReal
30 twiss_version = flags.Sim.TwissFileVersion
33 twiss_path = os.getenv(
'TwissFilesPATH')
35 msg.warning(
"buildTwissFilePath: TwissFilesPATH environment variable is empty.")
36 twiss_beam = os.path.join(twiss_path, twiss_energy, twiss_beta, twiss_nomreal, twiss_version, filename)
37 if not os.access(twiss_beam,os.R_OK):
38 raise Exception(f
'Failed to find {filename} at {twiss_beam}')