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 = "((abs(TruthParticles.pdgId) >= 23) && (abs(TruthParticles.pdgId) <= 25))"
69 truth_cond_Lepton = "((abs(TruthParticles.pdgId) >= 11) && (abs(TruthParticles.pdgId) <= 16) && !(TruthParticles.isSimulationParticle))"
70 truth_cond_Quark = "((abs(TruthParticles.pdgId) <= 5 && (TruthParticles.pt > 10000.)) || (abs(TruthParticles.pdgId) == 6))"
71 truth_cond_Gluon = "((abs(TruthParticles.pdgId) == 21) && (TruthParticles.pt > 10000.))"
72 truth_cond_Photon = "((abs(TruthParticles.pdgId) == 22) && (TruthParticles.pt > 10000.) && !(TruthParticles.isSimulationParticle))"
73
74 truth_expression = '('+truth_cond_WZH+' || '+truth_cond_Lepton +' || '+truth_cond_Quark+'||'+truth_cond_Gluon+' || '+truth_cond_Photon+')'
75
76 preserveAllDescendants = False
77
78 JETM5TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning ( name = "JETM5TruthThinningTool",
79 StreamName = kwargs['StreamName'],
80 ParticleSelectionString = truth_expression,
81 PreserveDescendants = preserveAllDescendants,
82 PreserveGeneratorDescendants = not preserveAllDescendants,
83 PreserveAncestors = True)
84
85 acc.addPublicTool(JETM5TruthThinningTool)
86 thinningTools.append(JETM5TruthThinningTool)
87
88
89 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
90 acc.addEventAlgo(DerivationKernel(name,
91 ThinningTools = thinningTools,
92 SkimmingTools = [skimmingTool] if not flags.Input.isMC else []))
93
94
95
96 from DerivationFrameworkJetEtMiss.PFlowCommonConfig import PFlowCommonCfg
97 acc.merge(PFlowCommonCfg(flags))
98
99 return acc
100
101