ATLAS Offline Software
Loading...
Searching...
No Matches
python.STDM7 Namespace Reference

Functions

 STDM7TriggerSkimmingToolCfg (flags)
 STDM7StringSkimmingToolCfg (flags)
 STDM7KernelCfg (flags, name='STDM7Kernel', **kwargs)
 STDM7CoreCfg (flags, name_tag='STDM7', StreamName='StreamDAOD_STDM7', TriggerListsHelper=None)
 STDM7Cfg (flags)

Variables

 logSTDM7 = logging.getLogger('STDM7')

Function Documentation

◆ STDM7Cfg()

python.STDM7.STDM7Cfg ( flags)

Definition at line 292 of file STDM7.py.

292def STDM7Cfg(flags):
293
294 logSTDM7.info('****************** STARTING STDM7 *****************')
295
296 stream_name = 'StreamDAOD_STDM7'
297 acc = ComponentAccumulator()
298
299 # Get the lists of triggers needed for trigger matching.
300 # This is needed at this scope (for the slimming) and further down in the config chain
301 # for actually configuring the matching, so we create it here and pass it down
302 # TODO: this should ideally be called higher up to avoid it being run multiple times in a train
303 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
304 STDM7TriggerListsHelper = TriggerListsHelper(flags)
305
306 # Common augmentations
307 acc.merge(STDM7KernelCfg(
308 flags,
309 name="STDM7Kernel",
310 StreamName = stream_name,
311 TriggerListsHelper = STDM7TriggerListsHelper,
312 ))
313 # STDM7 content
314 acc.merge(STDM7CoreCfg(
315 flags,
316 "STDM7",
317 StreamName = stream_name,
318 TriggerListsHelper = STDM7TriggerListsHelper,
319 ))
320
321 return acc

◆ STDM7CoreCfg()

python.STDM7.STDM7CoreCfg ( flags,
name_tag = 'STDM7',
StreamName = 'StreamDAOD_STDM7',
TriggerListsHelper = None )

Definition at line 183 of file STDM7.py.

