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