ATLAS Offline Software
Classes | Functions | Variables
GenevaUtils Namespace Reference

Classes

class  GenevaConfig
 

Functions

def writeInputDAT (Init)
 
def run_command (command, stdin=None)
 
def GenevaInitialize (Init, stdin=None)
 
def GenevaExecute (Init)
 
def GenevaRun (Init, genSeq)
 

Variables

 logger = Logging.logging.getLogger("Geneva_i")
 Get handle to Athena logging. More...
 

Function Documentation

◆ GenevaExecute()

def GenevaUtils.GenevaExecute (   Init)

Definition at line 107 of file GenevaUtils.py.

107 def GenevaExecute(Init):
108 
109  logger.info("Starting Geneva Itself")
110 
111  try:
112  open(Init.cardname)
113  except IOError:
114  raise Exception ("problem with IO; potentially input.DAT not created correctly")
115  return
116  rc=0
117  try:
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))
121 
122  except OSError:
123  raise Exception("geneva executable or file not found")
124 
125  except Exception:
126  raise Exception("Non-OS Error or IOError in Superchic execution block")
127 
128  if rc:
129  raise Exception('Unexpected error in geneva execution')
130  return
131 

◆ GenevaInitialize()

def GenevaUtils.GenevaInitialize (   Init,
  stdin = None 
)

Definition at line 80 of file GenevaUtils.py.

80 def GenevaInitialize(Init, stdin=None):
81 
82  logger.info("Starting Geneva Initialization")
83 
84  try:
85  open(Init.cardname)
86  except IOError:
87  raise Exception("problem with file IO; potentially input.DAT not created correctly")
88  return
89  rc = 0
90  try:
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))
94 
95  except OSError:
96  raise Exception("init executable or file not found")
97 
98  except Exception:
99  raise Exception("Non-OS Error or IOError in init execution block")
100 
101  if rc:
102  raise Exception('Unexpected error in geneva init execution')
103 
104  return
105 
106 

◆ GenevaRun()

def GenevaUtils.GenevaRun (   Init,
  genSeq 
)

Definition at line 132 of file GenevaUtils.py.

132 def GenevaRun(Init, genSeq):
133  genSeq.GenevaConfig = Init
134  writeInputDAT(Init)
135  GenevaInitialize(Init)
136  GenevaExecute(Init)
137  return

◆ run_command()

def GenevaUtils.run_command (   command,
  stdin = None 
)
Run a command and print output continuously

Definition at line 61 of file GenevaUtils.py.

61 def run_command(command, stdin = None):
62  """
63  Run a command and print output continuously
64  """
65  process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stdin=stdin)
66  while True:
67  output = process.stdout.readline().decode("utf-8")
68  if output == '' and process.poll() is not None:
69  break
70  if output:
71  # remove ANSI escape formatting characters
72  reaesc = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]')
73  text = reaesc.sub('', output.strip())
74  logger.info(text)
75 
76  rc = process.poll()
77  return rc
78 
79 

◆ writeInputDAT()

def GenevaUtils.writeInputDAT (   Init)

Definition at line 55 of file GenevaUtils.py.

55 def writeInputDAT(Init):
56  with open(Init.cardname, "w") as outF:
57  yaml.dump(Init.yaml,outF)
58  return
59 
60 

Variable Documentation

◆ logger

GenevaUtils.logger = Logging.logging.getLogger("Geneva_i")

Get handle to Athena logging.

Definition at line 9 of file GenevaUtils.py.

AtlasMcWeight::decode
double decode(number_type binnedWeight)
Convert weight from unsigned to double.
Definition: AtlasMcWeight.cxx:32
GenevaUtils.GenevaInitialize
def GenevaInitialize(Init, stdin=None)
Definition: GenevaUtils.py:80
GenevaUtils.writeInputDAT
def writeInputDAT(Init)
Definition: GenevaUtils.py:55
GenevaUtils.GenevaRun
def GenevaRun(Init, genSeq)
Definition: GenevaUtils.py:132
GenevaUtils.GenevaExecute
def GenevaExecute(Init)
Definition: GenevaUtils.py:107
GenevaUtils.run_command
def run_command(command, stdin=None)
Definition: GenevaUtils.py:61
Trk::open
@ open
Definition: BinningType.h:40
str
Definition: BTagTrackIpAccessor.cxx:11
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70