183def STDM7CoreCfg(flags, name_tag='STDM7', StreamName='StreamDAOD_STDM7', TriggerListsHelper=None):
184
185 if TriggerListsHelper is None:
186 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
187 TriggerListsHelper = TriggerListsHelper(flags)
188
189 acc = ComponentAccumulator()
190
191 # ============================
192 # Define contents of the format
193 # =============================
194 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
195 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
196 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
197
198 STDM7SlimmingHelper = SlimmingHelper(name_tag+"SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
199 STDM7SlimmingHelper.SmartCollections = ["EventInfo",
200 "Electrons",
201 "Photons",
202 "Muons",
203 "PrimaryVertices",
204 "InDetTrackParticles",
205 "AntiKt4EMTopoJets",
206 "AntiKt4EMPFlowJets",
207 "MET_Baseline_AntiKt4EMTopo",
208 "MET_Baseline_AntiKt4EMPFlow",
209 "TauJets",
210 ]
211
212 excludedVertexAuxData = "-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
213 StaticContent = []
214 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Tight_Vertices"]
215 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Tight_VerticesAux." + excludedVertexAuxData]
216 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Medium_Vertices"]
217 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData]
218 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"]
219 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData]
220
221 STDM7SlimmingHelper.StaticContent = StaticContent
222
223 # IFF extra content
224 from LeptonTaggers.LeptonTaggersConfig import GetExtraPLITVariablesForDxAOD
225 STDM7SlimmingHelper.ExtraVariables += GetExtraPLITVariablesForDxAOD()
226
227 # Truth extra content
228 if flags.Input.isMC:
229
230 from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool
231 addTruth3ContentToSlimmerTool(STDM7SlimmingHelper)
232 STDM7SlimmingHelper.AllVariables += ['TruthLHEParticles', 'TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm','TruthPileupParticles','InTimeAntiKt4TruthJets','OutOfTimeAntiKt4TruthJets']
233 STDM7SlimmingHelper.ExtraVariables += ["Electrons.TruthLink",
234 "Muons.TruthLink",
235 "Photons.TruthLink",
236 "TruthPrimaryVertices.t.x.y.z",
237 "EventInfo.hardScatterVertexLink.timeStampNSOffset",
238 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.numberOfTRTHits.numberOfTRTOutliers",
239 "TauJets.dRmax.etOverPtLeadTrk",
240 ]
241
242 from DerivationFrameworkMCTruth.MCTruthCommonConfig import AddTauAndDownstreamParticlesCfg
243 acc.merge(AddTauAndDownstreamParticlesCfg(flags))
244 STDM7SlimmingHelper.AllVariables += ['TruthTausWithDecayParticles','TruthTausWithDecayVertices']
245
246 # STDM7 needs AFP information - hits only available in data
247 else:
248 STDM7SlimmingHelper.AllVariables = [ "AFPSiHitContainer",
249 "AFPToFHitContainer",
250 "AFPSiHitsClusterContainer",
251 "AFPTrackContainer",
252 "AFPToFTrackContainer",
253 "AFPProtonContainer",
254 "AFPVertexContainer",
255 ]
256
257 # Trigger content
258 STDM7SlimmingHelper.IncludeTriggerNavigation = False
259 STDM7SlimmingHelper.IncludeJetTriggerContent = False
260 STDM7SlimmingHelper.IncludeMuonTriggerContent = False
261 STDM7SlimmingHelper.IncludeEGammaTriggerContent = False
262 STDM7SlimmingHelper.IncludeTauTriggerContent = False
263 STDM7SlimmingHelper.IncludeEtMissTriggerContent = False
264 STDM7SlimmingHelper.IncludeBJetTriggerContent = False
265 STDM7SlimmingHelper.IncludeBPhysTriggerContent = False
266 STDM7SlimmingHelper.IncludeMinBiasTriggerContent = False
267 # Compact b-jet trigger matching info
268 STDM7SlimmingHelper.IncludeBJetTriggerByYearContent = False
269
270 # Trigger matching
271 # Run 2
272 if flags.Trigger.EDMVersion == 2:
273 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
274 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM7SlimmingHelper,
275 OutputContainerPrefix = "TrigMatch_",
276 TriggerList = TriggerListsHelper.Run2TriggerNamesTau)
277 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM7SlimmingHelper,
278 OutputContainerPrefix = "TrigMatch_",
279 TriggerList = TriggerListsHelper.Run2TriggerNamesNoTau)
280 # Run 3, or Run 2 with navigation conversion
281 if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
282 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
283 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(STDM7SlimmingHelper)
284
285 # Output stream
286 STDM7ItemList = STDM7SlimmingHelper.GetItemList()
287 acc.merge(OutputStreamCfg(flags, "DAOD_"+name_tag, ItemList=STDM7ItemList, AcceptAlgs=[name_tag+"Kernel"]))
288 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_"+name_tag, AcceptAlgs=[name_tag+"Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
289
290 return acc
291

◆ STDM7KernelCfg()

python.STDM7.STDM7KernelCfg ( flags,
name = 'STDM7Kernel',
** kwargs )
Configure the derivation framework driving algorithm (kernel) for STDM7

Definition at line 123 of file STDM7.py.

