ATLAS Offline Software
Functions | Variables
python.EGAM10 Namespace Reference

Functions

def EGAM10SkimmingToolCfg (flags)
 
def EGAM10KernelCfg (flags, name="EGAM10Kernel", **kwargs)
 
def EGAM10Cfg (flags)
 

Variables

string electronRequirements
 
string photonRequirements
 

Function Documentation

◆ EGAM10Cfg()

def python.EGAM10.EGAM10Cfg (   flags)

Definition at line 192 of file EGAM10.py.

192 def EGAM10Cfg(flags):
193  acc = ComponentAccumulator()
194 
195  # Get the lists of triggers needed for trigger matching.
196  # This is needed at this scope (for the slimming) and further down
197  # in the config chain for actually configuring the matching, so we create
198  # it here and pass it down
199  # TODO: this should ideally be called higher up to avoid it being run
200  # multiple times in a train.
201  # TODO: restrict it to relevant triggers
202  from DerivationFrameworkPhys.TriggerListsHelper import TriggerListsHelper
203 
204  EGAM10TriggerListsHelper = TriggerListsHelper(flags)
205 
206  # configure skimming/thinning/augmentation tools
207  acc.merge(
209  flags,
210  name="EGAM10Kernel",
211  StreamName="StreamDAOD_EGAM10",
212  TriggerListsHelper=EGAM10TriggerListsHelper,
213  )
214  )
215 
216  # configure slimming
217  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
218  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
219  from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper
220 
221  EGAM10SlimmingHelper = SlimmingHelper(
222  "EGAM10SlimmingHelper",
223  NamesAndTypes=flags.Input.TypedCollections,
224  flags=flags,
225  )
226 
227  # ------------------------------------------
228  # containers for which we save all variables
229  # -------------------------------------------
230 
231  # baseline
232  EGAM10SlimmingHelper.AllVariables = ["CaloCalTopoClusters"]
233 
234  # and on MC we also add:
235  if flags.Input.isMC:
236  EGAM10SlimmingHelper.AppendToDictionary.update(
237  {
238  "TruthIsoCentralEventShape": "xAOD::EventShape",
239  "TruthIsoCentralEventShapeAux": "xAOD::EventShapeAuxInfo",
240  "TruthIsoForwardEventShape": "xAOD::EventShape",
241  "TruthIsoForwardEventShapeAux": "xAOD::EventShapeAuxInfo",
242  }
243  )
244  EGAM10SlimmingHelper.AllVariables += [
245  "TruthEvents",
246  "TruthParticles",
247  "TruthVertices",
248  "TruthMuons",
249  "TruthElectrons",
250  "TruthPhotons",
251  "TruthNeutrinos",
252  "TruthTaus",
253  "AntiKt4TruthJets",
254  "AntiKt4TruthDressedWZJets",
255  "egammaTruthParticles",
256  "TruthIsoCentralEventShape",
257  "TruthIsoForwardEventShape",
258  ]
259 
260  # -------------------------------------------
261  # containers that we slim
262  # -------------------------------------------
263 
264  # first add variables from smart-slimming
265  # adding only also those for which we add all variables since
266  # the XXXCPContent.py files also bring in some extra variables
267  # for other collections
268  # muons, tau, MET, b-tagging could be switched off if not needed
269  # and use too much space
270  EGAM10SlimmingHelper.SmartCollections = [
271  "Electrons",
272  "Photons",
273  "InDetTrackParticles",
274  "PrimaryVertices",
275  "AntiKt4EMPFlowJets",
276  ]
277 
278  if flags.Input.isMC:
279  EGAM10SlimmingHelper.SmartCollections += [
280  "AntiKt4TruthJets",
281  "AntiKt4TruthDressedWZJets",
282  ]
283 
284  # then add extra variables:
285 
286  # egamma clusters
287  EGAM10SlimmingHelper.ExtraVariables += [
288  "egammaClusters.PHI2CALOFRAME.ETA2CALOFRAME.phi_sampl"
289  ]
290 
291  # photons
292  EGAM10SlimmingHelper.ExtraVariables += [
293  "Photons.ptcone30.ptcone40.f3.f3core",
294  "Photons.maxEcell_time.maxEcell_energy.maxEcell_gain.maxEcell_onlId",
295  "Photons.maxEcell_x.maxEcell_y.maxEcell_z",
296  "Photons.ptcone40_Nonprompt_All_MaxWeightTTVA_pt1000",
297  "Photons.ptcone40_Nonprompt_All_MaxWeightTTVA_pt500",
298  "Photons.ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
299  "Photons.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000",
300  "Photons.ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
301  ]
302 
303  # electrons
304  EGAM10SlimmingHelper.ExtraVariables += [
305  "Electrons.topoetcone30.topoetcone40.ptcone20.ptcone30",
306  "Electrons.ptcone40.maxEcell_time.maxEcell_energy.maxEcell_gain",
307  "Electrons.maxEcell_onlId.maxEcell_x.maxEcell_y.maxEcell_z",
308  ]
309 
310  # primary vertices
311  EGAM10SlimmingHelper.ExtraVariables += [
312  "PrimaryVertices.covariance.trackWeights.sumPt2.sumPt",
313  "PrimaryVertices.pt.eta.phi",
314  ]
315 
316  # tracks
317  EGAM10SlimmingHelper.ExtraVariables += [
318  "InDetTrackParticles.TTVA_AMVFVertices.TTVA_AMVFWeights"
319  ]
320 
321  # photons and electrons: detailed shower shape variables and track variables
322  EGAM10SlimmingHelper.ExtraVariables += PhotonsCPDetailedContent
323 
324  # photons: gain and cluster energy per layer
325  from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
326  getGainDecorations,
327  getClusterEnergyPerLayerDecorations,
328  )
329 
330  gainDecorations = getGainDecorations(acc, flags, "EGAM10Kernel")
331  print("EGAM10 gain decorations: ", gainDecorations)
332  EGAM10SlimmingHelper.ExtraVariables.extend(gainDecorations)
333  clusterEnergyDecorations = getClusterEnergyPerLayerDecorations(acc, "EGAM10Kernel")
334  print("EGAM10 cluster energy decorations: ", clusterEnergyDecorations)
335  EGAM10SlimmingHelper.ExtraVariables.extend(clusterEnergyDecorations)
336 
337  # energy density
338  EGAM10SlimmingHelper.ExtraVariables += [
339  "TopoClusterIsoCentralEventShape.Density",
340  "TopoClusterIsoForwardEventShape.Density",
341  ]
342 
343  from DerivationFrameworkEGamma import EGammaIsoConfig
344 
345  (
346  pflowIsoVar,
347  densityList,
348  densityDict,
349  acc1,
350  ) = EGammaIsoConfig.makeEGammaCommonIsoCfg(flags)
351  acc.merge(acc1)
352  EGAM10SlimmingHelper.AppendToDictionary.update(densityDict)
353  EGAM10SlimmingHelper.ExtraVariables += densityList + [f"Photons{pflowIsoVar}"]
354 
355  # To have ptcone40, needed for efficiency measurement with MM
356  from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
357 
358  acc.merge(
360  flags, object_types=("Photons",), ptCuts=(500, 1000), postfix="Extra"
361  )
362  )
363 
364  # truth
365  if flags.Input.isMC:
366  EGAM10SlimmingHelper.ExtraVariables += [
367  "Electrons.truthOrigin.truthType.truthParticleLink.truthPdgId",
368  "Electrons.lastEgMotherTruthType.lastEgMotherTruthOrigin",
369  "Electrons.lastEgMotherTruthParticleLink.lastEgMotherPdgId",
370  "Electrons.firstEgMotherTruthType.firstEgMotherTruthOrigin",
371  "Electrons.firstEgMotherTruthParticleLink.firstEgMotherPdgId",
372  ]
373 
374  EGAM10SlimmingHelper.ExtraVariables += [
375  "Photons.truthOrigin.truthType.truthParticleLink"
376  ]
377 
378  EGAM10SlimmingHelper.ExtraVariables += [
379  "TruthIsoCentralEventShape.DensitySigma.Density.DensityArea",
380  "TruthIsoForwardEventShape.DensitySigma.Density.DensityArea",
381  ]
382 
383  # Add event info
384  if flags.Derivation.Egamma.doEventInfoSlimming:
385  EGAM10SlimmingHelper.SmartCollections.append("EventInfo")
386  else:
387  EGAM10SlimmingHelper.AllVariables += ["EventInfo"]
388 
389  # Add egamma trigger objects
390  EGAM10SlimmingHelper.IncludeEGammaTriggerContent = True
391 
392  # Trigger matching
393  # Run 2
394  if flags.Trigger.EDMVersion == 2:
395  from DerivationFrameworkPhys.TriggerMatchingCommonConfig import AddRun2TriggerMatchingToSlimmingHelper
396  AddRun2TriggerMatchingToSlimmingHelper(SlimmingHelper = EGAM10SlimmingHelper,
397  OutputContainerPrefix = "TrigMatch_",
398  TriggerList = EGAM10TriggerListsHelper.Run2TriggerNamesNoTau)
399  # Run 3, or Run 2 with navigation conversion
400  if flags.Trigger.EDMVersion == 3 or (flags.Trigger.EDMVersion == 2 and flags.Trigger.doEDMVersionConversion):
401  from TrigNavSlimmingMT.TrigNavSlimmingMTConfig import AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
403 
404  EGAM10ItemList = EGAM10SlimmingHelper.GetItemList()
405  acc.merge(
407  flags,
408  "DAOD_EGAM10",
409  ItemList=EGAM10ItemList,
410  AcceptAlgs=["EGAM10Kernel"],
411  )
412  )
413  acc.merge(
415  flags,
416  "DAOD_EGAM10",
417  AcceptAlgs=["EGAM10Kernel"],
418  createMetadata=[
419  MetadataCategory.CutFlowMetaData,
420  MetadataCategory.TruthMetaData,
421  ],
422  )
423  )
424 
425  return acc

