21def JETM5KernelCfg(flags, name='JETM5Kernel', **kwargs):
22 """Configure the derivation framework driving algorithm (kernel) for JETM5"""
23 acc = ComponentAccumulator()
24
25
26 if not flags.Input.isMC:
27 skimmingTool = acc.getPrimaryAndMerge(JETM5SkimmingToolCfg(flags))
28
29
30 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
31 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
32
33
34 from DerivationFrameworkInDet.InDetToolsConfig import MuonTrackParticleThinningCfg, EgammaTrackParticleThinningCfg
35
36
37 JETM5MuonTPThinningTool = acc.getPrimaryAndMerge(MuonTrackParticleThinningCfg(
38 flags,
39 name = "JETM5MuonTPThinningTool",
40 StreamName = kwargs['StreamName'],
41 MuonKey = "Muons",
42 InDetTrackParticlesKey = "InDetTrackParticles"))
43
44
45 JETM5ElectronTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
46 flags,
47 name = "JETM5ElectronTPThinningTool",
48 StreamName = kwargs['StreamName'],
49 SGKey = "Electrons",
50 InDetTrackParticlesKey = "InDetTrackParticles"))
51
52
53 JETM5PhotonTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
54 flags,
55 name = "JETM5PhotonTPThinningTool",
56 StreamName = kwargs['StreamName'],
57 SGKey = "Photons",
58 InDetTrackParticlesKey = "InDetTrackParticles",
59 GSFConversionVerticesKey = "GSFConversionVertices"))
60
61
62 thinningTools = [JETM5MuonTPThinningTool,
63 JETM5ElectronTPThinningTool,
64 JETM5PhotonTPThinningTool]
65
66
67 if flags.Input.isMC:
68 truth_cond_WZH = "(TruthParticles.isW || TruthParticles.isZ || TruthParticles.isHiggs)"
69 truth_cond_Lepton = "((TruthParticles.isLepton) && !(TruthParticles.isSimulationParticle))"
70 truth_cond_QuarkGluon = "((TruthParticles.isParton) && (TruthParticles.pt > 10000.)) || (TruthParticles.isTop)"
71 truth_cond_Photon = "((TruthParticles.isPhoton) && (TruthParticles.pt > 10000.) && !(TruthParticles.isSimulationParticle))"
72
73 truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_QuarkGluon+' || '+truth_cond_Photon+')'
74
75 preserveAllDescendants = False
76
77 JETM5TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning ( name = "JETM5TruthThinningTool",
78 StreamName = kwargs['StreamName'],
79 ParticleSelectionString = truth_expression,
80 PreserveDescendants = preserveAllDescendants,
81 PreserveGeneratorDescendants = not preserveAllDescendants,
82 PreserveAncestors = True)
83
84 acc.addPublicTool(JETM5TruthThinningTool)
85 thinningTools.append(JETM5TruthThinningTool)
86
87
88 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
89 acc.addEventAlgo(DerivationKernel(name,
90 ThinningTools = thinningTools,
91 SkimmingTools = [skimmingTool] if not flags.Input.isMC else []))
92
93
94
95 from DerivationFrameworkJetEtMiss.PFlowCommonConfig import PFlowCommonCfg
96 acc.merge(PFlowCommonCfg(flags))
97
98 return acc
99
100