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 self.FinalItemList.append(entry)
297
298 # Add compulsory items not covered by smart slimming (so no expansion)
299 for item in CompulsoryContent:
300 self.FinalItemList.append(item)
301
302 # non xAOD collections for MinBias
303 if (self.IncludeMinBiasTriggerContent is True):
304 from DerivationFrameworkCore.MinBiasTrigger_nonxAOD_Content import MinBiasTrigger_nonxAOD_Content
305 for item in MinBiasTrigger_nonxAOD_Content:
306 self.FinalItemList.append(item)
307
308 if (triggerContent and self.IncludeTriggerNavigation):
309 # Run2
310 for item in CompulsoryTriggerNavigation:
311 self.FinalItemList.append(item)
312 # Run3
313 from TrigDecisionTool.TrigDecisionToolHelpers import possible_keys
314 for item in possible_keys:
315 if item == "HLTNav_Summary": # This is not a compact navigation summary collection, unlike the others in this list
316 continue
317 self.FinalItemList.append('xAOD::TrigCompositeContainer#'+item)
318 self.FinalItemList.append('xAOD::TrigCompositeAuxContainer#'+item+'Aux.')
319
320 # Add non-xAOD and on-the-fly content (not covered by smart slimming so no expansion)
321 badItemsWildcards = []
322 badItemsXAOD = []
323 for item in self.StaticContent:
324 if (self.ValidateStaticContent(item)=="OK"):
325 self.FinalItemList.append(item)
326 if (self.ValidateStaticContent(item)=="WILDCARD"):
327 badItemsWildcards.append(item)
328 if (self.ValidateStaticContent(item)=="XAOD"):
329 badItemsXAOD.append(item)
330 if (len(badItemsWildcards)>0):
331 msg.error("These static items contain wildcards: not permitted")
332 print (badItemsWildcards)
333 raise RuntimeError("Static content list contains wildcards")
334 if (len(badItemsXAOD)>0):
335 msg.error("These static items are xAOD collections: not permitted")
336 print (badItemsXAOD)
337 raise RuntimeError("Static content list contains xAOD collections")
338 #Prevent any more modifications As they will be completely ignored, and hard to debug
339 self.FinalItemList.lock()
340 self.StaticContent.lock()
341 self.ExtraVariables.lock()
343 self.AllVariables.lock()
344 self._locked=True
345
346
348
349# Get full content (e.g. whole aux store) for this container
350 def GetWholeContentItems(self,collection):
351 items = [collection,collection+"Aux."]
352 return items
353
354 # Get all branches associated with all tools needed for this container
355 def GetSmartItems(self,collectionName):
356 # Look up what is needed for this container type
357 items = []
358 if collectionName not in FullListOfSmartContainers(self.flags):
359 raise RuntimeError("Smart slimming container "+collectionName+" does not exist or does not have a smart slimming list")
360 if collectionName=="EventInfo":
361 from DerivationFrameworkCore.EventInfoContent import EventInfoContent
362 items.extend(EventInfoContent)
363 elif collectionName=="Electrons":
364 from DerivationFrameworkEGamma.ElectronsCPContent import ElectronsCPContent
365 items.extend(ElectronsCPContent)
366 elif collectionName=="LRTElectrons":
367 from DerivationFrameworkEGamma.LargeD0ElectronsCPContent import LargeD0ElectronsCPContent
368 items.extend(LargeD0ElectronsCPContent)
369 elif collectionName=="Photons":
370 from DerivationFrameworkEGamma.PhotonsCPContent import PhotonsCPContent
371 items.extend(PhotonsCPContent)
372 elif collectionName=="Muons":
373 if not self.flags:
374 raise RuntimeError("We're in the era of component accumulator. Please setup your job with CA if you want to have muons")
375 from DerivationFrameworkMuons.MuonsCommonConfig import MuonCPContentCfg
376 items.extend(MuonCPContentCfg(self.flags))
377 elif collectionName=="MuonsLRT":
378 if not self.flags:
379 raise RuntimeError("We're in the era of component accumulator. Please setup your job with CA if you want to have muons")
380 from DerivationFrameworkMuons.MuonsCommonConfig import MuonCPContentLRTCfg
381 items.extend(MuonCPContentLRTCfg(self.flags))
382 elif collectionName=="TauJets":
383 from DerivationFrameworkTau.TauJetsCPContent import TauJetsCPContent
384 items.extend(TauJetsCPContent)
385 elif collectionName=="DiTauJets":
386 from DerivationFrameworkTau.DiTauJetsCPContent import DiTauJetsCPContent
387 items.extend(DiTauJetsCPContent)
388 elif collectionName=="DiTauJetsLowPt":
389 from DerivationFrameworkTau.DiTauJetsCPContent import DiTauJetsLowPtCPContent
390 items.extend(DiTauJetsLowPtCPContent)
391 elif collectionName=="TauJets_MuonRM":
392 from DerivationFrameworkTau.TauJets_LepRMCPContent import TauJets_MuonRMCPContent
393 if "TauJets_MuonRM" not in self.AppendToDictionary:
394 self.AppendToDictionary["TauJets_MuonRM"] = 'xAOD::TauJetContainer'
395 self.AppendToDictionary["TauJets_MuonRMAux"] = 'xAOD::TauJetAuxContainer'
396 self.AppendToDictionary["TauTracks_MuonRM"] = 'xAOD::TauTrackContainer'
397 self.AppendToDictionary["TauTracks_MuonRMAux"] = 'xAOD::TauTrackAuxContainer'
398 self.AppendToDictionary["TauSecondaryVertices_MuonRM"] = 'xAOD::VertexContainer'
399 self.AppendToDictionary["TauSecondaryVertices_MuonRMAux"] = 'xAOD::VertexAuxContainer'
400 self.AppendToDictionary["TauNeutralParticleFlowObjects_MuonRM"] = 'xAOD::PFOContainer'
401 self.AppendToDictionary["TauNeutralParticleFlowObjects_MuonRMAux"] = 'xAOD::PFOAuxContainer'
402 items.extend(TauJets_MuonRMCPContent)
403 elif collectionName=="TauJets_EleRM":
404 from DerivationFrameworkTau.TauJets_LepRMCPContent import TauJets_EleRMCPContent
405 items.extend(TauJets_EleRMCPContent)
406 elif collectionName=="TauJetsLRT":
407 if "TauJetsLRT" not in self.AppendToDictionary:
408 self.AppendToDictionary["TauJetsLRT"] = 'xAOD::TauJetContainer'
409 self.AppendToDictionary["TauJetsLRTAux"] = 'xAOD::TauJetAuxContainer'
410 self.AppendToDictionary["TauTracksLRT"] = 'xAOD::TauTrackContainer'
411 self.AppendToDictionary["TauTracksLRTAux"] = 'xAOD::TauTrackAuxContainer'
412 self.AppendToDictionary["TauSecondaryVerticesLRT"] = 'xAOD::VertexContainer'
413 self.AppendToDictionary["TauSecondaryVerticesLRTAux"] = 'xAOD::VertexAuxContainer'
414 self.AppendToDictionary["TauNeutralParticleFlowObjectsLRT"] = 'xAOD::PFOContainer'
415 self.AppendToDictionary["TauNeutralParticleFlowObjectsLRTAux"] = 'xAOD::PFOAuxContainer'
416 from DerivationFrameworkTau.TauJetsLRTCPContent import TauJetsLRTCPContent
417 items.extend(TauJetsLRTCPContent)
418 elif collectionName=="MET_Baseline_AntiKt4EMTopo":
419 from DerivationFrameworkJetEtMiss.MET_Baseline_AntiKt4EMTopoCPContent import MET_Baseline_AntiKt4EMTopoCPContent
420 items.extend(MET_Baseline_AntiKt4EMTopoCPContent)
421 elif collectionName=="MET_Baseline_AntiKt4EMPFlow":
422 from DerivationFrameworkJetEtMiss.MET_Baseline_AntiKt4EMPFlowCPContent import MET_Baseline_AntiKt4EMPFlowCPContent
423 items.extend(MET_Baseline_AntiKt4EMPFlowCPContent)
424 elif collectionName=="AntiKt2TruthJets":
425 from DerivationFrameworkJetEtMiss.AntiKt2TruthJetsCPContent import AntiKt2TruthJetsCPContent
426 items.extend(AntiKt2TruthJetsCPContent)
427 elif collectionName=="AntiKt4TruthJets":
428 from DerivationFrameworkJetEtMiss.AntiKt4TruthJetsCPContent import AntiKt4TruthJetsCPContent
429 items.extend(AntiKt4TruthJetsCPContent)
430 elif collectionName=="AntiKt4TruthWZJets":
431 from DerivationFrameworkJetEtMiss.AntiKt4TruthWZJetsCPContent import AntiKt4TruthWZJetsCPContent
432 items.extend(AntiKt4TruthWZJetsCPContent)
433 elif collectionName=="AntiKt4TruthDressedWZJets":
434 from DerivationFrameworkJetEtMiss.AntiKt4TruthDressedWZJetsCPContent import AntiKt4TruthDressedWZJetsCPContent
435 items.extend(AntiKt4TruthDressedWZJetsCPContent)
436 elif collectionName=="AntiKt2LCTopoJets":
437 from DerivationFrameworkJetEtMiss.AntiKt2LCTopoJetsCPContent import AntiKt2LCTopoJetsCPContent
438 items.extend(AntiKt2LCTopoJetsCPContent)
439 elif collectionName=="AntiKt4LCTopoJets":
440 from DerivationFrameworkJetEtMiss.AntiKt4LCTopoJetsCPContent import AntiKt4LCTopoJetsCPContent
441 items.extend(AntiKt4LCTopoJetsCPContent)
442 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent
443 items.extend(BTaggingStandardContent(self.flags, "AntiKt4LCTopoJets"))
444 elif collectionName=="AntiKt4EMTopoJets":
445 from DerivationFrameworkJetEtMiss.AntiKt4EMTopoJetsCPContent import AntiKt4EMTopoJetsCPContent
446 items.extend(AntiKt4EMTopoJetsCPContent)
447 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent
448 items.extend(BTaggingStandardContent(self.flags, "AntiKt4EMTopoJets"))
449 elif collectionName=="AntiKt4EMTopoLowPtJets":
450 from DerivationFrameworkJetEtMiss.AntiKt4EMTopoLowPtJetsCPContent import AntiKt4EMTopoLowPtJetsCPContent
451 items.extend(AntiKt4EMTopoLowPtJetsCPContent)
452 elif collectionName=="AntiKt4EMTopoNoPtCutJets":
453 from DerivationFrameworkJetEtMiss.AntiKt4EMTopoNoPtCutJetsCPContent import AntiKt4EMTopoNoPtCutJetsCPContent
454 items.extend(AntiKt4EMTopoNoPtCutJetsCPContent)
455 elif collectionName=="AntiKt4EMPFlowJets":
456 from DerivationFrameworkJetEtMiss.AntiKt4EMPFlowJetsCPContent import AntiKt4EMPFlowJetsCPContent
457 items.extend(AntiKt4EMPFlowJetsCPContent)
458 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent
459 items.extend(BTaggingStandardContent(self.flags, "AntiKt4EMPFlowJets"))
460 elif collectionName=="AntiKt4EMPFlowJets_FTAG_expert":
461 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingExpertContent
462 items.extend(BTaggingExpertContent(self.flags, "AntiKt4EMPFlowJets"))
463 elif collectionName=="AntiKt4EMPFlowLowPtJets":
464 from DerivationFrameworkJetEtMiss.AntiKt4EMPFlowLowPtJetsCPContent import AntiKt4EMPFlowLowPtJetsCPContent
465 items.extend(AntiKt4EMPFlowLowPtJetsCPContent)
466 elif collectionName=="AntiKt4EMPFlowByVertexJets":
467 from DerivationFrameworkJetEtMiss.AntiKt4EMPFlowByVertexJetsCPContent import AntiKt4EMPFlowByVertexJetsCPContent
468 items.extend(AntiKt4EMPFlowByVertexJetsCPContent)
469 elif collectionName=="AntiKt4UFOCSSKJets":
470 from DerivationFrameworkJetEtMiss.AntiKt4UFOCSSKJetsCPContent import AntiKt4UFOCSSKJetsCPContent
471 items.extend(AntiKt4UFOCSSKJetsCPContent)
472 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent
473 items.extend(BTaggingStandardContent(self.flags, "AntiKt4UFOCSSKJets"))
474 elif collectionName=="AntiKt4UFOCSSKJets_FTAG_expert":
475 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingExpertContent
476 items.extend(BTaggingExpertContent(self.flags, "AntiKt4UFOCSSKJets"))
477 elif collectionName=="AntiKt4UFOCSSKLowPtJets":
478 from DerivationFrameworkJetEtMiss.AntiKt4UFOCSSKLowPtJetsCPContent import AntiKt4UFOCSSKLowPtJetsCPContent
479 items.extend(AntiKt4UFOCSSKLowPtJetsCPContent)
480 elif collectionName=="AntiKt10TruthJets":
481 from DerivationFrameworkJetEtMiss.AntiKt10TruthJetsCPContent import AntiKt10TruthJetsCPContent
482 items.extend(AntiKt10TruthJetsCPContent)
483 elif collectionName=="AntiKt10TruthWZJets":
484 from DerivationFrameworkJetEtMiss.AntiKt10TruthWZJetsCPContent import AntiKt10TruthWZJetsCPContent
485 items.extend(AntiKt10TruthWZJetsCPContent)
486 elif collectionName=="AntiKt10LCTopoJets":
487 from DerivationFrameworkJetEtMiss.AntiKt10LCTopoJetsCPContent import AntiKt10LCTopoJetsCPContent
488 items.extend(AntiKt10LCTopoJetsCPContent)
489 elif collectionName=="AntiKt10UFOCSSKJets":
490 from DerivationFrameworkJetEtMiss.AntiKt10UFOCSSKJetsCPContent import AntiKt10UFOCSSKJetsCPContent
491 items.extend(AntiKt10UFOCSSKJetsCPContent)
492 elif collectionName=="AntiKt10TruthSoftDropBeta100Zcut10Jets":
493 from DerivationFrameworkJetEtMiss.AntiKt10TruthSoftDropBeta100Zcut10JetsCPContent import AntiKt10TruthSoftDropBeta100Zcut10JetsCPContent
494 items.extend(AntiKt10TruthSoftDropBeta100Zcut10JetsCPContent)
495 elif collectionName=="AntiKt10TruthDressedWZSoftDropBeta100Zcut10Jets":
496 from DerivationFrameworkJetEtMiss.AntiKt10TruthDressedWZSoftDropBeta100Zcut10JetsCPContent import AntiKt10TruthDressedWZSoftDropBeta100Zcut10JetsCPContent
497 items.extend(AntiKt10TruthDressedWZSoftDropBeta100Zcut10JetsCPContent)
498 elif collectionName=="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets":
499 from DerivationFrameworkJetEtMiss.AntiKt10UFOCSSKSoftDropBeta100Zcut10JetsCPContent import AntiKt10UFOCSSKSoftDropBeta100Zcut10JetsCPContent
500 items.extend(AntiKt10UFOCSSKSoftDropBeta100Zcut10JetsCPContent)
501 from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingLargeRContent
502 items.extend(BTaggingLargeRContent(self.flags, "AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"))
503 elif collectionName=="AntiKtVR30Rmax4Rmin02PV0TrackJets":
504 from DerivationFrameworkJetEtMiss.AntiKtVR30Rmax4Rmin02PV0TrackJetsCPContent import AntiKtVR30Rmax4Rmin02PV0TrackJetsCPContent
505 items.extend(AntiKtVR30Rmax4Rmin02PV0TrackJetsCPContent)
506 elif collectionName=="InDetTrackParticles":
507 from DerivationFrameworkInDet.InDetTrackParticlesCPContent import InDetTrackParticlesCPContent
508 items.extend(InDetTrackParticlesCPContent)
509 if self.flags.GeoModel.Run >= LHCPeriod.Run4:
510 from DerivationFrameworkInDet.InDetTrackParticlesCPContentRun4 import InDetTrackParticlesCPContentRun4
511 items.extend(InDetTrackParticlesCPContentRun4)
512 elif collectionName=="InDetPseudoTrackParticles":
513 from DerivationFrameworkInDet.InDetPseudoTrackParticlesCPContent import InDetPseudoTrackParticlesCPContent
514 items.extend(InDetPseudoTrackParticlesCPContent)
515 elif collectionName=="InDetReplacedWithPseudoTrackParticles":
516 from DerivationFrameworkInDet.InDetReplacedWithPseudoTrackParticlesCPContent import InDetReplacedWithPseudoTrackParticlesCPContent
517 items.extend(InDetReplacedWithPseudoTrackParticlesCPContent)
518 elif collectionName=="InDetReplacedWithPseudoFromBTrackParticles":
519 from DerivationFrameworkInDet.InDetReplacedWithPseudoFromBTrackParticlesCPContent import InDetReplacedWithPseudoFromBTrackParticlesCPContent
520 items.extend(InDetReplacedWithPseudoFromBTrackParticlesCPContent)
521 elif collectionName=="InDetReplacedWithPseudoNotFromBTrackParticles":
522 from DerivationFrameworkInDet.InDetReplacedWithPseudoNotFromBTrackParticlesCPContent import InDetReplacedWithPseudoNotFromBTrackParticlesCPContent
523 items.extend(InDetReplacedWithPseudoNotFromBTrackParticlesCPContent)
524 elif collectionName=="InDetPlusPseudoTrackParticles":
525 from DerivationFrameworkInDet.InDetPlusPseudoTrackParticlesCPContent import InDetPlusPseudoTrackParticlesCPContent
526 items.extend(InDetPlusPseudoTrackParticlesCPContent)
527 elif collectionName=="InDetPlusPseudoFromBTrackParticles":
528 from DerivationFrameworkInDet.InDetPlusPseudoFromBTrackParticlesCPContent import InDetPlusPseudoFromBTrackParticlesCPContent
529 items.extend(InDetPlusPseudoFromBTrackParticlesCPContent)
530 elif collectionName=="InDetPlusPseudoNotFromBTrackParticles":
531 from DerivationFrameworkInDet.InDetPlusPseudoNotFromBTrackParticlesCPContent import InDetPlusPseudoNotFromBTrackParticlesCPContent
532 items.extend(InDetPlusPseudoNotFromBTrackParticlesCPContent)
533 elif collectionName=="InDetNoFakesTrackParticles":
534 from DerivationFrameworkInDet.InDetNoFakesTrackParticlesCPContent import InDetNoFakesTrackParticlesCPContent
535 items.extend(InDetNoFakesTrackParticlesCPContent)
536 elif collectionName=="InDetNoFakesFromBTrackParticles":
537 from DerivationFrameworkInDet.InDetNoFakesFromBTrackParticlesCPContent import InDetNoFakesFromBTrackParticlesCPContent
538 items.extend(InDetNoFakesFromBTrackParticlesCPContent)
539 elif collectionName=="InDetNoFakesNotFromBTrackParticles":
540 from DerivationFrameworkInDet.InDetNoFakesNotFromBTrackParticlesCPContent import InDetNoFakesNotFromBTrackParticlesCPContent
541 items.extend(InDetNoFakesNotFromBTrackParticlesCPContent)
542 elif collectionName=="InDetSiSPSeededTracksParticles":
543 from DerivationFrameworkInDet.InDetSiSPSeededTracksParticlesCPContent import InDetSiSPSeededTracksParticlesCPContent
544 items.extend(InDetSiSPSeededTracksParticlesCPContent)
545 elif collectionName=="InDetLowPtRoITrackParticles":
546 from DerivationFrameworkInDet.InDetLowPtRoITrackParticlesCPContent import InDetLowPtRoITrackParticlesCPContent
547 items.extend(InDetLowPtRoITrackParticlesCPContent)
548 elif collectionName=="RoIVerticesLowPtRoI":
549 from DerivationFrameworkInDet.InDetLowPtRoIVerticesCPContent import InDetLowPtRoIVerticesCPContent
550 items.extend(InDetLowPtRoIVerticesCPContent)
551 elif collectionName=="InDetLargeD0TrackParticles":
552 from DerivationFrameworkInDet.InDetLargeD0TrackParticlesCPContent import InDetLargeD0TrackParticlesCPContent
553 items.extend(InDetLargeD0TrackParticlesCPContent)
554 elif collectionName=="PrimaryVertices":
555 from DerivationFrameworkInDet.PrimaryVerticesCPContent import PrimaryVerticesCPContent
556 items.extend(PrimaryVerticesCPContent)
557 if self.flags.GeoModel.Run >= LHCPeriod.Run4:
558 from DerivationFrameworkInDet.PrimaryVerticesCPContentRun4 import PrimaryVerticesCPContentRun4
559 items.extend(PrimaryVerticesCPContentRun4)
560 elif self.IncludeAdditionalTriggerContent is True:
561 from DerivationFrameworkCore.AdditionalTriggerContent import AdditionalTriggerContent
562 items.extend(AdditionalTriggerContent)
563 elif collectionName=="HLT_xAOD__MuonContainer_MuonEFInfo":
564 from DerivationFrameworkMuons.MuonTriggerContent import MuonTriggerContent
565 items.extend(MuonTriggerContent)
566 elif collectionName=="HLT_xAOD__PhotonContainer_egamma_Photons":
567 from DerivationFrameworkCore.EGammaTriggerContent import EGammaTriggerContent
568 items.extend(EGammaTriggerContent)
569 elif collectionName=="HLT_xAOD__JetContainer_a4tcemsubjesFS":
570 from DerivationFrameworkCore.JetTriggerContent import JetTriggerContent
571 items.extend(JetTriggerContent)
572 elif collectionName=="HLT_IDVertex_FS":
573 from DerivationFrameworkCore.TrackingTriggerContent import TrackingTriggerContent
574 items.extend(TrackingTriggerContent)
575 elif collectionName=="HLT_IDTrack_FS_FTF":
576 from DerivationFrameworkCore.TrackingTriggerContent import TrackingTriggerContent
577 items.extend(TrackingTriggerContent)
578 elif collectionName=="HLT_xAOD__TrigMissingETContainer_TrigEFMissingET":
579 from DerivationFrameworkCore.EtMissTriggerContent import EtMissTriggerContent
580 items.extend(EtMissTriggerContent)
581 elif collectionName=="HLT_xAOD__TauJetContainer_TrigTauRecMerged":
582 from DerivationFrameworkCore.TauTriggerContent import TauTriggerContentRun2
583 items.extend(TauTriggerContentRun2)
584 elif collectionName=="HLT_TrigTauRecMerged_MVA":
585 from DerivationFrameworkCore.TauTriggerContent import TauTriggerContentRun3
586 items.extend(TauTriggerContentRun3)
587 elif collectionName=="HLT_DiTauJets":
588 from DerivationFrameworkCore.DiTauTriggerContent import DiTauTriggerContent
589 items.extend(DiTauTriggerContent)
590 elif collectionName=="HLT_xAOD__BTaggingContainer_HLTBjetFex":
591 from DerivationFrameworkFlavourTag.BJetTriggerContent import BJetTriggerContent
592 items.extend(BJetTriggerContent)
593 elif collectionName=="HLT_xAOD__TrigBphysContainer_EFBMuMuFex":
594 from DerivationFrameworkCore.BPhysTriggerContent import BPhysTriggerContent
595 items.extend(BPhysTriggerContent)
596 elif collectionName=="HLT_xAOD__TrigVertexCountsContainer_vertexcounts":
597 from DerivationFrameworkCore.MinBiasTriggerContent import MinBiasTriggerContent
598 items.extend(MinBiasTriggerContent)
599 elif collectionName=="HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf":
600 from DerivationFrameworkCore.JetTriggerContentRun3 import JetTriggerContentRun3
601 from DerivationFrameworkCore.JetTriggerContentRun3TLA import JetTriggerContentRun3TLA
603 items.extend(JetTriggerContentRun3)
604 else:
605 items.extend(JetTriggerContentRun3TLA)
606 elif collectionName=="HLT_BJetTriggerByYearContent":
607 from FTagAnalysisAlgorithms.BJetTriggerByYearContent import getBJetTriggerContent
608 items.extend(getBJetTriggerContent(self.flags))
609 elif collectionName=="HLT_FULL_EDM":
610 from DerivationFrameworkTrigger.TrigSlimmingHelper import addTrigEDMSetToOutput
611 items.extend(addTrigEDMSetToOutput(self.flags, self, edmSet=self.IncludeFullTriggerEDMLevel))
612
613 else:
614 raise RuntimeError("Smart slimming container "+collectionName+" does not exist or does not have a smart slimming list")
615 return items
616
617 # Kinematics content only
618 def GetKinematicsItems(self,collectionName):
619 # Content lines in the same style as is produced by the PrintStats
620 kinematicsLine = collectionName+"Aux."+"pt.eta.phi.m"
621 items = [collectionName,kinematicsLine]
622 return items
623
624 # Extra content, listed via container
625 def GetExtraItems(self,userInput):
626 # Build up a content list in the same style as is produced by the PrintStats
627 splitup = userInput.split(".")
628 auxContainerName = splitup[0]+"Aux"
629 items = []
630 items.append(splitup[0])
631 auxLine = ""
632 length = len(splitup)
633 for string in splitup:
634 if string==splitup[0]:
635 auxLine = auxContainerName+"."
636 continue
637 if string==splitup[length-1]:
638 auxLine = auxLine+string
639 else:
640 auxLine = auxLine+string+"."
641 items.append(auxLine)
642 return items
643
644 # Check that static content is legit
645 def ValidateStaticContent(self,item):
646 # No wildcards
647 if ("*" in item):
648 return "WILDCARD"
649 # No xAOD containers
650 sep = item.split("#")
651 if ("xAOD::" in item and sep[1] in self.NamesAndTypes.keys()):
652 return "XAOD"
653 return "OK"
654
655 # Required to prevent:
656 # Mixing up negative and positive Aux selections is not supported: xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_bJetsAux. : {'-clusterAssociation.-PseudoJet', 'phi.eta.pt.m'}
657 # 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.
658 # 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
659 # decorations which are not possible to include at the DAOD level. Current decorations: viewIndex, btaggingLink, JVFCorr, Jvt, SumPtTrkPt500
661 if self.IncludeFullTriggerEDMLevel and 'HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf_bJetsAux' in aux:
662 return False
663 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)