123def STDM7KernelCfg(flags, name='STDM7Kernel', **kwargs):
124 """Configure the derivation framework driving algorithm (kernel) for STDM7"""
125 acc = ComponentAccumulator()
126
127 # Common augmentations
128 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
129 acc.merge(PhysCommonAugmentationsCfg(
130 flags,
131 TriggerListsHelper = kwargs['TriggerListsHelper'],
132 ))
133 # Needed to decorate taus with DFTauGNTau WPs
134 from DerivationFrameworkTau.TauCommonConfig import AddTauAugmentationCfg
135 acc.merge(AddTauAugmentationCfg(flags, prefix="STDM7", doGNTauLoose=True))
136
137
138 from LeptonTaggers.LeptonTaggersConfig import DecoratePLITAlgsCfg
139 acc.merge(DecoratePLITAlgsCfg(flags))
140
141 filterList = []
142 filterList += [acc.getPrimaryAndMerge(STDM7StringSkimmingToolCfg(flags))]
143 # Only run trigger skimming tool after trigger EDM check to allow running on MC where trigger has not been simulated
144 if flags.Trigger.EDMVersion >= 0:
145 filterList += [acc.getPrimaryAndMerge(STDM7TriggerSkimmingToolCfg(flags))]
146
147 # AND combination of lepton and trigger skimming tools - event must fire lepton trigger and pass lepton reco skim to be kept
148 skimmingTools = [ acc.addPublicTool(CompFactory.DerivationFramework.FilterCombinationAND(
149 name="STDM7SkimmingTool",
150 FilterList = filterList,
151 ))]
152
153 nametag = name.replace('Kernel', '') #get the name to label the tools below such that other formats can use this KernelCfg
154 thinningToolsArgs = {
155 'TauJetThinningToolName' : nametag+"TauJetThinningTool",
156 }
157
158 # Inherit tau thinning tools from PHYS
159 from DerivationFrameworkPhys.PhysCommonThinningConfig import PhysCommonThinningCfg
160 acc.merge(PhysCommonThinningCfg(flags, StreamName = kwargs['StreamName'], **thinningToolsArgs))
161
162 # Implicit track thinning happening in tau thinning tools
163 # Add explict tool to tell derivation to keep all tracks
164 from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg
165 acc.merge(TrackParticleThinningCfg(flags,
166 name = 'STDM7TrackParticleThinningTool',
167 StreamName = kwargs['StreamName'],
168 SelectionString = "InDetTrackParticles.pt > -1",
169 InDetTrackParticlesKey = "InDetTrackParticles"))
170
171 thinningTools = []
172 for key in thinningToolsArgs:
173 thinningTools.append(acc.getPublicTool(thinningToolsArgs[key]))
174 thinningTools.append(acc.getPublicTool('STDM7TrackParticleThinningTool'))
175
176 # The kernel algorithm itself
177 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
178 acc.addEventAlgo(DerivationKernel(name,
179 ThinningTools = thinningTools,
180 SkimmingTools = skimmingTools))
181 return acc
182

◆ STDM7StringSkimmingToolCfg()

python.STDM7.STDM7StringSkimmingToolCfg ( flags)
Configure the STDM7 string skimming tool

Definition at line 84 of file STDM7.py.

84def STDM7StringSkimmingToolCfg(flags):
85 '''Configure the STDM7 string skimming tool'''
86 acc = ComponentAccumulator()
87
88 # skim on two good leptons
89 muonsRequirements = '(Muons.pt >= 10.*GeV) && (abs(Muons.eta) < 2.6) && (Muons.DFCommonMuonPassPreselection) && (Muons.DFCommonMuonPassIDCuts)'
90 electronsRequirements = '(Electrons.pt >= 15.*GeV) && (abs(Electrons.eta) < 2.6) && ((Electrons.DFCommonElectronsLHLoose) || (Electrons.DFCommonElectronsDNNLoose))'
91 tausRequirements = '(TauJets.pt >= 20.*GeV) && (abs(TauJets.eta) < 2.6) && ((TauJets.DFTauRNNLoose || TauJets.DFTauGNTauLoose))'
92
93 chargedParticleRequirements = '(TruthParticles.pt >= 500) && (TruthParticles.isGenStable)' \
94 '&& (TruthParticles.charge != 0)' \
95 '&& (TruthParticles.theta > 0.163803) && (TruthParticles.theta < 2.97778)' \
96 '&& (TruthParticles.HSBool)'
97 # theta selection correspond to |eta|<2.5 (minus epsilon); avoids floating point exception if theta=0 or pi
98
99 muonOnlySelection = 'count('+muonsRequirements+') >=2'
100 electronOnlySelection = 'count('+electronsRequirements+') >= 2'
101 tauOnlySelection = 'count('+tausRequirements+') >= 2'
102 electronMuonSelection = '(count('+electronsRequirements+') + count('+muonsRequirements+')) >= 2'
103 electronTauSelection = '(count('+electronsRequirements+') + count('+tausRequirements+')) >= 2'
104 muonTauSelection = '(count('+muonsRequirements+') + count('+tausRequirements+')) >= 2'
105
106 # for MC we may skim on the charged-particle multiplicity
107 filterVal = -1 # Todo: nChFilter flag to be implemented later
108 if filterVal > -1 and flags.Input.isMC :
109 chargedParticleSelection = 'count('+chargedParticleRequirements+') < '+str(filterVal)
110 offlineExpression = '(('+muonOnlySelection+' || '+electronOnlySelection+' || '+tauOnlySelection+' || '+electronMuonSelection+' || '+electronTauSelection+' || '+muonTauSelection+')' \
111 '&& ('+chargedParticleSelection+'))'
112 else:
113 offlineExpression = '('+muonOnlySelection+' || '+electronOnlySelection+' || '+tauOnlySelection+' || '+electronMuonSelection+' || '+electronTauSelection+' || '+muonTauSelection+')'
114
115 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import xAODStringSkimmingToolCfg
116 STDM7StringSkimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
117 flags, name = "STDM7StringSkimmingTool", expression = offlineExpression))
118 acc.addPublicTool(STDM7StringSkimmingTool, primary=True)
119
120 return acc
121
122# Main algorithm config

