205 """Configure the derivation framework driving algorithm (kernel)
210 from JetRecConfig.StandardSmallRJets
import AntiKt4PV0Track
211 from JetRecConfig.JetRecConfig
import JetRecCfg
213 jetList = [AntiKt4PV0Track]
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,
252 from AssociationUtils.AssociationUtilsConfig
import OverlapRemovalToolCfg
254 outputLabel =
"DFCommonJets_passOR"
258 orTool = acc.popToolsAndMerge(
260 flags, outputLabel=outputLabel, bJetLabel=bJetLabel, doTaus=
False
263 algOR = CompFactory.OverlapRemovalGenUseAlg(
264 "OverlapRemovalGenUseAlg",
265 OverlapLabel=outputLabel,
266 OverlapRemovalTool=orTool,
267 JetKey =
'AntiKt4HIJets',
272 acc.addEventAlgo(algOR)
275 augmentationTools = []
281 acc.addPublicTool(EGAM11ZeeMassTool1)
282 augmentationTools.append(EGAM11ZeeMassTool1)
285 acc.addPublicTool(EGAM11ZeeMassTool2)
286 augmentationTools.append(EGAM11ZeeMassTool2)
289 acc.addPublicTool(EGAM11ZeeMassTool3)
290 augmentationTools.append(EGAM11ZeeMassTool3)
293 acc.addPublicTool(EGAM11ZegMassTool)
294 augmentationTools.append(EGAM11ZegMassTool)
298 streamName = kwargs[
"StreamName"]
301 if flags.Derivation.Egamma.doTrackThinning:
302 from DerivationFrameworkInDet.InDetToolsConfig
import (
303 TrackParticleThinningCfg,
304 MuonTrackParticleThinningCfg,
305 TauTrackParticleThinningCfg,
308 TrackThinningKeepElectronTracks =
True
309 TrackThinningKeepPhotonTracks =
True
310 TrackThinningKeepAllElectronTracks =
True
311 TrackThinningKeepJetTracks =
False
312 TrackThinningKeepMuonTracks =
False
313 TrackThinningKeepTauTracks =
False
314 TrackThinningKeepPVTracks =
True
317 if TrackThinningKeepElectronTracks:
318 EGAM11ElectronTPThinningTool = (
319 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
320 name=
"EGAM11ElectronTPThinningTool",
321 StreamName=streamName,
323 GSFTrackParticlesKey=
"GSFTrackParticles",
324 InDetTrackParticlesKey=
"InDetTrackParticles",
325 SelectionString=
"Electrons.pt > 0*GeV",
330 acc.addPublicTool(EGAM11ElectronTPThinningTool)
331 thinningTools.append(EGAM11ElectronTPThinningTool)
335 if TrackThinningKeepAllElectronTracks:
336 EGAM11ElectronTPThinningTool2 = (
337 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
338 name=
"EGAM11ElectronTPThinningTool2",
339 StreamName=streamName,
341 GSFTrackParticlesKey=
"GSFTrackParticles",
342 InDetTrackParticlesKey=
"InDetTrackParticles",
343 SelectionString=
"Electrons.pt > 4*GeV",
348 acc.addPublicTool(EGAM11ElectronTPThinningTool2)
349 thinningTools.append(EGAM11ElectronTPThinningTool2)
352 if TrackThinningKeepPhotonTracks:
353 EGAM11PhotonTPThinningTool = (
354 CompFactory.DerivationFramework.EgammaTrackParticleThinning(
355 name=
"EGAM11PhotonTPThinningTool",
356 StreamName=streamName,
358 GSFTrackParticlesKey=
"GSFTrackParticles",
359 InDetTrackParticlesKey=
"InDetTrackParticles",
360 GSFConversionVerticesKey=
"GSFConversionVertices",
361 SelectionString=
"Photons.pt > 0*GeV",
366 acc.addPublicTool(EGAM11PhotonTPThinningTool)
367 thinningTools.append(EGAM11PhotonTPThinningTool)
370 if TrackThinningKeepJetTracks:
371 EGAM11JetTPThinningTool = (
372 CompFactory.DerivationFramework.JetTrackParticleThinning(
373 name=
"EGAM11JetTPThinningTool",
374 StreamName=streamName,
375 JetKey=
"AntiKt4EMTopoJets",
376 InDetTrackParticlesKey=
"InDetTrackParticles",
379 acc.addPublicTool(EGAM11JetTPThinningTool)
380 thinningTools.append(EGAM11JetTPThinningTool)
383 if TrackThinningKeepMuonTracks:
384 EGAM11MuonTPThinningTool = acc.getPrimaryAndMerge(
387 name=
"EGAM11MuonTPThinningTool",
388 StreamName=streamName,
390 InDetTrackParticlesKey=
"InDetTrackParticles",
393 thinningTools.append(EGAM11MuonTPThinningTool)
396 if TrackThinningKeepTauTracks:
397 EGAM11TauTPThinningTool = acc.getPrimaryAndMerge(
400 name=
"EGAM11TauTPThinningTool",
401 StreamName=streamName,
404 InDetTrackParticlesKey=
"InDetTrackParticles",
405 DoTauTracksThinning=
True,
406 TauTracksKey=
"TauTracks",
409 thinningTools.append(EGAM11TauTPThinningTool)
412 thinning_expression =
" && ".
join(
414 "(InDetTrackParticles.DFCommonTightPrimary)",
415 "(abs(DFCommonInDetTrackZ0AtPV)*sin(InDetTrackParticles.theta)<3*mm)",
416 "(InDetTrackParticles.pt>10*GeV)",
419 if TrackThinningKeepPVTracks:
420 EGAM11TPThinningTool = acc.getPrimaryAndMerge(
423 name=
"EGAM11TPThinningTool",
424 StreamName=streamName,
425 SelectionString=thinning_expression,
426 InDetTrackParticlesKey=
"InDetTrackParticles",
429 thinningTools.append(EGAM11TPThinningTool)
432 from DerivationFrameworkCalo.DerivationFrameworkCaloConfig
import (
433 CaloClusterThinningCfg,
436 EGAM11CCTCThinningTool = acc.getPrimaryAndMerge(
439 name=
"EGAM11CCTCThinningTool",
440 StreamName=streamName,
442 SelectionString=
"Electrons.pt>4*GeV",
443 TopoClCollectionSGKey=
"SubtractedCaloCalTopoClusters",
447 thinningTools.append(EGAM11CCTCThinningTool)
452 truth_cond_WZH =
" && ".
join(
453 [
"(abs(TruthParticles.pdgId) >= 23)",
"(abs(TruthParticles.pdgId) <= 25)"]
456 truth_cond_lep =
" && ".
join(
457 [
"(abs(TruthParticles.pdgId) >= 11)",
"(abs(TruthParticles.pdgId) <= 16)"]
460 truth_cond_top =
"(abs(TruthParticles.pdgId) == 6)"
462 truth_cond_gam =
" && ".
join(
463 [
"(abs(TruthParticles.pdgId) == 22)",
"(TruthParticles.pt > 1*GeV)"]
466 truth_cond_finalState =
"(TruthParticles.isGenStable)"
481 + truth_cond_finalState
484 print(
"EGAM11 truth thinning expression: ", truth_expression)
486 EGAM11TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(
487 name=
"EGAM11TruthThinningTool",
488 StreamName=streamName,
489 ParticleSelectionString=truth_expression,
490 PreserveDescendants=
False,
491 PreserveGeneratorDescendants=
True,
492 PreserveAncestors=
True,
494 acc.addPublicTool(EGAM11TruthThinningTool)
495 thinningTools.append(EGAM11TruthThinningTool)
499 acc.addPublicTool(skimmingTool)
503 CompFactory.DerivationFramework.DerivationKernel(
505 SkimmingTools=[skimmingTool],
506 AugmentationTools=augmentationTools,
507 ThinningTools=thinningTools,