137def STDM17KernelCfg(flags, name='STDM17Kernel', **kwargs):
138 """Configure the derivation framework driving algorithm (kernel) for STDM17"""
139 acc = ComponentAccumulator()
140
141
142 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
143 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
144
145
146 from AthenaCommon.CFElements import seqAND
147 acc.addSequence( seqAND("STDM17Sequence") )
148 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
149 skimmingTool = acc.getPrimaryAndMerge(STDM17SkimmingToolCfg(flags))
150 augmentationToolSkim = acc.getPrimaryAndMerge(STDM17AugmentationToolsForSkimmingCfg(flags))
151 skimmingKernel = DerivationKernel(kwargs["PreselectionName"], SkimmingTools = [skimmingTool], AugmentationTools = [augmentationToolSkim])
152 acc.addEventAlgo( skimmingKernel, sequenceName="STDM17Sequence" )
153
154
155 from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg, MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg, TauTrackParticleThinningCfg
156
157
158 STDM17_thinning_expression = "( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
159 STDM17TrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
160 flags,
161 name = "STDM17TrackParticleThinningTool",
162 StreamName = kwargs['StreamName'],
163 SelectionString = STDM17_thinning_expression,
164 InDetTrackParticlesKey = "InDetTrackParticles"))
165
166
167 STDM17MuonTPThinningTool = acc.getPrimaryAndMerge(MuonTrackParticleThinningCfg(
168 flags,
169 name = "STDM17MuonTPThinningTool",
170 StreamName = kwargs['StreamName'],
171 MuonKey = "Muons",
172 InDetTrackParticlesKey = "InDetTrackParticles"))
173
174
175 STDM17ElectronTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
176 flags,
177 name = "STDM17ElectronTPThinningTool",
178 StreamName = kwargs['StreamName'],
179 SGKey = "Electrons",
180 InDetTrackParticlesKey = "InDetTrackParticles"))
181
182
183 STDM17PhotonTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
184 flags,
185 name = "STDM17PhotonTPThinningTool",
186 StreamName = kwargs['StreamName'],
187 SGKey = "Photons",
188 InDetTrackParticlesKey = "InDetTrackParticles",
189 GSFConversionVerticesKey = "GSFConversionVertices"))
190
191
192 STDM17TauTPThinningTool = acc.getPrimaryAndMerge(TauTrackParticleThinningCfg(
193 flags,
194 name = "STDM17TauTPThinningTool",
195 StreamName = kwargs['StreamName'],
196 TauKey = "TauJets",
197 InDetTrackParticlesKey = "InDetTrackParticles",
198 DoTauTracksThinning = True,
199 TauTracksKey = "TauTracks"))
200
201 thinningTools = [STDM17TrackParticleThinningTool,
202 STDM17MuonTPThinningTool,
203 STDM17ElectronTPThinningTool,
204 STDM17PhotonTPThinningTool,
205 STDM17TauTPThinningTool]
206
207
208 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import CaloClusterThinningCfg
209 selectionString = "( InDetTrackParticles.pt > 6*GeV && InDetTrackParticles.DFCommonTightPrimary && abs(DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta)) < 5.0*mm )"
210 STDM17CaloThinningTool = acc.getPrimaryAndMerge(CaloClusterThinningCfg(flags,
211 name = "STDM17CaloClusterThinning",
212 StreamName = kwargs['StreamName'],
213 SGKey = "InDetTrackParticles",
214 TopoClCollectionSGKey = "CaloCalTopoClusters",
215 SelectionString = selectionString,
216 ConeSize = 0.6))
217 acc.addPublicTool(STDM17CaloThinningTool)
218 thinningTools.append(STDM17CaloThinningTool)
219
220 if flags.Input.isMC:
221 truth_cond_status = "( (TruthParticles.pdgId == 24) || (TruthParticles.pdgId == -24) )"
222 truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && (TruthParticles.barcode < 200000))"
223 truth_expression = '('+truth_cond_status+' || '+truth_cond_Lepton +')'
224
225 STDM17TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(name = "STDM17TruthThinningTool",
226 StreamName = kwargs['StreamName'],
227 ParticleSelectionString = truth_expression,
228 PreserveDescendants = False,
229 PreserveGeneratorDescendants = True,
230 PreserveAncestors = False)
231
232 acc.addPublicTool(STDM17TruthThinningTool)
233 thinningTools.append(STDM17TruthThinningTool)
234
235
236 augmentationTool = acc.getPrimaryAndMerge(STDM17AugmentationToolsCfg(flags))
237
238
239 acc.addEventAlgo(DerivationKernel(name,
240 ThinningTools = thinningTools,
241 AugmentationTools = [augmentationTool]),
242 sequenceName="STDM17Sequence")
243
244 return acc
245