3"""Functionality core of the Generate_tf transform"""
13import os, re, string, subprocess
14import AthenaCommon.AlgSequence
as acas
15import AthenaCommon.AppMgr
as acam
16from AthenaCommon.AthenaCommonFlags
import jobproperties
17from AthenaCommon.AthenaCommonFlags
import athenaCommonFlags
18from AthenaCommon.AthenaCommonFlags
import jobproperties
20from xAODEventInfoCnv.xAODEventInfoCnvConf
import xAODMaker__EventInfoCnvAlg
21acam.athMasterSeq += xAODMaker__EventInfoCnvAlg(xAODKey=
"TMPEvtInfo")
24acam.athMasterSeq += acas.AlgSequence(
"EvgenGenSeq")
25genSeq = acam.athMasterSeq.EvgenGenSeq
26acam.athMasterSeq += acas.AlgSequence(
"EvgenFixSeq")
27fixSeq = acam.athMasterSeq.EvgenFixSeq
28acam.athMasterSeq += acas.AlgSequence(
"EvgenPreFilterSeq")
29prefiltSeq = acam.athMasterSeq.EvgenPreFilterSeq
30acam.athMasterSeq += acas.AlgSequence(
"EvgenTestSeq")
31testSeq = acam.athMasterSeq.EvgenTestSeq
33from EvgenProdTools.LogicalExpressionFilter
import LogicalExpressionFilter
35filtSeq = acam.athMasterSeq.EvgenFilterSeq
36topSeq = acas.AlgSequence()
38topSeq += acas.AlgSequence(
"EvgenPostSeq")
39postSeq = topSeq.EvgenPostSeq
45import AthenaCommon.AtlasUnixGeneratorJob
46include(
"PartPropSvc/PartPropSvc.py")
49from PerfMonComps.PerfMonFlags
import jobproperties
as perfmonjp
50perfmonjp.PerfMonFlags.doFastMonMT =
True
52from RngComps.RngCompsConf
import AthRNGSvc
56jobproperties.AthenaCommonFlags.AllowIgnoreConfigError =
False
59from AthenaCommon.Logging
import logging
60evgenLog = logging.getLogger(
'Gen_tf')
67evgenLog.debug(
"****************** CHECKING EVENT GENERATION ARGS *****************")
68evgenLog.debug(str(runArgs))
69evgenLog.info (
"****************** CHECKING EVENT GENERATION ARGS *****************")
72if not hasattr(runArgs,
"ecmEnergy"):
73 raise RuntimeError(
"No center of mass energy provided.")
75 evgenLog.info(
'ecmEnergy = ' + str(runArgs.ecmEnergy) )
81evgenLog.debug(
"****************** CONFIGURING MATRIX ELEMENT GENERATION *****************")
82evgenLog.info(
"****************** CONFIGURING MATRIX ELEMENT GENERATION *****************")
86from EvgenJobTransforms.EvgenConfig
import evgenConfig
87from GeneratorConfig.GenConfigHelpers
import gens_known, gen_lhef, gens_lhef, gen_sortkey, gens_testhepmc, gens_notune, gen_require_steering
91from EvgenProdTools.EvgenProdToolsConf
import CountHepMC
92if (runArgs.firstEvent <= 0):
93 evgenLog.warning(
"Run argument firstEvent should be > 0")
95svcMgr.EventSelector.FirstEvent = runArgs.firstEvent
99if not hasattr(postSeq,
"CountHepMC"):
100 postSeq +=
CountHepMC(InputEventInfo=
"TMPEvtInfo",
101 OutputEventInfo=
"EventInfo",
102 mcEventWeightsKey=
"")
104postSeq.CountHepMC.FirstEvent = runArgs.firstEvent
105postSeq.CountHepMC.CorrectHepMC =
True
106postSeq.CountHepMC.CorrectEventID =
True
114evgenLog.debug(
"****************** LOADING PRE-INCLUDES AND JOB CONFIG *****************")
115evgenLog.info(
"****************** LOADING PRE-INCLUDES AND JOB CONFIG *****************")
118if hasattr(runArgs,
"preInclude"):
119 for fragment
in runArgs.preInclude:
123if hasattr(runArgs,
"preExec"):
124 evgenLog.info(
"Transform pre-exec")
125 for cmd
in runArgs.preExec:
129def get_immediate_subdirectories(a_dir):
130 return [name
for name
in os.listdir(a_dir)
131 if os.path.isdir(os.path.join(a_dir, name))]
137 if hasattr(runArgs,
"outputTXTFile"): outputTXTFile=runArgs.outputTXTFile
143if len(runArgs.jobConfig) != 1:
144 evgenLog.info(
"runArgs.jobConfig = " + runArgs.jobConfig)
145 evgenLog.error(
"You must supply one and only one jobConfig file argument. It has to start from mc. and end with .py")
148print (
"Using JOBOPTSEARCHPATH (as seen in skeleton) = '%s'" % (os.environ[
"JOBOPTSEARCHPATH"]))
149FIRST_DIR = (os.environ[
'JOBOPTSEARCHPATH']).
split(
":")[0]
151dsid_param = runArgs.jobConfig[0]
152evgenLog.info(
"dsid_param = " + dsid_param)
153dsid = os.path.basename(dsid_param)
154evgenLog.info(
"dsid = " + dsid)
155jofiles = [f
for f
in os.listdir(FIRST_DIR)
if (f.startswith(
'mc')
and f.endswith(
'.py'))]
158 evgenLog.info(
"runArgs.jobConfig wrong " + runArgs.jobConfig)
159 evgenLog.error(
"You must supply one and only one jobOption file in DSID directory. It has to start with mc. and end with .py")
162joparts = (os.path.basename(jofile)).
split(
".")
165if joparts[0].startswith(
"mc")
and all(c
in string.digits
for c
in joparts[0][2:]):
168 if len(joparts) != 3:
169 evgenLog.error(jofile +
" name format is wrong: must be of the form MC<xx>.<physicsShort>.py: please rename.")
173 jo_physshortpart = joparts[1]
174 max_jo_physshort_length = 50
175 if len(jo_physshortpart) > max_jo_physshort_length:
176 evgenLog.error(f
"{jofile} contains a physicsShort field of more than {max_jo_physshort_length} characters: please rename.")
179 jo_physshortparts = jo_physshortpart.split(
"_")
180 if len(jo_physshortparts) < 2:
181 evgenLog.error(jofile +
" has too few physicsShort fields separated by '_': should contain <generators>(_<tune+PDF_if_available>)_<process>. Please rename.")
184 check_jofiles=
"/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/scripts/check_jo_consistency.py"
185 if os.path.exists(check_jofiles):
186 evgenLog.info(
"Checking offical JO file name consistency")
187 include(check_jofiles)
188 check_naming(os.path.basename(jofile))
190 evgenLog.warning(
"check_jo_consistency.py not found, will proceed without JOs consistency check")
194include(
"EvgenJobTransforms/LHEonly.py")
201evgenLog.debug(
"****************** CHECKING EVGEN CONFIGURATION *****************")
202evgenLog.info(
"****************** CHECKING EVGEN CONFIGURATION *****************")
205for opt
in str(evgenConfig).
split(os.linesep):
207evgenLog.info(
".transform = Gen_tf")
210evgenLog.info(
".platform = "+str(os.environ[
'BINARY_TAG']))
215if evgenConfig.obsolete:
216 evgenLog.error(
"JOs or icludes are obsolete, please check them")
219if not evgenConfig.generators:
220 evgenLog.error(
"No entries in evgenConfig.generators: invalid configuration, please check your JO")
223if len(evgenConfig.generators) > len(
set(evgenConfig.generators)):
224 evgenLog.error(
"Duplicate entries in evgenConfig.generators: invalid configuration, please check your JO")
227gennames = sorted(evgenConfig.generators, key=gen_sortkey)
229if joparts[0].startswith(
"MC"):
230 genpart = jo_physshortparts[0]
231 expectedgenpart =
''.join(gennames)
233 expectedgenpart = expectedgenpart.replace(
"HerwigJimmy",
"Herwig")
238 return s.replace(
"Py",
"Pythia").
replace(
"MG",
"MadGraph").
replace(
"Ph",
"Powheg").
replace(
"Hpp",
"Herwigpp").
replace(
"H7",
"Herwig7").
replace(
"Sh",
"Sherpa").
replace(
"Ag",
"Alpgen").
replace(
"EG",
"EvtGen").
replace(
"PG",
"ParticleGun").
replace(
"Gva",
"Geneva")
241 return s.replace(
"Pythia",
"Py").
replace(
"MadGraph",
"MG").
replace(
"Powheg",
"Ph").
replace(
"Herwigpp",
"Hpp").
replace(
"Herwig7",
"H7").
replace(
"Sherpa",
"Sh").
replace(
"Alpgen",
"Ag").
replace(
"EvtGen",
"EG").
replace(
"PG",
"ParticleGun").
replace(
"Geneva",
"Gva")
244 if genpart !=
_norm(expectedgenpart)
and _norm2(genpart) !=
_norm(expectedgenpart):
245 evgenLog.error(
"Expected first part of JO name to be '%s' or '%s', but found '%s'" % (
_norm(expectedgenpart),
_norm(
_short2(expectedgenpart)), genpart))
246 evgenLog.error(
"gennames '%s' " %(expectedgenpart))
251 if not gens_notune(gennames)
and len(jo_physshortparts) < 3:
252 evgenLog.error(jofile +
" with generators " + expectedgenpart +
253 " has too few physicsShort fields separated by '_'." +
254 " It should contain <generators>_<tune+PDF_<process>. Please rename.")
259if gen_require_steering(gennames):
260 if hasattr(runArgs,
"outputEVNTFile")
and not hasattr(runArgs,
"outputEVNT_PreFile"):
261 raise RuntimeError(
"'EvtGen' found in job options name, please set '--steering=afterburn'")
267if hasattr(runArgs,
'inputGeneratorFile')
and ',' in runArgs.inputGeneratorFile: multiInput = runArgs.inputGeneratorFile.count(
',')+1
272if not evgenConfig.nEventsPerJob:
273 evgenLog.info(
'#############################################################')
274 evgenLog.info(
' !!!! no nEventsPerJob set !!! The default 10000 used. !!! ')
275 evgenLog.info(
'#############################################################')
277 evgenLog.info(
' nEventsPerJob set to ' + str(evgenConfig.nEventsPerJob) )
279if evgenConfig.minevents > 0 :
280 raise RuntimeError(
"evgenConfig.minevents is obsolete and should be removed from the JOs")
282if evgenConfig.nEventsPerJob < 1:
283 raise RunTimeError(
"evgenConfig.nEventsPerJob must be at least 1")
285 evgenLog.info(
"evgenConfig.nEventsPerJob = {}, but only {} (dummy) event(s) will be generated by Pythia8 for lhe-only production".format(evgenConfig.nEventsPerJob, postSeq.CountHepMC.RequestedOutput))
289if not evgenConfig.keywords:
290 evgenLog.warning(
"No entries in evgenConfig.keywords: invalid configuration, please check your JO !!")
293if evgenConfig.keywords:
294 from GeneratorConfig.GenConfigHelpers
import checkKeywords
295 checkKeywords(evgenConfig, evgenLog, officialJO)
298if not evgenConfig.categories:
299 evgenLog.warning(
"No entries in evgenConfig.categories: invalid configuration, please check your JO !!")
302if evgenConfig.categories:
305 lkwfile =
"CategoryList.txt"
307 for p
in os.environ[
"DATAPATH"].
split(
":"):
308 lkwpath = os.path.join(p, lkwfile)
309 if os.path.exists(lkwpath):
315 with open(lkwpath,
'r')
as catlist:
317 allowed_list = ast.literal_eval(line)
318 allowed_cat.append(allowed_list)
322 it = iter(evgenConfig.categories)
326 if "L1:" in l2
and "L2:" in l1:
328 print(
"first",l1,
"second",l2)
329 bad_cat.extend([l1, l2])
330 for a1,a2
in allowed_cat:
331 if l1.strip().lower()==a1.strip().lower()
and l2.strip().lower()==a2.strip().lower():
334 msg =
"evgenConfig.categories contains non-standard category: %s. " %
", ".join(bad_cat)
335 msg +=
"Please check the allowed categories list and fix."
340 evgenLog.warning(
"Could not find CategoryList.txt file %s in DATAPATH" % lkwfile)
343dsid = os.path.basename(runArgs.jobConfig[0])
344if not dsid.isdigit():
346svcMgr.EventSelector.RunNumber = int(dsid)
349from GeneratorConfig.Versioning
import generatorsGetInitialVersionedDictionary, generatorsVersionedStringList
350gendict = generatorsGetInitialVersionedDictionary(gennames)
351gennamesvers = generatorsVersionedStringList(gendict)
353import EventInfoMgt.EventInfoMgtInit
354svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"hepmc_version":
"HepMC" + str(os.environ[
'HEPMCVER'])})
355svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"mc_channel_number":str(dsid)})
356svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"lhefGenerator":
'+'.join( filter( gen_lhef, gennames ) ) })
357svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"generators":
'+'.join(gennamesvers)})
358svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"evgenProcess": evgenConfig.process})
359svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"evgenTune": evgenConfig.tune})
360if hasattr( evgenConfig,
"hardPDF" ) : svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"hardPDF": evgenConfig.hardPDF})
361if hasattr( evgenConfig,
"softPDF" ) : svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"softPDF": evgenConfig.softPDF})
362if hasattr( runArgs,
"randomSeed") : svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"randomSeed": str(runArgs.randomSeed)})
363svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"keywords":
", ".join(evgenConfig.keywords).lower()})
366evgenLog.info(
"HepMC version " + str(os.environ[
'HEPMCVER']))
369from PyUtils
import AMITagHelper
370AMITagHelper.SetAMITag(runArgs=runArgs)
373svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"beam_energy": str(int(runArgs.ecmEnergy*Units.GeV/2.0))})
374svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"beam_type":
'collisions'})
378include(
"EvgenJobTransforms/Generate_ecmenergies.py")
381include(
"EvgenJobTransforms/Generate_dsid_ranseed.py")
384if (hasattr( runArgs,
"VERBOSE")
and runArgs.VERBOSE )
or (hasattr( runArgs,
"loglevel")
and runArgs.loglevel ==
"DEBUG")
or (hasattr( runArgs,
"loglevel")
and runArgs.loglevel ==
"VERBOSE"):
385 include(
"EvgenJobTransforms/Generate_debug_level.py")
393 with open(
'/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/common/BlackList_caches.txt')
as bfile:
394 for line
in bfile.readlines():
398 badRelFlav=line.split(
',')[0].
strip()
400 badCache=line.split(
',')[1].
strip()
402 badGens=line.split(
',')[2].
strip()
404 used_gens =
','.join(generatorName)
406 if relFlavour==badRelFlav
and cache==badCache
and re.search(badGens,used_gens)
is not None:
407 if badGens==
"": badGens=
"all generators"
408 isError=relFlavour+
","+cache+
" is blocklisted for " + badGens
414 with open(
'/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/common/PurpleList_generators.txt')
as bfile:
415 for line
in bfile.readlines():
419 purpleRelFlav=line.split(
',')[0].
strip()
421 purpleCache=line.split(
',')[1].
strip()
423 purpleGens=line.split(
',')[2].
strip()
425 purpleProcess=line.split(
',')[3].
strip()
427 used_gens =
','.join(generatorName)
429 if relFlavour==purpleRelFlav
and cache==purpleCache
and re.search(purpleGens,used_gens)
is not None:
430 isError=relFlavour+
","+cache+
" is blocklisted for " + purpleGens +
" if it uses " + purpleProcess
435evgenLog.debug(
"****************** CHECKING RELEASE IS NOT BLACKLISTED *****************")
436rel = os.popen(
"echo $AtlasVersion").
read()
438if os.path.exists(
'/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/common'):
441 if (hasattr( runArgs,
"ignoreBlackList")
and runArgs.ignoreBlackList):
442 evgenLog.warning(
"This run is blocklisted for this generator, please use a different one for production !! "+ errorBL )
444 raise RuntimeError(
"This run is blocklisted for this generator, please use a different one !! "+ errorBL)
448 evgenLog.warning(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
449 evgenLog.warning(
"!!! WARNING !!! "+ errorPL )
450 evgenLog.warning(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
452 msg.waring(
"No access to cvmfs, so blocklisted runs will not be checked")
456svcMgr.TagInfoMgr.ExtraTagValuePairs.update({
"specialConfiguration": evgenConfig.specialConfig})
467if hasattr(runArgs,
"postInclude"):
468 for fragment
in runArgs.postInclude:
471if hasattr(runArgs,
"postExec"):
472 evgenLog.info(
"Transform post-exec")
473 for cmd
in runArgs.postExec:
480acas.dumpMasterSequence()
488evgenLog.debug(
"****************** HANDLING EVGEN INPUT FILES *****************")
489print(
"****************** HANDLING EVGEN INPUT FILES *****************")
492if "McAtNlo" in evgenConfig.generators
and "Herwig" in evgenConfig.generators:
493 datFile =
"inparmMcAtNlo.dat"
494elif "Alpgen" in evgenConfig.generators:
495 datFile =
"inparmAlpGen.dat"
496elif "Protos" in evgenConfig.generators:
497 datFile =
"protos.dat"
498elif "ProtosLHEF" in evgenConfig.generators:
499 datFile =
"protoslhef.dat"
500elif "AcerMC" in evgenConfig.generators:
501 datFile =
"inparmAcerMC.dat"
502elif "CompHep" in evgenConfig.generators:
503 datFile =
"inparmCompHep.dat"
506if "Alpgen" in evgenConfig.generators:
507 eventsFile =
"alpgen.unw_events"
508elif "Protos" in evgenConfig.generators:
509 eventsFile =
"protos.events"
510elif "ProtosLHEF" in evgenConfig.generators:
511 eventsFile =
"protoslhef.events"
512elif "BeamHaloGenerator" in evgenConfig.generators:
513 eventsFile =
"beamhalogen.events"
514elif "HepMCAscii" in evgenConfig.generators:
515 eventsFile =
"events.hepmc"
516elif "ReadMcAscii" in evgenConfig.generators:
517 eventsFile =
"events.hepmc"
518elif gens_lhef(evgenConfig.generators):
520 eventsFile =
"events.lhe"
525 "Return a matching file, provided it is unique"
527 files = glob.glob(pattern)
530 raise RuntimeError(
"No '%s' file found" % pattern)
532 raise RuntimeError(
"More than one '%s' file found" % pattern)
538 if(os.path.exists(outputFile)):
539 print (
"outputFile ",outputFile,
" already exists. Will rename to ",outputFile,
".OLD")
540 os.rename(outputFile,outputFile+
".OLD")
541 output = open(outputFile,
'w')
544 for file
in listOfFiles:
545 cmd =
"grep /event "+file+
" | wc -l"
546 nevents+=int(subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=
True))
548 for file
in listOfFiles:
551 print (
"*** Starting file ",file)
552 for line
in open(file,
"r"):
558 if(
"<event" in line
and inHeader):
560 if(len(holdHeader)<1):
566 elif(
not inHeader
and not (
"</LesHouchesEvents>" in line)):
570 if(
"nevents" in line):
572 tmp = line.split(
"=")
573 line = line.replace(tmp[0],str(nevents))
574 elif(
"numevts" in line):
576 tmp = line.split(
" ")
578 line = line.replace(tmp[1],nnn)
580 output.write(
"</LesHouchesEvents>\n")
584 "Make a symlink safely"
586 if os.path.exists(dstfile)
and not os.path.samefile(dstfile, srcfile):
588 if not os.path.exists(dstfile):
589 evgenLog.info(
"Symlinking %s to %s" % (srcfile, dstfile))
590 os.symlink(srcfile, dstfile)
592 evgenLog.debug(
"Symlinking: %s is already the same as %s" % (dstfile, srcfile))
595if eventsFile
or datFile:
596 if not hasattr(runArgs,
"inputGeneratorFile")
or runArgs.inputGeneratorFile ==
"NONE":
597 raise RuntimeError(
"%s needs input file (argument inputGeneratorFile)" % runArgs.jobConfig)
598 if evgenConfig.inputfilecheck
and not re.search(evgenConfig.inputfilecheck, runArgs.inputGeneratorFile):
599 raise RuntimeError(
"inputGeneratorFile=%s is incompatible with inputfilecheck '%s' in %s" %
600 (runArgs.inputGeneratorFile, evgenConfig.inputfilecheck, runArgs.jobConfig))
602 if ".tar" in os.path.basename(runArgs.inputGeneratorFile):
603 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".tar.")[0]
604 elif ".tgz" in os.path.basename(runArgs.inputGeneratorFile):
605 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".tgz")[0]
606 elif ".gz" in os.path.basename(runArgs.inputGeneratorFile):
607 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".gz")[0]
609 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
"._")[0]
614 myinputfiles = runArgs.inputGeneratorFile
615 genInputFiles = myinputfiles.split(
',')
616 numberOfFiles = len(genInputFiles)
619 if ".tar" in os.path.basename(runArgs.inputGeneratorFile):
620 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".tar.")[0]
621 elif ".tgz" in os.path.basename(runArgs.inputGeneratorFile):
622 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".tgz")[0]
623 elif ".gz" in os.path.basename(runArgs.inputGeneratorFile):
624 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".gz")[0]
626 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
"._")[0]
628 if "events" in inputroot :
629 inputroot = inputroot.replace(
".events",
"")
634 for file
in genInputFiles:
637 if ".tar" in os.path.basename(runArgs.inputGeneratorFile):
638 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".tar.")[0]
639 elif ".tgz" in os.path.basename(runArgs.inputGeneratorFile):
640 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".tgz")[0]
641 elif ".gz" in os.path.basename(runArgs.inputGeneratorFile):
642 inputroot = os.path.basename(runArgs.inputGeneratorFile).
split(
".gz")[0]
644 input0 = os.path.basename(file).
split(
"._")[0]
645 input1 = (os.path.basename(file).
split(
"._")[1]).
split(
".")[0]
646 inputroot = input0+
"._"+input1
649 with open(realEventsFile,
'r')
as f:
650 first_line = f.readline()
651 if(
not (
"LesHouche" in first_line)):
652 raise RuntimeError(
"%s is NOT a LesHouche file" % realEventsFile)
653 allFiles.append(realEventsFile)
657 if hasattr(runArgs,
"inputGeneratorFile")
and runArgs.inputGeneratorFile !=
"NONE":
658 raise RuntimeError(
"inputGeneratorFile arg specified for %s, but generators %s do not require an input file" %
659 (runArgs.jobConfig, str(gennames)))
665if evgenConfig.auxfiles:
667 get_files(evgenConfig.auxfiles, keepDir=
False, errorIfNotFound=
True)
674 if not hasattr(evgenConfig, attr)
or not getattr(evgenConfig, attr):
675 msg =
"evgenConfig attribute '%s' not found." % attr
677 raise RuntimeError(
"Required " + msg)
682with open(eventsFile)
as f:
684 count_ev += line.count(
'/event')
686evgenLog.info(
'Requested output events = '+str(count_ev))
687print(
"MetaData: %s = %s" % (
"Number of produced LHE events ", count_ev))
690 msg = evgenConfig.description
692 msg +=
" " + evgenConfig.notes
693 print(
"MetaData: %s = %s" % (
"physicsComment", msg))
695 print (
"MetaData: %s = %s" % (
"generatorName",
"+".join(gennamesvers)))
697 print (
"MetaData: %s = %s" % (
"physicsProcess", evgenConfig.process))
699 print (
"MetaData: %s = %s" % (
"generatorTune", evgenConfig.tune))
701 print (
"MetaData: %s = %s" % (
"hardPDF", evgenConfig.hardPDF))
703 print (
"MetaData: %s = %s" % (
"softPDF", evgenConfig.softPDF))
705 print (
"MetaData: %s = %s" % (
"nEventsPerJob", evgenConfig.nEventsPerJob))
707 print (
"MetaData: %s = %s" % (
"keywords",
", ".join(evgenConfig.keywords).lower() ))
709 print (
", " +
", ".join(evgenConfig.categories))
716 print (
"MetaData: %s = %s" % (
"specialConfig", evgenConfig.specialConfig))
719 print (
"MetaData: %s = %s" % (
"contactPhysicist",
", ".join(evgenConfig.contact)))
721print (
"MetaData: %s = %s" % (
"randomSeed", str(runArgs.randomSeed)))
727filterNames = [alg.getType()
for alg
in acas.iter_algseq(filtSeq)]
728excludedNames = [
'AthSequencer',
'PyAthena::Alg',
'TestHepMC']
729filterNames = list(
set(filterNames) -
set(excludedNames))
730print (
"MetaData: %s = %s" % (
"genFilterNames",
", ".join(filterNames)))
737from PyJobTransformsCore.runargs
import RunArguments
738runPars = RunArguments()
739runPars.nEventsPerJob = evgenConfig.nEventsPerJob
740runPars.maxeventsstrategy = evgenConfig.maxeventsstrategy
741with open(
"config.pickle",
"wb")
as f:
743 pickle.dump(runPars, f)
750evgenLog.debug(
"****************** STARTING EVENT GENERATION *****************")
751print (
"****************** STARTING EVENT GENERATION *****************")
752print (
"**************************************************************")
753print (
"****************** PLEASE IGNORE THE LOG FROM PYTHIA ************")
754print (
"****************** GENERATION OF ONE PYTHIA EVENT ***************")
755print (
"******************** IS NEEDED TO MAKE *************")
756print (
"****************** THE TRANSFORM WORK ***************************")
757print (
"**************************************************************")
void print(char *figname, TCanvas *c1)
A service to manage multiple RNG streams in thread-safe way.
Count the number of events to pass all algorithms/filters.
std::string replace(std::string s, const std::string &s2, const std::string &s3)
std::vector< std::string > split(const std::string &s, const std::string &t=":")
checkBlockList(relFlavour, cache, generatorName)
Add special config option (extended model info for BSM scenarios)
_checkattr(attr, required=False)
==============================================================
mk_symlink(srcfile, dstfile)
checkPurpleList(relFlavour, cache, generatorName)
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)