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