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

Functions

 STDM7SkimmingToolCfg (flags)
 STDM7KernelCfg (flags, name='STDM7Kernel', **kwargs)
 STDM7Cfg (flags)

Function Documentation

◆ STDM7Cfg()

python.STDM7.STDM7Cfg ( flags)

Definition at line 104 of file STDM7.py.

104def STDM7Cfg(flags):
105
106 acc = ComponentAccumulator()
107
108 # Get the lists of triggers needed for trigger matching.
109 # This is needed at this scope (for the slimming) and further down in the config chain
110 # for actually configuring the matching, so we create it here and pass it down
111 # TODO: this should ideally be called higher up to avoid it being run multiple times in a train
112 from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
113 STDM7TriggerListsHelper = TriggerListsHelper(flags)
114
115 # Common augmentations
116 acc.merge(STDM7KernelCfg(flags, name="STDM7Kernel", StreamName = 'StreamDAOD_STDM7', TriggerListsHelper = STDM7TriggerListsHelper))
117
118 # ============================
119 # Define contents of the format
120 # =============================
121 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
122 from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
123 from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
124
125 STDM7SlimmingHelper = SlimmingHelper("STDM7SlimmingHelper", NamesAndTypes = flags.Input.TypedCollections, flags = flags)
126 STDM7SlimmingHelper.SmartCollections = ["EventInfo",
127 "Electrons",
128 "Photons",
129 "Muons",
130 "PrimaryVertices",
131 "InDetTrackParticles",
132 "AntiKt4EMTopoJets",
133 "AntiKt4EMPFlowJets",
134 "MET_Baseline_AntiKt4EMTopo",
135 "MET_Baseline_AntiKt4EMPFlow",
136 "TauJets"
137 # custom reconstruction for yy->WW
138 # this has not yet been migrated to master, and smart slimming is not yet available
139 # "LowPtRoITrackParticles",
140 # "LowPtRoIVertexContainer"
141 ]
142
143 # STDM7 needs AFP information
144 STDM7SlimmingHelper.AllVariables = [ "AFPSiHitContainer",
145 "AFPToFHitContainer",
146 "AFPSiHitsClusterContainer",
147 "AFPTrackContainer",
148 "AFPToFTrackContainer",
149 "AFPProtonContainer",
150 "AFPVertexContainer"
151 ]
152
153 excludedVertexAuxData = "-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV"
154 StaticContent = []
155 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Tight_Vertices"]
156 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Tight_VerticesAux." + excludedVertexAuxData]
157 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Medium_Vertices"]
158 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Medium_VerticesAux." + excludedVertexAuxData]
159 StaticContent += ["xAOD::VertexContainer#SoftBVrtClusterTool_Loose_Vertices"]
160 StaticContent += ["xAOD::VertexAuxContainer#SoftBVrtClusterTool_Loose_VerticesAux." + excludedVertexAuxData]
161
162 STDM7SlimmingHelper.StaticContent = StaticContent
163
164 # Truth containers
165 if flags.Input.isMC:
166
167 from DerivationFrameworkMCTruth.MCTruthCommonConfig import addTruth3ContentToSlimmerTool
168 addTruth3ContentToSlimmerTool(STDM7SlimmingHelper)
169 STDM7SlimmingHelper.AllVariables += ['TruthHFWithDecayParticles','TruthHFWithDecayVertices','TruthCharm','TruthPileupParticles','InTimeAntiKt4TruthJets','OutOfTimeAntiKt4TruthJets']
170 STDM7SlimmingHelper.ExtraVariables += ["Electrons.TruthLink",
171 "Muons.TruthLink",
172 "Photons.TruthLink",
173 "AntiKt4EMTopoJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt",
174 "AntiKt4EMPFlowJets.DFCommonJets_QGTagger_truthjet_nCharged.DFCommonJets_QGTagger_truthjet_pt.DFCommonJets_QGTagger_truthjet_eta.DFCommonJets_QGTagger_NTracks.DFCommonJets_QGTagger_TracksWidth.DFCommonJets_QGTagger_TracksC1.ConeExclBHadronsFinal.ConeExclCHadronsFinal.GhostBHadronsFinal.GhostCHadronsFinal.GhostBHadronsFinalCount.GhostBHadronsFinalPt.GhostCHadronsFinalCount.GhostCHadronsFinalPt",
175 "TruthPrimaryVertices.t.x.y.z",
176 "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights.eProbabilityHT.numberOfTRTHits.numberOfTRTOutliers",
177 "EventInfo.hardScatterVertexLink.timeStampNSOffset",
178 "TauJets.dRmax.etOverPtLeadTrk",
179 # "TauJets_MuonRM.dRmax.etOverPtLeadTrk", # copied from PHYS but container is not in STDM7
180 "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET.ex.ey",
181 "HLT_xAOD__TrigMissingETContainer_TrigEFMissingET_mht.ex.ey"]
182
183 # Trigger content
184 STDM7SlimmingHelper.IncludeTriggerNavigation = False
185 STDM7SlimmingHelper.IncludeJetTriggerContent = False
186 STDM7SlimmingHelper.IncludeMuonTriggerContent = False
187 STDM7SlimmingHelper.IncludeEGammaTriggerContent = False
188 STDM7SlimmingHelper.IncludeTauTriggerContent = False
189 STDM7SlimmingHelper.IncludeEtMissTriggerContent = False
190 STDM7SlimmingHelper.IncludeBJetTriggerContent = False
191 STDM7SlimmingHelper.IncludeBPhysTriggerContent = False
192 STDM7SlimmingHelper.IncludeMinBiasTriggerContent = False
193
194 # Trigger matching
195 # Run 2
196 if flags.Trigger.EDMVersion == 2:
197 from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
198 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM7SlimmingHelper,
199 OutputContainerPrefix = "TrigMatch_",
200 TriggerList = STDM7TriggerListsHelper.Run2TriggerNamesTau)
201 AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = STDM7SlimmingHelper,
202 OutputContainerPrefix = "TrigMatch_",
203 TriggerList = STDM7TriggerListsHelper.Run2TriggerNamesNoTau)
204 # Run 3, or Run 2 with navigation conversion
205 if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
206 from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
207 AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(STDM7SlimmingHelper)
208
209 # Output stream
210 STDM7ItemList = STDM7SlimmingHelper.GetItemList()
211 acc.merge(OutputStreamCfg(flags, "DAOD_STDM7", ItemList=STDM7ItemList, AcceptAlgs=["STDM7Kernel"]))
212 acc.merge(SetupMetaDataForStreamCfg(flags, "DAOD_STDM7", AcceptAlgs=["STDM7Kernel"], createMetadata=[MetadataCategory.CutFlowMetaData]))
213
214 return acc

