Commit 1b6e1914 authored by Ewelina Maria Lobodzinska's avatar Ewelina Maria Lobodzinska
Browse files

Merge branch '21.6-truthjetmoments' into '21.6'

Add truth jet labels and save truth jet moments selectively: ATLMCPROD-8646

See merge request !35082
parents ed71fe21 1e27d3b5
......@@ -396,8 +396,9 @@ StreamEVGEN.ItemList += ["EventInfo#*", "McEventCollection#*"]
StreamEVGEN.RequireAlgs += ["EvgenFilterSeq"]
## Used for pile-up (remove dynamic variables except flavour labels)
if evgenConfig.saveJets:
StreamEVGEN.ItemList += ["xAOD::JetContainer#*"]
StreamEVGEN.ItemList += ["xAOD::JetAuxContainer#*.TruthLabelID.PartonTruthLabelID"]
for jetradius in [4,6]:
StreamEVGEN.ItemList += ["xAOD::JetContainer#AntiKt{}TruthJets".format(jetradius)]
StreamEVGEN.ItemList += ["xAOD::JetAuxContainer#AntiKt{}TruthJetsAux.TruthLabelID.PartonTruthLabelID".format(jetradius)]
## Set the run numbers
dsid = os.path.basename(runArgs.jobConfig[0])
......
......@@ -467,8 +467,9 @@ if hasattr( runArgs, "outputEVNTFile") or hasattr( runArgs, "outputEVNT_PreFile"
StreamEVGEN.RequireAlgs += ["EvgenFilterSeq"]
## Used for pile-up (remove dynamic variables except flavour labels)
if evgenConfig.saveJets:
StreamEVGEN.ItemList += ["xAOD::JetContainer#*"]
StreamEVGEN.ItemList += ["xAOD::JetAuxContainer#*.TruthLabelID.PartonTruthLabelID"]
for jetradius in [4,6]:
StreamEVGEN.ItemList += ["xAOD::JetContainer#AntiKt{}TruthJets".format(jetradius)]
StreamEVGEN.ItemList += ["xAOD::JetAuxContainer#AntiKt{}TruthJetsAux.TruthLabelID.PartonTruthLabelID".format(jetradius)]
# Remove any requested items from the ItemList so as not to write out
for removeItem in evgenConfig.doNotSaveItems: StreamEVGEN.ItemList.remove( removeItem )
......
......@@ -30,7 +30,16 @@ def PrepareTruthJetInputs(algseq):
#IncludePromptPhotons=False,
BarCodeFromMetadata=0)
algseq += JetRecConf.JetAlgorithm("JetTruthCopyAlg", Tools=[ToolSvc.truthpartcopy,ToolSvc.truthpartcopywz])
ToolSvc += ParticleJetToolsConf.CopyTruthJetParticles("truthpartcopy",
OutputName="JetInputTruthParticles",
MCTruthClassifier=ToolSvc.JetMCTruthClassifier,
BarCodeFromMetadata=0)
ToolSvc += ParticleJetToolsConf.CopyTruthPartons("truthpartonscopy",
OutputName="TruthLabelPartons",
PtMin=5000)
algseq += JetRecConf.JetAlgorithm("JetTruthCopyAlg", Tools=[ToolSvc.truthpartcopy,ToolSvc.truthpartcopywz,ToolSvc.truthpartonscopy])
def ScheduleAntiKtTruthJets(jetradius,algseq,mods=""):
jetcollname = 'AntiKt{0}{1}TruthJets'.format(int(jetradius*10),mods)
......@@ -60,7 +69,7 @@ def ScheduleAntiKtTruthJets(jetradius,algseq,mods=""):
pjget = ToolSvc.truthwzget
else:
pjget = JetRecConf.PseudoJetGetter("truthwzget",
Label = "Truth",
Label = "TruthWZ",
InputContainer = ToolSvc.truthpartcopywz.OutputName,
OutputContainer = "PseudoJetTruthWZ",
GhostScale = 0.0,
......@@ -85,11 +94,29 @@ def ScheduleAntiKtTruthJets(jetradius,algseq,mods=""):
)
ToolSvc += finder
if "truthpartonget" in ToolSvc:
truthpartonget = ToolSvc.truthpartonget
else:
truthpartonget = JetRecConf.PseudoJetGetter("truthpartonget",
Label = "TruthPartons",
InputContainer = ToolSvc.truthpartonscopy.OutputName,
OutputContainer = "PseudoJetTruthPartons",
GhostScale = 0.0,
SkipNegativeEnergy = True,
)
ToolSvc += truthpartonget
from ParticleJetTools import ParticleJetToolsConf
partontruthlabel = ParticleJetToolsConf.Analysis__JetPartonTruthLabel("partontruthlabel")
ToolSvc += partontruthlabel
#Now we setup a JetRecTool which will use the above JetFinder
jetrectool = JetRecConf.JetRecTool(jetcollname+"Rec",
JetFinder = finder,
PseudoJetGetters = [pjget],
OutputContainer = jetcollname
PseudoJetGetters = [pjget,truthpartonget],
OutputContainer = jetcollname,
JetModifiers = [partontruthlabel]
)
ToolSvc += jetrectool
......
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