Skip to content
Snippets Groups Projects
Commit bd538bf5 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'master_TruthDerivationLastChunk' into 'master'

Enabling truth jets in TRUTH derivations

See merge request atlas/athena!38141
parents 78aa88b9 65125658
No related branches found
No related tags found
No related merge requests found
...@@ -59,6 +59,8 @@ def simplePJGetter(Label, InputContainer): ...@@ -59,6 +59,8 @@ def simplePJGetter(Label, InputContainer):
# Helper for adding truth jet collections # Helper for adding truth jet collections
def addTruthJets(kernel=None, decorationDressing=None): def addTruthJets(kernel=None, decorationDressing=None):
if not dfInputIsEVNT:
return
# Ensure that we are adding it to something, and that we haven't run it already # Ensure that we are adding it to something, and that we haven't run it already
if kernel is None: if kernel is None:
from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob from DerivationFrameworkCore.DerivationFrameworkMaster import DerivationFrameworkJob
...@@ -74,33 +76,34 @@ def addTruthJets(kernel=None, decorationDressing=None): ...@@ -74,33 +76,34 @@ def addTruthJets(kernel=None, decorationDressing=None):
# Set up the copy truth jet particle algorithms # Set up the copy truth jet particle algorithms
from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles from ParticleJetTools.ParticleJetToolsConf import CopyTruthJetParticles
ToolSvc += CopyTruthJetParticles("truthpartcopy", ToolSvc += CopyTruthJetParticles("TruthPartCopy",
OutputName="JetInputTruthParticles", OutputName="JetInputTruthParticles",
MCTruthClassifier=ToolSvc.DFCommonTruthClassifier,BarCodeFromMetadata=barCodeFromMetadata) MCTruthClassifier=ToolSvc.DFCommonTruthClassifier,BarCodeFromMetadata=barCodeFromMetadata)
ToolSvc += CopyTruthJetParticles("truthpartcopywz", ToolSvc += CopyTruthJetParticles("TruthPartCopyWZ",
OutputName="JetInputTruthParticlesNoWZ", OutputName="JetInputTruthParticlesNoWZ",
MCTruthClassifier=ToolSvc.DFCommonTruthClassifier,BarCodeFromMetadata=barCodeFromMetadata, MCTruthClassifier=ToolSvc.DFCommonTruthClassifier,BarCodeFromMetadata=barCodeFromMetadata,
IncludePromptLeptons=False) IncludePromptLeptons=False)
ToolSvc += CopyTruthJetParticles("truthpartcopydressedwz", ToolSvc += CopyTruthJetParticles("TruthPartCopyDressedWZ",
OutputName="JetInputTruthParticlesDressedWZ", OutputName="JetInputTruthParticlesDressedWZ",
MCTruthClassifier=ToolSvc.DFCommonTruthClassifier, MCTruthClassifier=ToolSvc.DFCommonTruthClassifier,
IncludePromptLeptons=False,IncludePromptPhotons=False, IncludePromptLeptons=False,IncludePromptPhotons=False,
IncludeMuons=True,IncludeNeutrinos=True,BarCodeFromMetadata=barCodeFromMetadata, IncludeMuons=True,IncludeNeutrinos=True,BarCodeFromMetadata=barCodeFromMetadata,
FSRPhotonCone=-1., DressingDecorationName=decorationDressing) FSRPhotonCone=-1., DressingDecorationName=decorationDressing)
ToolSvc += CopyTruthJetParticles("truthpartcopycharged", OutputName="JetInputTruthParticlesCharged", ToolSvc += CopyTruthJetParticles("TruthPartCopyCharged", OutputName="JetInputTruthParticlesCharged",
MCTruthClassifier=ToolSvc.DFCommonTruthClassifier, MCTruthClassifier=ToolSvc.DFCommonTruthClassifier,
ChargedParticlesOnly=True, ChargedParticlesOnly=True,
BarCodeFromMetadata=barCodeFromMetadata) BarCodeFromMetadata=barCodeFromMetadata)
from JetRec import JetRecConf from JetRec import JetRecConf
kernel += JetRecConf.JetAlgorithm("MCTruthCommonJetTruthCopyAlg", kernel += JetRecConf.JetAlgorithm("MCTruthCommonJetTruthCopyAlg",
Tools=[ToolSvc.truthpartcopy,ToolSvc.truthpartcopywz,ToolSvc.truthpartcopydressedwz,ToolSvc.truthpartcopycharged]) Tools=[ToolSvc.TruthPartCopy,ToolSvc.TruthPartCopyWZ,
ToolSvc.TruthPartCopyDressedWZ,ToolSvc.TruthPartCopyCharged])
# Set up pseudo-jet getters # Set up pseudo-jet getters
from JetRec import JetRecConf from JetRec import JetRecConf
kernel += simplePJGetter( Label = "Truth", InputContainer = ToolSvc.truthpartcopy.OutputName ) kernel += simplePJGetter( Label = "Truth", InputContainer = ToolSvc.TruthPartCopy.OutputName )
kernel += simplePJGetter( Label = "TruthWZ", InputContainer = ToolSvc.truthpartcopywz.OutputName ) kernel += simplePJGetter( Label = "TruthWZ", InputContainer = ToolSvc.TruthPartCopyWZ.OutputName )
kernel += simplePJGetter( Label = "TruthDressedWZ", InputContainer = ToolSvc.truthpartcopydressedwz.OutputName ) kernel += simplePJGetter( Label = "TruthDressedWZ", InputContainer = ToolSvc.TruthPartCopyDressedWZ.OutputName )
kernel += simplePJGetter( Label = "TruthCharged", InputContainer = ToolSvc.truthpartcopycharged.OutputName ) kernel += simplePJGetter( Label = "TruthCharged", InputContainer = ToolSvc.TruthPartCopyCharged.OutputName )
# Set up the jet builder (no area moments) # Set up the jet builder (no area moments)
from AthenaCommon import CfgMgr from AthenaCommon import CfgMgr
...@@ -204,11 +207,15 @@ def addTruthJets(kernel=None, decorationDressing=None): ...@@ -204,11 +207,15 @@ def addTruthJets(kernel=None, decorationDressing=None):
GhostArea = 0.01, GhostArea = 0.01,
PtMin = threshold PtMin = threshold
) )
from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorrelatorTool
DFCommon_EnCorr = EnergyCorrelatorTool("DFCommon_EnCorr", Beta = 1.0)
from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import NSubjettinessTool
DFCommon_NSubjettiness = NSubjettinessTool("DFCommon_NSubjettiness",Alpha = 1.0)
AntiKt10TruthSoftDropBeta100Zcut10JetsRec = CfgMgr.JetRecTool("AntiKt10TruthSoftDropBeta100Zcut10JetsRec", AntiKt10TruthSoftDropBeta100Zcut10JetsRec = CfgMgr.JetRecTool("AntiKt10TruthSoftDropBeta100Zcut10JetsRec",
JetGroomer = groomer, JetGroomer = groomer,
InputPseudoJets = [kernel.TruthGet.OutputContainer], InputPseudoJets = [kernel.TruthGet.OutputContainer],
OutputContainer = "AntiKt10TruthSoftDropBeta100Zcut10Jets", OutputContainer = "AntiKt10TruthSoftDropBeta100Zcut10Jets",
JetModifiers = [ToolSvc.partontruthlabel], JetModifiers = [ToolSvc.partontruthlabel,DFCommon_EnCorr,DFCommon_NSubjettiness],
JetFinder = AntiKt10TruthSoftDropBeta100Zcut10JetsFinder) JetFinder = AntiKt10TruthSoftDropBeta100Zcut10JetsFinder)
kernel += CfgMgr.JetAlgorithm("AntiKt10TruthSoftDropBeta100Zcut10JetsAlg",Tools=[AntiKt10TruthSoftDropBeta100Zcut10JetsRec]) kernel += CfgMgr.JetAlgorithm("AntiKt10TruthSoftDropBeta100Zcut10JetsAlg",Tools=[AntiKt10TruthSoftDropBeta100Zcut10JetsRec])
...@@ -282,20 +289,15 @@ def schedulePostJetMCTruthAugmentations(kernel=None, decorationDressing=None): ...@@ -282,20 +289,15 @@ def schedulePostJetMCTruthAugmentations(kernel=None, decorationDressing=None):
augmentationToolsList = [ dfTruth.DFCommonTruthTauDressingTool ] augmentationToolsList = [ dfTruth.DFCommonTruthTauDressingTool ]
#Save the post-shower HT and MET filter values that will make combining filtered samples easier (adds to the EventInfo) #Save the post-shower HT and MET filter values that will make combining filtered samples easier (adds to the EventInfo)
#from DerivationFrameworkMCTruth.GenFilterToolSetup import DFCommonTruthGenFilter if dfInputIsEVNT:
from DerivationFrameworkMCTruth.GenFilterToolSetup import DFCommonTruthGenFilter
# schedule the special truth building tools and add them to a common augmentation; note taus are handled separately below
#from DerivationFrameworkMCTruth.TruthDerivationTools import DFCommonTruthQGLabelTool # schedule the special truth building tools and add them to a common augmentation; note taus are handled separately below
#augmentationToolsList += [ DFCommonTruthGenFilter, #from DerivationFrameworkMCTruth.TruthDerivationTools import DFCommonTruthDressedWZQGLabelTool
# DFCommonTruthQGLabelTool] augmentationToolsList += [ DFCommonTruthGenFilter ]
augmentationToolsList = [] #DFCommonTruthDressedWZQGLabelTool] - missing decoration from FTAG
#if decorationDressing is not None: else:
# from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthQGDecorationTool augmentationToolsList = []
# DFCommonTruthDressedWZQGLabelTool = DerivationFramework__TruthQGDecorationTool(name="DFCommonTruthDressedWZQGLabelTool",
# JetCollection = "AntiKt4TruthDressedWZJets")
# from AthenaCommon.AppMgr import ToolSvc
# ToolSvc += DFCommonTruthDressedWZQGLabelTool
# augmentationToolsList += [ DFCommonTruthDressedWZQGLabelTool ]
# SUSY signal decorations # SUSY signal decorations
from DerivationFrameworkSUSY.DecorateSUSYProcess import IsSUSYSignal from DerivationFrameworkSUSY.DecorateSUSYProcess import IsSUSYSignal
if IsSUSYSignal(): if IsSUSYSignal():
...@@ -323,7 +325,7 @@ def addStandardTruthContents(kernel=None, ...@@ -323,7 +325,7 @@ def addStandardTruthContents(kernel=None,
from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AppMgr import ToolSvc
ToolSvc.DFCommonTruthTauDressingTool.decorationName=decorationDressing ToolSvc.DFCommonTruthTauDressingTool.decorationName=decorationDressing
# Jets and MET # Jets and MET
#addTruthJets(kernel, decorationDressing) addTruthJets(kernel, decorationDressing)
addTruthMET(kernel) addTruthMET(kernel)
# Tools that must come after jets # Tools that must come after jets
schedulePostJetMCTruthAugmentations(kernel, decorationDressing) schedulePostJetMCTruthAugmentations(kernel, decorationDressing)
...@@ -331,7 +333,8 @@ def addStandardTruthContents(kernel=None, ...@@ -331,7 +333,8 @@ def addStandardTruthContents(kernel=None,
addTruthCollectionNavigationDecorations(kernel, ["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix=prefix) addTruthCollectionNavigationDecorations(kernel, ["TruthElectrons", "TruthMuons", "TruthPhotons", "TruthTaus", "TruthNeutrinos", "TruthBSM", "TruthBottom", "TruthTop", "TruthBoson"], prefix=prefix)
# Some more additions for standard TRUTH3 # Some more additions for standard TRUTH3
addBosonsAndDownstreamParticles(kernel) addBosonsAndDownstreamParticles(kernel)
#addLargeRJetD2(kernel) if dfInputIsEVNT:
addLargeRJetD2(kernel)
# Special collection for BSM particles # Special collection for BSM particles
addBSMAndDownstreamParticles(kernel) addBSMAndDownstreamParticles(kernel)
# Special collection for Born leptons # Special collection for Born leptons
...@@ -339,7 +342,8 @@ def addStandardTruthContents(kernel=None, ...@@ -339,7 +342,8 @@ def addStandardTruthContents(kernel=None,
# Special collection for hard scatter (matrix element) - save TWO extra generations of particles # Special collection for hard scatter (matrix element) - save TWO extra generations of particles
addHardScatterCollection(kernel,2) addHardScatterCollection(kernel,2)
# Energy density for isolation corrections # Energy density for isolation corrections
#addTruthEnergyDensity(kernel) if dfInputIsEVNT:
addTruthEnergyDensity(kernel)
def addParentAndDownstreamParticles(kernel=None, def addParentAndDownstreamParticles(kernel=None,
...@@ -580,6 +584,8 @@ def addTruthEnergyDensity(kernel=None): ...@@ -580,6 +584,8 @@ def addTruthEnergyDensity(kernel=None):
AbsRapidityMax = 1.5, AbsRapidityMax = 1.5,
OutputContainer = "TruthIsoCentralEventShape", OutputContainer = "TruthIsoCentralEventShape",
) )
# Note the helper function mangles the naming in a specific way that is not sufficiently general
DFCommonTruthCentralEDTool.InputContainer = kernel.TruthGet.OutputContainer
ToolSvc += DFCommonTruthCentralEDTool ToolSvc += DFCommonTruthCentralEDTool
kernel += EventDensityAthAlg("DFCommonTruthCentralEDAlg", EventDensityTool = DFCommonTruthCentralEDTool ) kernel += EventDensityAthAlg("DFCommonTruthCentralEDAlg", EventDensityTool = DFCommonTruthCentralEDTool )
if not hasattr(ToolSvc,'EDTruthForwardTool'): if not hasattr(ToolSvc,'EDTruthForwardTool'):
...@@ -590,6 +596,8 @@ def addTruthEnergyDensity(kernel=None): ...@@ -590,6 +596,8 @@ def addTruthEnergyDensity(kernel=None):
AbsRapidityMax = 3.0, AbsRapidityMax = 3.0,
OutputContainer = "TruthIsoForwardEventShape", OutputContainer = "TruthIsoForwardEventShape",
) )
# Note the helper function mangles the naming in a specific way that is not sufficiently general
DFCommonTruthForwardEDTool.InputContainer = kernel.TruthGet.OutputContainer
ToolSvc += DFCommonTruthForwardEDTool ToolSvc += DFCommonTruthForwardEDTool
kernel += EventDensityAthAlg("DFCommonTruthForwardEDAlg", EventDensityTool = DFCommonTruthForwardEDTool ) kernel += EventDensityAthAlg("DFCommonTruthForwardEDAlg", EventDensityTool = DFCommonTruthForwardEDTool )
......
...@@ -198,6 +198,6 @@ DFCommonTruthPhotonIsolationTool3 = DerivationFramework__TruthIsolationTool(name ...@@ -198,6 +198,6 @@ DFCommonTruthPhotonIsolationTool3 = DerivationFramework__TruthIsolationTool(name
ToolSvc += DFCommonTruthPhotonIsolationTool3 ToolSvc += DFCommonTruthPhotonIsolationTool3
# Quark/gluon decoration for jets # Quark/gluon decoration for jets
from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthQGDecorationTool from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__TruthQGDecorationTool
DFCommonTruthQGLabelTool = DerivationFramework__TruthQGDecorationTool(name="DFCommonTruthQGLabelTool", DFCommonTruthDressedWZQGLabelTool = DerivationFramework__TruthQGDecorationTool(name="DFCommonTruthDressedWZQGLabelTool",
JetCollection = "AntiKt4TruthDressedWZJets") JetCollection = "AntiKt4TruthDressedWZJets")
ToolSvc += DFCommonTruthQGLabelTool ToolSvc += DFCommonTruthDressedWZQGLabelTool
...@@ -39,11 +39,14 @@ StatusCode DerivationFramework::TruthQGDecorationTool::addBranches() const ...@@ -39,11 +39,14 @@ StatusCode DerivationFramework::TruthQGDecorationTool::addBranches() const
SG::AuxElement::Decorator<int> output_decorator(m_decOutput); SG::AuxElement::Decorator<int> output_decorator(m_decOutput);
for (auto ajet : *inputJets){ for (auto ajet : *inputJets){
if (!ajet->isAvailable<int>("PartonTruthLabelID") || if (!ajet->isAvailable<int>("PartonTruthLabelID") ){
!ajet->isAvailable<int>("HadronConeExclTruthLabelID")){ ATH_MSG_ERROR("Did not have input PartonTruthLabelID decorations available");
ATH_MSG_ERROR("Did not have input decorations available");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} // Now we have the input decorations }
else if (!ajet->isAvailable<int>("HadronConeExclTruthLabelID") ){
ATH_MSG_ERROR("Did not have input HadronConeExclTruthLabelID decorations available");
return StatusCode::FAILURE;
} // Now we have the input decorations
/* Agreement from the HF-tagging and Jet/MET group: /* Agreement from the HF-tagging and Jet/MET group:
- If it is non-zero, use the label from the HF-tagging group (b, c, tau) - If it is non-zero, use the label from the HF-tagging group (b, c, tau)
- If it is zero, use the label from the Jet/MET group (q/g) - If it is zero, use the label from the Jet/MET group (q/g)
......
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