13def SUSY20KernelCfg(flags, name = "SUSY20Kernel", **kwargs):
14
15 """Configure the derivation framework driving algorithm (kernel) for SUSY20"""
16
17 acc = ComponentAccumulator()
18
19
20
21
22 augmentationTools = []
23
24
25
26 from DerivationFrameworkBPhys.V0ToolConfig import BPHY_Reco_V0FinderCfg as Reco_V0Finder
27 SUSY20_RecoV0_Finder = acc.popToolsAndMerge(Reco_V0Finder(
28 flags,
29 derivation = "SUSY20",
30 suffix = "DT",
31 V0ContainerName = "SUSY20RecoV0Candidates",
32 KshortContainerName = "SUSY20RecoKshortCandidates",
33 LambdaContainerName = "SUSY20RecoLambdaCandidates",
34 LambdabarContainerName = "SUSY20RecoLambdabarCandidates",
35 CheckVertexContainers = ["PrimaryVertices"]
36 ))
37 acc.addPublicTool(SUSY20_RecoV0_Finder)
38 augmentationTools.append(SUSY20_RecoV0_Finder)
39
40
41 from VrtSecInclusive.VrtSecInclusiveConfig import VrtSecInclusiveCfg
42 acc.merge(VrtSecInclusiveCfg(
43 flags,
44 name = "SUSY20_VrtSecInclusiveTool",
45 AugmentingVersionString = "_SUSY20",
46 CutSctHits = 1,
47 TrkA0ErrCut = 200000,
48 TrkZErrCut = 200000,
49 TrkPtCut = 300,
50 TrkChi2Cut = 5.0,
51 SelTrkMaxCutoff = 2000,
52 a0TrkPVDstMinCut = 0.0,
53 SelVrtChi2Cut = 4.5,
54 CutSharedHits = 5,
55 TruthTrkLen = 1,
56 DoSAloneTRT = False,
57 DoTruth = flags.Input.isMC,
58 ))
59
60
61 from xAODPrimitives.xAODIso import xAODIso as isoPar
62 deco_ptcones = [isoPar.ptcone40, isoPar.ptcone30, isoPar.ptcone20, isoPar.topoetcone40, isoPar.topoetcone30, isoPar.topoetcone20]
63 deco_ptcones_suffix = ["ptcone40", "ptcone30", "ptcone20", "topoetcone40", "topoetcone30", "topoetcone20"]
64 deco_prefix = 'SUSY20_'
65
66 from IsolationAlgs.IsoToolsConfig import TrackIsolationToolCfg
67 SUSY20TrackIsoTool = acc.popToolsAndMerge(TrackIsolationToolCfg(
68 flags,
69 name = "SUSY20TrackIsoTool",
70 ))
71 SUSY20TrackIsoTool.TrackSelectionTool.maxZ0SinTheta = 1.5
72 SUSY20TrackIsoTool.TrackSelectionTool.maxD0 = 1.5
73 SUSY20TrackIsoTool.TrackSelectionTool.minPt = 1000
74 SUSY20TrackIsoTool.TrackSelectionTool.CutLevel = "TightPrimary"
75 acc.addPublicTool(SUSY20TrackIsoTool)
76
77 from IsolationAlgs.IsoToolsConfig import CaloIsolationToolCfg
78 from CaloIdentifier import SUBCALO
79 SUSY20CaloIsoTool = acc.popToolsAndMerge(CaloIsolationToolCfg(
80 flags,
81 name = "SUSY20CaloIsoTool",
82 EMCaloNums = [SUBCALO.LAREM],
83 HadCaloNums = [SUBCALO.LARHEC, SUBCALO.TILE],
84 UseEMScale = True,
85 UseCaloExtensionCaching = False,
86 saveOnlyRequestedCorrections = True
87 ))
88 acc.addPublicTool(SUSY20CaloIsoTool)
89
90 from DerivationFrameworkInDet.InDetToolsConfig import IsolationTrackDecoratorCfg
91 SUSY20IDTrackDecoratorTool = acc.getPrimaryAndMerge(IsolationTrackDecoratorCfg(
92 flags,
93 name = "SUSY20IDTrackDecoratorTool",
94 TrackIsolationTool = SUSY20TrackIsoTool,
95 CaloIsolationTool = SUSY20CaloIsoTool,
96 TargetContainer = "InDetTrackParticles",
97 SelectionString = "InDetTrackParticles.pt > 0.5*GeV",
98 iso = deco_ptcones,
99 isoSuffix = deco_ptcones_suffix,
100 Prefix = deco_prefix,
101 ))
102 acc.addPublicTool(SUSY20IDTrackDecoratorTool)
103 augmentationTools.append(SUSY20IDTrackDecoratorTool)
104
105
106 '''# Electron TrackParticles isolation
107 SUSY20ElectronDecorator = acc.getPrimaryAndMerge(IsolationTrackDecoratorCfg(
108 flags,
109 name = "SUSY20ElectronDecoratorTool",
110 TrackIsolationTool = SUSY20TrackIsoTool,
111 CaloIsolationTool = SUSY20CaloIsoTool,
112 TargetContainer = "Electrons",
113 iso = [isoPar.topoetcone40, isoPar.topoetcone30, isoPar.topoetcone20],
114 isoSuffix = ["topoetcone40", "topoetcone30", "topoetcone20"],
115 Prefix = deco_prefix,
116 ))
117 acc.addPublicTool(SUSY20ElectronDecorator)
118 augmentationTools.append(SUSY20ElectronDecorator)
119
120 # Muon TrackParticles isolation
121 SUSY20MuonDecorator = acc.getPrimaryAndMerge(IsolationTrackDecoratorCfg(
122 flags,
123 name = "SUSY20MuonDecoratorTool",
124 TrackIsolationTool = SUSY20TrackIsoTool,
125 CaloIsolationTool = SUSY20CaloIsoTool,
126 TargetContainer = "Muons",
127 iso = [isoPar.topoetcone40, isoPar.topoetcone30, isoPar.topoetcone20],
128 isoSuffix = ["topoetcone40", "topoetcone30", "topoetcone20"],
129 Prefix = deco_prefix,
130 ))
131 acc.addPublicTool(SUSY20MuonDecorator)
132 augmentationTools.append(SUSY20MuonDecorator)
133
134 # Photon TrackParticles isolation
135 SUSY20PhotonDecorator = acc.getPrimaryAndMerge(IsolationTrackDecoratorCfg(
136 flags,
137 name = "SUSY20PhotonDecoratorTool",
138 TrackIsolationTool = SUSY20TrackIsoTool,
139 CaloIsolationTool = SUSY20CaloIsoTool,
140 TargetContainer = "Photons",
141 iso = [isoPar.topoetcone40, isoPar.topoetcone30, isoPar.topoetcone20],
142 isoSuffix = ["topoetcone40", "topoetcone30", "topoetcone20"],
143 Prefix = deco_prefix,
144 ))
145 acc.addPublicTool(SUSY20PhotonDecorator)
146 augmentationTools.append(SUSY20PhotonDecorator)'''
147
148
149 from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
150 acc.merge(PhysCommonAugmentationsCfg(flags, TriggerListsHelper = kwargs['TriggerListsHelper']))
151
152
153 from DerivationFrameworkInDet.InDetToolsConfig import InDetTrackSelectionToolWrapperCfg
154 SUSY20TrackSelection = acc.getPrimaryAndMerge(InDetTrackSelectionToolWrapperCfg(
155 flags,
156 name = "SUSY20TrackSelection",
157 ContainerName = "InDetTrackParticles",
158 DecorationName = "DFLoose"
159 ))
160 SUSY20TrackSelection.TrackSelectionTool.CutLevel = "Loose"
161 acc.addPublicTool(SUSY20TrackSelection)
162 augmentationTools.append(SUSY20TrackSelection)
163
164
165
166
167 thinningTools = []
168 thinningExpression = "InDetTrackParticles.DFLoose && (InDetTrackParticles.pt > 0.5*GeV) && (abs( DFCommonInDetTrackZ0AtPV*sin(InDetTrackParticles.theta) ) < 3.0*mm)"
169
170
171 from DerivationFrameworkInDet.InDetToolsConfig import TrackParticleThinningCfg
172 SUSY20TrackParticleThinningTool = acc.getPrimaryAndMerge(TrackParticleThinningCfg(
173 flags,
174 name = "SUSY20TrackParticleThinningTool",
175 StreamName = kwargs['StreamName'],
176 SelectionString = thinningExpression,
177 InDetTrackParticlesKey = "InDetTrackParticles"
178 ))
179 acc.addPublicTool(SUSY20TrackParticleThinningTool)
180 thinningTools.append(SUSY20TrackParticleThinningTool)
181
182
183 from DerivationFrameworkInDet.InDetToolsConfig import MuonTrackParticleThinningCfg
184 SUSY20MuonTPThinningTool = acc.getPrimaryAndMerge(MuonTrackParticleThinningCfg(
185 flags,
186 name = "SUSY20MuonTPThinningTool",
187 StreamName = kwargs['StreamName'],
188 MuonKey = "Muons",
189 InDetTrackParticlesKey = "InDetTrackParticles"
190 ))
191 acc.addPublicTool(SUSY20MuonTPThinningTool)
192 thinningTools.append(SUSY20MuonTPThinningTool)
193
194
195 from DerivationFrameworkInDet.InDetToolsConfig import EgammaTrackParticleThinningCfg
196 SUSY20ElectronTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
197 flags,
198 name = "SUSY20ElectronTPThinningTool",
199 StreamName = kwargs['StreamName'],
200 SGKey = "Electrons",
201 InDetTrackParticlesKey = "InDetTrackParticles"
202 ))
203 acc.addPublicTool(SUSY20ElectronTPThinningTool)
204 thinningTools.append(SUSY20ElectronTPThinningTool)
205
206
207 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import GenericObjectThinningCfg
208 SUSY20PhotonThinningTool = acc.getPrimaryAndMerge(GenericObjectThinningCfg(
209 flags,
210 name = "SUSY20PhotonThinningTool",
211 StreamName = kwargs['StreamName'],
212 ContainerName = "Photons",
213 SelectionString = "Photons.pt > 10*GeV"
214 ))
215 acc.addPublicTool(SUSY20PhotonThinningTool)
216 thinningTools.append(SUSY20PhotonThinningTool)
217
218
219 SUSY20PhotonTPThinningTool = acc.getPrimaryAndMerge(EgammaTrackParticleThinningCfg(
220 flags,
221 name = "SUSY20PhotonTPThinningTool",
222 StreamName = kwargs['StreamName'],
223 SGKey = "Photons",
224 InDetTrackParticlesKey = "InDetTrackParticles",
225 GSFConversionVerticesKey = "GSFConversionVertices"
226 ))
227 acc.addPublicTool(SUSY20PhotonTPThinningTool)
228 thinningTools.append(SUSY20PhotonTPThinningTool)
229
230
231 if flags.Input.isMC:
232 from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import MenuTruthThinningCfg
233 SUSY20TruthThinningTool = acc.getPrimaryAndMerge(MenuTruthThinningCfg(
234 flags,
235 name = "SUSY20TruthThinningTool",
236 WritePartons = False,
237 WriteHadrons = True,
238 WriteBHadrons = True,
239 WriteGeant = False,
240 GeantPhotonPtThresh = 20000,
241 WriteTauHad = True,
242 PartonPtThresh = -1.0,
243 WriteBSM = True,
244 WriteBosons = True,
245 WriteBosonProducts = False,
246 WriteBSMProducts = True,
247 WriteTopAndDecays = True,
248 WriteEverything = False,
249 WriteAllLeptons = True,
250 WriteLeptonsNotFromHadrons = False,
251 WriteNotPhysical = False,
252 WriteFirstN = 10,
253 PreserveAncestors = True,
254 PreserveGeneratorDescendants = True
255 ))
256 acc.addPublicTool(SUSY20TruthThinningTool)
257 thinningTools.append(SUSY20TruthThinningTool)
258
259
260
261
262 skimmingTools = []
263
264
265 from DerivationFrameworkSUSY.SUSYToolsConfig import SUSY20DTTriggerSkimmingToolCfg
266 SUSY20TriggerSkimmingTool_DT = acc.getPrimaryAndMerge(SUSY20DTTriggerSkimmingToolCfg(
267 flags,
268 name = "SUSY20TriggerSkimmingTool"
269 ))
270 acc.addPublicTool(SUSY20TriggerSkimmingTool_DT)
271
272
273 jetRequirements_DT = "AntiKt4EMPFlowJets.pt > 200*GeV && abs(AntiKt4EMPFlowJets.eta) < 2.8"
274 jetSelection_DT = "(count(" + jetRequirements_DT + ") >= 1)"
275
276 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import xAODStringSkimmingToolCfg
277 SUSY20JetSkimmingTool_DT = acc.getPrimaryAndMerge(xAODStringSkimmingToolCfg(
278 flags,
279 name = "SUSY20JetSkimmingTool_DT",
280 expression = jetSelection_DT
281 ))
282 acc.addPublicTool(SUSY20JetSkimmingTool_DT)
283
284
285 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import FilterCombinationANDCfg
286 SUSY20xAODSkimmingTool_DT = acc.getPrimaryAndMerge(FilterCombinationANDCfg(
287 flags,
288 name = "SUSY20SkimmingTool_DT",
289 FilterList = [SUSY20JetSkimmingTool_DT, SUSY20TriggerSkimmingTool_DT]
290 ))
291 acc.addPublicTool(SUSY20xAODSkimmingTool_DT)
292 skimmingTools.append(SUSY20xAODSkimmingTool_DT)
293
294
295
296
297 DerivationKernel = CompFactory.DerivationFramework.DerivationKernel
298 acc.addEventAlgo(DerivationKernel(
299 name,
300 SkimmingTools = skimmingTools,
301 ThinningTools = thinningTools,
302 AugmentationTools = augmentationTools,
303 RunSkimmingFirst = True
304 ))
305
306 return acc
307