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