205 """Configure the derivation framework driving algorithm (kernel)
210 from JetRecConfig.StandardSmallRJets
import AntiKt4PV0Track, AntiKt4EMTopo
211 from JetRecConfig.JetRecConfig
import JetRecCfg
213 jetList = [AntiKt4PV0Track, AntiKt4EMTopo]
222 from DerivationFrameworkInDet.InDetCommonConfig
import InDetCommonCfg
223 from DerivationFrameworkMuons.MuonsCommonConfig
import MuonsCommonCfg
224 from DerivationFrameworkEGamma.EGammaCommonConfig
import EGammaCommonCfg
226 TrackingFlags = flags.Tracking
230 DoVertexFinding=TrackingFlags.doVertexFinding,
231 AddPseudoTracks=TrackingFlags.doPseudoTracking,
233 DoR3LargeD0=flags.Tracking.doLargeD0,
234 StoreSeparateLargeD0Container=TrackingFlags.storeSeparateLargeD0Container,
249 from JetJvtEfficiency.JetJvtEfficiencyToolConfig
import getJvtEffToolCfg
251 algName =
"DFJet_EventCleaning_passJvtAlg"
252 passJvtTool = acc.popToolsAndMerge(
getJvtEffToolCfg(flags,
"AntiKt4EMTopo"))
253 passJvtTool.PassJVTKey =
"AntiKt4EMTopoJets.DFCommonJets_passJvt"
255 CompFactory.JetDecorationAlg(
256 algName, JetContainer=
"AntiKt4EMTopoJets", Decorators=[passJvtTool]
262 from AssociationUtils.AssociationUtilsConfig
import OverlapRemovalToolCfg
264 outputLabel =
"DFCommonJets_passOR"
268 orTool = acc.popToolsAndMerge(
270 flags, outputLabel=outputLabel, bJetLabel=bJetLabel, doTaus=
False
273 algOR = CompFactory.OverlapRemovalGenUseAlg(
274 "OverlapRemovalGenUseAlg",
275 OverlapLabel=outputLabel,
276 OverlapRemovalTool=orTool,
281 acc.addEventAlgo(algOR)
284 from JetSelectorTools.JetSelectorToolsConfig
import (
285 EventCleaningToolCfg,
289 workingPoints = [
"Loose"]
290 prefix =
"DFCommonJets_"
292 for wp
in workingPoints:
293 cleaningLevel = wp +
"Bad"
296 cleaningLevel = wp.replace(
"LLP",
"BadLLP")
298 jetCleaningTool = acc.popToolsAndMerge(
301 "JetCleaningTool_" + cleaningLevel,
307 acc.addPublicTool(jetCleaningTool)
309 ecTool = acc.popToolsAndMerge(
312 ecTool.JetCleanPrefix = prefix
313 ecTool.JetContainer =
"AntiKt4EMTopoJets"
314 ecTool.JetCleaningTool = jetCleaningTool
315 acc.addPublicTool(ecTool)
319 eventCleanAlg = CompFactory.EventCleaningTestAlg(
320 "EventCleaningTestAlg_" + wp,
321 EventCleaningTool=ecTool,
322 JetCollectionName=
"AntiKt4EMTopoJets",
323 EventCleanPrefix=prefix,
324 CleaningLevel=cleaningLevel,
325 doEvent=(
"Loose" in wp),
327 acc.addEventAlgo(eventCleanAlg)
330 augmentationTools = []
336 acc.addPublicTool(EGAM11ZeeMassTool1)
337 augmentationTools.append(EGAM11ZeeMassTool1)
340 acc.addPublicTool(EGAM11ZeeMassTool2)
341 augmentationTools.append(EGAM11ZeeMassTool2)
344 acc.addPublicTool(EGAM11ZeeMassTool3)
345 augmentationTools.append(EGAM11ZeeMassTool3)
348 acc.addPublicTool(EGAM11ZegMassTool)
349 augmentationTools.append(EGAM11ZegMassTool)
353 streamName = kwargs[
"StreamName"]
356 if flags.Derivation.Egamma.doTrackThinning:
357 from DerivationFrameworkInDet.InDetToolsConfig
import (
358 TrackParticleThinningCfg,
359 MuonTrackParticleThinningCfg,
360 TauTrackParticleThinningCfg,
363 TrackThinningKeepElectronTracks =
True
364 TrackThinningKeepPhotonTracks =
True
365 TrackThinningKeepAllElectronTracks =
True
366 TrackThinningKeepJetTracks =
False
367 TrackThinningKeepMuonTracks =
False
368 TrackThinningKeepTauTracks =
False
369 TrackThinningKeepPVTracks =
True
372 if TrackThinningKeepElectronTracks:
373 EGAM11ElectronTPThinningTool = (
374 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
375 name=
"EGAM11ElectronTPThinningTool",
376 StreamName=streamName,
378 GSFTrackParticlesKey=
"GSFTrackParticles",
379 InDetTrackParticlesKey=
"InDetTrackParticles",
380 SelectionString=
"Electrons.pt > 0*GeV",
385 acc.addPublicTool(EGAM11ElectronTPThinningTool)
386 thinningTools.append(EGAM11ElectronTPThinningTool)
390 if TrackThinningKeepAllElectronTracks:
391 EGAM11ElectronTPThinningTool2 = (
392 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
393 name=
"EGAM11ElectronTPThinningTool2",
394 StreamName=streamName,
396 GSFTrackParticlesKey=
"GSFTrackParticles",
397 InDetTrackParticlesKey=
"InDetTrackParticles",
398 SelectionString=
"Electrons.pt > 4*GeV",
403 acc.addPublicTool(EGAM11ElectronTPThinningTool2)
404 thinningTools.append(EGAM11ElectronTPThinningTool2)
407 if TrackThinningKeepPhotonTracks:
408 EGAM11PhotonTPThinningTool = (
409 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
410 name=
"EGAM11PhotonTPThinningTool",
411 StreamName=streamName,
413 GSFTrackParticlesKey=
"GSFTrackParticles",
414 InDetTrackParticlesKey=
"InDetTrackParticles",
415 GSFConversionVerticesKey=
"GSFConversionVertices",
416 SelectionString=
"Photons.pt > 0*GeV",
421 acc.addPublicTool(EGAM11PhotonTPThinningTool)
422 thinningTools.append(EGAM11PhotonTPThinningTool)
425 if TrackThinningKeepJetTracks:
426 EGAM11JetTPThinningTool = (
427 CompFactory.DerivationFramework.JetTrackParticleThinning(
428 name=
"EGAM11JetTPThinningTool",
429 StreamName=streamName,
430 JetKey=
"AntiKt4EMTopoJets",
431 InDetTrackParticlesKey=
"InDetTrackParticles",
434 acc.addPublicTool(EGAM11JetTPThinningTool)
435 thinningTools.append(EGAM11JetTPThinningTool)
438 if TrackThinningKeepMuonTracks:
439 EGAM11MuonTPThinningTool = acc.getPrimaryAndMerge(
442 name=
"EGAM11MuonTPThinningTool",
443 StreamName=streamName,
445 InDetTrackParticlesKey=
"InDetTrackParticles",
448 thinningTools.append(EGAM11MuonTPThinningTool)
451 if TrackThinningKeepTauTracks:
452 EGAM11TauTPThinningTool = acc.getPrimaryAndMerge(
455 name=
"EGAM11TauTPThinningTool",
456 StreamName=streamName,
459 InDetTrackParticlesKey=
"InDetTrackParticles",
460 DoTauTracksThinning=
True,
461 TauTracksKey=
"TauTracks",
464 thinningTools.append(EGAM11TauTPThinningTool)
467 thinning_expression =
" && ".
join(
469 "(InDetTrackParticles.DFCommonTightPrimary)",
470 "(abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta)<3mm)",
471 "(InDetTrackParticles.pt>10*GeV)",
474 if TrackThinningKeepPVTracks:
475 EGAM11TPThinningTool = acc.getPrimaryAndMerge(
478 name=
"EGAM11TPThinningTool",
479 StreamName=streamName,
480 SelectionString=thinning_expression,
481 InDetTrackParticlesKey=
"InDetTrackParticles",
484 thinningTools.append(EGAM11TPThinningTool)
487 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
488 CaloClusterThinningCfg,
491 EGAM11CCTCThinningTool = acc.getPrimaryAndMerge(
494 name=
"EGAM11CCTCThinningTool",
495 StreamName=streamName,
497 SelectionString=
"Electrons.pt>4*GeV",
498 TopoClCollectionSGKey=
"CaloCalTopoClusters",
502 thinningTools.append(EGAM11CCTCThinningTool)
507 truth_cond_WZH =
" && ".
join(
508 [
"(abs(TruthParticles.pdgId) >= 23)",
"(abs(TruthParticles.pdgId) <= 25)"]
511 truth_cond_lep =
" && ".
join(
512 [
"(abs(TruthParticles.pdgId) >= 11)",
"(abs(TruthParticles.pdgId) <= 16)"]
515 truth_cond_top =
"(abs(TruthParticles.pdgId) == 6)"
517 truth_cond_gam =
" && ".
join(
518 [
"(abs(TruthParticles.pdgId) == 22)",
"(TruthParticles.pt > 1*GeV)"]
521 truth_cond_finalState =
" && ".
join(
522 [
"(TruthParticles.status == 1)",
"(TruthParticles.barcode < 200000)"]
538 + truth_cond_finalState
541 print(
"EGAM11 truth thinning expression: ", truth_expression)
543 EGAM11TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(
544 name=
"EGAM11TruthThinningTool",
545 StreamName=streamName,
546 ParticleSelectionString=truth_expression,
547 PreserveDescendants=
False,
548 PreserveGeneratorDescendants=
True,
549 PreserveAncestors=
True,
551 acc.addPublicTool(EGAM11TruthThinningTool)
552 thinningTools.append(EGAM11TruthThinningTool)
556 acc.addPublicTool(skimmingTool)
560 CompFactory.DerivationFramework.DerivationKernel(
562 SkimmingTools=[skimmingTool],
563 AugmentationTools=augmentationTools,
564 ThinningTools=thinningTools,