ATLAS Offline Software
STDM13.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 #====================================================================
3 # DAOD_STDM13.py for W+D analysises
4 # * 1L skimming
5 # * InDetTrackParticles with |z0|*sinTheta < 6.0
6 #====================================================================
7 
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from AthenaConfiguration.Enums import MetadataCategory
11 
12 # Main algorithm config
13 def STDM13KernelCfg(flags, name='STDM13Kernel', **kwargs):
14  """Configure the derivation framework driving algorithm (kernel) for STDM13"""
15  acc = ComponentAccumulator()
16 
17  # Common augmentations
18  from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
19  acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
20 
21  from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg
22 
23  # filter leptons
24  lepton_skimming_expression = 'count( (Muons.pt > 25*GeV) && (0 == Muons.muonType || 1 == Muons.muonType || 4 == Muons.muonType) ) + count(( Electrons.pt > 25*GeV) && ((Electrons.Loose) || (Electrons.DFCommonElectronsLHLoose))) >= 1'
25 
26  STDM13StringSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
27  name = "STDM13StringSkimmingTool",
28  expression = lepton_skimming_expression )
29  acc.addPublicTool(STDM13StringSkimmingTool)
30  STDM13SkimmingTool = CompFactory.DerivationFramework.FilterCombinationAND("STDM13SkimmingTool", FilterList = [STDM13StringSkimmingTool])
31 
32  acc.addPublicTool(STDM13SkimmingTool, primary = True)
33  tp_thinning_expression = "abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 6.0*mm"
34  STDM13TPThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
35  flags,
36  name = "STDM13TPThinningTool",
37  StreamName = kwargs['StreamName'],
38  SelectionString = tp_thinning_expression,
39  InDetTrackParticlesKey = "InDetTrackParticles"))
40 
41  thinningTools = [ STDM13TPThinningTool ]
42  skimmingTools = [ STDM13SkimmingTool ]
43 
44  DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
45  acc.addEventAlgo(DerivationKernel(name, SkimmingTools = skimmingTools, ThinningTools = thinningTools))
46  return acc
47 
48 
49 def STDM13Cfg(flags):
50  acc = ComponentAccumulator()
51 
52  # Get the lists of triggers needed for trigger matching.
53  # This is needed at this scope (for the slimming) and further down in the config chain
54  # for actually configuring the matching, so we create it here and pass it down
55  # TODO: this should ideally be called higher up to avoid it being run multiple times in a train
56  from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
57  STDM13TriggerListsHelper = TriggerListsHelper(flags)
58 
59  # Common augmentations
60  acc.merge(STDM13KernelCfg(flags, name="STDM13Kernel", StreamName = 'StreamDAOD_STDM13', TriggerListsHelper = STDM13TriggerListsHelper))
61 
62  # ============================
63  # Define contents of the format
64  # =============================
65  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
66  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
67  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
68 
69  STDM13SlimmingHelper = SlimmingHelper("STDM13SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
70 
71  STDM13SlimmingHelper.SmartCollections = [
72  "Electrons",
73  "Muons",
74  "AntiKt4EMPFlowJets",
75  "MET_Baseline_AntiKt4EMPFlow",
76  "PrimaryVertices",
77  "InDetTrackParticles",
78  "BTagging_AntiKt4EMPFlow",
79  ]
80 
81  STDM13SlimmingHelper.AllVariables = [
82  "EventInfo",
83  "PrimaryVertices",
84  "InDetTrackParticles",
85  "BTagging_AntiKt4EMPFlow",
86  "AntiKt4TruthDressedWZJets",
87  "TruthEvents","TruthHFWithDecayParticles","TruthBoson","TruthBottom", "TruthCharm","TruthElectrons","TruthMuons","TruthTop","TruthTaus","MET_Truth",
88  "TruthPrimaryVertices","TruthHFWithDecayVertices",
89  ]
90 
91  STDM13SlimmingHelper.IncludeTriggerNavigation = False
92  STDM13SlimmingHelper.IncludeJetTriggerContent = False
93  STDM13SlimmingHelper.IncludeMuonTriggerContent = False
94  STDM13SlimmingHelper.IncludeEGammaTriggerContent = False
95  STDM13SlimmingHelper.IncludeJetTauEtMissTriggerContent = False
96  STDM13SlimmingHelper.IncludeTauTriggerContent = False
97  STDM13SlimmingHelper.IncludeEtMissTriggerContent = False
98  STDM13SlimmingHelper.IncludeBJetTriggerContent = False
99  STDM13SlimmingHelper.IncludeBPhysTriggerContent = False
100  STDM13SlimmingHelper.IncludeMinBiasTriggerContent = False
101 
102  # Trigger matching
103  # Run 2
104  if flags.Trigger.EDMVersion == 2:
105  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
106  AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM13SlimmingHelper,
107  OutputContainerPrefix = "TrigMatch_",
108  TriggerList = STDM13TriggerListsHelper.Run2TriggerNamesTau)
109  AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM13SlimmingHelper,
110  OutputContainerPrefix = "TrigMatch_",
111  TriggerList = STDM13TriggerListsHelper.Run2TriggerNamesNoTau)
112  # Run 3, or Run 2 with navigation conversion
113  if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
114  from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
116 
117  # Output stream
118  STDM13ItemList = STDM13SlimmingHelper.GetItemList()
119  acc.merge(OutputStreamCfg(flags, "DAOD_STDM13", ItemList=STDM13ItemList, AcceptAlgs=["STDM13Kernel"]))
120  acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_STDM13", AcceptAlgs=["STDM13Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData, MetadataCategory.TruthMetaData]))
121 
122  return acc
123 
TrigNavSlimmingMTConfig.AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
def AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(slimmingHelper)
Definition: TrigNavSlimmingMTConfig.py:98
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.InDetToolsConfig.TrackParticleThinningCfg
def TrackParticleThinningCfg(flags, name, **kwargs)
Definition: InDetToolsConfig.py:458
python.TriggerMatchingCommonConfig.AddRun2TriggerMatchingToSlimmingHelper
def AddRun2TriggerMatchingToSlimmingHelper(**kwargs)
Definition: TriggerMatchingCommonConfig.py:49
python.STDM13.STDM13Cfg
def STDM13Cfg(flags)
Definition: STDM13.py:49
python.STDM13.STDM13KernelCfg
def STDM13KernelCfg(flags, name='STDM13Kernel', **kwargs)
Definition: STDM13.py:13
python.PhysCommonConfig.PhysCommonAugmentationsCfg
def PhysCommonAugmentationsCfg(flags, **kwargs)
Definition: PhysCommonConfig.py:14
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:222
SlimmingHelper
Definition: SlimmingHelper.py:1
python.HION12.DerivationKernel
DerivationKernel
Definition: HION12.py:66