Verified Commit 5d8621c9 authored by Tadej Novak's avatar Tadej Novak
Browse files

Handle xAOD::EventInfo in HITS merge and giltering

parent cff050b2
Pipeline #3839090 passed with stage
in 0 seconds
......@@ -8,14 +8,21 @@ def getStreamHITS_ItemList(ConfigFlags):
#--------------------------------------------------------------
# Specify collections for output HIT files, as not all are required.
#--------------------------------------------------------------
ItemList = ["EventInfo#*",
"McEventCollection#TruthEvent", # mc truth (hepmc)
ItemList = ["McEventCollection#TruthEvent", # mc truth (hepmc)
"TrackRecordCollection#MuonEntryLayer", # others not used in pileup
"xAOD::JetContainer#*",
"xAOD::JetAuxContainer#*",
"xAOD::TruthParticleContainer#TruthPileupParticles",
"xAOD::TruthParticleAuxContainer#TruthPileupParticlesAux."]
if "xAOD::EventInfo#EventInfo" in ConfigFlags.Input.TypedCollections:
ItemList += ["xAOD::EventInfo#EventInfo",
"xAOD::EventAuxInfo#EventInfoAux.",
"xAOD::EventInfoContainer#*",
"xAOD::EventInfoAuxContainer#*"]
else:
ItemList += ["EventInfo#*"]
#PLR
if ConfigFlags.Detector.EnablePLR:
ItemList += ["SiHitCollection#PLRHits"]
......@@ -205,7 +212,7 @@ def fromRunArgs(runArgs):
cfg.merge(sTGC_HitsTruthRelinkCfg(ConfigFlags))
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
cfg.merge( OutputStreamCfg(ConfigFlags,"HITS", ItemList=getStreamHITS_ItemList(ConfigFlags), disableEventTag=True) )
cfg.merge( OutputStreamCfg(ConfigFlags,"HITS", ItemList=getStreamHITS_ItemList(ConfigFlags), disableEventTag="xAOD::EventInfo#EventInfo" not in ConfigFlags.Input.TypedCollections) )
# Post-include
processPostInclude(runArgs, ConfigFlags, cfg)
......
......@@ -66,7 +66,7 @@ def fromRunArgs(runArgs):
cfg.merge(TileGMCfg(ConfigFlags))
from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
cfg.merge(OutputStreamCfg(ConfigFlags, 'HITS', disableEventTag=True))
cfg.merge(OutputStreamCfg(ConfigFlags, 'HITS', disableEventTag="xAOD::EventInfo#EventInfo" not in ConfigFlags.Input.TypedCollections))
cfg.getEventAlgo('OutputStreamHITS').TakeItemsFromInput = True
# Post-include
......
......@@ -35,6 +35,8 @@ def HitsFilePeeker(runArgs, skeletonLog):
peekInfo["AntiKt4TruthJetsPresent"] = False
peekInfo["AntiKt6TruthJetsPresent"] = False
peekInfo["PileUpTruthParticlesPresent"] = False
peekInfo["xAODEventInfoPresent"] = False
from PyUtils.MetaReader import read_metadata
try:
input_file = getHITSFile(runArgs)
......@@ -91,6 +93,8 @@ def HitsFilePeeker(runArgs, skeletonLog):
peekInfo["AntiKt6TruthJetsPresent"] = True
if 'TruthPileupParticles' == entry[1]:
peekInfo["PileUpTruthParticlesPresent"] = True
if 'xAOD::EventInfo' == entry[0]:
peekInfo["xAODEventInfoPresent"] = True
from AthenaCommon.GlobalFlags import globalflags
globalflags.DataSource="geant4"
......
......@@ -113,11 +113,12 @@ elif hasattr(runArgs,"outputHitsFile"):
athenaCommonFlags.PoolHitsOutput=runArgs.outputHitsFile
else:
raise RuntimeError("No outputHitsFile provided.")
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
try:
Stream1 = AthenaPoolOutputStream( "StreamHITS", athenaCommonFlags.PoolHitsOutput(), noTag=True )
Stream1 = AthenaPoolOutputStream( "StreamHITS", athenaCommonFlags.PoolHitsOutput(), noTag=not peekInfo["xAODEventInfoPresent"] )
except:
Stream1 = AthenaPoolOutputStream( "StreamHITS", "DidNotSetOutputName.root", noTag=True )
Stream1 = AthenaPoolOutputStream( "StreamHITS", "DidNotSetOutputName.root", noTag=not peekInfo["xAODEventInfoPresent"] )
# The next line is an example on how to exclude clid's if they are causing a problem
#Stream1.ExcludeList = ['6421#*']
......@@ -133,13 +134,21 @@ ServiceMgr.AthenaPoolCnvSvc.PoolAttributes += [ pah.setTreeAutoFlush( Stream1.Ou
#--------------------------------------------------------------
#Truth
Stream1.ItemList=["EventInfo#*",
"McEventCollection#TruthEvent", # mc truth (hepmc)
Stream1.ItemList=["McEventCollection#TruthEvent", # mc truth (hepmc)
"JetCollection#*", # Truth jets reconstructed (optionally) during evgen
"TrackRecordCollection#MuonEntryLayer"] # others not used in pileup
# "TrackRecordCollection#MuonExitLayer", # not used in pileup
# "TrackRecordCollection#CaloEntryLayer"] # not used in pileup
# event info
if not peekInfo["xAODEventInfoPresent"]:
Stream1.ItemList += ["EventInfo#*"]
else:
Stream1.ItemList += ["xAOD::EventInfo#EventInfo",
"xAOD::EventAuxInfo#EventInfoAux.",
"xAOD::EventInfoContainer#*",
"xAOD::EventInfoAuxContainer#*"]
# Deal with "new" truth jet collections properly
from PyJobTransforms.trfUtils import releaseIsOlderThan
if releaseIsOlderThan(20,0):
......
......@@ -37,7 +37,8 @@ if not hasattr(runArgs,"inputHITSFile"):
raise RuntimeError("No inputHITSFile provided.")
from SimuJobTransforms.HitsFilePeeker import HitsFilePeeker
HitsFilePeeker(runArgs, merHitLog)
peekInfo = HitsFilePeeker(runArgs, merHitLog)
from AthenaCommon.DetFlags import DetFlags
DetFlags.geometry.all_setOff()
......@@ -110,9 +111,9 @@ if not hasattr(runArgs,"outputHITS_MRGFile"):
Out = runArgs.outputHITS_MRGFile
from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream
try:
StreamHITS = AthenaPoolOutputStream( "StreamHITS", Out, True, noTag=True )
StreamHITS = AthenaPoolOutputStream( "StreamHITS", Out, True, noTag=not peekInfo["xAODEventInfoPresent"] )
except:
StreamHITS = AthenaPoolOutputStream( "StreamHITS", "DidNotSetOutputName.root", True, noTag=True )
StreamHITS = AthenaPoolOutputStream( "StreamHITS", "DidNotSetOutputName.root", True, noTag=not peekInfo["xAODEventInfoPresent"] )
StreamHITS.TakeItemsFromInput=TRUE;
# The next line is an example on how to exclude clid's if they are causing a problem
#StreamHITS.ExcludeList = ['6421#*']
......
......@@ -71,6 +71,7 @@ Digi_tf.py \
--skipEvents 6 \
--geometryVersion ${GEOMETRY} \
--conditionsTag 'OFLCOND-RUN12-SDR-30' \
--postExec 'HITtoRDO:condSeq.TileSamplingFractionCondAlg.G4Version = -1;' \
--DataRunNumber 222525
echo "art-result: $? mergeDigi"
......@@ -82,6 +83,7 @@ Digi_tf.py \
--skipEvents 6 \
--geometryVersion ${GEOMETRY} \
--conditionsTag 'OFLCOND-RUN12-SDR-30' \
--postExec 'HITtoRDO:condSeq.TileSamplingFractionCondAlg.G4Version = -1;' \
--DataRunNumber 222525
echo "art-result: $? unmergeDigi"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment