Skip to content
Snippets Groups Projects
Commit ff58415f authored by Timothee Theveneaux-Pelzer's avatar Timothee Theveneaux-Pelzer :vulcan:
Browse files

Possibility to run GENtoEVGEN without saving EVNT but saving the yoda file

parent a5c87963
No related branches found
No related tags found
No related merge requests found
...@@ -185,6 +185,9 @@ def getTransform(): ...@@ -185,6 +185,9 @@ def getTransform():
if "--outputEVNTFile" in str(sys.argv[1:]): if "--outputEVNTFile" in str(sys.argv[1:]):
exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoEVGEN.py", inData=["inNULL"], outData=["EVNT", "EVNT_Pre", "TXT" ])) exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoEVGEN.py", inData=["inNULL"], outData=["EVNT", "EVNT_Pre", "TXT" ]))
msg.info("Output EVNT file") msg.info("Output EVNT file")
elif "--outputYODAFile" in str(sys.argv[1:]):
exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoEVGEN.py", inData=["inNULL"], outData=["outNULL", "TXT" ]))
msg.info("Output EVNT file")
elif "--outputTXTFile" in str(sys.argv[1:]): elif "--outputTXTFile" in str(sys.argv[1:]):
exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoTXT.py", inData=["inNULL"], outData=["TXT"])) exeSet.add(EvgenExecutor(name="generate", skeleton="EvgenJobTransforms/skel.GENtoTXT.py", inData=["inNULL"], outData=["TXT"]))
msg.info("Output TXT file") msg.info("Output TXT file")
......
...@@ -81,10 +81,17 @@ if hasattr(runArgs, "inputGenConfFile"): ...@@ -81,10 +81,17 @@ if hasattr(runArgs, "inputGenConfFile"):
if hasattr(runArgs, "inputGeneratorFile"): if hasattr(runArgs, "inputGeneratorFile"):
evgenLog.info("inputGeneratorFile used " + runArgs.inputGeneratorFile) evgenLog.info("inputGeneratorFile used " + runArgs.inputGeneratorFile)
if hasattr(runArgs, "outputYODAFile"):
evgenLog.info("outputYODAFile specified " + runArgs.outputYODAFile)
## Ensure that an output name has been given ## Ensure that an output name has been given
# TODO: Allow generation without writing an output file (if outputEVNTFile is None)? # TODO: Allow generation without writing an output file (if outputEVNTFile is None)?
if not hasattr(runArgs, "outputEVNTFile") and not hasattr(runArgs, "outputEVNT_PreFile"): if not hasattr(runArgs, "outputEVNTFile") and not hasattr(runArgs, "outputEVNT_PreFile"):
raise RuntimeError("No output evgen EVNT or EVNT_Pre file provided.") if hasattr(runArgs, "outputYODAFile"):
evgenLog.info("No outputEVNTFile specified but outputYODAFile is used")
evgenLog.info("Will run GENtoEVGEN without saving the output EVNT file, asuming a valid outputYODAFile will be produced")
else:
raise RuntimeError("No output evgen EVNT or EVNT_Pre file provided.")
## Ensure that mandatory args have been supplied (complain before processing the includes) ## Ensure that mandatory args have been supplied (complain before processing the includes)
if not hasattr(runArgs, "ecmEnergy"): if not hasattr(runArgs, "ecmEnergy"):
...@@ -169,6 +176,8 @@ if hasattr(runArgs, "rivetAnas"): ...@@ -169,6 +176,8 @@ if hasattr(runArgs, "rivetAnas"):
anaSeq += Rivet_i() anaSeq += Rivet_i()
anaSeq.Rivet_i.Analyses = runArgs.rivetAnas anaSeq.Rivet_i.Analyses = runArgs.rivetAnas
anaSeq.Rivet_i.DoRootHistos = True anaSeq.Rivet_i.DoRootHistos = True
if hasattr(runArgs, "outputYODAFile"):
anaSeq.Rivet_i.HistoFile = runArgs.outputYODAFile
##============================================================== ##==============================================================
## Pre- and main config parsing ## Pre- and main config parsing
...@@ -456,34 +465,35 @@ if evgenConfig.categories: ...@@ -456,34 +465,35 @@ if evgenConfig.categories:
else: else:
evgenLog.warning("Could not find CategoryList.txt file %s in $JOBOPTSEARCHPATH" % lkwfile) evgenLog.warning("Could not find CategoryList.txt file %s in $JOBOPTSEARCHPATH" % lkwfile)
## Configure POOL streaming to the output EVNT format file if hasattr( runArgs, "outputEVNTFile") or hasattr( runArgs, "outputEVNT_PreFile"):
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream ## Configure POOL streaming to the output EVNT format file
from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
#from PoolSvc.PoolSvcConf import PoolSvc from AthenaPoolCnvSvc.AthenaPoolCnvSvcConf import AthenaPoolCnvSvc
svcMgr.AthenaPoolCnvSvc.CommitInterval = 10 #< tweak for MC needs #from PoolSvc.PoolSvcConf import PoolSvc
if hasattr(runArgs, "outputEVNTFile"): svcMgr.AthenaPoolCnvSvc.CommitInterval = 10 #< tweak for MC needs
poolFile = runArgs.outputEVNTFile if hasattr(runArgs, "outputEVNTFile"):
elif hasattr(runArgs, "outputEVNT_PreFile"): poolFile = runArgs.outputEVNTFile
poolFile = runArgs.outputEVNT_PreFile elif hasattr(runArgs, "outputEVNT_PreFile"):
else: poolFile = runArgs.outputEVNT_PreFile
raise RuntimeError("Output pool file, either EVNT or EVNT_Pre, is not known.") else:
raise RuntimeError("Output pool file, either EVNT or EVNT_Pre, is not known.")
#StreamEVGEN = AthenaPoolOutputStream("StreamEVGEN", runArgs.outputEVNTFile) #StreamEVGEN = AthenaPoolOutputStream("StreamEVGEN", runArgs.outputEVNTFile)
StreamEVGEN = AthenaPoolOutputStream("StreamEVGEN", poolFile) StreamEVGEN = AthenaPoolOutputStream("StreamEVGEN", poolFile)
StreamEVGEN.ForceRead = True StreamEVGEN.ForceRead = True
StreamEVGEN.ItemList += ["EventInfo#*", "McEventCollection#*"] StreamEVGEN.ItemList += ["EventInfo#*", "McEventCollection#*"]
StreamEVGEN.RequireAlgs += ["EvgenFilterSeq"] StreamEVGEN.RequireAlgs += ["EvgenFilterSeq"]
## Used for pile-up (remove dynamic variables except flavour labels) ## Used for pile-up (remove dynamic variables except flavour labels)
if evgenConfig.saveJets: if evgenConfig.saveJets:
StreamEVGEN.ItemList += ["xAOD::JetContainer_v1#*"] StreamEVGEN.ItemList += ["xAOD::JetContainer_v1#*"]
StreamEVGEN.ItemList += ["xAOD::JetAuxContainer_v1#*.TruthLabelID.PartonTruthLabelID"] StreamEVGEN.ItemList += ["xAOD::JetAuxContainer_v1#*.TruthLabelID.PartonTruthLabelID"]
# Remove any requested items from the ItemList so as not to write out # Remove any requested items from the ItemList so as not to write out
for removeItem in evgenConfig.doNotSaveItems: StreamEVGEN.ItemList.remove( removeItem ) for removeItem in evgenConfig.doNotSaveItems: StreamEVGEN.ItemList.remove( removeItem )
# Allow (re-)addition to the output stream # Allow (re-)addition to the output stream
for addItem in evgenConfig.extraSaveItems: StreamEVGEN.ItemList += [ addItem ] for addItem in evgenConfig.extraSaveItems: StreamEVGEN.ItemList += [ addItem ]
## Set the run numbers ## Set the run numbers
dsid = os.path.basename(runArgs.jobConfig[0]) dsid = os.path.basename(runArgs.jobConfig[0])
......
...@@ -67,7 +67,7 @@ class PowhegControl(object): ...@@ -67,7 +67,7 @@ class PowhegControl(object):
if hasattr(run_args, "ecmEnergy"): if hasattr(run_args, "ecmEnergy"):
process_kwargs["beam_energy"] = 0.5 * run_args.ecmEnergy process_kwargs["beam_energy"] = 0.5 * run_args.ecmEnergy
if hasattr(run_args, "maxEvents") and run_args.maxEvents > 0: if hasattr(run_args, "maxEvents") and run_args.maxEvents > 0:
if hasattr(run_args, "outputEVNTFile"): if hasattr(run_args, "outputEVNTFile") or hasattr(run_args, "outputYODAFile"):
process_kwargs["nEvents"] = int(1.1 * run_args.maxEvents + 0.5) process_kwargs["nEvents"] = int(1.1 * run_args.maxEvents + 0.5)
else:# default nEvents value is maxEvents for lhe-only production else:# default nEvents value is maxEvents for lhe-only production
process_kwargs["nEvents"] = run_args.maxEvents process_kwargs["nEvents"] = run_args.maxEvents
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment