4 import subprocess, os, shlex, re, yaml
6 from AthenaCommon
import Logging
9 logger = Logging.logging.getLogger(
"Geneva_i")
24 if hasattr(runArgs,
"ecmEnergy"):
25 self.
rts = runArgs.ecmEnergy
33 if hasattr(runArgs,
"randomSeed"):
34 self.
iseed = runArgs.randomSeed
38 if hasattr(runArgs,
"maxEvents"):
39 self.
nev = runArgs.maxEvents
43 self.
yaml[
'global'][
'run_name']=
"tutorial"
45 for a
in self.
yaml[
'process'].
keys():
46 self.
yaml[
'process'][a][
'initial_state'][
'beams']=
'pp'
47 self.
yaml[
'process'][a][
'initial_state'][
'Ecm']=self.
rts
48 self.
yaml[
'process'][a][
'initial_state'][
'pdf_provider'][
'LHAPDF'][
'set']=
"PDF4LHC15_nnlo_100"
52 return "generate/tutorial_1.lhe.gz"
56 with open(Init.cardname,
"w")
as outF:
57 yaml.dump(Init.yaml,outF)
63 Run a command and print output continuously
65 process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stdin=stdin)
67 output = process.stdout.readline().
decode(
"utf-8")
68 if output ==
'' and process.poll()
is not None:
72 reaesc = re.compile(
r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]')
73 text = reaesc.sub(
'', output.strip())
82 logger.info(
"Starting Geneva Initialization")
87 raise Exception(
"problem with file IO; potentially input.DAT not created correctly")
91 os.environ[
'OpenLoopsPath']=os.environ[
'OPENLOOPSPATH']
92 print(Init.exe +
' setup ' + Init.cardname +
' --points '+
str(Init.points) +
' --iterations '+
str(Init.iterations) +
' --num-runs ' +
str(Init.numruns))
93 rc =
run_command(Init.exe +
' setup ' + Init.cardname +
' --points '+
str(Init.points) +
' --iterations '+
str(Init.iterations) +
' --num-runs ' +
str(Init.integrationnumruns))
96 raise Exception(
"init executable or file not found")
99 raise Exception(
"Non-OS Error or IOError in init execution block")
102 raise Exception(
'Unexpected error in geneva init execution')
109 logger.info(
"Starting Geneva Itself")
114 raise Exception (
"problem with IO; potentially input.DAT not created correctly")
118 os.environ[
'OpenLoopsPath']=os.environ[
'OPENLOOPSPATH']
119 rc =
run_command(Init.exe +
' generate ' + Init.cardname +
' --num-runs ' +
str(Init.numruns))
120 rc =
run_command(Init.exe +
' reweight ' + Init.cardname +
' --sigma-below '+ Init.sigmabelow +
' --num-runs '+
str(Init.numruns))
123 raise Exception(
"geneva executable or file not found")
126 raise Exception(
"Non-OS Error or IOError in Superchic execution block")
129 raise Exception(
'Unexpected error in geneva execution')
133 genSeq.GenevaConfig = Init