142 ecmfolder =
"ecm"+(
'{0:g}'.
format(ecm)).
replace(
".",
"p")+
"TeV"
144 if not (
"integrate" in options.performOnly
or "all" in options.performOnly):
147 resname =
"Results.db" if os.environ[
"SHERPAVER"].startswith(
'2.')
else "Results.zip"
148 if os.path.isfile(ecmfolder+
"/"+resname)
and os.path.isfile(ecmfolder+
"/3.integrate.log"):
153 targetCores = options.Sherpa_i.NCores
154 if options.maxCores < options.Sherpa_i.NCores:
155 targetHours =
int(
round(24.*options.Sherpa_i.NCores/options.maxCores))
156 targetCores = options.maxCores
158 if options.RAM > 100:
159 options.Sherpa_i.MemoryMB = options.RAM
160 job = options.batchSystemModule.batchJob(
"3.integrate", hours=targetHours, nCores=targetCores, memMB=options.Sherpa_i.MemoryMB, basedir=options.jobOptionDir[0]+
"/"+ecmfolder)
163 job.dependsOnOk.append(prevJob.id)
165 job.cmds += [
"source $AtlasSetup/scripts/asetup.sh "+options.athenaVersion]
166 job.cmds += [
"set -e"]
168 if os.environ[
"SHERPAVER"].startswith(
'3.'):
170 job.cmds += [
"cat > Base.yaml <<EOL"]
171 job.cmds += [options.Sherpa_i.BaseFragment]
174 job.cmds += [
r"sed '/.*EXTERNAL_RNG.*/d' -i Base.yaml"]
176 configname =
"Run.dat" if os.environ[
"SHERPAVER"].startswith(
'2.')
else "Sherpa.yaml"
177 job.cmds += [
"cat > "+configname+
" <<EOL"]
178 job.cmds += [options.Sherpa_i.RunCard]
181 ecmopt = [
"BEAM_ENERGY_1="+
str(ecm/2.*1000),
"BEAM_ENERGY_2="+
str(ecm/2.*1000)] \
182 if os.environ[
"SHERPAVER"].startswith(
'2.')
else [
"BEAM_ENERGIES: "+
str(ecm/2.*1000)]
183 ignoreopt = [
"RUNDATA",
"LOG_FILE",
"NNPDF_GRID_PATH",
"RESULT_DIRECTORY"]
184 totopt = options.Sherpa_i.Parameters + ecmopt
185 if options.Sherpa_i.PluginCode !=
"":
186 if os.environ[
"SHERPAVER"].startswith(
'2.'):
187 totopt.append(
"SHERPA_LDADD=Sherpa_iPlugin")
189 totopt.append(
"SHERPA_LDADD: Sherpa_iPlugin")
191 if not (re.split(
r'\W',s)[0]
in ignoreopt):
192 if os.environ[
"SHERPAVER"].startswith(
'2.'):
193 job.cmds += [
r"sed '/.*\}(run).*/i\ \ "+s+
"' -i Run.dat"]
195 job.cmds += [
r"sed '/.*PROCESSES:.*/i"+s+
"\\n' -i Sherpa.yaml"]
197 olpath =
str(os.environ[
'OPENLOOPSPATH'])
198 lcglayer = olpath[olpath.find(
"LCG_"):olpath.find(
"/MCGenerators")]
199 sftlayer =
"/cvmfs/sft.cern.ch/lcg/releases/" + lcglayer
200 lcgbase =
"_".
join(lcglayer.split(
'_')[:2])
201 sftbase =
"/cvmfs/sft.cern.ch/lcg/releases/" + lcgbase
203 if not options.sherpaInstallPath:
204 options.sherpaInstallPath = sftlayer+
"/MCGenerators/sherpa/${SHERPAVER}.openmpi3/${LCG_PLATFORM}"
207 LCG_PLATFORM =
str(os.environ[
'LCG_PLATFORM'])
209 openmpi_path =
":".
join(glob.glob(sftbase+
"/openmpi/*/"+LCG_PLATFORM+
"/bin"))
210 opal_prefix =
":".
join(glob.glob(sftbase+
"/openmpi/*/"+LCG_PLATFORM))
211 ld_library_path =
":".
join(glob.glob(sftbase+
"/openmpi/*/"+LCG_PLATFORM+
"/lib"))
212 gccpath =
str(os.environ[
'COMPILER_PATH'])
214 job.cmds += [
"source "+gccpath+
"/setup.sh" ]
215 job.cmds += [
"export PATH="+openmpi_path+
":$PATH"]
216 job.cmds += [
"export LHAPATH=/cvmfs/sft.cern.ch/lcg/external/lhapdfsets/current:/cvmfs/atlas.cern.ch/repo/sw/Generators/lhapdfsets/current/"]
217 job.cmds += [
"export OPAL_PREFIX="+opal_prefix]
218 job.cmds += [
"export LD_LIBRARY_PATH="+ld_library_path+
":" \
219 +sftbase+
"/zlib/*/${LCG_PLATFORM}/lib:" \
220 +sftbase+
"/sqlite/*/${LCG_PLATFORM}/lib:" \
221 +sftbase+
"/HepMC/*/${LCG_PLATFORM}/lib:" \
222 +sftlayer+
"/MCGenerators/lhapdf/*/${LCG_PLATFORM}/lib:" \
223 +sftlayer+
"/fastjet/*/${LCG_PLATFORM}/lib:" \
224 +olpath+
"/lib:"+olpath+
"/proclib:" \
225 +options.sherpaInstallPath+
"/lib64/SHERPA-MC:" \
226 +options.sherpaInstallPath+
"/lib/SHERPA-MC:$LD_LIBRARY_PATH"]
228 cmdLineOpts =
"EVENTS=0 FRAGMENTATION=Off MI_HANDLER=None"
229 if os.environ[
"SHERPAVER"].startswith(
'2.'):
230 cmdLineOpts +=
" BEAM_ENERGY_1="+
str(ecm/2.*1000)+
" BEAM_ENERGY_2="+
str(ecm/2.*1000)
232 cmdLineOpts +=
" \"RUNDATA: [Base.yaml, Sherpa.yaml]\" BEAM_ENERGIES="+
str(ecm/2.*1000)
233 job.cmds += [
"mpirun -n {0} ".
format(
str(targetCores))+options.sherpaInstallPath+
"/bin/Sherpa "+cmdLineOpts]
235 job.write(extraDirs=[options.jobOptionDir[0]])
236 job.submit(dryRun=options.dryRun)