◆ STDM7TriggerSkimmingToolCfg()

python.STDM7.STDM7TriggerSkimmingToolCfg ( flags)
Configure the STDM7 trigger skimming tool

Definition at line 21 of file STDM7.py.

21def STDM7TriggerSkimmingToolCfg(flags):
22 '''Configure the STDM7 trigger skimming tool'''
23 acc = ComponentAccumulator()
24
25 TriggerAPI.setConfigFlags(flags)
26
27 if flags.Trigger.EDMVersion <= 2:
28
29 # Trigger API for Runs 1, 2
30 #====================================================================
31 # TRIGGER CONTENT
32 #====================================================================
33
36 allperiods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future2e34
37 trig_el = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, livefraction=0.8)
38 trig_mu = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, livefraction=0.8)
39 trig_tau = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.tau, livefraction=0.8)
40
41 trig_em = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.mu, livefraction=0.8)
42 trig_et = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.tau, livefraction=0.8)
43 trig_mt = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, additionalTriggerType=TriggerType.tau, livefraction=0.8)
44
45
46 extra_file_notau = read_trig_list_file("DerivationFrameworkPhys/run2ExtraMatchingTriggers.txt")
47 extra_file_tau = read_trig_list_file("DerivationFrameworkPhys/run2ExtraMatchingTauTriggers.txt")
48
49
50 extra_flag_notau, extra_flag_tau = read_trig_list_flags(flags)
51
52
53 trigger_names = list(set(trig_el+trig_mu+trig_tau+trig_em+trig_et+trig_mt+extra_file_notau+extra_file_tau+extra_flag_notau+extra_flag_tau))
54
55 else: # Run 3 and Run 4
56 # TriggerAPI Session based trigger lists
57 session = getTapisSession(flags)
58 api_trigger_names = set()
59 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.el, livefraction=0.8).union(api_trigger_names)
60 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.mu, livefraction=0.8).union(api_trigger_names)
61 api_trigger_names = session.getLowestUnprescaled(triggerType=TriggerType.tau, livefraction=0.8).union(api_trigger_names)
62
63 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.mu], livefraction=0.8).union(api_trigger_names)
64 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.el, TriggerType.tau], livefraction=0.8).union(api_trigger_names)
65 api_trigger_names = session.getLowestUnprescaled(triggerType=[TriggerType.mu, TriggerType.tau], livefraction=0.8).union(api_trigger_names)
66
67
68 extra_flag_notau, extra_flag_tau = read_trig_list_flags(flags)
69 extra_flag = extra_flag_notau + extra_flag_tau
70
71
72 extra_file = read_trig_list_file("DerivationFrameworkPhys/run3ExtraMatchingTriggers.txt")
73
74
75 trigger_names = list(set(extra_file + extra_flag + list(api_trigger_names)))
76
77 STDM7TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(name = "STDM7TriggerSkimmingTool",
78 OutputLevel = 0,
79 TriggerListOR = trigger_names,
80 TriggerListAND = [] )
81 acc.addPublicTool(STDM7TriggerSkimmingTool,primary=True)
82 return(acc)
83
STL class.

Variable Documentation

◆ logSTDM7

python.STDM7.logSTDM7 = logging.getLogger('STDM7')

Definition at line 19 of file STDM7.py.