10 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
11 from AthenaConfiguration.ComponentFactory
import CompFactory
12 from AthenaConfiguration.Enums
import MetadataCategory
16 from DerivationFrameworkEGamma.PhotonsCPDetailedContent
import (
17 PhotonsCPDetailedContent,
22 """Configure the EGAM11 skimming tool"""
25 expression =
" || ".
join(
27 "(count( EGAM11_DiElectronMass1 > 50.0*GeV ) >= 1)",
28 "(count( EGAM11_DiElectronMass2 > 50.0*GeV ) >= 1)",
29 "(count( EGAM11_DiElectronMass3 > 50.0*GeV ) >= 1)",
30 "(count( EGAM11_ElectronPhotonMass > 50.0*GeV )>=1)",
33 print(
"EGAM11 skimming expression: ", expression)
36 CompFactory.DerivationFramework.xAODStringSkimmingTool(
37 name=
"EGAM11SkimmingTool", expression=expression, TrigDecisionTool=
""
45 """Configure the EGAM11 ee invariant mass augmentation tool 1"""
58 requirement_tag =
" && ".
join(
59 [
"(Electrons.DFCommonElectronsLHTight)",
"(Electrons.pt > 24.5*GeV)"]
62 requirement_probe =
" && ".
join(
63 [
"(Electrons.DFCommonElectronsLHMedium)",
"(Electrons.pt > 19.5*GeV)"]
67 CompFactory.DerivationFramework.EGInvariantMassTool(
68 name=
"EGAM11_ZEEMassTool1",
69 Object1Requirements=requirement_tag,
70 Object2Requirements=requirement_probe,
71 StoreGateEntryName=
"EGAM11_DiElectronMass1",
72 Mass1Hypothesis=0.511 * MeV,
73 Mass2Hypothesis=0.511 * MeV,
74 Container1Name=
"Electrons",
75 Container2Name=
"Electrons",
77 DoTransverseMass=
False,
86 """Configure the EGAM11 ee invariant mass augmentation tool 2"""
98 requirement =
" && ".
join(
99 [
"(Electrons.DFCommonElectronsLHMedium)",
"(Electrons.pt > 19.5*GeV)"]
103 CompFactory.DerivationFramework.EGInvariantMassTool(
104 name=
"EGAM11_ZEEMassTool2",
105 Object1Requirements=requirement,
106 Object2Requirements=requirement,
107 StoreGateEntryName=
"EGAM11_DiElectronMass2",
108 Mass1Hypothesis=0.511 * MeV,
109 Mass2Hypothesis=0.511 * MeV,
110 Container1Name=
"Electrons",
111 Container2Name=
"Electrons",
113 DoTransverseMass=
False,
122 """Configure the EGAM11 ee invariant mass augmentation tool 3"""
135 requirement_tag =
" && ".
join(
136 [
"(Electrons.DFCommonElectronsLHMedium)",
"(Electrons.pt > 24.5*GeV)"]
139 requirement_probe =
"Electrons.pt > 4*GeV"
142 CompFactory.DerivationFramework.EGInvariantMassTool(
143 name=
"EGAM11_ZEEMassTool3",
144 Object1Requirements=requirement_tag,
145 Object2Requirements=requirement_probe,
146 StoreGateEntryName=
"EGAM11_DiElectronMass3",
147 Mass1Hypothesis=0.511 * MeV,
148 Mass2Hypothesis=0.511 * MeV,
149 Container1Name=
"Electrons",
150 Container2Name=
"Electrons",
152 DoTransverseMass=
False,
161 """Configure the EGAM11 e+photon mass augmentation tool"""
176 requirement_tag =
" && ".
join(
177 [
"(Electrons.DFCommonElectronsLHMedium)",
"(Electrons.pt > 24.5*GeV)"]
180 requirement_probe =
"DFCommonPhotons_et > 14.5*GeV"
183 CompFactory.DerivationFramework.EGInvariantMassTool(
184 name=
"EGAM11_ZEGMassTool",
185 Object1Requirements=requirement_tag,
186 Object2Requirements=requirement_probe,
187 StoreGateEntryName=
"EGAM11_ElectronPhotonMass",
188 Mass1Hypothesis=0.511 * MeV,
189 Mass2Hypothesis=0.511 * MeV,
190 Container1Name=
"Electrons",
191 Container2Name=
"Photons",
192 Pt2BranchName=
"DFCommonPhotons_et",
193 Eta2BranchName=
"DFCommonPhotons_eta",
194 Phi2BranchName=
"DFCommonPhotons_phi",
196 DoTransverseMass=
False,
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 =
" && ".
join(
467 [
"(TruthParticles.status == 1)",
"(TruthParticles.barcode < 200000)"]
483 + truth_cond_finalState
486 print(
"EGAM11 truth thinning expression: ", truth_expression)
488 EGAM11TruthThinningTool = CompFactory.DerivationFramework.GenericTruthThinning(
489 name=
"EGAM11TruthThinningTool",
490 StreamName=streamName,
491 ParticleSelectionString=truth_expression,
492 PreserveDescendants=
False,
493 PreserveGeneratorDescendants=
True,
494 PreserveAncestors=
True,
496 acc.addPublicTool(EGAM11TruthThinningTool)
497 thinningTools.append(EGAM11TruthThinningTool)
501 acc.addPublicTool(skimmingTool)
505 CompFactory.DerivationFramework.DerivationKernel(
507 SkimmingTools=[skimmingTool],
508 AugmentationTools=augmentationTools,
509 ThinningTools=thinningTools,
524 StreamName=
"StreamDAOD_EGAM11",
525 TriggerListsHelper=
None,
530 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
531 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
532 from DerivationFrameworkCore.SlimmingHelper
import SlimmingHelper
535 "EGAM11SlimmingHelper",
536 NamesAndTypes=flags.Input.TypedCollections,
545 EGAM11SlimmingHelper.AllVariables = [
555 EGAM11SlimmingHelper.AllVariables += [
559 "egammaTruthParticles",
570 EGAM11SlimmingHelper.SmartCollections = [
574 "InDetTrackParticles"
577 EGAM11SlimmingHelper.SmartCollections += [
579 "AntiKt4TruthDressedWZJets",
585 EGAM11SlimmingHelper.ExtraVariables += [
586 "Muons.ptcone20.ptcone30.ptcone40.etcone20.etcone30.etcone40"
590 EGAM11SlimmingHelper.ExtraVariables += [
591 "GSFConversionVertices.x.y.z.px.py.pz.pt1.pt2.etaAtCalo.phiAtCalo",
592 "GSFConversionVertices.trackParticleLinks",
596 EGAM11SlimmingHelper.ExtraVariables += [
"PrimaryVertices.sumPt2"]
599 EGAM11SlimmingHelper.ExtraVariables += [
600 "AntiKt4PV0TrackJets.pt.eta.phi.e.m.btaggingLink.constituentLinks"
604 EGAM11SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent
608 EGAM11SlimmingHelper.ExtraVariables += [
609 "MuonTruthParticles.e.px.py.pz.status.pdgId.truthOrigin.truthType"
612 EGAM11SlimmingHelper.ExtraVariables += [
613 "Photons.truthOrigin.truthType.truthParticleLink"
617 if flags.Derivation.Egamma.doEventInfoSlimming:
618 EGAM11SlimmingHelper.SmartCollections.append(
"EventInfo")
620 EGAM11SlimmingHelper.AllVariables += [
"EventInfo"]
623 EGAM11SlimmingHelper.AllVariables += [
"HIEventShape"]
624 EGAM11SlimmingHelper.AllVariables += [
"CaloSums"]
628 EGAM11ItemList = EGAM11SlimmingHelper.GetItemList()
633 ItemList=EGAM11ItemList,
634 AcceptAlgs=[
"EGAM11Kernel"],
641 AcceptAlgs=[
"EGAM11Kernel"],
643 MetadataCategory.CutFlowMetaData,
644 MetadataCategory.TruthMetaData,