◆ STDM7KernelCfg()

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

Definition at line 82 of file STDM7.py.

82def STDM7KernelCfg(flags, name='STDM7Kernel', **kwargs):
83 """Configure the derivation framework driving algorithm (kernel)"""
84 acc = ComponentAccumulator()
85
86 # Common augmentations
87 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
88 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
89
90 # Inner detector group recommendations for indet tracks in analysis
91 # --> removed InDetTrackParticle thinning as we need all
92
93 # Finally the kernel itself
94 thinningTools = [] # none for the moment
95 skimmingTools = [ acc.getPrimaryAndMerge(STDM7SkimmingToolCfg(flags)) ]
96
97 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
98 acc.addEventAlgo(DerivationKernel(name,
99 ThinningTools = thinningTools,
100 SkimmingTools = skimmingTools))
101 return acc
102
103

◆ STDM7SkimmingToolCfg()

python.STDM7.STDM7SkimmingToolCfg ( flags)
Configure the STDM7 skimming tool

Definition at line 9 of file STDM7.py.

9def STDM7SkimmingToolCfg(flags):
10 '''Configure the STDM7 skimming tool'''
11 acc = ComponentAccumulator()
12
13 filterList = []
14
15 # skim on two good leptons
16 muonsRequirements = '(Muons.pt >= 4*GeV) && (abs(Muons.eta) < 2.6)' \
17 '&& (Muons.DFCommonMuonPassPreselection) && (Muons.DFCommonMuonPassIDCuts)'
18 electronsRequirements = '(Electrons.pt > 11*GeV) && (abs(Electrons.eta) < 2.6)' \
19 '&& ((Electrons.DFCommonElectronsLHLoose) || ((Electrons.DFCommonElectronsDNNLoose) && (Electrons.pt > 15*GeV)))'
20
21 chargedParticleRequirements = '(TruthParticles.pt > 500) && (TruthParticles.isGenStable)' \
22 '&& (TruthParticles.charge != 0)' \
23 '&& (TruthParticles.theta > 0.163803) && (TruthParticles.theta < 2.97778)' \
24 '&& (TruthParticles.HSBool)'
25 # theta selection correspond to |eta|<2.5 (minus epsilon); avoids floating point exception if theta=0 or pi
26
27 muonOnlySelection = 'count('+muonsRequirements+') >=2'
28 electronOnlySelection = 'count('+electronsRequirements+') >= 2'
29 electronMuonSelection = '(count('+electronsRequirements+') + count('+muonsRequirements+')) >= 2'
30
31 # for MC we may skim on the charged-particle multiplicity
32 filterVal = -1 # Todo: nChFilter flag to be implemented later
33 if filterVal > -1 and flags.Input.isMC :
34 chargedParticleSelection = 'count('+chargedParticleRequirements+') < '+str(filterVal)
35 offlineExpression = '(('+muonOnlySelection+' || '+electronOnlySelection+' || '+electronMuonSelection+') && ('+chargedParticleSelection+'))'
36 else:
37 offlineExpression = '(('+muonOnlySelection+' || '+electronOnlySelection+' || '+electronMuonSelection+'))'
38
39 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import (
40 xAODStringSkimmingToolCfg)
41 STDM7StringSkimmingTool = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
42 flags, name = "STDM7StringSkimmingTool", expression = offlineExpression))
43 filterList += [STDM7StringSkimmingTool]
44
45 # require an OR of el and mu triggers, in the past we had a dedicated SM list but this should do just fine
46 if flags.Trigger.EDMVersion >= 0:
47 from TriggerMenuMT.TriggerAPI.TriggerAPI import TriggerAPI
48 from TriggerMenuMT.TriggerAPI.TriggerEnums import TriggerPeriod, TriggerType
49 allperiods = TriggerPeriod.y2015 | TriggerPeriod.y2016 | TriggerPeriod.y2017 | TriggerPeriod.y2018 | TriggerPeriod.future2e34
50 TriggerAPI.setConfigFlags(flags)
51 trig_el = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, livefraction=0.8)
52 trig_mu = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.mu, livefraction=0.8)
53 trig_em = TriggerAPI.getLowestUnprescaledAnyPeriod(allperiods, triggerType=TriggerType.el, additionalTriggerType=TriggerType.mu, livefraction=0.8)
54
55 # Read list of triggers from PHYS
56 extra_notau = []
57 from PathResolver import PathResolver
58 with open(PathResolver.FindCalibFile("DerivationFrameworkPhys/run2ExtraMatchingTriggers.txt")) as fp:
59 for line in fp:
60 line = line.strip()
61 if line == "" or line.startswith("#"):
62 continue
63 extra_notau.append(line)
64
65
66 trigger_names_full_notau = list(set(trig_el+trig_mu+trig_em+extra_notau))
67 STDM7TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(
68 name = "STDM7TriggerSkimmingTool",
69 OutputLevel = 0,
70 TriggerListOR = trigger_names_full_notau,
71 TriggerListAND = [] )
72 acc.addPublicTool(STDM7TriggerSkimmingTool)
73 filterList += [STDM7TriggerSkimmingTool]
74
75 # the two skimming tools go into an AND filter combination tool
76 acc.addPublicTool(CompFactory.DerivationFramework.FilterCombinationAND(
77 "STDM7SkimmingTool", FilterList = filterList), primary = True)
78
79 return(acc)
80
81
static std::string FindCalibFile(const std::string &logical_file_name)
STL class.