Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 309 of file SuperChicUtils.py.

309 def run_command(command, stdin = None):
310  """
311  Run a command and print output continuously
312  """
313  process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stdin=stdin)
314  while True:
315  output = process.stdout.readline().decode("utf-8")
316  if output == '' and process.poll() is not None:
317  break
318  if output:
319  # remove ANSI escape formatting characters
320  reaesc = re.compile(r'(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]')
321  text = reaesc.sub('', output.strip())
322  logger.info(text)
323 
324  rc = process.poll()
325  return rc
326 
327 

◆ SuperChicExecute()

def SuperChicUtils.SuperChicExecute (   Init)

Definition at line 362 of file SuperChicUtils.py.

362 def SuperChicExecute(Init):
363 
364  logger.info("Starting SuperChic Itself")
365 
366  if not os.path.exists('inputs'):
367  os.makedirs('inputs')
368  if not os.path.exists('evrecs'):
369  os.makedirs('evrecs')
370  if not os.path.exists('outputs'):
371  os.makedirs('outputs')
372 
373 
374  try:
375  inputDAT = open('input.DAT')
376  except IOError:
377  raise Exception ("problem with IO; potentially input.DAT not created correctly")
378  else:
379 
380  try:
381  rc = run_command(Init.superchicpath+'/bin/superchic', stdin=inputDAT)
382 
383  except OSError:
384  raise Exception("Superchic executable or file not found")
385 
386  except Exception:
387  raise Exception("Non-OSError or IOError in Superchic execution block")
388 
389  if rc:
390  raise Exception('Unexpected error in superchic execution')
391 
392  return
393 
394 
395 

◆ SuperChicInitialize()

def SuperChicUtils.SuperChicInitialize (   Init,
  stdin = None 
)

Definition at line 328 of file SuperChicUtils.py.

328 def SuperChicInitialize(Init, stdin=None):
329 
330  logger.info("Starting SuperChic Initialization")
331 
332  if not os.path.exists('inputs'):
333  os.makedirs('inputs')
334  if not os.path.exists('evrecs'):
335  os.makedirs('evrecs')
336  if not os.path.exists('outputs'):
337  os.makedirs('outputs')
338 
339 
340  try:
341  inputDAT = open('input.DAT')
342 
343  except IOError:
344  raise Exception("problem with file IO; potentially input.DAT not created correctly")
345  else:
346 
347  try:
348  rc = run_command(Init.superchicpath+"/bin/init", inputDAT)
349 
350  except OSError:
351  raise Exception("init executable or file not found")
352 
353  except Exception:
354  raise Exception("Non-OSError or IOError in init execution block")
355 
356  if rc:
357  raise Exception('Unexpected error in superchic init execution')
358 
359  return
360 
361 

◆ SuperChicRun()

def SuperChicUtils.SuperChicRun (   Init,
  genSeq 
)

Definition at line 396 of file SuperChicUtils.py.

396 def SuperChicRun(Init, genSeq):
397 
398  # dump the job configuration for fortran code
399  print(Init.toFortran())
400 
401  # attach config to genSequence for later usin in showering
402  genSeq.SuperChicConfig = Init
403 
404  writeInputDAT(Init)
405  SuperChicInitialize(Init)
406  SuperChicExecute(Init)
407 
408  return

◆ writeInputDAT()

def SuperChicUtils.writeInputDAT (   Init)

Definition at line 301 of file SuperChicUtils.py.

301 def writeInputDAT(Init):
302 
303  with open("input.DAT", "w") as outF:
304  outF.write(Init.toFortran())
305 
306  return
307 
308 

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:301
SuperChicUtils.SuperChicInitialize
def SuperChicInitialize(Init, stdin=None)
Definition: SuperChicUtils.py:328
SuperChicUtils.SuperChicRun
def SuperChicRun(Init, genSeq)
Definition: SuperChicUtils.py:396
SuperChicUtils.SuperChicExecute
def SuperChicExecute(Init)
Definition: SuperChicUtils.py:362
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:309