ATLAS Offline Software
Loading...
Searching...
No Matches
SlimmingHelper.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
36
37from DerivationFrameworkCore.CompulsoryContent import CompulsoryContent, CompulsoryTriggerNavigation, CompulsoryDynamicContent
38from DerivationFrameworkCore.ContentHandler import ContentHandler
39from DerivationFrameworkCore.ContainersOnTheFly import ContainersOnTheFly
40from DerivationFrameworkCore.FullListOfSmartContainers import FullListOfSmartContainers
41from AthenaConfiguration.Enums import LHCPeriod
42import PyUtils.Logging as L
43msg = L.logging.getLogger('DerivationFramework__SlimmingHelper')
44msg.setLevel(L.logging.INFO)
45
46# This list base class allows the slimming helper to be locked after calling BuildFinalItemList
47class lockable_list(list):
48 def __init__(self,data=[]):
49 list.__init__(self,data)
50 self.__dict__["_locked"] = False
51 def append(self,name):
52 if self._locked is True:
53 msg.error("Attempting to Modify SlimmingHelper after BuildFinalItemList has Been Called")
54 raise RuntimeError("Late Modification to SlimmingHelper do not modify after calling BuildFinalItemList")
55 else:
56 return list.append(self, name)
57 def __setattr__(self,name,value):
58 if self._locked is True:
59 msg.error("Attempting to Modify SlimmingHelper after BuildFinalItemList has Been Called")
60 raise RuntimeError("Late Modification to SlimmingHelper do not modify after calling BuildFinalItemList")
61 else:
62 self.__dict__[name] = value
63 def lock(self):
64 self.__dict__["_locked"] = True
65
66# Builds the "NamesAndTypes" map needed to set up the item list
68 namesAndTypes = {}
69 if len(args)==0:
70 from DerivationFrameworkCore.StaticNamesAndTypes import StaticNamesAndTypes
71 namesAndTypes = StaticNamesAndTypes
72 else:
73 for item in args[0]:
74 item = item.split('#')
75 namesAndTypes[item[1].strip('.')] = item[0]
76 return namesAndTypes
77
79 def __init__(self, inputName, flags, **kwargs):
80 self.__dict__["_locked"] = False
81 self.name = inputName
82 self.FinalItemList = lockable_list() # The final item list that will be appended to the output stream
83 self.StaticContent = lockable_list() # Content added explicitly via old-style content lists
84 self.ExtraVariables = lockable_list() # Content added by users via variable names (dictionary type:[item1,item,..,N])
85 # Smart slimming (only variables needed for CP + kinematics)
87 self.AllVariables = lockable_list() # Containers for which all branches should be kept
89 self.flags = flags
103 self.IncludeFullTriggerEDMLevel = "" # Specify an AllowedOutputFormat from TriggerEDM.py
105 # Choice of whether user provided a typed container list or not (CA vs non-CA)
106 if "NamesAndTypes" in kwargs.keys(): self.NamesAndTypes = buildNamesAndTypes(kwargs["NamesAndTypes"])
107 else: self.NamesAndTypes = buildNamesAndTypes()
108 self.theHandler = ContentHandler(self.name+"Handler",self.NamesAndTypes)
109
110 # This hack prevents any members from being modified after lock is set to true, this happens in AppendContentToStream
111 def __setattr__(self,name,value):
112 if self._locked is True:
113 msg.error("Attempting to Modify SlimmingHelper "+self.name+" After AppendContentToStream has Been Called")
114 raise RuntimeError("Late Modification to SlimmingHelper, do not modifiy after calling AppendContentToStream")
115 elif type(value)==list:
116 self.__dict__[name] = lockable_list(value)
117 else:
118 self.__dict__[name] = value
119
120 # Function to check the configuration of the Smart Slimming List
121 def CheckList(self,masterList):
122 conflicted_items=[]
123 for item in CompulsoryContent:
124 if item.endswith("#*"):
125 compare_str=item[:-2].replace("xAOD::","")
126 for m_item in masterList:
127 if m_item.startswith(compare_str) and m_item.replace("Aux.","") not in CompulsoryDynamicContent:
128 conflicted_items.append(m_item)
129 if len(conflicted_items)!=0:
130 msg.error("Slimming list contains " +str(conflicted_items)+" which are already included in compulsory content: please remove these items from slimming list")
131 raise RuntimeError("Conflict in Slimming List and Compulsory Content")
132
133
134 # Loops over final ItemList and appends each item to the stream
135 # Used for jobs not set up in the component accumulator
136 def AppendContentToStream(self,Stream):
137 # Check if the SlimmingHelper is locked.
138 # If it is, just loop over the items and append.
139 # If not, build the item list and then append.
140 if self._locked is False:
141 self.BuildFinalItemList()
142 for item in self.FinalItemList:
143 Stream.AddItem(item)
144
145 # Returns the final item list. Used for component accumulator jobs
146 def GetItemList(self):
147 # Check if the SlimmingHelper is locked.
148 # If it is, just return the item list.
149 # If not, build the item list and then return it.
150 if self._locked is False:
151 self.BuildFinalItemList()
152 return(self.FinalItemList)
153
155 # Master item list: all items that must be passed to the ContentHandler for processing
156 # This will now be filled
157 masterItemList = []
158 # All variables list: where all variables are requested, no variable lists are needed
159 # This list ensures that variables are not added individually in such cases
160 allVariablesList = []
161 self.AllVariables += CompulsoryDynamicContent
162 # Add all-variable collections
163 if len(self.AllVariables)>0:
164 for item in self.AllVariables: masterItemList.extend(self.GetWholeContentItems(item))
165 for item in masterItemList:
166 if "Aux." in item:
167 allVariablesList.append(item)
168
169 # Trigger objects: add them by hand to the smart collection list (to keep the previous interface)
170 triggerContent = False
171
172 if (self.IncludeAdditionalTriggerContent is True):
173 triggerContent = True
174
175 if (self.IncludeMuonTriggerContent is True):
176 triggerContent = True
177 self.SmartCollections.append("HLT_xAOD__MuonContainer_MuonEFInfo")
178
179 if (self.IncludeEGammaTriggerContent is True):
180 triggerContent = True
181 self.SmartCollections.append("HLT_xAOD__PhotonContainer_egamma_Photons")
182
183 if (self.IncludeJetTriggerContent is True):
184 triggerContent = True
185 self.SmartCollections.append("HLT_xAOD__JetContainer_a4tcemsubjesFS")
186 self.SmartCollections.append("HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf") # Run 3 jet collections
187 from DerivationFrameworkCore.JetTriggerFixContent import JetTriggerFixContent
188 for item in JetTriggerFixContent:
189 self.FinalItemList.append(item)
190
191 if (self.IncludeTrackingTriggerContent is True):
192 triggerContent = True
193 self.SmartCollections.append("HLT_IDVertex_FS")
194 self.SmartCollections.append("HLT_IDTrack_FS_FTF")
195
196 if (self.IncludeEtMissTriggerContent is True):
197 triggerContent = True
198 self.SmartCollections.append("HLT_xAOD__TrigMissingETContainer_TrigEFMissingET")
199 from DerivationFrameworkCore.EtMissTriggerFixContent import EtMissTriggerFixContent
200 for item in EtMissTriggerFixContent:
201 self.FinalItemList.append(item)
202 if (self.IncludeDiTauTriggerContent is True):
203 triggerContent = True
204 self.SmartCollections.append("HLT_DiTauJets")
205
206 if (self.IncludeTauTriggerContent is True):
207 triggerContent = True
208 if self.flags.Trigger.EDMVersion == 2:
209 self.SmartCollections.append("HLT_xAOD__TauJetContainer_TrigTauRecMerged")
210 elif self.flags.Trigger.EDMVersion == 3:
211 self.SmartCollections.append("HLT_TrigTauRecMerged_MVA")
212
213 if (self.IncludeBJetTriggerContent is True):
214 triggerContent = True
215 self.SmartCollections.append("HLT_xAOD__BTaggingContainer_HLTBjetFex")
216
217 if (self.IncludeBJetTriggerByYearContent is True):
218 triggerContent = True
219 self.SmartCollections.append("HLT_BJetTriggerByYearContent")
220
221 if (self.IncludeBPhysTriggerContent is True):
222 triggerContent = True
223 self.SmartCollections.append("HLT_xAOD__TrigBphysContainer_EFBMuMuFex")
224
225 if (self.IncludeMinBiasTriggerContent is True):
226 triggerContent = True
227 self.SmartCollections.append("HLT_xAOD__TrigVertexCountsContainer_vertexcounts")
228
230 triggerContent = True
231 self.SmartCollections.append("HLT_FULL_EDM")
232
233 # Smart items
234 if len(self.SmartCollections)>0:
235 for collection in self.SmartCollections:
236 masterItemList.extend(self.GetSmartItems(collection))
237
238 # Run some basic tests to prevent clashes with CompulsoryContent content
239 self.CheckList(masterItemList)
240
241 # Add extra variables
242 if len(self.ExtraVariables)>0:
243 for item in self.ExtraVariables:
244 masterItemList.extend(self.GetExtraItems(item))
245
246 #Add on-the-fly containers to the dictionary
247 for _cont,_type in ContainersOnTheFly(self.flags):
248 if _cont not in self.AppendToDictionary:
249 self.AppendToDictionary[_cont]=_type
250
251 # Process the master list...
252
253 # Main containers (this is a simple list of lines, one per container X collection)
254 mainEntries = []
255 # Aux items (this is a dictionary: collection name and list of aux variables)
256 auxEntries = {}
257 self.theHandler.AppendToDictionary = self.AppendToDictionary
258 mainEntries,auxEntries = self.theHandler.GetContent(masterItemList,allVariablesList)
259
260 # Add processed items to the stream
261 excludedAuxData = "-clusterAssociation.-PseudoJet"
262 excludedAuxEntries= [entry.strip("-") for entry in excludedAuxData.split(".")]
263 for item in mainEntries:
264 self.FinalItemList.append(item)
265 for item in auxEntries.keys():
266 theDictionary = self.NamesAndTypes.copy()
267 theDictionary.update (self.AppendToDictionary)
268 if item in theDictionary.keys():
269 if (theDictionary[item]=='xAOD::ShallowAuxContainer'):
270 entry = "xAOD::ShallowAuxContainer#"+item+"."
271 elif (theDictionary[item]=='xAOD::MissingETAuxAssociationMap'):
272 entry = "xAOD::MissingETAuxAssociationMap#"+item+"."
273 elif (theDictionary[item]=='xAOD::JetTrigAuxContainer'):
274 entry = "xAOD::JetTrigAuxContainer#"+item+"."
275 elif ("AuxInfo" in theDictionary[item]):
276 entry = "xAOD::AuxInfoBase!#"+item+"."
277 elif (theDictionary[item]=='xAOD::SpacePointAuxContainer'):
278 entry = "xAOD::SpacePointAuxContainer#"+item+"."
279 else:
280 entry = "xAOD::AuxContainerBase!#"+item+"."
281 for element in auxEntries[item]:
282 #Skip anything that shouldn't be written out to a DAOD for tracks or jets
283 if ('xAOD::TrackParticleContainer' in theDictionary[item]) and (element in excludedAuxEntries): continue
284 if ('xAOD::JetAuxContainer' in theDictionary[item]) and (element in excludedAuxEntries): continue
285 length = len(auxEntries[item])
286 if (element==(auxEntries[item])[length-1]):
287 entry += element
288 else:
289 entry += element+"."
290 if ('xAOD::TrackParticleContainer' in theDictionary[item] and auxEntries[item]==""):
291 entry+=excludedAuxData
292 if ('xAOD::JetAuxContainer' in theDictionary[item] and auxEntries[item]=="" and self.CheckDoubleTrigAuxInstruction(item)):
293 entry+=excludedAuxData
294 if (theDictionary[item]=='xAOD::SpacePointAuxContainer' and auxEntries[item]==""):
295 entry+="-measurements.-measurementLink"
296 elif ("ITkPixelSpacePointsAux" in item or \
297 "ITkStripSpacePointsAux" in item or \
298 "ITkStripOverlapSpacePointsAux" in item) and \
299 auxEntries[item]=="":
300 entry+="globalPosition"
301 self.FinalItemList.append(entry)
302
303 # Add compulsory items not covered by smart slimming (so no expansion)
304 for item in CompulsoryContent:
305 self.FinalItemList.append(item)
306
307 if (triggerContent and self.IncludeTriggerNavigation):
308 # Run2
309 for item in CompulsoryTriggerNavigation:
310 self.FinalItemList.append(item)
311 # Run3
312 from TrigDecisionTool.TrigDecisionToolHelpers import possible_keys
313 for item in possible_keys:
314 if item == "HLTNav_Summary": # This is not a compact navigation summary collection, unlike the others in this list
315 continue
316 self.FinalItemList.append('xAOD::TrigCompositeContainer#'+item)
317 self.FinalItemList.append('xAOD::TrigCompositeAuxContainer#'+item+'Aux.')
318
319 # Add non-xAOD and on-the-fly content (not covered by smart slimming so no expansion)
320 badItemsWildcards = []
321 badItemsXAOD = []
322 for item in self.StaticContent:
323 if (self.ValidateStaticContent(item)=="OK"):
324 self.FinalItemList.append(item)
325 if (self.ValidateStaticContent(item)=="WILDCARD"):
326 badItemsWildcards.append(item)
327 if (self.ValidateStaticContent(item)=="XAOD"):
328 badItemsXAOD.append(item)
329 if (len(badItemsWildcards)>0):
330 msg.error("These static items contain wildcards: not permitted")
331 print (badItemsWildcards)
332 raise RuntimeError("Static content list contains wildcards")
333 if (len(badItemsXAOD)>0):
334 msg.error("These static items are xAOD collections: not permitted")
335 print (badItemsXAOD)
336 raise RuntimeError("Static content list contains xAOD collections")
337 #Prevent any more modifications As they will be completely ignored, and hard to debug
338 self.FinalItemList.lock()
339 self.StaticContent.lock()
340 self.ExtraVariables.lock()
342 self.AllVariables.lock()
343 self._locked=True
344
345
347
348# Get full content (e.g. whole aux store) for this container
349 def GetWholeContentItems(self,collection):
350 items = [collection,collection+"Aux."]
351 return items
352
353 # Get all branches associated with all tools needed for this container
354 def GetSmartItems(self,collectionName):
355 # Look up what is needed for this container type
356 items = []
357 if collectionName not in FullListOfSmartContainers(self.flags):
358 raise RuntimeError("Smart slimming container "+collectionName+" does not exist or does not have a smart slimming list")
359 if collectionName=="EventInfo":
360 from DerivationFrameworkCore.EventInfoContent import EventInfoContent
361 items.extend(EventInfoContent)
362 elif collectionName=="Electrons":
363 from DerivationFrameworkEGamma.ElectronsCPContent import ElectronsCPContent
364 items.extend(ElectronsCPContent)
365 elif collectionName=="LRTElectrons":
366 from DerivationFrameworkEGamma.LargeD0ElectronsCPContent import LargeD0ElectronsCPContent
367 items.extend(LargeD0ElectronsCPContent)
368 elif collectionName=="Photons":
369 from DerivationFrameworkEGamma.PhotonsCPContent import PhotonsCPContent
370 items.extend(PhotonsCPContent)
371 elif collectionName=="Muons":
372 if not self.flags:
373 raise RuntimeError("We're in the era of component accumulator. Please setup your job with CA if you want to have muons")
374 from DerivationFrameworkMuons.MuonsCommonConfig import MuonCPContentCfg
375 items.extend(MuonCPContentCfg(self.flags))
376 elif collectionName=="MuonsLRT":
377 if not self.flags:
378 raise RuntimeError("We're in the era of component accumulator. Please setup your job with CA if you want to have muons")
379 from DerivationFrameworkMuons.MuonsCommonConfig import MuonCPContentLRTCfg
380 items.extend(MuonCPContentLRTCfg(self.flags))
381 elif collectionName=="TauJets":
382 if self.flags:
383 from DerivationFrameworkTau.TauCommonConfig import TauCPContentCfg
384 items.extend(TauCPContentCfg(self.flags))
385 else:
386 from DerivationFrameworkTau.TauJetsCPContent import TauJetsCPContent
387 items.extend(TauJetsCPContent)
388 elif collectionName=="DiTauJets":
389 from DerivationFrameworkTau.DiTauJetsCPContent import DiTauJetsCPContent
390 items.extend(DiTauJetsCPContent)
391 elif collectionName=="DiTauJetsLowPt":
392 from DerivationFrameworkTau.DiTauJetsCPContent import DiTauJetsLowPtCPContent
393 items.extend(DiTauJetsLowPtCPContent)
394 elif collectionName=="TauJets_MuonRM":
395 from DerivationFrameworkTau.TauJets_LepRMCPContent import TauJets_MuonRMCPContent
396 if "TauJets_MuonRM" not in self.AppendToDictionary:
397 self.AppendToDictionary["TauJets_MuonRM"] = 'xAOD::TauJetContainer'
398 self.AppendToDictionary["TauJets_MuonRMAux"] = 'xAOD::TauJetAuxContainer'
399 self.AppendToDictionary["TauTracks_MuonRM"] = 'xAOD::TauTrackContainer'
400 self.AppendToDictionary["TauTracks_MuonRMAux"] = 'xAOD::TauTrackAuxContainer'
401 self.AppendToDictionary["TauSecondaryVertices_MuonRM"] = 'xAOD::VertexContainer'
402 self.AppendToDictionary["TauSecondaryVertices_MuonRMAux"] = 'xAOD::VertexAuxContainer'
403 self.AppendToDictionary["TauNeutralParticleFlowObjects_MuonRM"] = 'xAOD::PFOContainer'
404 self.AppendToDictionary["TauNeutralParticleFlowObjects_MuonRMAux"] = 'xAOD::PFOAuxContainer'
405 items.extend(TauJets_MuonRMCPContent)
406 elif collectionName=="TauJets_EleRM":
407 from DerivationFrameworkTau.TauJets_LepRMCPContent import TauJets_EleRMCPContent
408 items.extend(TauJets_EleRMCPContent)
409 elif collectionName=="TauJetsLRT":
410 if "TauJetsLRT" not in self.AppendToDictionary:
411 self.AppendToDictionary["TauJetsLRT"] = 'xAOD::TauJetContainer'
412 self.AppendToDictionary["TauJetsLRTAux"] = 'xAOD::TauJetAuxContainer'
413 self.AppendToDictionary["TauTracksLRT"] = 'xAOD::TauTrackContainer'
414 self.AppendToDictionary["TauTracksLRTAux"] = 'xAOD::TauTrackAuxContainer'
415 self.AppendToDictionary["TauSecondaryVerticesLRT"] = 'xAOD::VertexContainer'
416 self.AppendToDictionary["TauSecondaryVerticesLRTAux"] = 'xAOD::VertexAuxContainer'
417 self.AppendToDictionary["TauNeutralParticleFlowObjectsLRT"] = 'xAOD::PFOContainer'
418 self.AppendToDictionary["TauNeutralParticleFlowObjectsLRTAux"] = 'xAOD::PFOAuxContainer'
419 from DerivationFrameworkTau.TauJetsLRTCPContent import TauJetsLRTCPContent
420 items.extend(TauJetsLRTCPContent)
421 elif collectionName=="MET_Baseline_AntiKt4EMTopo":
422 from DerivationFrameworkJetEtMiss.MET_Baseline_AntiKt4EMTopoCPContent import MET_Baseline_AntiKt4EMTopoCPContent
423 items.extend(MET_Baseline_AntiKt4EMTopoCPContent)
424 elif collectionName=="MET_Baseline_AntiKt4EMPFlow":
425 from DerivationFrameworkJetEtMiss.MET_Baseline_AntiKt4EMPFlowCPContent import MET_Baseline_AntiKt4EMPFlowCPContent
426 items.extend(MET_Baseline_AntiKt4EMPFlowCPContent)
427 elif collectionName=="AntiKt2TruthJets":
428 from DerivationFrameworkJetEtMiss.AntiKt2TruthJetsCPContent import AntiKt2TruthJetsCPContent
429 items.extend(AntiKt2TruthJetsCPContent)
430 elif collectionName=="AntiKt4TruthJets":
431 from DerivationFrameworkJetEtMiss.AntiKt4TruthJetsCPContent import AntiKt4TruthJetsCPContent
432 items.extend(AntiKt4TruthJetsCPContent)
433 elif collectionName=="AntiKt4TruthWZJets":
434 from DerivationFrameworkJetEtMiss.AntiKt4TruthWZJetsCPContent import AntiKt4TruthWZJetsCPContent
435 items.extend(AntiKt4TruthWZJetsCPContent)
436 elif collectionName=="AntiKt4TruthDressedWZJets":
437 from DerivationFrameworkJetEtMiss.AntiKt4TruthDressedWZJetsCPContent import AntiKt4TruthDressedWZJetsCPContent
438 items.extend(AntiKt4TruthDressedWZJetsCPContent)
439 elif collectionName=="AntiKt2LCTopoJets":
440 from DerivationFrameworkJetEtMiss.AntiKt2LCTopoJetsCPContent import AntiKt2LCTopoJetsCPContent
441 items.extend(AntiKt2LCTopoJetsCPContent)
442 elif collectionName=="AntiKt4LCTopoJets":
443 from DerivationFrameworkJetEtMiss.AntiKt4LCTopoJetsCPContent import AntiKt4LCTopoJetsCPContent
444 items.extend(AntiKt4LCTopoJetsCPContent)
445 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent
446 items.extend(BTaggingStandardContent(self.flags, "AntiKt4LCTopoJets"))
447 elif collectionName=="AntiKt4EMTopoJets":
448 from DerivationFrameworkJetEtMiss.AntiKt4EMTopoJetsCPContent import AntiKt4EMTopoJetsCPContent
449 items.extend(AntiKt4EMTopoJetsCPContent)
450 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent
451 items.extend(BTaggingStandardContent(self.flags, "AntiKt4EMTopoJets"))
452 elif collectionName=="AntiKt4EMTopoLowPtJets":
453 from DerivationFrameworkJetEtMiss.AntiKt4EMTopoLowPtJetsCPContent import AntiKt4EMTopoLowPtJetsCPContent
454 items.extend(AntiKt4EMTopoLowPtJetsCPContent)
455 elif collectionName=="AntiKt4EMTopoNoPtCutJets":
456 from DerivationFrameworkJetEtMiss.AntiKt4EMTopoNoPtCutJetsCPContent import AntiKt4EMTopoNoPtCutJetsCPContent
457 items.extend(AntiKt4EMTopoNoPtCutJetsCPContent)
458 elif collectionName=="AntiKt4EMPFlowJets":
459 from DerivationFrameworkJetEtMiss.AntiKt4EMPFlowJetsCPContent import AntiKt4EMPFlowJetsCPContent
460 items.extend(AntiKt4EMPFlowJetsCPContent)
461 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent
462 items.extend(BTaggingStandardContent(self.flags, "AntiKt4EMPFlowJets"))
463 elif collectionName=="AntiKt4EMPFlowJets_FTAG_expert":
464 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingExpertContent
465 items.extend(BTaggingExpertContent(self.flags, "AntiKt4EMPFlowJets"))
466 elif collectionName=="AntiKt4EMPFlowLowPtJets":
467 from DerivationFrameworkJetEtMiss.AntiKt4EMPFlowLowPtJetsCPContent import AntiKt4EMPFlowLowPtJetsCPContent
468 items.extend(AntiKt4EMPFlowLowPtJetsCPContent)
469 elif collectionName=="AntiKt4EMPFlowByVertexJets":
470 from DerivationFrameworkJetEtMiss.AntiKt4EMPFlowByVertexJetsCPContent import AntiKt4EMPFlowByVertexJetsCPContent
471 items.extend(AntiKt4EMPFlowByVertexJetsCPContent)
472 elif collectionName=="AntiKt4UFOCSSKJets":
473 from DerivationFrameworkJetEtMiss.AntiKt4UFOCSSKJetsCPContent import AntiKt4UFOCSSKJetsCPContent
474 items.extend(AntiKt4UFOCSSKJetsCPContent)
475 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent
476 items.extend(BTaggingStandardContent(self.flags, "AntiKt4UFOCSSKJets"))
477 elif collectionName=="AntiKt4UFOCSSKJets_FTAG_expert":
478 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingExpertContent
479 items.extend(BTaggingExpertContent(self.flags, "AntiKt4UFOCSSKJets"))
480 elif collectionName=="AntiKt4UFOCSSKLowPtJets":
481 from DerivationFrameworkJetEtMiss.AntiKt4UFOCSSKLowPtJetsCPContent import AntiKt4UFOCSSKLowPtJetsCPContent
482 items.extend(AntiKt4UFOCSSKLowPtJetsCPContent)
483 elif collectionName=="AntiKt10TruthJets":
484 from DerivationFrameworkJetEtMiss.AntiKt10TruthJetsCPContent import AntiKt10TruthJetsCPContent
485 items.extend(AntiKt10TruthJetsCPContent)
486 elif collectionName=="AntiKt10TruthWZJets":
487 from DerivationFrameworkJetEtMiss.AntiKt10TruthWZJetsCPContent import AntiKt10TruthWZJetsCPContent
488 items.extend(AntiKt10TruthWZJetsCPContent)
489 elif collectionName=="AntiKt10LCTopoJets":
490 from DerivationFrameworkJetEtMiss.AntiKt10LCTopoJetsCPContent import AntiKt10LCTopoJetsCPContent
491 items.extend(AntiKt10LCTopoJetsCPContent)
492 elif collectionName=="AntiKt10UFOCSSKJets":
493 from DerivationFrameworkJetEtMiss.AntiKt10UFOCSSKJetsCPContent import AntiKt10UFOCSSKJetsCPContent
494 items.extend(AntiKt10UFOCSSKJetsCPContent)
495 elif collectionName=="AntiKt10TruthSoftDropBeta100Zcut10Jets":
496 from DerivationFrameworkJetEtMiss.AntiKt10TruthSoftDropBeta100Zcut10JetsCPContent import AntiKt10TruthSoftDropBeta100Zcut10JetsCPContent
497 items.extend(AntiKt10TruthSoftDropBeta100Zcut10JetsCPContent)
498 elif collectionName=="AntiKt10TruthDressedWZSoftDropBeta100Zcut10Jets":
499 from DerivationFrameworkJetEtMiss.AntiKt10TruthDressedWZSoftDropBeta100Zcut10JetsCPContent import AntiKt10TruthDressedWZSoftDropBeta100Zcut10JetsCPContent
500 items.extend(AntiKt10TruthDressedWZSoftDropBeta100Zcut10JetsCPContent)
501 elif collectionName=="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets":
502 from DerivationFrameworkJetEtMiss.AntiKt10UFOCSSKSoftDropBeta100Zcut10JetsCPContent import AntiKt10UFOCSSKSoftDropBeta100Zcut10JetsCPContent
503 items.extend(AntiKt10UFOCSSKSoftDropBeta100Zcut10JetsCPContent)
504 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingLargeRContent
505 items.extend(BTaggingLargeRContent(self.flags, "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"))
506 elif collectionName=="AntiKtVR30Rmax4Rmin02PV0TrackJets":
507 from DerivationFrameworkJetEtMiss.AntiKtVR30Rmax4Rmin02PV0TrackJetsCPContent import AntiKtVR30Rmax4Rmin02PV0TrackJetsCPContent
508 items.extend(AntiKtVR30Rmax4Rmin02PV0TrackJetsCPContent)
509 elif collectionName=="InDetTrackParticles":
510 from DerivationFrameworkInDet.InDetTrackParticlesCPContent import InDetTrackParticlesCPContent
511 items.extend(InDetTrackParticlesCPContent)
512 if self.flags.GeoModel.Run >= LHCPeriod.Run4:
513 from DerivationFrameworkInDet.InDetTrackParticlesCPContentRun4 import InDetTrackParticlesCPContentRun4
514 items.extend(InDetTrackParticlesCPContentRun4)
515 elif collectionName=="InDetPseudoTrackParticles":
516 from DerivationFrameworkInDet.InDetPseudoTrackParticlesCPContent import InDetPseudoTrackParticlesCPContent
517 items.extend(InDetPseudoTrackParticlesCPContent)
518 elif collectionName=="InDetReplacedWithPseudoTrackParticles":
519 from DerivationFrameworkInDet.InDetReplacedWithPseudoTrackParticlesCPContent import InDetReplacedWithPseudoTrackParticlesCPContent
520 items.extend(InDetReplacedWithPseudoTrackParticlesCPContent)
521 elif collectionName=="InDetReplacedWithPseudoFromBTrackParticles":
522 from DerivationFrameworkInDet.InDetReplacedWithPseudoFromBTrackParticlesCPContent import InDetReplacedWithPseudoFromBTrackParticlesCPContent
523 items.extend(InDetReplacedWithPseudoFromBTrackParticlesCPContent)
524 elif collectionName=="InDetReplacedWithPseudoNotFromBTrackParticles":
525 from DerivationFrameworkInDet.InDetReplacedWithPseudoNotFromBTrackParticlesCPContent import InDetReplacedWithPseudoNotFromBTrackParticlesCPContent
526 items.extend(InDetReplacedWithPseudoNotFromBTrackParticlesCPContent)
527 elif collectionName=="InDetPlusPseudoTrackParticles":
528 from DerivationFrameworkInDet.InDetPlusPseudoTrackParticlesCPContent import InDetPlusPseudoTrackParticlesCPContent
529 items.extend(InDetPlusPseudoTrackParticlesCPContent)
530 elif collectionName=="InDetPlusPseudoFromBTrackParticles":
531 from DerivationFrameworkInDet.InDetPlusPseudoFromBTrackParticlesCPContent import InDetPlusPseudoFromBTrackParticlesCPContent
532 items.extend(InDetPlusPseudoFromBTrackParticlesCPContent)
533 elif collectionName=="InDetPlusPseudoNotFromBTrackParticles":
534 from DerivationFrameworkInDet.InDetPlusPseudoNotFromBTrackParticlesCPContent import InDetPlusPseudoNotFromBTrackParticlesCPContent
535 items.extend(InDetPlusPseudoNotFromBTrackParticlesCPContent)
536 elif collectionName=="InDetNoFakesTrackParticles":
537 from DerivationFrameworkInDet.InDetNoFakesTrackParticlesCPContent import InDetNoFakesTrackParticlesCPContent
538 items.extend(InDetNoFakesTrackParticlesCPContent)
539 elif collectionName=="InDetNoFakesFromBTrackParticles":
540 from DerivationFrameworkInDet.InDetNoFakesFromBTrackParticlesCPContent import InDetNoFakesFromBTrackParticlesCPContent
541 items.extend(InDetNoFakesFromBTrackParticlesCPContent)
542 elif collectionName=="InDetNoFakesNotFromBTrackParticles":
543 from DerivationFrameworkInDet.InDetNoFakesNotFromBTrackParticlesCPContent import InDetNoFakesNotFromBTrackParticlesCPContent
544 items.extend(InDetNoFakesNotFromBTrackParticlesCPContent)
545 elif collectionName=="InDetSiSPSeededTracksParticles":
546 from DerivationFrameworkInDet.InDetSiSPSeededTracksParticlesCPContent import InDetSiSPSeededTracksParticlesCPContent
547 items.extend(InDetSiSPSeededTracksParticlesCPContent)
548 elif collectionName=="InDetLowPtRoITrackParticles":
549 from DerivationFrameworkInDet.InDetLowPtRoITrackParticlesCPContent import InDetLowPtRoITrackParticlesCPContent
550 items.extend(InDetLowPtRoITrackParticlesCPContent)
551 elif collectionName=="RoIVerticesLowPtRoI":
552 from DerivationFrameworkInDet.InDetLowPtRoIVerticesCPContent import InDetLowPtRoIVerticesCPContent
553 items.extend(InDetLowPtRoIVerticesCPContent)
554 elif collectionName=="InDetLargeD0TrackParticles":
555 from DerivationFrameworkInDet.InDetLargeD0TrackParticlesCPContent import InDetLargeD0TrackParticlesCPContent
556 items.extend(InDetLargeD0TrackParticlesCPContent)
557 elif collectionName=="PrimaryVertices":
558 from DerivationFrameworkInDet.PrimaryVerticesCPContent import PrimaryVerticesCPContent
559 items.extend(PrimaryVerticesCPContent)
560 if self.flags.GeoModel.Run >= LHCPeriod.Run4:
561 from DerivationFrameworkInDet.PrimaryVerticesCPContentRun4 import PrimaryVerticesCPContentRun4
562 items.extend(PrimaryVerticesCPContentRun4)
563 elif self.IncludeAdditionalTriggerContent is True:
564 from DerivationFrameworkCore.AdditionalTriggerContent import AdditionalTriggerContent
565 items.extend(AdditionalTriggerContent)
566 elif collectionName=="HLT_xAOD__MuonContainer_MuonEFInfo":
567 from DerivationFrameworkMuons.MuonTriggerContent import MuonTriggerContent
568 items.extend(MuonTriggerContent)
569 elif collectionName=="HLT_xAOD__PhotonContainer_egamma_Photons":
570 from DerivationFrameworkCore.EGammaTriggerContent import EGammaTriggerContent
571 items.extend(EGammaTriggerContent)
572 elif collectionName=="HLT_xAOD__JetContainer_a4tcemsubjesFS":
573 from DerivationFrameworkCore.JetTriggerContent import JetTriggerContent
574 items.extend(JetTriggerContent)
575 elif collectionName=="HLT_IDVertex_FS":
576 from DerivationFrameworkCore.TrackingTriggerContent import TrackingTriggerContent
577 items.extend(TrackingTriggerContent)
578 elif collectionName=="HLT_IDTrack_FS_FTF":
579 from DerivationFrameworkCore.TrackingTriggerContent import TrackingTriggerContent
580 items.extend(TrackingTriggerContent)
581 elif collectionName=="HLT_xAOD__TrigMissingETContainer_TrigEFMissingET":
582 from DerivationFrameworkCore.EtMissTriggerContent import EtMissTriggerContent
583 items.extend(EtMissTriggerContent)
584 elif collectionName=="HLT_xAOD__TauJetContainer_TrigTauRecMerged":
585 from DerivationFrameworkCore.TauTriggerContent import TauTriggerContentRun2
586 items.extend(TauTriggerContentRun2)
587 elif collectionName=="HLT_TrigTauRecMerged_MVA":
588 from DerivationFrameworkCore.TauTriggerContent import TauTriggerContentRun3
589 items.extend(TauTriggerContentRun3)
590 elif collectionName=="HLT_DiTauJets":
591 from DerivationFrameworkCore.DiTauTriggerContent import DiTauTriggerContent
592 items.extend(DiTauTriggerContent)
593 elif collectionName=="HLT_xAOD__BTaggingContainer_HLTBjetFex":
594 from DerivationFrameworkFlavourTag.BJetTriggerContent import BJetTriggerContent
595 items.extend(BJetTriggerContent)
596 elif collectionName=="HLT_xAOD__TrigBphysContainer_EFBMuMuFex":
597 from DerivationFrameworkCore.BPhysTriggerContent import BPhysTriggerContent
598 items.extend(BPhysTriggerContent)
599 elif collectionName=="HLT_xAOD__TrigVertexCountsContainer_vertexcounts":
600 from DerivationFrameworkCore.MinBiasTriggerContent import MinBiasTriggerContent
601 items.extend(MinBiasTriggerContent)
602 elif collectionName=="HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf":
603 from DerivationFrameworkCore.JetTriggerContentRun3 import JetTriggerContentRun3
604 from DerivationFrameworkCore.JetTriggerContentRun3TLA import JetTriggerContentRun3TLA
606 items.extend(JetTriggerContentRun3)
607 else:
608 items.extend(JetTriggerContentRun3TLA)
609 elif collectionName=="HLT_BJetTriggerByYearContent":
610 from FTagAnalysisAlgorithms.BJetTriggerByYearContent import getBJetTriggerContent
611 items.extend(getBJetTriggerContent(self.flags))
612 elif collectionName=="HLT_FULL_EDM":
613 from DerivationFrameworkTrigger.TrigSlimmingHelper import addTrigEDMSetToOutput
614 items.extend(addTrigEDMSetToOutput(self.flags, self, edmSet=self.IncludeFullTriggerEDMLevel))
615
616 else:
617 raise RuntimeError("Smart slimming container "+collectionName+" does not exist or does not have a smart slimming list")
618 return items
619
620 # Kinematics content only
621 def GetKinematicsItems(self,collectionName):
622 # Content lines in the same style as is produced by the PrintStats
623 kinematicsLine = collectionName+"Aux."+"pt.eta.phi.m"
624 items = [collectionName,kinematicsLine]
625 return items
626
627 # Extra content, listed via container
628 def GetExtraItems(self,userInput):
629 # Build up a content list in the same style as is produced by the PrintStats
630 splitup = userInput.split(".")
631 auxContainerName = splitup[0]+"Aux"
632 items = []
633 items.append(splitup[0])
634 auxLine = ""
635 length = len(splitup)
636 for string in splitup:
637 if string==splitup[0]:
638 auxLine = auxContainerName+"."
639 continue
640 if string==splitup[length-1]:
641 auxLine = auxLine+string
642 else:
643 auxLine = auxLine+string+"."
644 items.append(auxLine)
645 return items
646
647 # Check that static content is legit
648 def ValidateStaticContent(self,item):
649 # No wildcards
650 if ("*" in item):
651 return "WILDCARD"
652 # No xAOD containers
653 sep = item.split("#")
654 if ("xAOD::" in item and sep[1] in self.NamesAndTypes.keys()):
655 return "XAOD"
656 return "OK"
657
658 # Required to prevent:
659 # Mixing up negative and positive Aux selections is not supported: xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_bJetsAux. : {'-clusterAssociation.-PseudoJet', 'phi.eta.pt.m'}
660 # Where the negative rule comes from the above excludedAuxData loop, and the positive rule comes from the IncludeFullTriggerEDMLevel flag and "HLT_FULL_EDM" smart-collection.
661 # Results in all content being stored for this container (will write all attributes. Original selection was: {'', 'phi.m.eta.pt'}) which is OK as it does not have either of the above
662 # decorations which are not possible to include at the DAOD level. Current decorations: viewIndex, btaggingLink, JVFCorr, Jvt, SumPtTrkPt500
664 if self.IncludeFullTriggerEDMLevel and 'HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_bJetsAux' in aux:
665 return False
666 return True
virtual void lock()=0
Interface to allow an object to lock itself when made const in SG.
__init__(self, inputName, flags, **kwargs)
masterItemList.extend(self.GetWholeContentItems(item)) AllVariables
GetWholeContentItems(self, collection)
GetSmartItems(self, collectionName)
GetKinematicsItems(self, collectionName)
__setattr__(self, name, value)
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition hcg.cxx:312
buildNamesAndTypes(*args)