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