125 """Configure the derivation framework driving algorithm (kernel)
130 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
134 flags, TriggerListsHelper=kwargs[
"TriggerListsHelper"]
139 augmentationTools = []
145 acc.addPublicTool(EGAM8ZeeMassTool)
146 augmentationTools.append(EGAM8ZeeMassTool)
149 acc.addPublicTool(EGAM8ZmueMassTool)
150 augmentationTools.append(EGAM8ZmueMassTool)
155 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
156 CaloDecoratorKernelCfg)
161 streamName = kwargs[
"StreamName"]
164 if flags.Derivation.Egamma.doTrackThinning:
165 from DerivationFrameworkInDet.InDetToolsConfig
import (
166 TrackParticleThinningCfg,
167 MuonTrackParticleThinningCfg,
168 TauTrackParticleThinningCfg,
171 TrackThinningKeepElectronTracks =
True
172 TrackThinningKeepPhotonTracks =
True
173 TrackThinningKeepAllElectronTracks =
False
174 TrackThinningKeepJetTracks =
False
175 TrackThinningKeepMuonTracks =
True
176 TrackThinningKeepTauTracks =
False
177 TrackThinningKeepPVTracks =
False
180 if TrackThinningKeepElectronTracks:
181 EGAM8ElectronTPThinningTool = (
182 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
183 name=
"EGAM8ElectronTPThinningTool",
184 StreamName=streamName,
186 GSFTrackParticlesKey=
"GSFTrackParticles",
187 InDetTrackParticlesKey=
"InDetTrackParticles",
188 SelectionString=
"Electrons.pt > 0*GeV",
193 acc.addPublicTool(EGAM8ElectronTPThinningTool)
194 thinningTools.append(EGAM8ElectronTPThinningTool)
198 if TrackThinningKeepAllElectronTracks:
199 EGAM8ElectronTPThinningTool2 = (
200 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
201 name=
"EGAM8ElectronTPThinningTool2",
202 StreamName=streamName,
204 GSFTrackParticlesKey=
"GSFTrackParticles",
205 InDetTrackParticlesKey=
"InDetTrackParticles",
206 SelectionString=
"Electrons.pt > 4*GeV",
211 acc.addPublicTool(EGAM8ElectronTPThinningTool2)
212 thinningTools.append(EGAM8ElectronTPThinningTool2)
215 if TrackThinningKeepPhotonTracks:
216 EGAM8PhotonTPThinningTool = (
217 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
218 name=
"EGAM8PhotonTPThinningTool",
219 StreamName=streamName,
221 GSFTrackParticlesKey=
"GSFTrackParticles",
222 InDetTrackParticlesKey=
"InDetTrackParticles",
223 GSFConversionVerticesKey=
"GSFConversionVertices",
224 SelectionString=
"Photons.pt > 0*GeV",
229 acc.addPublicTool(EGAM8PhotonTPThinningTool)
230 thinningTools.append(EGAM8PhotonTPThinningTool)
233 if TrackThinningKeepJetTracks:
234 EGAM8JetTPThinningTool = (
235 CompFactory.DerivationFramework.JetTrackParticleThinning(
236 name=
"EGAM8JetTPThinningTool",
237 StreamName=streamName,
238 JetKey=
"AntiKt4EMPFlowJets",
239 InDetTrackParticlesKey=
"InDetTrackParticles",
242 acc.addPublicTool(EGAM8JetTPThinningTool)
243 thinningTools.append(EGAM8JetTPThinningTool)
246 if TrackThinningKeepMuonTracks:
247 EGAM8MuonTPThinningTool = acc.getPrimaryAndMerge(
250 name=
"EGAM8MuonTPThinningTool",
251 StreamName=streamName,
253 InDetTrackParticlesKey=
"InDetTrackParticles",
256 thinningTools.append(EGAM8MuonTPThinningTool)
259 if TrackThinningKeepTauTracks:
260 EGAM8TauTPThinningTool = acc.getPrimaryAndMerge(
263 name=
"EGAM8TauTPThinningTool",
264 StreamName=streamName,
267 InDetTrackParticlesKey=
"InDetTrackParticles",
268 DoTauTracksThinning=
True,
269 TauTracksKey=
"TauTracks",
272 thinningTools.append(EGAM8TauTPThinningTool)
275 thinning_expression =
" && ".
join(
277 "(InDetTrackParticles.DFCommonTightPrimary)",
278 "(abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta)<3.0*mm)",
279 "(InDetTrackParticles.pt>10*GeV)",
282 if TrackThinningKeepPVTracks:
283 EGAM8TPThinningTool = acc.getPrimaryAndMerge(
286 name=
"EGAM8TPThinningTool",
287 StreamName=streamName,
288 SelectionString=thinning_expression,
289 InDetTrackParticlesKey=
"InDetTrackParticles",
292 thinningTools.append(EGAM8TPThinningTool)
297 truth_cond_WZH =
" && ".
join(
298 [
"(abs(TruthParticles.pdgId) >= 23)",
"(abs(TruthParticles.pdgId) <= 25)"]
301 truth_cond_lep =
" && ".
join(
302 [
"(abs(TruthParticles.pdgId) >= 11)",
"(abs(TruthParticles.pdgId) <= 16)"]
305 truth_cond_top =
"(abs(TruthParticles.pdgId) == 6)"
307 truth_cond_gam =
" && ".
join(
308 [
"(abs(TruthParticles.pdgId) == 22)",
"(TruthParticles.pt > 1*GeV)"]
311 truth_cond_finalState =
" && ".
join(
312 [
"(TruthParticles.status == 1)",
"(TruthParticles.barcode<200000)"]
328 + truth_cond_finalState
331 print(
"EGAM8 truth thinning expression: ", truth_expression)
333 EGAM8TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(
334 name=
"EGAM8TruthThinningTool",
335 StreamName=streamName,
336 ParticleSelectionString=truth_expression,
337 PreserveDescendants=
False,
338 PreserveGeneratorDescendants=
True,
339 PreserveAncestors=
True,
341 acc.addPublicTool(EGAM8TruthThinningTool)
342 thinningTools.append(EGAM8TruthThinningTool)
346 acc.addPublicTool(skimmingTool)
350 CompFactory.DerivationFramework.DerivationKernel(
352 SkimmingTools=[skimmingTool],
353 AugmentationTools=augmentationTools,
354 ThinningTools=thinningTools,