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