13 """Configure the skimming tool"""
14 acc = ComponentAccumulator()
18 from DerivationFrameworkJetEtMiss
import TriggerLists
19 elTriggers = TriggerLists.single_el_Trig(flags)
20 muTriggers = TriggerLists.single_mu_Trig(flags)
22 addRun3ElectronTriggers = [
"HLT_e17_lhvloose_L1EM15VHI",
"HLT_e20_lhvloose_L1EM15VH",
"HLT_e250_etcut_L1EM22VHI",
23 "HLT_e26_lhtight_ivarloose_L1EM22VHI",
"HLT_e26_lhtight_ivarloose_L1eEM26M",
24 "HLT_e60_lhmedium_L1EM22VHI",
"HLT_e60_lhmedium_L1eEM26M",
25 "HLT_e140_lhloose_L1EM22VHI",
"HLT_e140_lhloose_L1eEM26M",
26 "HLT_e300_etcut_L1EM22VHI",
"HLT_e300_etcut_L1eEM26M",
27 "HLT_e140_lhloose_noringer_L1EM22VHI",
"HLT_e140_lhloose_noringer_L1eEM26M"]
29 addRund3MuonTriggers = [
"HLT_mu24_ivarmedium_L1MU14FCH",
"HLT_mu50_L1MU14FCH",
"HLT_mu60_0eta105_msonly_L1MU14FCH",
"HLT_mu60_L1MU14FCH",
"HLT_mu80_msonly_3layersEC_L1MU14FCH"]
31 elTriggers = elTriggers+addRun3ElectronTriggers
32 muTriggers = muTriggers+addRund3MuonTriggers
33 lepTriggers = elTriggers+muTriggers
36 tracks =
'InDetTrackParticles.TrkIsoPt1000_ptcone20 < 0.12*InDetTrackParticles.pt && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm'
38 trackRequirements =
'(InDetTrackParticles.pt > 9.*GeV && '+tracks+
' )'
40 jetRequirementsTtbar =
'(AntiKt4EMPFlowJets.pt > 18*GeV && log(AntiKt4EMPFlowJets.GN2v01_pb/(0.2*AntiKt4EMPFlowJets.GN2v01_pc+0.01*AntiKt4EMPFlowJets.GN2v01_ptau+(1.0-0.2-0.01)*AntiKt4EMPFlowJets.GN2v01_pu)) > -0.378)'
43 if flags.GeoModel.Run >= LHCPeriod.Run4:
44 jetRequirementsTtbar =
'(AntiKt4EMPFlowJets.pt > 18*GeV)'
46 muonsRequirements =
'(Muons.pt >= 24.*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonMuonPassPreselection)'
47 electronsRequirements =
'(Electrons.pt > 24.*GeV) && (abs(Electrons.eta) < 2.6) && ((Electrons.Loose) || (Electrons.DFCommonElectronsLHLoose))'
50 expression =
'( count('+trackRequirements+
') >=2 && count('+jetRequirementsTtbar+
') >=1 && ( count('+muonsRequirements+
') >=1 || count('+electronsRequirements+
') >=1 ) )'
52 from DerivationFrameworkTools.DerivationFrameworkToolsConfig
import (
53 xAODStringSkimmingToolCfg)
54 skimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
55 flags, name =
"skimmingTool", expression = expression))
56 acc.addPublicTool(skimmingTool)
57 filterList += [skimmingTool]
60 if flags.Trigger.EDMVersion >= 0:
61 STDM17TriggerSkimmingTool_lep = CompFactory.DerivationFramework.TriggerSkimmingTool(name =
"STDM17TriggerSkimmingTool_lep", TriggerListOR = lepTriggers)
62 acc.addPublicTool(STDM17TriggerSkimmingTool_lep)
63 filterList += [STDM17TriggerSkimmingTool_lep]
65 STDM17SkimmingTool_lep = CompFactory.DerivationFramework.FilterCombinationAND(name=
"STDM17SkimmingTool_lep", FilterList=filterList)
66 acc.addPublicTool(STDM17SkimmingTool_lep)
68 STDM17SkimmingTool = CompFactory.DerivationFramework.FilterCombinationOR(name=
"STDM17SkimmingTool", FilterList=[STDM17SkimmingTool_lep])
69 acc.addPublicTool(STDM17SkimmingTool, primary =
True)
74 """Configure the augmentation tool for skimming"""
75 acc = ComponentAccumulator()
79 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig
import (
80 InDetTrackSelectionTool_Loose_Cfg)
81 toolkwargs[
"TrackSelectionTool"] = acc.popToolsAndMerge(InDetTrackSelectionTool_Loose_Cfg(flags,
82 name =
"TrackSelectionTool1000_STDM17",
86 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig
import isoTTVAToolCfg
87 toolkwargs[
'TTVATool'] = acc.popToolsAndMerge(isoTTVAToolCfg(flags))
89 toolkwargs[
"name"] =
"TrackIsolationToolPt1000"
90 TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(**toolkwargs)
91 acc.addPublicTool(TrackIsoTool)
94 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
95 from DerivationFrameworkInDet.InDetToolsConfig
import IsolationTrackDecoratorCfg
96 Pt1000IsoTrackDecorator = acc.getPrimaryAndMerge(IsolationTrackDecoratorCfg(flags,
97 name =
"Pt1000IsoTrackDecorator",
98 TrackIsolationTool = TrackIsoTool,
99 TargetContainer =
"InDetTrackParticles",
100 iso = [isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20],
101 isoSuffix = [
"ptcone40",
"ptcone30",
"ptcone20"],
102 Prefix =
"TrkIsoPt1000_"))
103 acc.addPublicTool(Pt1000IsoTrackDecorator, primary=
True)
108 """Configure the augmentation tool"""
109 acc = ComponentAccumulator()
113 from InDetTrackSelectionTool.InDetTrackSelectionToolConfig
import (
114 InDetTrackSelectionTool_Loose_Cfg)
115 toolkwargs[
"TrackSelectionTool"] = acc.popToolsAndMerge(InDetTrackSelectionTool_Loose_Cfg(flags,
116 name =
"TrackSelectionTool500_STDM17",
119 from TrackVertexAssociationTool.TrackVertexAssociationToolConfig
import isoTTVAToolCfg
120 toolkwargs[
'TTVATool'] = acc.popToolsAndMerge(isoTTVAToolCfg(flags))
122 toolkwargs[
"name"] =
"TrackIsolationToolPt500"
123 TrackIsoTool = CompFactory.xAOD.TrackIsolationTool(**toolkwargs)
124 acc.addPublicTool(TrackIsoTool)
127 from xAODPrimitives.xAODIso
import xAODIso
as isoPar
128 from DerivationFrameworkInDet.InDetToolsConfig
import IsolationTrackDecoratorCfg
129 Pt500IsoTrackDecorator = acc.getPrimaryAndMerge(IsolationTrackDecoratorCfg(flags,
130 name =
"Pt500IsoTrackDecorator",
131 TrackIsolationTool = TrackIsoTool,
132 TargetContainer =
"InDetTrackParticles",
133 iso = [isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20],
134 isoSuffix = [
"ptcone40",
"ptcone30",
"ptcone20"],
135 Prefix =
"TrkIsoPt500_"))
136 acc.addPublicTool(Pt500IsoTrackDecorator, primary=
True)
142 """Configure the derivation framework driving algorithm (kernel) for STDM17"""
143 acc = ComponentAccumulator()
146 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
147 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs[
'TriggerListsHelper']))
150 from AthenaCommon.CFElements
import seqAND
151 acc.addSequence( seqAND(
"STDM17Sequence") )
152 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
155 skimmingKernel = DerivationKernel(kwargs[
"PreselectionName"], SkimmingTools = [skimmingTool], AugmentationTools = [augmentationToolSkim])
156 acc.addEventAlgo( skimmingKernel, sequenceName=
"STDM17Sequence" )
159 from DerivationFrameworkInDet.InDetToolsConfig
import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, TauTrackParticleThinningCfg
162 STDM17_thinning_expression =
"( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
163 STDM17TrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
165 name =
"STDM17TrackParticleThinningTool",
166 StreamName = kwargs[
'StreamName'],
167 SelectionString = STDM17_thinning_expression,
168 InDetTrackParticlesKey =
"InDetTrackParticles"))
171 STDM17MuonTPThinningTool = acc.getPrimaryAndMerge(MuonTrackParticleThinningCfg(
173 name =
"STDM17MuonTPThinningTool",
174 StreamName = kwargs[
'StreamName'],
176 InDetTrackParticlesKey =
"InDetTrackParticles"))
179 STDM17ElectronTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
181 name =
"STDM17ElectronTPThinningTool",
182 StreamName = kwargs[
'StreamName'],
184 InDetTrackParticlesKey =
"InDetTrackParticles"))
187 STDM17PhotonTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
189 name =
"STDM17PhotonTPThinningTool",
190 StreamName = kwargs[
'StreamName'],
192 InDetTrackParticlesKey =
"InDetTrackParticles",
193 GSFConversionVerticesKey =
"GSFConversionVertices"))
196 STDM17TauTPThinningTool = acc.getPrimaryAndMerge(TauTrackParticleThinningCfg(
198 name =
"STDM17TauTPThinningTool",
199 StreamName = kwargs[
'StreamName'],
201 InDetTrackParticlesKey =
"InDetTrackParticles",
202 DoTauTracksThinning =
True,
203 TauTracksKey =
"TauTracks"))
205 thinningTools = [STDM17TrackParticleThinningTool,
206 STDM17MuonTPThinningTool,
207 STDM17ElectronTPThinningTool,
208 STDM17PhotonTPThinningTool,
209 STDM17TauTPThinningTool]
212 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import CaloClusterThinningCfg
213 selectionString =
"( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
214 STDM17CaloThinningTool = acc.getPrimaryAndMerge(CaloClusterThinningCfg(flags,
215 name =
"STDM17CaloClusterThinning",
216 StreamName = kwargs[
'StreamName'],
217 SGKey =
"InDetTrackParticles",
218 TopoClCollectionSGKey =
"CaloCalTopoClusters",
219 SelectionString = selectionString,
221 acc.addPublicTool(STDM17CaloThinningTool)
222 thinningTools.append(STDM17CaloThinningTool)
225 truth_cond_status =
"( (TruthParticles.pdgId == 24) || (TruthParticles.pdgId == -24) )"
226 truth_cond_Lepton =
"((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && (TruthParticles.barcode < 200000))"
227 truth_expression =
'('+truth_cond_status+
' || '+truth_cond_Lepton +
')'
229 STDM17TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(name =
"STDM17TruthThinningTool",
230 StreamName = kwargs[
'StreamName'],
231 ParticleSelectionString = truth_expression,
232 PreserveDescendants =
False,
233 PreserveGeneratorDescendants =
True,
234 PreserveAncestors =
False)
236 acc.addPublicTool(STDM17TruthThinningTool)
237 thinningTools.append(STDM17TruthThinningTool)
243 acc.addEventAlgo(DerivationKernel(name,
244 ThinningTools = thinningTools,
245 AugmentationTools = [augmentationTool]),
246 sequenceName=
"STDM17Sequence")
252 acc = ComponentAccumulator()
258 from DerivationFrameworkPhys.TriggerListsHelper
import TriggerListsHelper
259 STDM17TriggerListsHelper = TriggerListsHelper(flags)
262 acc.merge(
STDM17KernelCfg(flags, name=
"STDM17Kernel", PreselectionName=
"STDM17PreselectionKernel", StreamName =
'StreamDAOD_STDM17', TriggerListsHelper = STDM17TriggerListsHelper))
267 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
268 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
269 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
271 STDM17SlimmingHelper =
SlimmingHelper(
"STDM17SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
273 STDM17SlimmingHelper.SmartCollections = [
"EventInfo",
274 "Electrons",
"Photons",
"Muons",
"TauJets",
"TauJets_MuonRM",
275 "InDetTrackParticles",
"PrimaryVertices",
276 "MET_Baseline_AntiKt4EMPFlow",
277 "AntiKt4EMPFlowJets"]
280 STDM17SlimmingHelper.AllVariables = [
"MuonSegments",
"InDetTrackParticles",
281 "Kt4EMTopoOriginEventShape",
"Kt4EMPFlowEventShape",
"CaloCalTopoClusters"]
283 STDM17SlimmingHelper.ExtraVariables = [
"InDetTrackParticles.TrkIsoPt1000_ptcone40.TrkIsoPt1000_ptcone30.TrkIsoPt1000_ptcone20.TrkIsoPt500_ptcone40.TrkIsoPt500_ptcone30.TrkIsoPt500_ptcone20"]
286 from DerivationFrameworkMCTruth.MCTruthCommonConfig
import addTruth3ContentToSlimmerTool
287 addTruth3ContentToSlimmerTool(STDM17SlimmingHelper)
289 STDM17SlimmingHelper.AppendToDictionary.update({
'TruthParticles':
'xAOD::TruthParticleContainer',
290 'TruthParticlesAux':
'xAOD::TruthParticleAuxContainer'})
292 STDM17SlimmingHelper.SmartCollections += [
"AntiKt4TruthJets"]
293 STDM17SlimmingHelper.AllVariables += [
"MuonTruthParticles",
"TruthParticles",
"TruthVertices"]
296 STDM17SlimmingHelper.IncludeTriggerNavigation =
False
297 STDM17SlimmingHelper.IncludeJetTriggerContent =
False
298 STDM17SlimmingHelper.IncludeMuonTriggerContent =
False
299 STDM17SlimmingHelper.IncludeEGammaTriggerContent =
False
300 STDM17SlimmingHelper.IncludeTauTriggerContent =
False
301 STDM17SlimmingHelper.IncludeEtMissTriggerContent =
False
302 STDM17SlimmingHelper.IncludeBJetTriggerContent =
False
303 STDM17SlimmingHelper.IncludeBPhysTriggerContent =
False
304 STDM17SlimmingHelper.IncludeMinBiasTriggerContent =
False
309 if flags.Trigger.EDMVersion == 2:
310 from DerivationFrameworkPhys.TriggerMatchingCommonConfig
import AddRun2TriggerMatchingToSlimmingHelper
311 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM17SlimmingHelper,
312 OutputContainerPrefix =
"TrigMatch_",
313 TriggerList = STDM17TriggerListsHelper.Run2TriggerNamesTau)
314 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM17SlimmingHelper,
315 OutputContainerPrefix =
"TrigMatch_",
316 TriggerList = STDM17TriggerListsHelper.Run2TriggerNamesNoTau)
318 if flags.Trigger.EDMVersion == 3
or (flags.Trigger.EDMVersion == 2
and flags.Trigger.doEDMVersionConversion):
319 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig
import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
320 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(STDM17SlimmingHelper)
325 STDM17ItemList = STDM17SlimmingHelper.GetItemList()
326 acc.merge(OutputStreamCfg(flags,
"DAOD_STDM17", ItemList=STDM17ItemList, AcceptAlgs=[
"STDM17Kernel"]))
327 acc.merge(SetupMetaDataForStreamCfg(flags,
"DAOD_STDM17", AcceptAlgs=[
"STDM17Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))