7 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
9 flags.addFlag(
'Output.HepMCFileName',
'events.hepmc',help=
'Name of the output HepMC file')
10 flags.addFlag(
'Output.CompressHepMC',
False,help=
'Compress the output after Athena finishes')
14 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
15 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
20 from AthenaConfiguration.ComponentFactory
import CompFactory
21 cfg.addEventAlgo( CompFactory.WriteHepMC(
'WriteHepMC',
22 OutputFile = flags.Output.HepMCFileName.replace(
'.tgz',
'') ) )
24 cfg.run(flags.Exec.MaxEvents)
27 if flags.Output.CompressHepMC:
28 print(
'Compressing output (this may take a moment)')
30 final_name = flags.Output.HepMCFileName
if '.tgz' in flags.Output.HepMCFileName
else flags.Output.HepMCFileName+
'.tgz'
31 tar = tarfile.open(final_name,
'w:gz')
32 tar.add(flags.Output.HepMCFileName.replace(
'.tgz',
''))
36 os.remove(flags.Output.HepMCFileName.replace(
'.tgz',
''))