◆ EGAM10KernelCfg()

def python.EGAM10.EGAM10KernelCfg (   flags,
  name = "EGAM10Kernel",
**  kwargs 
)
Configure the derivation framework driving algorithm (kernel)
for EGAM10

Definition at line 84 of file EGAM10.py.

84 def EGAM10KernelCfg(flags, name="EGAM10Kernel", **kwargs):
85  """Configure the derivation framework driving algorithm (kernel)
86  for EGAM10"""
87  acc = ComponentAccumulator()
88 
89  # Common augmentations
90  from DerivationFrameworkPhys.PhysCommonConfig import PhysCommonAugmentationsCfg
91 
92  acc.merge(
94  flags, TriggerListsHelper=kwargs["TriggerListsHelper"]
95  )
96  )
97 
98  # EGAM10 augmentations
99  augmentationTools = []
100 
101  # ====================================================================
102  # PhotonVertexSelectionWrapper decoration tool - needs PhotonPointing tool
103  # ====================================================================
104  from DerivationFrameworkEGamma.EGammaToolsConfig import (
105  PhotonVertexSelectionWrapperKernelCfg)
106  acc.merge(PhotonVertexSelectionWrapperKernelCfg(flags))
107 
108  # ====================================================================
109  # Common calo decoration tools
110  # ====================================================================
111  from DerivationFrameworkCalo.DerivationFrameworkCaloConfig import (
112  CaloDecoratorKernelCfg)
113  acc.merge(CaloDecoratorKernelCfg(flags))
114 
115  # thinning tools
116  thinningTools = []
117  streamName = kwargs["StreamName"]
118 
119  # Track thinning
120  if flags.Derivation.Egamma.doTrackThinning:
121  TrackThinningKeepElectronTracks = True
122  TrackThinningKeepPhotonTracks = True
123  TrackThinningKeepAllElectronTracks = True
124 
125  # Tracks associated with high-pT Electrons (deltaR=0.6)
126  if TrackThinningKeepElectronTracks:
127  EGAM10ElectronTPThinningTool = (
128  CompFactory.DerivationFramework.EgammaTrackParticleThinning(
129  name="EGAM10ElectronTPThinningTool",
130  StreamName=streamName,
131  SGKey="Electrons",
132  GSFTrackParticlesKey="GSFTrackParticles",
133  InDetTrackParticlesKey="InDetTrackParticles",
134  SelectionString=electronRequirements,
135  BestMatchOnly=True,
136  ConeSize=0.6,
137  )
138  )
139  acc.addPublicTool(EGAM10ElectronTPThinningTool)
140  thinningTools.append(EGAM10ElectronTPThinningTool)
141 
142  # Tracks associated with Photons
143  if TrackThinningKeepPhotonTracks:
144  EGAM10PhotonTPThinningTool = (
145  CompFactory.DerivationFramework.EgammaTrackParticleThinning(
146  name="EGAM10PhotonTPThinningTool",
147  StreamName=streamName,
148  SGKey="Photons",
149  GSFTrackParticlesKey="GSFTrackParticles",
150  InDetTrackParticlesKey="InDetTrackParticles",
151  GSFConversionVerticesKey="GSFConversionVertices",
152  SelectionString=photonRequirements,
153  BestMatchOnly=False,
154  ConeSize=0.6,
155  )
156  )
157  acc.addPublicTool(EGAM10PhotonTPThinningTool)
158  thinningTools.append(EGAM10PhotonTPThinningTool)
159 
160  # Tracks associated with all Electrons (for ambiguity resolver tool)
161  if TrackThinningKeepAllElectronTracks:
162  EGAM10ElectronTPThinningToolAR = (
163  CompFactory.DerivationFramework.EgammaTrackParticleThinning(
164  name="EGAM10ElectronTPThinningToolAR",
165  StreamName=streamName,
166  SGKey="Electrons",
167  GSFTrackParticlesKey="GSFTrackParticles",
168  InDetTrackParticlesKey="InDetTrackParticles",
169  SelectionString=electronRequirements,
170  BestMatchOnly=True,
171  )
172  )
173  acc.addPublicTool(EGAM10ElectronTPThinningToolAR)
174  thinningTools.append(EGAM10ElectronTPThinningToolAR)
175 
176  # skimming
177  skimmingTool = acc.getPrimaryAndMerge(EGAM10SkimmingToolCfg(flags))
178 
179  # setup the kernel
180  acc.addEventAlgo(
181  CompFactory.DerivationFramework.DerivationKernel(
182  name,
183  SkimmingTools=[skimmingTool],
184  AugmentationTools=augmentationTools,
185  ThinningTools=thinningTools,
186  )
187  )
188 
189  return acc
190 
191 

