5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.Enums
import MetadataCategory
10 '''Configure the STDM7 skimming tool'''
14 muonsRequirements =
'(Muons.pt >= 4*GeV) && (abs(Muons.eta) < 2.6)' \
15 '&& (Muons.DFCommonMuonPassPreselection) && (Muons.DFCommonMuonPassIDCuts)'
16 electronsRequirements =
'(Electrons.pt > 11*GeV) && (abs(Electrons.eta) < 2.6)' \
17 '&& ((Electrons.DFCommonElectronsLHLoose) || ((Electrons.DFCommonElectronsDNNLoose) && (Electrons.pt > 15*GeV)))'
19 chargedParticleRequirements =
'(TruthParticles.pt > 500) && (TruthParticles.barcode < 200000)' \
20 '&& (TruthParticles.status == 1) && (TruthParticles.charge != 0)' \
21 '&& (TruthParticles.theta > 0.163803) && (TruthParticles.theta < 2.97778)' \
22 '&& (TruthParticles.HSBool)'
25 muonOnlySelection =
'count('+muonsRequirements+
') >=2'
26 electronOnlySelection =
'count('+electronsRequirements+
') >= 2'
27 electronMuonSelection =
'(count('+electronsRequirements+
') + count('+muonsRequirements+
')) >= 2'
31 if filterVal > -1
and flags.Input.isMC :
32 chargedParticleSelection =
'count('+chargedParticleRequirements+
') < '+
str(filterVal)
33 offlineExpression =
'(('+muonOnlySelection+
' || '+electronOnlySelection+
' || '+electronMuonSelection+
') && ('+chargedParticleSelection+
'))'
35 offlineExpression =
'(('+muonOnlySelection+
' || '+electronOnlySelection+
' || '+electronMuonSelection+
'))'
37 from TrigDecisionTool.TrigDecisionToolConfig
import TrigDecisionToolCfg
39 STDM7StringSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(name =
"STDM7StringSkimmingTool",
40 expression = offlineExpression,
42 acc.addPublicTool(STDM7StringSkimmingTool)
45 from TriggerMenuMT.TriggerAPI.TriggerAPI
import TriggerAPI
46 from TriggerMenuMT.TriggerAPI.TriggerEnums
import TriggerPeriod, TriggerType
47 allperiods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future2e34
48 TriggerAPI.setConfigFlags(flags)
49 trig_el = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, livefraction=0.8)
50 trig_mu = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, livefraction=0.8)
51 trig_em = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.mu, livefraction=0.8)
55 from PathResolver
import PathResolver
59 if line ==
"" or line.startswith(
"#"):
61 extra_notau.append(line)
64 trigger_names_full_notau =
list(
set(trig_el+trig_mu+trig_em+extra_notau))
65 STDM7TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"STDM7TriggerSkimmingTool",
67 TriggerListOR = trigger_names_full_notau,
69 acc.addPublicTool(STDM7TriggerSkimmingTool)
72 acc.addPublicTool(CompFactory.DerivationFramework.FilterCombinationAND(
"STDM7SkimmingTool",
73 FilterList = [STDM7StringSkimmingTool,STDM7TriggerSkimmingTool]),
80 """Configure the derivation framework driving algorithm (kernel)"""
84 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
94 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
96 ThinningTools = thinningTools,
97 SkimmingTools = skimmingTools))
109 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
110 STDM7TriggerListsHelper = TriggerListsHelper(flags)
113 acc.merge(
STDM7KernelCfg(flags, name=
"STDM7Kernel", StreamName =
'StreamDAOD_STDM7', TriggerListsHelper = STDM7TriggerListsHelper))
118 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
119 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
120 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
122 STDM7SlimmingHelper =
SlimmingHelper(
"STDM7SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
123 STDM7SlimmingHelper.SmartCollections = [
"EventInfo",
128 "InDetTrackParticles",
130 "AntiKt4EMPFlowJets",
131 "BTagging_AntiKt4EMPFlow",
132 "BTagging_AntiKtVR30Rmax4Rmin02Track",
133 "MET_Baseline_AntiKt4EMTopo",
134 "MET_Baseline_AntiKt4EMPFlow",
143 STDM7SlimmingHelper.AllVariables = [
"AFPSiHitContainer",
144 "AFPToFHitContainer",
145 "AFPSiHitsClusterContainer",
147 "AFPToFTrackContainer",
148 "AFPProtonContainer",
152 excludedVertexAuxData =
"-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
154 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Tight_Vertices"]
155 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Tight_VerticesAux." + excludedVertexAuxData]
156 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Medium_Vertices"]
157 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData]
158 StaticContent += [
"xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"]
159 StaticContent += [
"xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData]
161 STDM7SlimmingHelper.StaticContent = StaticContent
166 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
168 STDM7SlimmingHelper.AllVariables += [
'TruthHFWithDecayParticles',
'TruthHFWithDecayVertices',
'TruthCharm',
'TruthPileupParticles',
'InTimeAntiKt4TruthJets',
'OutOfTimeAntiKt4TruthJets']
169 STDM7SlimmingHelper.ExtraVariables += [
"Electrons.TruthLink",
172 "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",
173 "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",
174 "TruthPrimaryVertices.t.x.y.z",
175 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.numberOfTRTHits.numberOfTRTOutliers",
176 "EventInfo.hardScatterVertexLink.timeStampNSOffset",
177 "TauJets.dRmax.etOverPtLeadTrk",
179 "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET.ex.ey",
180 "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht.ex.ey"]
183 STDM7SlimmingHelper.IncludeTriggerNavigation =
False
184 STDM7SlimmingHelper.IncludeJetTriggerContent =
False
185 STDM7SlimmingHelper.IncludeMuonTriggerContent =
False
186 STDM7SlimmingHelper.IncludeEGammaTriggerContent =
False
187 STDM7SlimmingHelper.IncludeTauTriggerContent =
False
188 STDM7SlimmingHelper.IncludeEtMissTriggerContent =
False
189 STDM7SlimmingHelper.IncludeBJetTriggerContent =
False
190 STDM7SlimmingHelper.IncludeBPhysTriggerContent =
False
191 STDM7SlimmingHelper.IncludeMinBiasTriggerContent =
False
195 if flags.Trigger.EDMVersion == 2:
196 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
198 OutputContainerPrefix =
"TrigMatch_",
199 TriggerList = STDM7TriggerListsHelper.Run2TriggerNamesTau)
201 OutputContainerPrefix =
"TrigMatch_",
202 TriggerList = STDM7TriggerListsHelper.Run2TriggerNamesNoTau)
204 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
205 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
209 STDM7ItemList = STDM7SlimmingHelper.GetItemList()
210 acc.merge(
OutputStreamCfg(flags,
"DAOD_STDM7", ItemList=STDM7ItemList, AcceptAlgs=[
"STDM7Kernel"]))
211 acc.merge(
SetupMetaDataForStreamCfg(flags,
"DAOD_STDM7", AcceptAlgs=[
"STDM7Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))