199def EGAM11KernelCfg(flags, name="EGAM11Kernel", **kwargs):
200 """Configure the derivation framework driving algorithm (kernel)
201 for EGAM11"""
202 acc = ComponentAccumulator()
203
204
205 from JetRecConfig.StandardSmallRJets import AntiKt4PV0Track
206 from JetRecConfig.JetRecConfig import JetRecCfg
207
208 jetList = [AntiKt4PV0Track]
209 for jd in jetList:
210 acc.merge(JetRecCfg(flags, jd))
211
212
213
214
215
216
217 from DerivationFrameworkInDet.InDetCommonConfig import InDetCommonCfg
218 from DerivationFrameworkMuons.MuonsCommonConfig import MuonsCommonCfg
219 from DerivationFrameworkEGamma.EGammaCommonConfig import EGammaCommonCfg
220
221 TrackingFlags = flags.Tracking
222 acc.merge(
223 InDetCommonCfg(
224 flags,
225 DoVertexFinding=TrackingFlags.doVertexFinding,
226 AddPseudoTracks=TrackingFlags.doPseudoTracking,
227 DecoLRTTTVA=False,
228 DoR3LargeD0=flags.Tracking.doLargeD0,
229 StoreSeparateLargeD0Container=TrackingFlags.storeSeparateLargeD0Container,
230 MergeLRT=False,
231 )
232 )
233 acc.merge(MuonsCommonCfg(flags))
234 acc.merge(EGammaCommonCfg(flags))
235
236
237
238
239
240
241
242
243
244
245
246
247 from AssociationUtils.AssociationUtilsConfig import OverlapRemovalToolCfg
248
249 outputLabel = "DFCommonJets_passOR_HI"
250 bJetLabel = ""
251 tauLabel = ""
252 tauKey = ""
253 orTool = acc.popToolsAndMerge(
254 OverlapRemovalToolCfg(
255 flags, outputLabel=outputLabel, bJetLabel=bJetLabel, doTaus=False
256 )
257 )
258 algOR = CompFactory.OverlapRemovalGenUseAlg(
259 "OverlapRemovalGenUseAlg",
260 OverlapLabel=outputLabel,
261 OverlapRemovalTool=orTool,
262 JetKey = 'AntiKt4HIJets',
263 TauKey=tauKey,
264 TauLabel=tauLabel,
265 BJetLabel=bJetLabel,
266 )
267 acc.addEventAlgo(algOR)
268
269
270 augmentationTools = []
271
272
273
274
275 EGAM11ZeeMassTool1 = acc.popToolsAndMerge(EGAM11ZeeMassTool1Cfg(flags))
276 acc.addPublicTool(EGAM11ZeeMassTool1)
277 augmentationTools.append(EGAM11ZeeMassTool1)
278
279 EGAM11ZeeMassTool2 = acc.popToolsAndMerge(EGAM11ZeeMassTool2Cfg(flags))
280 acc.addPublicTool(EGAM11ZeeMassTool2)
281 augmentationTools.append(EGAM11ZeeMassTool2)
282
283 EGAM11ZeeMassTool3 = acc.popToolsAndMerge(EGAM11ZeeMassTool3Cfg(flags))
284 acc.addPublicTool(EGAM11ZeeMassTool3)
285 augmentationTools.append(EGAM11ZeeMassTool3)
286
287 EGAM11ZegMassTool = acc.popToolsAndMerge(EGAM11ZegMassToolCfg(flags))
288 acc.addPublicTool(EGAM11ZegMassTool)
289 augmentationTools.append(EGAM11ZegMassTool)
290
291
292 thinningTools = []
293 streamName = kwargs["StreamName"]
294
295
296 if flags.Derivation.Egamma.doTrackThinning:
297 from DerivationFrameworkInDet.InDetToolsConfig import (
298 TrackParticleThinningCfg,
299 MuonTrackParticleThinningCfg,
300 TauTrackParticleThinningCfg,
301 )
302
303 TrackThinningKeepElectronTracks = True
304 TrackThinningKeepPhotonTracks = True
305 TrackThinningKeepAllElectronTracks = True
306 TrackThinningKeepJetTracks = False
307 TrackThinningKeepMuonTracks = False
308 TrackThinningKeepTauTracks = False
309 TrackThinningKeepPVTracks = True
310
311
312 if TrackThinningKeepElectronTracks:
313 EGAM11ElectronTPThinningTool = (
314 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
315 name="EGAM11ElectronTPThinningTool",
316 StreamName=streamName,
317 SGKey="Electrons",
318 GSFTrackParticlesKey="GSFTrackParticles",
319 InDetTrackParticlesKey="InDetTrackParticles",
320 SelectionString="Electrons.pt > 0*GeV",
321 BestMatchOnly=True,
322 ConeSize=0.3,
323 )
324 )
325 acc.addPublicTool(EGAM11ElectronTPThinningTool)
326 thinningTools.append(EGAM11ElectronTPThinningTool)
327
328
329
330 if TrackThinningKeepAllElectronTracks:
331 EGAM11ElectronTPThinningTool2 = (
332 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
333 name="EGAM11ElectronTPThinningTool2",
334 StreamName=streamName,
335 SGKey="Electrons",
336 GSFTrackParticlesKey="GSFTrackParticles",
337 InDetTrackParticlesKey="InDetTrackParticles",
338 SelectionString="Electrons.pt > 4*GeV",
339 BestMatchOnly=False,
340 ConeSize=0.6,
341 )
342 )
343 acc.addPublicTool(EGAM11ElectronTPThinningTool2)
344 thinningTools.append(EGAM11ElectronTPThinningTool2)
345
346
347 if TrackThinningKeepPhotonTracks:
348 EGAM11PhotonTPThinningTool = (
349 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
350 name="EGAM11PhotonTPThinningTool",
351 StreamName=streamName,
352 SGKey="Photons",
353 GSFTrackParticlesKey="GSFTrackParticles",
354 InDetTrackParticlesKey="InDetTrackParticles",
355 GSFConversionVerticesKey="GSFConversionVertices",
356 SelectionString="Photons.pt > 0*GeV",
357 BestMatchOnly=True,
358 ConeSize=0.3,
359 )
360 )
361 acc.addPublicTool(EGAM11PhotonTPThinningTool)
362 thinningTools.append(EGAM11PhotonTPThinningTool)
363
364
365 if TrackThinningKeepJetTracks:
366 EGAM11JetTPThinningTool = (
367 CompFactory.DerivationFramework.JetTrackParticleThinning(
368 name="EGAM11JetTPThinningTool",
369 StreamName=streamName,
370 JetKey="AntiKt4EMTopoJets",
371 InDetTrackParticlesKey="InDetTrackParticles",
372 )
373 )
374 acc.addPublicTool(EGAM11JetTPThinningTool)
375 thinningTools.append(EGAM11JetTPThinningTool)
376
377
378 if TrackThinningKeepMuonTracks:
379 EGAM11MuonTPThinningTool = acc.getPrimaryAndMerge(
380 MuonTrackParticleThinningCfg(
381 flags,
382 name="EGAM11MuonTPThinningTool",
383 StreamName=streamName,
384 MuonKey="Muons",
385 InDetTrackParticlesKey="InDetTrackParticles",
386 )
387 )
388 thinningTools.append(EGAM11MuonTPThinningTool)
389
390
391 if TrackThinningKeepTauTracks:
392 EGAM11TauTPThinningTool = acc.getPrimaryAndMerge(
393 TauTrackParticleThinningCfg(
394 flags,
395 name="EGAM11TauTPThinningTool",
396 StreamName=streamName,
397 TauKey="TauJets",
398 ConeSize=0.6,
399 InDetTrackParticlesKey="InDetTrackParticles",
400 DoTauTracksThinning=True,
401 TauTracksKey="TauTracks",
402 )
403 )
404 thinningTools.append(EGAM11TauTPThinningTool)
405
406
407 thinning_expression = " && ".join(
408 [
409 "(InDetTrackParticles.DFCommonTightPrimary)",
410 "(abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta)<3*mm)",
411 "(InDetTrackParticles.pt>10*GeV)",
412 ]
413 )
414 if TrackThinningKeepPVTracks:
415 EGAM11TPThinningTool = acc.getPrimaryAndMerge(
416 TrackParticleThinningCfg(
417 flags,
418 name="EGAM11TPThinningTool",
419 StreamName=streamName,
420 SelectionString=thinning_expression,
421 InDetTrackParticlesKey="InDetTrackParticles",
422 )
423 )
424 thinningTools.append(EGAM11TPThinningTool)
425
426
427 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
428 CaloClusterThinningCfg,
429 )
430
431 EGAM11CCTCThinningTool = acc.getPrimaryAndMerge(
432 CaloClusterThinningCfg(
433 flags,
434 name="EGAM11CCTCThinningTool",
435 StreamName=streamName,
436 SGKey="Electrons",
437 SelectionString="Electrons.pt>4*GeV",
438 TopoClCollectionSGKey="SubtractedCaloCalTopoClusters",
439 ConeSize=0.5,
440 )
441 )
442 thinningTools.append(EGAM11CCTCThinningTool)
443
444
445 if flags.Input.isMC:
446
447 truth_cond_WZH = " && ".join(
448 ["(abs(TruthParticles.pdgId) >= 23)", "(abs(TruthParticles.pdgId) <= 25)"]
449 )
450
451 truth_cond_lep = " && ".join(
452 ["(abs(TruthParticles.pdgId) >= 11)", "(abs(TruthParticles.pdgId) <= 16)"]
453 )
454
455 truth_cond_top = "(abs(TruthParticles.pdgId) == 6)"
456
457 truth_cond_gam = " && ".join(
458 ["(abs(TruthParticles.pdgId) == 22)", "(TruthParticles.pt > 1*GeV)"]
459 )
460
461 truth_cond_finalState = "(TruthParticles.isGenStable)"
462 truth_expression = (
463 "( "
464 + truth_cond_WZH
465 + " ) || "
466 + "( "
467 + truth_cond_lep
468 + " ) || "
469 + "( "
470 + truth_cond_top
471 + " ) || "
472 + "( "
473 + truth_cond_gam
474 + " ) || "
475 + "( "
476 + truth_cond_finalState
477 + " )"
478 )
479 print(
"EGAM11 truth thinning expression: ", truth_expression)
480
481 EGAM11TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(
482 name="EGAM11TruthThinningTool",
483 StreamName=streamName,
484 ParticleSelectionString=truth_expression,
485 PreserveDescendants=False,
486 PreserveGeneratorDescendants=True,
487 PreserveAncestors=True,
488 )
489 acc.addPublicTool(EGAM11TruthThinningTool)
490 thinningTools.append(EGAM11TruthThinningTool)
491
492
493 skimmingTool = acc.getPrimaryAndMerge(EGAM11SkimmingToolCfg(flags))
494
495
496 acc.addEventAlgo(
497 CompFactory.DerivationFramework.DerivationKernel(
498 name,
499 SkimmingTools=[skimmingTool],
500 AugmentationTools=augmentationTools,
501 ThinningTools=thinningTools,
502 )
503 )
504
505 return acc
506
507
void print(char *figname, TCanvas *c1)