◆ EGAM10SkimmingToolCfg()

def python.EGAM10.EGAM10SkimmingToolCfg (   flags)
Configure the EGAM10 skimming tool

Definition at line 37 of file EGAM10.py.

37 def EGAM10SkimmingToolCfg(flags):
38  """Configure the EGAM10 skimming tool"""
39  acc = ComponentAccumulator()
40 
41  # off-line based selection
42  photonSelection = "(count(" + photonRequirements + ") >= 1)"
43  print("EGAM10 offline skimming expression: ", photonSelection)
44  EGAM10_OfflineSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
45  name="EGAM10_OfflineSkimmingTool", expression=photonSelection
46  )
47 
48  # trigger-based selection
49  MenuType = None
50  if flags.Trigger.EDMVersion == 2:
51  MenuType = "Run2"
52  elif flags.Trigger.EDMVersion == 3:
53  MenuType = "Run3"
54  else:
55  MenuType = ""
56  allTriggers = (
57  singlePhotonTriggers[MenuType]
58  + diPhotonTriggers[MenuType]
59  + triPhotonTriggers[MenuType]
60  + noalgTriggers[MenuType]
61  )
62  # remove duplicates
63  allTriggers = list(set(allTriggers))
64 
65  print("EGAM10 trigger skimming list (OR): ", allTriggers)
66  EGAM10_TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(
67  name="EGAM10_TriggerSkimmingTool", TriggerListOR=allTriggers
68  )
69 
70  # do the AND of trigger-based and offline-based selection
71  print("EGAM10 skimming is logical AND of previous selections")
72  EGAM10_SkimmingTool = CompFactory.DerivationFramework.FilterCombinationAND(
73  name="EGAM10_SkimmingTool",
74  FilterList=[EGAM10_OfflineSkimmingTool, EGAM10_TriggerSkimmingTool],
75  )
76 
77  acc.addPublicTool(EGAM10_OfflineSkimmingTool)
78  acc.addPublicTool(EGAM10_TriggerSkimmingTool)
79  acc.addPublicTool(EGAM10_SkimmingTool, primary=True)
80 
81  return acc
82 
83 

