ATLAS Offline Software
Classes | Functions | Variables
SuperChicUtils Namespace Reference

Classes

class  SuperChicConfig
 

Functions

def writeInputDAT (Init)
 
def run_command (command, stdin=None)
 
def SuperChicInitialize (Init, stdin=None)
 
def SuperChicExecute (Init)
 
def SuperChicRun (Init, genSeq)
 

Variables

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

Function Documentation

◆ run_command()

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

Definition at line 295 of file SuperChicUtils.py.

295 def run_command(command, stdin = None):
296  """
297  Run a command and print output continuously
298  """
299  process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stdin=stdin)
300  while True:
301  output = process.stdout.readline().decode("utf-8")
302  if output == '' and process.poll() is not None:
303  break
304  if output:
305  # remove ANSI escape formatting characters
306  reaesc = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]')
307  text = reaesc.sub('', output.strip())
308  logger.info(text)
309 
310  rc = process.poll()
311  return rc
312 
313 

◆ SuperChicExecute()

def SuperChicUtils.SuperChicExecute (   Init)

Definition at line 348 of file SuperChicUtils.py.

348 def SuperChicExecute(Init):
349 
350  logger.info("Starting SuperChic Itself")
351 
352  if not os.path.exists('inputs'):
353  os.makedirs('inputs')
354  if not os.path.exists('evrecs'):
355  os.makedirs('evrecs')
356  if not os.path.exists('outputs'):
357  os.makedirs('outputs')
358 
359 
360  try:
361  inputDAT = open('input.DAT')
362  except IOError:
363  raise Exception ("problem with IO; potentially input.DAT not created correctly")
364  else:
365 
366  try:
367  rc = run_command(Init.superchicpath+'/bin/superchic', stdin=inputDAT)
368 
369  except OSError:
370  raise Exception("Superchic executable or file not found")
371 
372  except Exception:
373  raise Exception("Non-OSError or IOError in Superchic execution block")
374 
375  if rc:
376  raise Exception('Unexpected error in superchic execution')
377 
378  return
379 
380 
381 

◆ SuperChicInitialize()

def SuperChicUtils.SuperChicInitialize (   Init,
  stdin = None 
)

Definition at line 314 of file SuperChicUtils.py.

314 def SuperChicInitialize(Init, stdin=None):
315 
316  logger.info("Starting SuperChic Initialization")
317 
318  if not os.path.exists('inputs'):
319  os.makedirs('inputs')
320  if not os.path.exists('evrecs'):
321  os.makedirs('evrecs')
322  if not os.path.exists('outputs'):
323  os.makedirs('outputs')
324 
325 
326  try:
327  inputDAT = open('input.DAT')
328 
329  except IOError:
330  raise Exception("problem with file IO; potentially input.DAT not created correctly")
331  else:
332 
333  try:
334  rc = run_command(Init.superchicpath+"/bin/init", inputDAT)
335 
336  except OSError:
337  raise Exception("init executable or file not found")
338 
339  except Exception:
340  raise Exception("Non-OSError or IOError in init execution block")
341 
342  if rc:
343  raise Exception('Unexpected error in superchic init execution')
344 
345  return
346 
347 

◆ SuperChicRun()

def SuperChicUtils.SuperChicRun (   Init,
  genSeq 
)

Definition at line 382 of file SuperChicUtils.py.

382 def SuperChicRun(Init, genSeq):
383 
384  # dump the job configuration for fortran code
385  print(Init.toFortran())
386 
387  # attach config to genSequence for later usin in showering
388  genSeq.SuperChicConfig = Init
389 
390  writeInputDAT(Init)
391  SuperChicInitialize(Init)
392  SuperChicExecute(Init)
393 
394  return

◆ writeInputDAT()

def SuperChicUtils.writeInputDAT (   Init)

Definition at line 287 of file SuperChicUtils.py.

287 def writeInputDAT(Init):
288 
289  with open("input.DAT", "w") as outF:
290  outF.write(Init.toFortran())
291 
292  return
293 
294 

Variable Documentation

◆ logger

SuperChicUtils.logger = Logging.logging.getLogger("Superchic_i")

Get handle to Athena logging.

Definition at line 9 of file SuperChicUtils.py.

AtlasMcWeight::decode
double decode(number_type binnedWeight)
Convert weight from unsigned to double.
Definition: AtlasMcWeight.cxx:32
SuperChicUtils.writeInputDAT
def writeInputDAT(Init)
Definition: SuperChicUtils.py:287
SuperChicUtils.SuperChicInitialize
def SuperChicInitialize(Init, stdin=None)
Definition: SuperChicUtils.py:314
SuperChicUtils.SuperChicRun
def SuperChicRun(Init, genSeq)
Definition: SuperChicUtils.py:382
SuperChicUtils.SuperChicExecute
def SuperChicExecute(Init)
Definition: SuperChicUtils.py:348
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
Trk::open
@ open
Definition: BinningType.h:40
SuperChicUtils.run_command
def run_command(command, stdin=None)
Definition: SuperChicUtils.py:295