15 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
16 from AthenaConfiguration.ComponentFactory
import CompFactory
17 from AthenaConfiguration.Enums
import MetadataCategory
18 from AthenaCommon.Logging
import logging
19 logSTDM6 = logging.getLogger(
'STDM6')
25 """Configure the derivation framework driving algorithm (kernel) for STDM6"""
29 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
32 TriggerListsHelper = kwargs[
'TriggerListsHelper'],
33 TauJets_EleRM_in_input = kwargs[
'TauJets_EleRM_in_input']
36 from DerivationFrameworkInDet.InDetToolsConfig
import InDetTrackSelectionToolWrapperCfg
39 name =
"DFJETM1CommonTrackSelectionLoose",
41 DecorationName =
"DFJETM1Loose"))
43 acc.addEventAlgo(CompFactory.DerivationFramework.CommonAugmentation(
"JETM1CommonKernel", AugmentationTools = [DFCommonTrackSelection]))
48 'TrackParticleThinningToolName' :
"STDM6TrackParticleThinningTool",
49 'MuonTPThinningToolName' :
"STDM6MuonTPThinningTool",
50 'TauJetThinningToolName' :
"STDM6TauJetThinningTool",
51 'TauJets_MuonRMThinningToolName' :
"STDM6TauJets_MuonRMThinningTool",
52 'DiTauTPThinningToolName' :
"STDM6DiTauTPThinningTool",
53 'DiTauLowPtThinningToolName' :
"STDM6DiTauLowPtThinningTool",
54 'DiTauLowPtTPThinningToolName' :
"STDM6DiTauLowPtTPThinningTool",
57 if kwargs.get(
'TauJets_EleRM_in_input',
False):
58 thinningToolsArgs[
'TauJets_EleRMThinningToolName'] =
"STDM6TauJets_EleRMThinningTool"
60 from DerivationFrameworkPhys.PhysCommonThinningConfig
import PhysCommonThinningCfg
64 for key
in thinningToolsArgs:
65 thinningTools.append(acc.getPublicTool(thinningToolsArgs[key]))
68 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
82 from JetRecConfig.JetRecConfig
import JetRecCfg, getModifier
83 from JetRecConfig.StandardJetMods
import stdJetModifiers
84 from JetRecConfig.StandardSmallRJets
import AntiKt4PV0Track, AntiKt4EMPFlow, AntiKt4EMPFlowNoPtCut, AntiKt4EMTopoNoPtCut
89 bJVTTool =
getModifier(AntiKt4EMPFlow, stdJetModifiers[
'bJVT'], stdJetModifiers[
'bJVT'].modspec, flags=flags)
90 acc.addEventAlgo(CompFactory.JetDecorationAlg(name=
'bJVTAlg',
91 JetContainer=
'AntiKt4EMPFlowJets',
92 Decorators=[bJVTTool]))
97 jetList = [AntiKt4PV0Track]
103 jetList += [AntiKt4EMPFlowNoPtCut, AntiKt4EMTopoNoPtCut]
109 from JetRecConfig.StandardSmallRJets
import AntiKt4UFOCSSKNoPtCut
110 AntiKt4UFOCSSKNoPtCut_JETM1 = AntiKt4UFOCSSKNoPtCut.clone(
111 modifiers = AntiKt4UFOCSSKNoPtCut.modifiers+(
"NNJVT",)
113 jetList += [AntiKt4UFOCSSKNoPtCut_JETM1]
115 from JetRecConfig.StandardSmallRJets
import AntiKt4UFOCSSK
116 AntiKt4UFOCSSK_JETM1 = AntiKt4UFOCSSK.clone(
117 modifiers = AntiKt4UFOCSSK.modifiers+(
"NNJVT",)
119 jetList += [AntiKt4UFOCSSK_JETM1]
129 from JetRecConfig.JetRecConfig
import getConstitPJGAlg
130 from JetRecConfig.StandardJetConstits
import stdConstitDic
as cst
131 from JetRecConfig.JetInputConfig
import buildEventShapeAlg
142 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import AddTopQuarkAndDownstreamParticlesCfg
151 if flags.Trigger.EDMVersion == 2:
152 triggerNames = [
"JetContainer_a4tcemsubjesFS",
"JetContainer_a4tcemsubjesISFS",
"JetContainer_GSCJet",
153 "JetContainer_a10tclcwsubjesFS",
"JetContainer_a10tclcwsubFS",
"JetContainer_a10ttclcwjesFS"]
155 for trigger
in triggerNames:
156 wrapperName = trigger+
'AuxWrapper'
157 auxContainerName =
'HLT_xAOD__'+trigger+
'Aux'
159 acc.addEventAlgo(CompFactory.xAODMaker.AuxStoreWrapper( wrapperName, SGKeys = [ auxContainerName+
"." ] ))
164 def STDM6CoreCfg(flags, name_tag='STDM6', StreamName='StreamDAOD_STDM6', TriggerListsHelper=None, TauJets_EleRM_in_input=None):
166 if TriggerListsHelper
is None:
167 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
168 TriggerListsHelper = TriggerListsHelper(flags)
170 if TauJets_EleRM_in_input
is None:
172 TauJets_EleRM_in_input = (flags.Input.TypedCollections.count(
'xAOD::TauJetContainer#TauJets_EleRM') > 0)
177 from DerivationFrameworkHiggs.HiggsPhysContent
import HiggsAugmentationAlgsCfg
182 from IsolationSelection.IsolationSelectionConfig
import IsoCloseByAlgsCfg
183 acc.merge(
IsoCloseByAlgsCfg(flags, suff =
"_"+name_tag, isPhysLite =
False, stream_name = StreamName))
188 from DerivationFrameworkMCTruth.HFClassificationCommonConfig
import HFClassificationCommonCfg
194 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
195 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
196 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
198 STDM6SlimmingHelper =
SlimmingHelper(name_tag+
"SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
199 STDM6SlimmingHelper.SmartCollections = [
"EventInfo",
204 "InDetTrackParticles",
206 "AntiKt4EMPFlowJets",
207 "AntiKt10UFOCSSKJets",
208 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
209 "BTagging_AntiKt4EMPFlow",
210 "BTagging_AntiKtVR30Rmax4Rmin02Track",
211 "MET_Baseline_AntiKt4EMTopo",
212 "MET_Baseline_AntiKt4EMPFlow",
217 "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets",
218 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets",
219 "AntiKtVR30Rmax4Rmin02PV0TrackJets",
221 if TauJets_EleRM_in_input:
222 STDM6SlimmingHelper.SmartCollections.append(
"TauJets_EleRM")
227 STDM6SlimmingHelper.AllVariables += [
"AFPSiHitContainer",
228 "AFPToFHitContainer",
229 "AFPSiHitsClusterContainer",
231 "AFPToFTrackContainer",
232 "AFPProtonContainer",
233 "AFPVertexContainer",
234 "CaloCalTopoClusters",
239 STDM6SlimmingHelper.AllVariables += [
"MuonSegments",
"EventInfo",
240 "Kt4EMTopoOriginEventShape",
"Kt4EMPFlowEventShape",
"Kt4EMPFlowPUSBEventShape",
"Kt4EMPFlowNeutEventShape",
"Kt4UFOCSSKEventShape",
"Kt4UFOCSSKNeutEventShape",
241 "AntiKt4EMPFlowJets"]
243 excludedVertexAuxData =
"-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
245 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Tight_Vertices"]
246 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Tight_VerticesAux." + excludedVertexAuxData]
247 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Medium_Vertices"]
248 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData]
249 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"]
250 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData]
252 STDM6SlimmingHelper.StaticContent = StaticContent
255 STDM6SlimmingHelper.ExtraVariables += [
"AntiKt4EMTopoJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt",
256 "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt.isJvtHS.isJvtPU",
257 "TruthPrimaryVertices.t.x.y.z",
258 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.numberOfTRTHits.numberOfTRTOutliers",
259 "EventInfo.GenFiltHT.GenFiltMET.GenFiltHTinclNu.GenFiltPTZ.GenFiltFatJ.HF_Classification.HF_SimpleClassification",
260 "TauJets.dRmax.etOverPtLeadTrk",
261 "TauJets_MuonRM.dRmax.etOverPtLeadTrk",
262 "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET.ex.ey",
263 "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht.ex.ey"]
264 if TauJets_EleRM_in_input:
265 STDM6SlimmingHelper.ExtraVariables += [
"TauJets_EleRM.dRmax.etOverPtLeadTrk"]
269 STDM6SlimmingHelper.ExtraVariables += [
"AntiKt4EMTopoJets.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1",
270 "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1",
271 "AntiKt4EMPFlowJets.passOnlyBJVT.DFCommonJets_bJvt.isJvtHS.isJvtPU",
272 "InDetTrackParticles.truthMatchProbability",
273 "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets.zg.rg.NumTrkPt1000.TrackWidthPt1000.GhostMuonSegmentCount.EnergyPerSampling.GhostTrack",
274 "AntiKt10UFOCSSKJets.NumTrkPt1000.TrackWidthPt1000.GhostMuonSegmentCount.EnergyPerSampling.GhostTrack"]
279 for tagger
in [
"GN2Xv00",
"GN2XWithMassv00",
"GN2Xv01"]:
280 for score
in [
"phbb",
"phcc",
"ptop",
"pqcd"]:
281 extraList.append(f
"{tagger}_{score}")
282 STDM6SlimmingHelper.ExtraVariables += [
"AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets." +
".".
join(extraList)]
292 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
296 STDM6SlimmingHelper.AppendToDictionary.update({
'TruthParticles':
'xAOD::TruthParticleContainer',
297 'TruthParticlesAux':
'xAOD::TruthParticleAuxContainer'})
299 STDM6SlimmingHelper.AllVariables += [
'TruthHFWithDecayParticles',
'TruthHFWithDecayVertices',
'TruthCharm',
'TruthPileupParticles',
'InTimeAntiKt4TruthJets',
'OutOfTimeAntiKt4TruthJets']
300 STDM6SlimmingHelper.AllVariables += [
"TruthEvents",
"TruthParticles",
"TruthVertices",
"AntiKt4TruthJets",
"AntiKt4TruthWZJets"]
301 STDM6SlimmingHelper.ExtraVariables += [
"Electrons.TruthLink",
304 "AntiKt4EMTopoJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt",
305 "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt",
306 "TruthPrimaryVertices.t.x.y.z",
307 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.numberOfTRTHits.numberOfTRTOutliers",
308 "PrimaryVertices.x.y.z.covariance.trackWeights.vertexType.sumPt2",
312 STDM6SlimmingHelper.SmartCollections += [
"AntiKt4TruthWZJets"]
313 STDM6SlimmingHelper.AllVariables += [
"TruthTopQuarkWithDecayParticles",
"TruthTopQuarkWithDecayVertices",
314 "AntiKt4TruthJets",
"InTimeAntiKt4TruthJets",
"OutOfTimeAntiKt4TruthJets",
"TruthParticles"]
315 STDM6SlimmingHelper.ExtraVariables += [
"TruthVertices.barcode.z"]
317 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import AddTauAndDownstreamParticlesCfg
319 STDM6SlimmingHelper.AllVariables += [
'TruthTausWithDecayParticles',
'TruthTausWithDecayVertices']
321 STDM6SlimmingHelper.AppendToDictionary.update({
'Kt4UFOCSSKEventShape':
'xAOD::EventShape',
322 'Kt4UFOCSSKEventShapeAux':
'xAOD::EventShapeAuxInfo',
323 'Kt4UFOCSSKNeutEventShape':
'xAOD::EventShape',
324 'Kt4UFOCSSKNeutEventShapeAux':
'xAOD::EventShapeAuxInfo'})
327 from DerivationFrameworkHiggs.HiggsPhysContent
import setupHiggsSlimmingVariables
331 STDM6SlimmingHelper.IncludeTriggerNavigation =
False
333 STDM6SlimmingHelper.IncludeJetTriggerContent =
True
334 STDM6SlimmingHelper.IncludeMuonTriggerContent =
False
335 STDM6SlimmingHelper.IncludeEGammaTriggerContent =
False
336 STDM6SlimmingHelper.IncludeJetTauEtMissTriggerContent =
False
337 STDM6SlimmingHelper.IncludeTauTriggerContent =
False
338 STDM6SlimmingHelper.IncludeEtMissTriggerContent =
False
339 STDM6SlimmingHelper.IncludeBJetTriggerContent =
False
340 STDM6SlimmingHelper.IncludeBPhysTriggerContent =
False
341 STDM6SlimmingHelper.IncludeMinBiasTriggerContent =
False
345 if flags.Trigger.EDMVersion == 2:
346 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
348 OutputContainerPrefix =
"TrigMatch_",
349 TriggerList = TriggerListsHelper.Run2TriggerNamesTau)
351 OutputContainerPrefix =
"TrigMatch_",
352 TriggerList = TriggerListsHelper.Run2TriggerNamesNoTau)
353 triggerNames = [
"a4tcemsubjesFS",
"a4tcemsubjesISFS",
"a10tclcwsubjesFS",
"a10tclcwsubFS",
"a10ttclcwjesFS",
"GSCJet"]
354 for trigger
in triggerNames:
355 STDM6SlimmingHelper.FinalItemList.append(
'xAOD::AuxContainerBase!#HLT_xAOD__JetContainer_'+trigger+
'Aux.pt.eta.phi.m')
358 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
359 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
362 jetOutputList = [
"AntiKt4PV0TrackJets",
"AntiKt4UFOCSSKJets"]
364 jetOutputList = [
"AntiKt4PV0TrackJets",
"AntiKt4UFOCSSKNoPtCutJets",
"AntiKt4EMPFlowNoPtCutJets",
"AntiKt4EMTopoNoPtCutJets"]
365 from DerivationFrameworkJetEtMiss.JetCommonConfig
import addJetsToSlimmingTool
370 STDM6ItemList = STDM6SlimmingHelper.GetItemList()
371 acc.merge(
OutputStreamCfg(flags,
"DAOD_"+name_tag, ItemList=STDM6ItemList, AcceptAlgs=[name_tag+
"Kernel"]))
372 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_"+name_tag, AcceptAlgs=[name_tag+
"Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
378 logSTDM6.info(
'****************** STARTING STDM6 *****************')
380 stream_name =
'StreamDAOD_STDM6'
387 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
388 STDM6TriggerListsHelper = TriggerListsHelper(flags)
391 TauJets_EleRM_in_input = (flags.Input.TypedCollections.count(
'xAOD::TauJetContainer#TauJets_EleRM') > 0)
392 if TauJets_EleRM_in_input:
393 logSTDM6.info(
"TauJets_EleRM is in the input AOD. Relevant containers will be scheduled")
395 logSTDM6.info(
"TauJets_EleRM is Not in the input AOD. No relevant containers will be written")
401 StreamName = stream_name,
402 TriggerListsHelper = STDM6TriggerListsHelper,
403 TauJets_EleRM_in_input=TauJets_EleRM_in_input
409 StreamName = stream_name,
410 TriggerListsHelper = STDM6TriggerListsHelper,
411 TauJets_EleRM_in_input=TauJets_EleRM_in_input