Variable Documentation

◆ electronRequirements

string python.EGAM10.electronRequirements
Initial value:
1 = " && ".join(
2  [
3  "(Electrons.pt > 15*GeV)",
4  "(abs(Electrons.eta) < 2.5)",
5  "(Electrons.DFCommonElectronsLHLoose)",
6  ]
7 )

Definition at line 25 of file EGAM10.py.

◆ photonRequirements

string python.EGAM10.photonRequirements
Initial value:
1 = " && ".join(
2  ["(DFCommonPhotons_et >= 15*GeV)", "(abs(DFCommonPhotons_eta) < 2.5)"]
3 )

Definition at line 32 of file EGAM10.py.

python.EGAM10.EGAM10KernelCfg
def EGAM10KernelCfg(flags, name="EGAM10Kernel", **kwargs)
Definition: EGAM10.py:84
TrigNavSlimmingMTConfig.AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
def AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(slimmingHelper)
Definition: TrigNavSlimmingMTConfig.py:98
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
python.TriggerMatchingCommonConfig.AddRun2TriggerMatchingToSlimmingHelper
def AddRun2TriggerMatchingToSlimmingHelper(**kwargs)
Definition: TriggerMatchingCommonConfig.py:49
python.EGAM10.EGAM10Cfg
def EGAM10Cfg(flags)
Definition: EGAM10.py:192
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
python.EGAM10.EGAM10SkimmingToolCfg
def EGAM10SkimmingToolCfg(flags)
Definition: EGAM10.py:37
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
DerivationFrameworkCaloConfig.CaloDecoratorKernelCfg
def CaloDecoratorKernelCfg(flags, name="CaloDecoratorKernel", **kwargs)
Definition: DerivationFrameworkCaloConfig.py:77
DerivationFrameworkCaloConfig.getClusterEnergyPerLayerDecorations
def getClusterEnergyPerLayerDecorations(acc, kernel)
Definition: DerivationFrameworkCaloConfig.py:159
DerivationFrameworkCaloConfig.getGainDecorations
def getGainDecorations(acc, flags, kernel, collections=None, info=["E", "nCells"])
Definition: DerivationFrameworkCaloConfig.py:127
python.PhysCommonConfig.PhysCommonAugmentationsCfg
def PhysCommonAugmentationsCfg(flags, **kwargs)
Definition: PhysCommonConfig.py:14
DerivationTrackIsoConfig.DerivationTrackIsoCfg
def DerivationTrackIsoCfg(flags, **jwarg)
Definition: DerivationTrackIsoConfig.py:11
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:219
SlimmingHelper
Definition: SlimmingHelper.py:1
python.EGammaToolsConfig.PhotonVertexSelectionWrapperKernelCfg
def PhotonVertexSelectionWrapperKernelCfg(flags, name="PhotonVertexSelectionWrapperKernel", **kwargs)
Definition: EGammaToolsConfig.py:104