CMS 3D CMS Logo

cmsDriver.py
Go to the documentation of this file.
1 #! /usr/bin/env python3
2 
3 # A Pyrelval Wrapper
4 
5 def run():
6  import sys
7  import os
8  import Configuration.Applications
9  from Configuration.Applications.ConfigBuilder import ConfigBuilder
10  from Configuration.Applications.cmsDriverOptions import OptionsFromCommandLine
11  options = OptionsFromCommandLine()
12 
13  # after cleanup of all config parameters pass it to the ConfigBuilder
14  configBuilder = ConfigBuilder(options, with_output = True, with_input = True)
15 
16  configBuilder.prepare()
17  # fetch the results and write it to file
18  config = open(options.python_filename,"w")
19  config.write(configBuilder.pythonCfgCode)
20  config.close()
21 
22  # handle different dump options
23  if options.dump_python:
24  status_code = os.system('edmConfigDump -o {f} {f}'.format(f=options.python_filename))
25  if status_code: sys.exit(status_code)
26  print("Expanded config file", options.python_filename, "created")
27  sys.exit(0)
28 
29  if options.no_exec_flag:
30  print("Config file "+options.python_filename+ " created")
31  sys.exit(0)
32  else:
33  commandString = options.prefix+" cmsRun "+options.suffix
34  print("Starting "+commandString+' '+options.python_filename)
35  commands = commandString.lstrip().split()
36  sys.stdout.flush()
37  os.execvpe(commands[0],commands+[options.python_filename],os.environ)
38  sys.exit()
39 
40 run()
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def run()
Definition: cmsDriver.py:5