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