ATLAS Offline Software
TrigEgammaFactoriesCfg.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 from TriggerMenuMT.HLT.Egamma.TrigEgammaKeys import getTrigEgammaKeys
6 
7 def TrigEgammaRecCfg(flags, name= "trigEgammaRec"):
9  TrigEgammaKeys = getTrigEgammaKeys(flags)
10  egammaRec = CompFactory.egammaRecBuilder( name = name,
11  InputClusterContainerName = TrigEgammaKeys.precisionCaloTopoCollection, # input,
12  egammaRecContainer = TrigEgammaKeys.precisionCaloEgammaRecCollection, # output,
13  doTrackMatching = False,
14  # Builder tools
15  TrackMatchBuilderTool = None, # Don't want to use these for trigger....
16  ConversionBuilderTool = None,
17  doConversions = False)
18  acc.addEventAlgo(egammaRec)
19  return acc
20 
21 def TrigEgammaSuperClusterBuilderCfg(flags, name, calibrationType, superClusterCollectionName, superegammaRecCollectionName):
22  acc = ComponentAccumulator()
23  TrigEgammaKeys = getTrigEgammaKeys(flags)
24  from egammaTools.egammaSwToolConfig import egammaSwToolCfg
25  from egammaMVACalib.egammaMVACalibConfig import egammaMVASvcCfg
26  trigMVAfolder = flags.Trigger.egamma.Calib.precCaloMVAVersion
27  TrigEgammaSuperClusterBuilder = CompFactory.egammaSuperClusterBuilder(
28  name = name,
29  InputEgammaRecContainerName = TrigEgammaKeys.precisionCaloEgammaRecCollection,
30  SuperClusterCollectionName = superClusterCollectionName,
31  OutputEgammaRecContainerKey = superegammaRecCollectionName, # output,
32  ClusterCorrectionTool = acc.popToolsAndMerge(egammaSwToolCfg(flags)),
33  MVACalibSvc = acc.getPrimaryAndMerge(egammaMVASvcCfg(flags,name="trigPrecCaloEgammaMVASvc",folder = trigMVAfolder)),
34  CalibrationType = calibrationType,
35  EtThresholdCut = 1000,
36  LinkToConstituents = False)
37  acc.addEventAlgo(TrigEgammaSuperClusterBuilder)
38  return acc
39 
41  acc = ComponentAccumulator()
42  TrigEgammaKeys = getTrigEgammaKeys(flags, ion =ion)
43  if ion:
44  name = "TrigCaloClustersInConeToolHI"
45  else:
46  name = "TrigCaloClustersInConeTool"
47  tool = CompFactory.xAOD.CaloClustersInConeTool(name = name,
48  CaloClusterLocation = TrigEgammaKeys.precisionTopoClusterContainer)
49  acc.setPrivateTools(tool)
50  return acc
51 
53  acc = ComponentAccumulator()
54  tool = CompFactory.CP.IsolationCorrectionTool(name = "TrigLeakageCorrTool")
55  acc.setPrivateTools(tool)
56  return acc
57 
58 def CaloFillRectangularClusterCfg(flags, **kwargs):
59  result = ComponentAccumulator()
60  kwargs.setdefault("eta_size", 5)
61  kwargs.setdefault("phi_size", 7)
62  kwargs.setdefault("cells_name",'CaloCells')
63  result.setPrivateTools(CompFactory.CaloFillRectangularCluster(**kwargs))
64  return result
65 
67  acc = ComponentAccumulator()
68  name = "TrigCaloIsolationToolHI"
69  from CaloIdentifier import SUBCALO
70  tool = CompFactory.xAOD.CaloIsolationTool(name = name,
71  CaloFillRectangularClusterTool = acc.popToolsAndMerge(CaloFillRectangularClusterCfg(flags,name="trigegamma_CaloFillRectangularCluster_HI")),
72  ClustersInConeTool = acc.popToolsAndMerge(TrigCaloClustersInConeToolCfg(flags,ion=True)),
73  FlowElementsInConeTool = None,
74  ParticleCaloExtensionTool = None,
75  IsoLeakCorrectionTool = acc.popToolsAndMerge(TrigCaloIsoCorrectionToolCfg(flags)),
76  ParticleCaloCellAssociationTool = None,
77  saveOnlyRequestedCorrections = True,
78  InitializeReadHandles = False,
79  doEnergyDensityCorrection = True,
80  UseEMScale = True,
81  EMCaloNums = [SUBCALO.LAREM],
82  HadCaloNums = [SUBCALO.LARHEC, SUBCALO.TILE])
83  acc.setPrivateTools(tool)
84  return acc
85 
87  acc = ComponentAccumulator()
88  name = "TrigCaloIsolationTool"
89  from CaloIdentifier import SUBCALO
90  tool = CompFactory.xAOD.CaloIsolationTool(name = name,
91  CaloFillRectangularClusterTool = acc.popToolsAndMerge(CaloFillRectangularClusterCfg(flags,name="trigegamma_CaloFillRectangularCluster")),
92  ClustersInConeTool = acc.popToolsAndMerge(TrigCaloClustersInConeToolCfg(flags,ion=False)),
93  FlowElementsInConeTool = None,
94  ParticleCaloExtensionTool = None,
95  IsoLeakCorrectionTool = acc.popToolsAndMerge(TrigCaloIsoCorrectionToolCfg(flags)),
96  ParticleCaloCellAssociationTool = None,
97  saveOnlyRequestedCorrections = True,
98  InitializeReadHandles = True,
99  TopoClusterEDCentralContainer = 'TrigIsoEventShape',
100  TopoClusterEDForwardContainer = 'TrigIsoEventShape',
101  EFlowEDCentralContainer = 'TrigIsoEventShape',
102  EFlowEDForwardContainer = 'TrigIsoEventShape',
103  EMCaloNums = [SUBCALO.LAREM],
104  HadCaloNums = [SUBCALO.LARHEC, SUBCALO.TILE])
105  acc.setPrivateTools(tool)
106  return acc
107 
108 
109 def TrigPhotonIsoBuilderCfg(flags, ion = False):
110  acc = ComponentAccumulator()
111  TrigEgammaKeys = getTrigEgammaKeys(flags, ion=ion)
112  if ion:
113  name = 'TrigPhotonIsolationBuilderHI'
114  TrigCaloIsolationTool = TrigCaloIsolationToolCfg_HI(flags)
115  else:
116  name = 'TrigPhotonIsolationBuilder'
117  TrigCaloIsolationTool = TrigCaloIsolationToolCfg(flags)
118 
119  from xAODPrimitives.xAODIso import xAODIso as isoPar
120  TrigPhotonIsolationBuilder = CompFactory.IsolationBuilder(name = name,
121  PhotonCollectionContainerName = TrigEgammaKeys.precisionPhotonContainer,
122  CaloCellIsolationTool = None,
123  CaloTopoIsolationTool = acc.popToolsAndMerge(TrigCaloIsolationTool),
124  PFlowIsolationTool = None,
125  TrackIsolationTool = None,
126  PhIsoTypes = [[isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40]],
127  PhCorTypes = [[isoPar.core57cells, isoPar.pileupCorrection]],
128  PhCorTypesExtra = [[]],
129  )
130  acc.addEventAlgo(TrigPhotonIsolationBuilder)
131  return acc
132 
133 
134 def TrigEgammaPseudoJetAlgCfg(flags, name='TrigPhotonEgammaPSeudoJetBuilder'):
135  acc = ComponentAccumulator()
136  # This is to run pseudoJetAlgorithm to compute event density over FullScan TopoClusters
137  TrigEgammaPseudoJetAlgBuilder = CompFactory.PseudoJetAlgorithm(name = name,
138  Label = "EMTopo",
139  InputContainer = "HLT_TopoCaloClustersFS",
140  OutputContainer = "PseudoJetTrigEMTopo",
141  SkipNegativeEnergy = True)
142  acc.addEventAlgo(TrigEgammaPseudoJetAlgBuilder)
143  return acc
144 
145 
146 def TrigConfigEventDensityToolCfg( flags, **kwargs ):
147  acc = ComponentAccumulator()
148  kwargs.setdefault("JetAlgorithm", "Kt")
149  kwargs.setdefault("JetRadius", 0.5)
150  kwargs.setdefault("InputContainer", "PseudoJetTrigEMTopo")
151  kwargs.setdefault("AbsRapidityMin",0.0)
152  kwargs.setdefault("AbsRapidityMax",2.0)
153  kwargs.setdefault("AreaDefinition","Voronoi")
154  kwargs.setdefault("VoronoiRfact",0.9)
155  kwargs.setdefault("OutputContainer",'TrigIsoEventShape')
156  acc.setPrivateTools(CompFactory.EventDensityTool(**kwargs))
157  return acc
158 
159 
160 def TrigIsoEventShapeAlgCfg (flags, name = 'TrigPhotonIsoEventShapeAlg'):
161  acc = ComponentAccumulator()
162  TrigIsoEventShapeAlg = CompFactory.EventDensityAthAlg(name = name,
163  EventDensityTool = acc.popToolsAndMerge(TrigConfigEventDensityToolCfg(flags=flags,name="TrigIsoTool")))
164  acc.addEventAlgo(TrigIsoEventShapeAlg)
165  return acc
166 
167 
168 def TrigEgammaFSEventDensitySequenceCfg(flags, name = 'TrigEgammaFSEventDensitySequence'):
169  acc = ComponentAccumulator()
170  from TrigCaloRec.TrigCaloRecConfig import jetmetTopoClusteringCfg
171  acc.merge(jetmetTopoClusteringCfg(flags,
172  RoIs = '') )
173  acc.merge(TrigEgammaPseudoJetAlgCfg(flags))
174  acc.merge(TrigIsoEventShapeAlgCfg(flags))
175  return acc
176 
177 
TrigCaloRecConfig.jetmetTopoClusteringCfg
def jetmetTopoClusteringCfg(flags, RoIs)
JetMetSpecific TopoClustering####################################.
Definition: TrigCaloRecConfig.py:437
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigEgammaSuperClusterBuilderCfg
def TrigEgammaSuperClusterBuilderCfg(flags, name, calibrationType, superClusterCollectionName, superegammaRecCollectionName)
Definition: TrigEgammaFactoriesCfg.py:21
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigCaloClustersInConeToolCfg
def TrigCaloClustersInConeToolCfg(flags, ion)
Definition: TrigEgammaFactoriesCfg.py:40
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigCaloIsolationToolCfg
def TrigCaloIsolationToolCfg(flags)
Definition: TrigEgammaFactoriesCfg.py:86
python.HLT.Egamma.TrigEgammaFactoriesCfg.CaloFillRectangularClusterCfg
def CaloFillRectangularClusterCfg(flags, **kwargs)
Definition: TrigEgammaFactoriesCfg.py:58
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigPhotonIsoBuilderCfg
def TrigPhotonIsoBuilderCfg(flags, ion=False)
Definition: TrigEgammaFactoriesCfg.py:109
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigEgammaPseudoJetAlgCfg
def TrigEgammaPseudoJetAlgCfg(flags, name='TrigPhotonEgammaPSeudoJetBuilder')
Definition: TrigEgammaFactoriesCfg.py:134
egammaSwToolConfig.egammaSwToolCfg
def egammaSwToolCfg(flags, name='egammaSwTool', **kwargs)
Definition: egammaSwToolConfig.py:42
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigIsoEventShapeAlgCfg
def TrigIsoEventShapeAlgCfg(flags, name='TrigPhotonIsoEventShapeAlg')
Definition: TrigEgammaFactoriesCfg.py:160
python.egammaMVACalibConfig.egammaMVASvcCfg
def egammaMVASvcCfg(flags, name="egammaMVASvc", **kwargs)
Definition: egammaMVACalibConfig.py:15
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigEgammaRecCfg
def TrigEgammaRecCfg(flags, name="trigEgammaRec")
Definition: TrigEgammaFactoriesCfg.py:7
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigCaloIsoCorrectionToolCfg
def TrigCaloIsoCorrectionToolCfg(flags)
Definition: TrigEgammaFactoriesCfg.py:52
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigCaloIsolationToolCfg_HI
def TrigCaloIsolationToolCfg_HI(flags)
Definition: TrigEgammaFactoriesCfg.py:66
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigEgammaFSEventDensitySequenceCfg
def TrigEgammaFSEventDensitySequenceCfg(flags, name='TrigEgammaFSEventDensitySequence')
Definition: TrigEgammaFactoriesCfg.py:168
python.HLT.Egamma.TrigEgammaFactoriesCfg.TrigConfigEventDensityToolCfg
def TrigConfigEventDensityToolCfg(flags, **kwargs)
Definition: TrigEgammaFactoriesCfg.py:146
python.HLT.Egamma.TrigEgammaKeys.getTrigEgammaKeys
def getTrigEgammaKeys(AthConfigFlags flags, name='', ion=False)
Definition: TrigEgammaKeys.py:138