ATLAS Offline Software
Functions
sherpaTarCreator.main Namespace Reference

Functions

def main ()
 

Function Documentation

◆ main()

def sherpaTarCreator.main.main ( )

Definition at line 16 of file Generators/Sherpa_i/python/sherpaTarCreator/main.py.

16 def main():
17  parser = ArgumentParser(description='create gridpackage from job option')
18  parser.add_argument("jobOptionDir",type=str, nargs='+',help="Path to job option directory. If multiple are given only the calculation of MinEvents is performed for the additional setups (meant e.g. for different filters).")
19  parser.add_argument('-b', '--batchSystem', type=str, dest='batchSystem', default='htcondor_lxplus', help='Batch system to use (default = %(default)s, alternatives: htcondor_naf, slurm_taurus, slurm_barnard, sge_grace)')
20  parser.add_argument('-c', '--ecm', type=float, dest='ecm', nargs="+", default=[13.6], help='center of mass energy in TeV')
21  parser.add_argument('-o', '--only', type=str, dest='performOnly', nargs="+", default=["all"], help='steps which can be performed, default:all, there are: getOpenLoops, createLibs, makelibs, integrate, makeTarball, evgen')
22  parser.add_argument('-n', '--maxCores', type=int, dest='maxCores', default="100000", help='maximal number of cores for the integration')
23  parser.add_argument('-r', '--RAM', type=int, dest='RAM', default="-1", help='reserved RAM in MB for the integration')
24  parser.add_argument('-l', '--createLibsRAM', type=int, dest='createLibsRAM', default="2", help='reserved RAM in MB for createLibs, values 1 and 2 are translated into normal RAM usage and extended RAM usage respectively')
25  parser.add_argument('-m', '--ncoresMakelibs', type=int, dest='ncoresMakelibs', default="4", help='maximal number of cores for Makelibs')
26  parser.add_argument('-s', '--ncoresScons', type=int, dest='ncoresScons', default="4", help='maximal number of cores for OpenLoops installation')
27  parser.add_argument('-e', '--nEvts', type=int, dest='nEvts', default="100", help='number of events which get generated in the test run')
28  parser.add_argument('-t', '--tarballVersion', type=str, dest='tarballVersion', default="1", help='version of tarball on grid')
29  parser.add_argument('-p', '--local-sherpa', dest='sherpaInstallPath', default=None, help="Path to custom-built local Sherpa installation. If None, use cvmfs version.")
30  parser.add_argument('-v', '--athenaVersion', type=str, dest='athenaVersion', default=None, help='Overwrite Athena version to be used.')
31  parser.add_argument('--OLskipcvmfs', dest='OLskipcvmfs', default=False, action='store_true', help="Skip precompiled OpenLoops libraries from cvmfs.")
32  parser.add_argument('--OLbranch', dest='OLbranch', type=str, default=None, help="OpenLoops branch to use from https://gitlab.com/openloops/OpenLoops (e.g. OpenLoops-2.1.2 or public_beta)")
33  parser.add_argument('--OLprocessrepos', dest='OLprocessrepos', type=str, default="ATLAS,public_beta,public", help="OpenLoops process repositories to use with ./openloops libinstall")
34  parser.add_argument('-d', '--dryRun', action='store_true', default=False, dest='dryRun', help="Do not actually submit jobs to cluster but just print them.")
35  options = parser.parse_args()
36 
37  import importlib
38  options.batchSystemModule = importlib.import_module("Sherpa_i.sherpaTarCreator."+options.batchSystem)
39 
40  for i in range(len(options.jobOptionDir)):
41  if not os.path.isdir(options.jobOptionDir[i]):
42  print ("ERROR: JO folder \"" + options.jobOptionDir[i] + "\" not found.")
43  sys.exit(2)
44  options.jobOptionDir[i] = os.path.abspath(options.jobOptionDir[i])
45  os.chdir(options.jobOptionDir[0])
46 
47  if not options.athenaVersion:
48  if "stable" in os.environ['AtlasReleaseType']:
49  options.athenaVersion = os.environ['AtlasVersion']+","+os.environ['AtlasProject']
50  elif "nightly" in os.environ['AtlasReleaseType']:
51  options.athenaVersion = os.environ['AtlasBuildBranch']+","+os.environ['AtlasProject']+",r"+os.environ['AtlasBuildStamp']
52  else:
53  print ("ERROR: Did not find Athena environment. Did you run asetup?")
54  sys.exit(1)
55 
56  # Load information from JO file
57  from . import readjo
58  readjo.readJO(options)
59 
60  from . import jobDefinitions
61 
62  for jodir in options.jobOptionDir:
63  if not os.path.isdir(jodir):
64  print ("ERROR: JO folder not found.")
65  sys.exit(2)
66  for ecm in options.ecm:
67  folder = jodir+"/ecm"+('{0:g}'.format(ecm)).replace(".","p")+"TeV"
68  #create folder
69  if not os.path.isdir(folder):
70  os.makedirs(folder)
71  #link Process directory in new folder
72  if not os.path.islink(os.path.join(folder,"Process")):
73  os.symlink(os.path.join("..","Process"), os.path.join(folder,"Process"))
74 
75  for f in options.Sherpa_i.ExtraFiles:
76  fi = os.path.basename(os.path.normpath(os.path.abspath(f)))
77  if not os.path.exists(fi):
78  print ("ERROR: The extraFile '"+f+"' does not exist, but is required according to the joboption file")
79  sys.exit(3)
80  if not os.path.islink(os.path.join(folder,fi)):
81  os.symlink(os.path.join(options.jobOptionDir[0],fi), os.path.join(folder,fi))
82 
83  if not os.path.islink(os.path.join(folder,"libSherpa_iPlugin.so")):
84  if options.Sherpa_i.PluginCode != "":
85  os.symlink(os.path.join(options.jobOptionDir[0],"libSherpa_iPlugin.so"), os.path.join(folder,"libSherpa_iPlugin.so"))
86 
87  prevJob = None
88  getOpenLoopsJob = jobDefinitions.mkGetOpenLoopsJob(options)
89  if getOpenLoopsJob:
90  prevJob = getOpenLoopsJob
91 
92  createLibsJob = jobDefinitions.mkCreateLibsJob(options, prevJob)
93  if createLibsJob:
94  prevJob = createLibsJob
95 
96  makelibsJob = jobDefinitions.mkMakelibsJob(options, prevJob)
97  if makelibsJob:
98  prevJob = makelibsJob
99 
100  for ecm in options.ecm:
101 
102  ecmPrevJob = prevJob
103  integrationJob = jobDefinitions.mkIntegrateJob(options, ecm, ecmPrevJob)
104  if integrationJob:
105  ecmPrevJob = integrationJob
106 
107  tarballmakerJob = jobDefinitions.mkTarballmakerJob(options, ecm, ecmPrevJob)
108  if tarballmakerJob:
109  ecmPrevJob = tarballmakerJob
110 
111  for jodir in options.jobOptionDir:
112  jobDefinitions.mkEvntGenTestJob(options, ecm, jodir, ecmPrevJob)
113 
114  options.batchSystemModule.finalizeJobs(options.dryRun)
115 
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
vtune_athena.format
format
Definition: vtune_athena.py:14
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
sherpaTarCreator.main.main
def main()
Definition: Generators/Sherpa_i/python/sherpaTarCreator/main.py:16