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 101 of file STDM7.py.

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

◆ STDM7KernelCfg()

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

Definition at line 79 of file STDM7.py.

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

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