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
 
bool decorateCells = True
 

Function Documentation

◆ EGAM10Cfg()

def python.EGAM10.EGAM10Cfg (   flags)

Definition at line 196 of file EGAM10.py.

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

◆ EGAM10KernelCfg()

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

Definition at line 87 of file EGAM10.py.

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

◆ EGAM10SkimmingToolCfg()

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

Definition at line 38 of file EGAM10.py.

38 def EGAM10SkimmingToolCfg(flags):
39  """Configure the EGAM10 skimming tool"""
40  acc = ComponentAccumulator()
41 
42  # off-line based selection
43  photonSelection = "(count(" + photonRequirements + ") >= 1)"
44  print("EGAM10 offline skimming expression: ", photonSelection)
45  EGAM10_OfflineSkimmingTool = CompFactory.DerivationFramework.xAODStringSkimmingTool(
46  name="EGAM10_OfflineSkimmingTool", expression=photonSelection, TrigDecisionTool="",
47  )
48 
49  # trigger-based selection
50  MenuType = None
51  if flags.Trigger.EDMVersion == 2:
52  MenuType = "Run2"
53  elif flags.Trigger.EDMVersion == 3:
54  MenuType = "Run3"
55  if 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  print("EGAM10 trigger skimming list (OR): ", allTriggers)
65  EGAM10_TriggerSkimmingTool = CompFactory.DerivationFramework.TriggerSkimmingTool(
66  name="EGAM10_TriggerSkimmingTool", TriggerListOR=allTriggers
67  )
68 
69  # do the AND of trigger-based and offline-based selection
70  print("EGAM10 skimming is logical AND of previous selections")
71  EGAM10_SkimmingTool = CompFactory.DerivationFramework.FilterCombinationAND(
72  name="EGAM10_SkimmingTool",
73  FilterList=[EGAM10_OfflineSkimmingTool, EGAM10_TriggerSkimmingTool],
74  )
75 
76  acc.addPublicTool(EGAM10_OfflineSkimmingTool)
77  acc.addPublicTool(EGAM10_TriggerSkimmingTool)
78  acc.addPublicTool(EGAM10_SkimmingTool, primary=True)
79  else:
80  print("Unknown Trigger.EDMVersion ", flags.Trigger.EDMVersion)
81  print("Will not apply trigger-based skimming")
82  acc.addPublicTool(EGAM10_OfflineSkimmingTool, primary=True)
83 
84  return acc
85 
86 

Variable Documentation

◆ decorateCells

bool python.EGAM10.decorateCells = True

Definition at line 36 of file EGAM10.py.

◆ 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:87
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=None, MetadataItemList=None, disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, keepProvenanceTagsRegEx=None, AcceptAlgs=None, HelperTools=None)
Definition: OutputStreamConfig.py:13
TrigNavSlimmingMTConfig.AddRun3TrigNavSlimmingCollectionsToSlimmingHelper
def AddRun3TrigNavSlimmingCollectionsToSlimmingHelper(slimmingHelper)
Definition: TrigNavSlimmingMTConfig.py:99
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TriggerMatchingCommonConfig.AddRun2TriggerMatchingToSlimmingHelper
def AddRun2TriggerMatchingToSlimmingHelper(**kwargs)
Definition: TriggerMatchingCommonConfig.py:49
DerivationFrameworkCaloConfig.CaloCellDecoratorKernelCfg
def CaloCellDecoratorKernelCfg(flags, name="CaloCellDecoratorKernel", **kwargs)
Definition: DerivationFrameworkCaloConfig.py:79
python.EGAM10.EGAM10Cfg
def EGAM10Cfg(flags)
Definition: EGAM10.py:196
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:38
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:26
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:105
DerivationFrameworkCaloConfig.getClusterEnergyPerLayerDecorations
def getClusterEnergyPerLayerDecorations(acc, kernel)
Definition: DerivationFrameworkCaloConfig.py:184
DerivationFrameworkCaloConfig.getGainDecorations
def getGainDecorations(acc, flags, kernel, collections=None, info=["E", "nCells"])
Definition: DerivationFrameworkCaloConfig.py:155
python.PhysCommonConfig.PhysCommonAugmentationsCfg
def PhysCommonAugmentationsCfg(flags, **kwargs)
Definition: PhysCommonConfig.py:13
DerivationTrackIsoConfig.DerivationTrackIsoCfg
def DerivationTrackIsoCfg(flags, **jwarg)
Definition: DerivationTrackIsoConfig.py:10
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:222
SlimmingHelper
Definition: SlimmingHelper.py:1
python.EGammaToolsConfig.PhotonVertexSelectionWrapperKernelCfg
def PhotonVertexSelectionWrapperKernelCfg(flags, name="PhotonVertexSelectionWrapperKernel", **kwargs)
Definition: EGammaToolsConfig.py:95