Skip to content
Snippets Groups Projects
Commit b6391754 authored by Emmanuel Le Guirriec's avatar Emmanuel Le Guirriec
Browse files

Merge branch 'Fix-HIGG3D1-Runtime-Issues' into '21.2'

Initial fix for HIGG3D1  derivation format

See merge request atlas/athena!13824

Former-commit-id: 3aca0b6f9fed41b6a16a013b4998405be10911c5
parents 9d07a43b 123b2693
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ HIGG3D1ExtraVariables = [ "GSFTrackParticles.z0.vz",
"CaloCalTopoClusters.rawE.rawEta.rawPhi.rawM.calE.calEta.calPhi.calM.e_sampl",
"MuonClusterCollection.eta_sampl.phi_sampl",
"BTagging_AntiKt4EMPFlow.SV1_pb.SV1_pu.IP3D_pb.IP3D_pu.MV2c00_discriminant.MV2c10_discriminant.MV2c20_discriminant.MVb_discriminant.MV1_discriminant.MSV_vertices.MV1c_discriminant.SV0_badTracksIP.SV0_vertices.SV1_badTracksIP.SV1_vertices.BTagTrackToJetAssociator.BTagTrackToJetAssociatorBB.JetFitter_JFvertices.JetFitter_tracksAtPVlinks.MSV_badTracksIP.MV2c100_discriminant.MV2m_pu.MV2m_pc.MV2m_pb",
"AntiKt4EMPFlowJets.btagging.constituentLinks.GhostBHadronsFinal.GhostBHadronsInitial.GhostBQuarksFinal.GhostCHadronsFinal.GhostCHadronsInitial.GhostCQuarksFinal.GhostHBosons.GhostPartons.GhostTQuarksFinal.GhostTausFinal.GhostWBosons.GhostZBosons.GhostTruth.OriginVertex.GhostAntiKt3TrackJet.GhostAntiKt4TrackJet.GhostTrack.HighestJVFVtx.ConeExclBHadronsFinal.ConeExclCHadronsFinal.ConeExclTausFinal.HighestJVFLooseVtx.GhostAntiKt2TrackJet.Jvt.JvtJvfcorr.JvtRpt.SumPtTrkPt500.SumPtTrkPt1000.TrackWidthPt1000.TrackWidthPt500"]
"AntiKt4EMPFlowJets.JetEMScaleMomentum_pt.JetEMScaleMomentum_eta.JetEMScaleMomentum_phi.JetEMScaleMomentum_m.Jvt.JvtJvfcorr.JvtRpt.btagging.constituentLinks.GhostBHadronsFinal.GhostBHadronsInitial.GhostBQuarksFinal.GhostCHadronsFinal.GhostCHadronsInitial.GhostCQuarksFinal.GhostHBosons.GhostPartons.GhostTQuarksFinal.GhostTausFinal.GhostWBosons.GhostZBosons.GhostTruth.OriginVertex.GhostAntiKt3TrackJet.GhostAntiKt4TrackJet.GhostTrack.HighestJVFVtx.ConeExclBHadronsFinal.ConeExclCHadronsFinal.ConeExclTausFinal.HighestJVFLooseVtx.GhostAntiKt2TrackJet.Jvt.JvtJvfcorr.JvtRpt.SumPtTrkPt500.SumPtTrkPt1000.TrackWidthPt1000.TrackWidthPt500"]
HIGG3D1ExtraTruthVariables = [ "Electrons.truthOrigin.truthType.truthParticleLink.bkgTruthType.bkgMotherPdgId.bkgTruthOrigin.bkgTruthParticleLink.firstEgMotherTruthType.firstEgMotherTruthOrigin.firstEgMotherPdgId.firstEgMotherTruthParticleLink",
"AntiKt4LCTopoJets.ConeTruthLabelID.PartonTruthLabelID",
......@@ -31,5 +31,4 @@ HIGG3D1ExtraContainers = [ ]
HIGG3D1ExtraTruthContainers = [ "TruthEvents",
"TruthParticles",
"TruthVertices",
"AntiKt4TruthJets",
"MuonTruthParticles" ]
#********************************************************************
# HIGG3D1.py
# reductionConf flag HIGG3D1 in Reco_tf.py
# HIGG3D1.py
# reductionConf flag HIGG3D1 in Reco_tf.py
#********************************************************************
from DerivationFrameworkCore.DerivationFrameworkMaster import *
......@@ -10,10 +10,12 @@ from DerivationFrameworkJetEtMiss.ExtendedJetCommon import *
from DerivationFrameworkJetEtMiss.METCommon import *
from DerivationFrameworkEGamma.EGammaCommon import *
from DerivationFrameworkMuons.MuonsCommon import *
###from DerivationFrameworkFlavourTag.FlavourTagCommon import *
from DerivationFrameworkFlavourTag.FlavourTagCommon import *
from DerivationFrameworkFlavourTag.HbbCommon import *
from DerivationFrameworkCore.WeightMetadata import *
from JetRec.JetRecStandard import jtm
from DerivationFrameworkHiggs.TruthCategories import *
from AthenaCommon.GlobalFlags import globalflags
......@@ -32,14 +34,17 @@ HIGG3D1ThinningHelper = ThinningHelper( "HIGG3D1ThinningHelper" )
HIGG3D1ThinningHelper.TriggerChains = "HLT_mu.* | HLT_e.* | HLT_2e.* | HLT_2mu.*"
HIGG3D1ThinningHelper.AppendToStream( HIGG3D1Stream )
#================
# THINNING
#================
#====================================================================
# THINNING TOOLS
#====================================================================
thinningTools=[]
# MET/Jet tracks
thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)"
# InDetTrackParticle Thinning
from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning
#MET Track Thinning
thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)"
HIGG3D1MetTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG3D1MetTPThinningTool",
ThinningService = HIGG3D1ThinningHelper.ThinningSvc(),
SelectionString = thinning_expression,
......@@ -48,6 +53,7 @@ HIGG3D1MetTPThinningTool = DerivationFramework__TrackParticleThinning(name
ToolSvc += HIGG3D1MetTPThinningTool
thinningTools.append(HIGG3D1MetTPThinningTool)
#Jet Track Thinning
from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning
HIGG3D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG3D1JetTPThinningTool",
ThinningService = HIGG3D1ThinningHelper.ThinningSvc(),
......@@ -57,13 +63,13 @@ HIGG3D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name
ToolSvc += HIGG3D1JetTPThinningTool
thinningTools.append(HIGG3D1JetTPThinningTool)
# Tracks associated with Muons
from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning
HIGG3D1MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "HIGG3D1MuonTPThinningTool",
ThinningService = HIGG3D1ThinningHelper.ThinningSvc(),
MuonKey = "Muons",
InDetTrackParticlesKey = "InDetTrackParticles")
ToolSvc += HIGG3D1MuonTPThinningTool
thinningTools.append(HIGG3D1MuonTPThinningTool)
......@@ -84,27 +90,6 @@ HIGG3D1TPThinningTool = DerivationFramework__TrackParticleThinning(name
ToolSvc += HIGG3D1TPThinningTool
thinningTools.append(HIGG3D1TPThinningTool)
# Truth particles
truth_cond1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs
truth_cond2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons
truth_cond3 = "(abs(TruthParticles.pdgId) == 6)" # Top quark
truth_cond4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 5*GeV))" # Photon
truth_expression = truth_cond1+' || '+truth_cond2 +' || '+truth_cond3 +' || '+truth_cond4
from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
HIGG3D1TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG3D1TruthThinningTool",
ThinningService = HIGG3D1ThinningHelper.ThinningSvc(),
ParticleSelectionString = truth_expression,
PreserveDescendants = True,
PreserveAncestors = True,
SimBarcodeOffset = DerivationFrameworkSimBarcodeOffset)
if globalflags.DataSource()=='geant4':
ToolSvc += HIGG3D1TruthThinningTool
thinningTools.append(HIGG3D1TruthThinningTool)
# Calo cluster thinning
from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning
from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__JetCaloClusterThinning
......@@ -129,18 +114,43 @@ HIGG3D1MuonCCThinningTool = DerivationFramework__CaloClusterThinning( name
ToolSvc += HIGG3D1MuonCCThinningTool
thinningTools.append(HIGG3D1MuonCCThinningTool)
# Seems to no longer be needed/causes errors
# Calo Clusters associated with AntiKt4EM Jets
HIGG3D1AntiKt4EMCCThinningTool = DerivationFramework__JetCaloClusterThinning(name = "HIGG3D1AntiKt4EMCCThinningTool",
ThinningService = HIGG3D1ThinningHelper.ThinningSvc(),
SGKey = "AntiKt4EMTopoJets",
TopoClCollectionSGKey = "CaloCalTopoClusters",
SelectionString = "AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 15*GeV")
ToolSvc += HIGG3D1AntiKt4EMCCThinningTool
thinningTools.append(HIGG3D1AntiKt4EMCCThinningTool)
#HIGG3D1AntiKt4EMCCThinningTool = DerivationFramework__JetCaloClusterThinning(name = "HIGG3D1AntiKt4EMCCThinningTool",
# ThinningService = HIGG3D1ThinningHelper.ThinningSvc(),
# SGKey = "AntiKt4EMTopoJets",
# TopoClCollectionSGKey = "CaloCalTopoClusters",
# SelectionString = "AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 15*GeV")
#ToolSvc += HIGG3D1AntiKt4EMCCThinningTool
#thinningTools.append(HIGG3D1AntiKt4EMCCThinningTool)
###############################################################
# Truth particles
truth_cond1 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))" # W, Z and Higgs
truth_cond2 = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16))" # Leptons
truth_cond3 = "(abs(TruthParticles.pdgId) == 6)" # Top quark
truth_cond4 = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 5*GeV))" # Photon
truth_cond5 = "((abs(TruthParticles.pdgId) >= 35) && (abs(TruthParticles.pdgId) <= 37))" # BSM Higgs
truth_expression = truth_cond1+' || '+truth_cond2 +' || '+truth_cond3 +' || '+truth_cond4 +' || '+truth_cond5
from DerivationFrameworkMCTruth.DerivationFrameworkMCTruthConf import DerivationFramework__GenericTruthThinning
HIGG3D1TruthThinningTool = DerivationFramework__GenericTruthThinning(name = "HIGG3D1TruthThinningTool",
ThinningService = HIGG3D1ThinningHelper.ThinningSvc(),
ParticleSelectionString = truth_expression,
PreserveDescendants = True,
PreserveAncestors = True,
SimBarcodeOffset = DerivationFrameworkSimBarcodeOffset)
if globalflags.DataSource()=='geant4':
ToolSvc += HIGG3D1TruthThinningTool
thinningTools.append(HIGG3D1TruthThinningTool)
#====================================================================
# SKIMMING TOOL
# SKIMMING TOOL
#====================================================================
electronIDRequirements = '(Electrons.DFCommonElectronsLHVeryLoose)'
electronRequirements = '(Electrons.pt > 7*GeV) && (abs(Electrons.eta) < 2.6) && '+electronIDRequirements
......@@ -150,7 +160,9 @@ leadMuon = muonsRequirements + ' && (Muons.pt > 17*GeV)'
eeSelection = '((count('+electronRequirements+') >= 2) && (count('+leadElectron+') >= 1))'
mmSelection = '((count('+muonsRequirements+') >= 2) && (count('+leadMuon+') >= 1))'
emSelection = '(((count('+electronRequirements+') >= 1) && (count('+muonsRequirements+') >= 1)) && ((count('+leadElectron+') >= 1) || (count('+leadMuon+') >= 1)))'
expression = eeSelection+' || '+mmSelection+' || '+emSelection
from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool
......@@ -164,26 +176,44 @@ higg3d1PreSeq = CfgMgr.AthSequencer("HIGG3d1PreSelectionSequence")
#====================================================================
# RESTORE JET COLLECTIONS REMOVED BETWEEN r20 AND r21
#====================================================================
OutputJets["HIGG3D1"] = ["AntiKt4EMPFlowJets",
"AntiKtVR30Rmax4Rmin02TrackJets"]
reducedJetList = ["AntiKt2PV0TrackJets","AntiKt4PV0TrackJets"]
reducedJetList = ["AntiKt2PV0TrackJets",
"AntiKt4PV0TrackJets",
"AntiKt10LCTopoJets" # Needed for Ghost association
]
if jetFlags.useTruth:
reducedJetList += ["AntiKt4TruthJets", "AntiKt4TruthWZJets"]
replaceAODReducedJets(reducedJetList, higg3d1Seq,"HIGG3D1Jets")
replaceAODReducedJets(reducedJetList, higg3d1Seq,"HIGG3D1")
addDefaultTrimmedJets(higg3d1Seq,"HIGG3D1")
#====================================================================
# Create variable-R trackjets and dress AntiKt10LCTopo with ghost VR-trkjet
#====================================================================
addVRJets(higg3d1Seq)
#addVRJets(higg3d1Seq, "AntiKtVR30Rmax4Rmin02Track", "GhostVR30Rmax4Rmin02TrackJet",
# VRJetAlg="AntiKt", VRJetRadius=0.4, VRJetInputs="pv0track",
# ghostArea = 0 , ptmin = 2000, ptminFilter = 7000,
# variableRMinRadius = 0.02, variableRMassScale = 30000, calibOpt = "none")
#===================================================================
# Run b-tagging
# B-TAGGING
#===================================================================
from BTagging.BTaggingFlags import BTaggingFlags
# alias for VR
# BTaggingFlags.CalibrationChannelAliases += ["AntiKt4EMTopo"]
BTaggingFlags.CalibrationChannelAliases += ["AntiKtVR30Rmax4Rmin02Track->AntiKtVR30Rmax4Rmin02Track,AntiKt4EMTopo"]
#===================================================================
# Hbb tagger
#===================================================================
addHbbTagger(higg3d1Seq, ToolSvc)
from DerivationFrameworkFlavourTag.FlavourTagCommon import FlavorTagInit
# must re-tag AntiKt4LCTopoJets and AntiKt4PV0TrackJets to make JetFitterNN work with corresponding VR jets (nikola: why?)
# also, re-tag R=0.2 track jets
###FlavorTagInit( JetCollections = ["AntiKt4PV0TrackJets", "AntiKt2PV0TrackJets"], Sequencer = higg3d1Seq )
FlavorTagInit( JetCollections = ["AntiKt4PV0TrackJets"], Sequencer = higg3d1Seq )
### add back VR jets !!!!
# Add flavor tagging to the PFlow Jet collections
FlavorTagInit(JetCollections = ['AntiKt4EMPFlowJets'], Sequencer = higg3d1Seq)
#====================================================================
# Add non-prompt lepton tagging
......@@ -192,8 +222,9 @@ FlavorTagInit( JetCollections = ["AntiKt4PV0TrackJets"], Sequencer = higg3d1Seq
import JetTagNonPromptLepton.JetTagNonPromptLeptonConfig as JetTagConfig
higg3d1Seq += JetTagConfig.GetDecoratePromptLeptonAlgs()
#=======================================
# CREATE THE DERIVATION KERNEL ALGORITHM
# CREATE THE DERIVATION KERNEL ALGORITHM
#=======================================
from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel
higg3d1PreSeq += CfgMgr.DerivationFramework__DerivationKernel("HIGG3D1Kernel_skimming",
......@@ -218,13 +249,6 @@ from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
HIGG3D1SlimmingHelper = SlimmingHelper("HIGG3D1SlimmingHelper")
from DerivationFrameworkHiggs.HIGG3D1ExtraContent import *
#HIGG3D1SlimmingHelper.AppendToDictionary = {
# "AntiKtVR30Rmax4Rmin02TrackJets" : "xAOD::JetContainer" ,
# "AntiKtVR30Rmax4Rmin02TrackJetsAux" : "xAOD::JetAuxContainer" ,
# "BTagging_AntiKtVR30Rmax4Rmin02Track" : "xAOD::BTaggingContainer" ,
# "BTagging_AntiKtVR30Rmax4Rmin02TrackAux" : "xAOD::BTaggingAuxContainer",
# }
HIGG3D1SlimmingHelper.SmartCollections = ["Electrons",
"Photons",
"Muons",
......@@ -232,18 +256,28 @@ HIGG3D1SlimmingHelper.SmartCollections = ["Electrons",
"MET_Reference_AntiKt4EMTopo",
"MET_Reference_AntiKt4LCTopo",
"AntiKt4EMTopoJets",
"AntiKt4EMPFlowJets",
"AntiKt4LCTopoJets",
"BTagging_AntiKt4EMTopo",
"BTagging_AntiKt4EMPFlow",
"BTagging_AntiKtVR30Rmax4Rmin02Track",
"InDetTrackParticles",
"PrimaryVertices"]
HIGG3D1SlimmingHelper.ExtraVariables = list(HIGG3D1ExtraVariables)
HIGG3D1SlimmingHelper.AllVariables = list(HIGG3D1ExtraContainers)
HIGG3D1SlimmingHelper.ExtraVariables += JetTagConfig.GetExtraPromptVariablesForDxAOD()
HIGG3D1SlimmingHelper.AppendToDictionary = {'BTagging_AntiKt4EMPFlow':'xAOD::BTaggingContainer',
'BTagging_AntiKt4EMPFlowAux':'xAOD::BTaggingAuxContainer',
'AntiKtVR30Rmax4Rmin02Track':'xAOD::JetContainer',
'AntiKtVR30Rmax4Rmin02TrackAux':'xAOD::JetAuxContainer',
'BTagging_AntiKtVR30Rmax4Rmin02Track':'xAOD::BTaggingContainer',
'BTagging_AntiKtVR30Rmax4Rmin02TrackAux':'xAOD::BTaggingAuxContainer'
}
if globalflags.DataSource()=='geant4':
HIGG3D1SlimmingHelper.AllVariables += list(HIGG3D1ExtraTruthContainers)
HIGG3D1SlimmingHelper.ExtraVariables += list(HIGG3D1ExtraTruthVariables)
HIGG3D1SlimmingHelper.SmartCollections += ["AntiKt4TruthJets",
"AntiKt4TruthWZJets"]
# Add special truth containers
from DerivationFrameworkMCTruth.MCTruthCommon import addStandardTruthContents
......@@ -256,12 +290,27 @@ if globalflags.DataSource()=='geant4':
"xAOD::TruthParticleAuxContainer#TruthPhotonsAux.",
"xAOD::TruthParticleContainer#TruthNeutrinos",
"xAOD::TruthParticleAuxContainer#TruthNeutrinosAux." ]
HIGG3D1SlimmingHelper.AllVariables += list(HIGG3D1ExtraTruthContainers)
HIGG3D1SlimmingHelper.ExtraVariables += list(HIGG3D1ExtraTruthVariables)
# Add Trigger content
HIGG3D1SlimmingHelper.IncludeMuonTriggerContent = True
HIGG3D1SlimmingHelper.IncludeEGammaTriggerContent = True
# Add MET to output stream
addMETOutputs(HIGG3D1SlimmingHelper, ["AntiKt4EMPFlow", "Track"])
addMETOutputs(HIGG3D1SlimmingHelper, ["AntiKt4EMPFlow", "Track"],
["AntiKt4EMPFlow",
"AntiKt4EMTopo"] # smart collections list
)
addJetOutputs(HIGG3D1SlimmingHelper, ["HIGG3D1"],
[], # smart collections list
["AntiKt2PV0TrackJets",
"AntiKt4TruthJets",
"AntiKt4TruthWZJets",
"AntiKt4EMPFlowJets",
"AntiKt10TruthTrimmedPtFrac5SmallR20Jets",
"AntiKt10LCTopoJets",
"AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"] #veto list
)
HIGG3D1SlimmingHelper.AppendContentToStream(HIGG3D1Stream)
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