210 """Configure the derivation framework driving algorithm (kernel)
215 from JetRecConfig.StandardSmallRJets
import AntiKt4PV0Track
216 from JetRecConfig.JetRecConfig
import JetRecCfg
218 jetList = [AntiKt4PV0Track]
223 from DerivationFrameworkPhys.PhysCommonConfig
import PhysCommonAugmentationsCfg
227 flags, TriggerListsHelper=kwargs[
"TriggerListsHelper"]
232 augmentationTools = []
238 acc.addPublicTool(EGAM1ZeeMassTool1)
239 augmentationTools.append(EGAM1ZeeMassTool1)
242 acc.addPublicTool(EGAM1ZeeMassTool2)
243 augmentationTools.append(EGAM1ZeeMassTool2)
246 acc.addPublicTool(EGAM1ZeeMassTool3)
247 augmentationTools.append(EGAM1ZeeMassTool3)
250 acc.addPublicTool(EGAM1ZegMassTool)
251 augmentationTools.append(EGAM1ZegMassTool)
256 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
257 CaloDecoratorKernelCfg)
262 streamName = kwargs[
"StreamName"]
265 if flags.Derivation.Egamma.doTrackThinning:
266 from DerivationFrameworkInDet.InDetToolsConfig
import (
267 TrackParticleThinningCfg,
268 MuonTrackParticleThinningCfg,
269 TauTrackParticleThinningCfg,
272 TrackThinningKeepElectronTracks =
True
273 TrackThinningKeepPhotonTracks =
True
274 TrackThinningKeepAllElectronTracks =
True
275 TrackThinningKeepJetTracks =
False
276 TrackThinningKeepMuonTracks =
False
277 TrackThinningKeepTauTracks =
False
278 TrackThinningKeepPVTracks =
True
281 if TrackThinningKeepElectronTracks:
282 EGAM1ElectronTPThinningTool = (
283 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
284 name=
"EGAM1ElectronTPThinningTool",
285 StreamName=streamName,
287 GSFTrackParticlesKey=
"GSFTrackParticles",
288 InDetTrackParticlesKey=
"InDetTrackParticles",
289 SelectionString=
"Electrons.pt > 0*GeV",
294 acc.addPublicTool(EGAM1ElectronTPThinningTool)
295 thinningTools.append(EGAM1ElectronTPThinningTool)
299 if TrackThinningKeepAllElectronTracks:
300 EGAM1ElectronTPThinningTool2 = (
301 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
302 name=
"EGAM1ElectronTPThinningTool2",
303 StreamName=streamName,
305 GSFTrackParticlesKey=
"GSFTrackParticles",
306 InDetTrackParticlesKey=
"InDetTrackParticles",
307 SelectionString=
"Electrons.pt > 4*GeV",
312 acc.addPublicTool(EGAM1ElectronTPThinningTool2)
313 thinningTools.append(EGAM1ElectronTPThinningTool2)
316 if TrackThinningKeepPhotonTracks:
317 EGAM1PhotonTPThinningTool = (
318 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
319 name=
"EGAM1PhotonTPThinningTool",
320 StreamName=streamName,
322 GSFTrackParticlesKey=
"GSFTrackParticles",
323 InDetTrackParticlesKey=
"InDetTrackParticles",
324 GSFConversionVerticesKey=
"GSFConversionVertices",
325 SelectionString=
"Photons.pt > 0*GeV",
330 acc.addPublicTool(EGAM1PhotonTPThinningTool)
331 thinningTools.append(EGAM1PhotonTPThinningTool)
334 if TrackThinningKeepJetTracks:
335 EGAM1JetTPThinningTool = (
336 CompFactory.DerivationFramework.JetTrackParticleThinning(
337 name=
"EGAM1JetTPThinningTool",
338 StreamName=streamName,
339 JetKey=
"AntiKt4EMPFlowJets",
340 InDetTrackParticlesKey=
"InDetTrackParticles",
343 acc.addPublicTool(EGAM1JetTPThinningTool)
344 thinningTools.append(EGAM1JetTPThinningTool)
347 if TrackThinningKeepMuonTracks:
348 EGAM1MuonTPThinningTool = acc.getPrimaryAndMerge(
351 name=
"EGAM1MuonTPThinningTool",
352 StreamName=streamName,
354 InDetTrackParticlesKey=
"InDetTrackParticles",
357 thinningTools.append(EGAM1MuonTPThinningTool)
360 if TrackThinningKeepTauTracks:
361 EGAM1TauTPThinningTool = acc.getPrimaryAndMerge(
364 name=
"EGAM1TauTPThinningTool",
365 StreamName=streamName,
368 InDetTrackParticlesKey=
"InDetTrackParticles",
369 DoTauTracksThinning=
True,
370 TauTracksKey=
"TauTracks",
373 thinningTools.append(EGAM1TauTPThinningTool)
376 thinning_expression =
" && ".
join(
378 "(InDetTrackParticles.DFCommonTightPrimary)",
379 "(abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta)<3*mm)",
380 "(InDetTrackParticles.pt>10*GeV)",
383 if TrackThinningKeepPVTracks:
384 EGAM1TPThinningTool = acc.getPrimaryAndMerge(
387 name=
"EGAM1TPThinningTool",
388 StreamName=streamName,
389 SelectionString=thinning_expression,
390 InDetTrackParticlesKey=
"InDetTrackParticles",
393 thinningTools.append(EGAM1TPThinningTool)
396 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
397 CaloClusterThinningCfg,
400 EGAM1CCTCThinningTool = acc.getPrimaryAndMerge(
403 name=
"EGAM1CCTCThinningTool",
404 StreamName=streamName,
406 SelectionString=
"Electrons.pt>4*GeV",
407 TopoClCollectionSGKey=
"CaloCalTopoClusters",
411 thinningTools.append(EGAM1CCTCThinningTool)
416 truth_cond_WZH =
" && ".
join(
417 [
"(abs(TruthParticles.pdgId) >= 23)",
"(abs(TruthParticles.pdgId) <= 25)"]
420 truth_cond_lep =
" && ".
join(
421 [
"(abs(TruthParticles.pdgId) >= 11)",
"(abs(TruthParticles.pdgId) <= 16)"]
424 truth_cond_top =
"(abs(TruthParticles.pdgId) == 6)"
426 truth_cond_gam =
" && ".
join(
427 [
"(abs(TruthParticles.pdgId) == 22)",
"(TruthParticles.pt > 1*GeV)"]
430 truth_cond_finalState =
" && ".
join(
431 [
"(TruthParticles.status == 1)",
"(TruthParticles.barcode < 200000)"]
447 + truth_cond_finalState
450 print(
"EGAM1 truth thinning expression: ", truth_expression)
452 EGAM1TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(
453 name=
"EGAM1TruthThinningTool",
454 StreamName=streamName,
455 ParticleSelectionString=truth_expression,
456 PreserveDescendants=
False,
457 PreserveGeneratorDescendants=
True,
458 PreserveAncestors=
True,
460 acc.addPublicTool(EGAM1TruthThinningTool)
461 thinningTools.append(EGAM1TruthThinningTool)
465 acc.addPublicTool(skimmingTool)
469 CompFactory.DerivationFramework.DerivationKernel(
471 SkimmingTools=[skimmingTool],
472 AugmentationTools=augmentationTools,
473 ThinningTools=thinningTools,