ATLAS Offline Software
Loading...
Searching...
No Matches
PrecisionElectronRecoSequences.py
Go to the documentation of this file.
2# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3#
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7
8#logging
9from AthenaCommon.Logging import logging
10log = logging.getLogger(__name__)
11
12def precisionElectronRecoSequence(flags, RoIs, ion=False, doGSF=True, doLRT=False):
13
14 acc = ComponentAccumulator()
15 """ With this function we will setup the sequence of offline EgammaAlgorithms so to make a electron for TrigEgamma
16
17 Sequence of algorithms is the following:
18 - egammaRecBuilder/TrigEgammaRecElectron creates egammaObjects out of clusters and tracks.
19 - electronSuperClusterBuilder algorithm will create superclusters out of the topoclusters and tracks in egammaRec under the electron hypothesis
20 https://gitlab.cern.ch/atlas/athena/blob/master/Reconstruction/egamma/egammaAlgs/python/egammaSuperClusterBuilder.py#L26
21 - TopoEgammBuilder will create photons and electrons out of trakcs and SuperClusters. Here at HLT electrons the aim is to ignore photons.
22 https://gitlab.cern.ch/atlas/athena/blob/master/Reconstruction/egamma/egammaAlgs/src/xAODEgammaBuilder.cxx
23 """
24
25 log.debug('precisionElectronRecoSequence(RoIs = %s, ion = %s, doGSF = %s, doLRT = %s)',RoIs,ion,doGSF,doLRT)
26
27 tag = '_ion' if ion is True else ''
28
29 # create a Variant string out of the options above
30 variant = '_'
31 if doLRT:
32 variant+='LRT'
33 if doGSF:
34 variant+='GSF'
35
36 if not doLRT and not doGSF:
37 variant+='noGSF'
38
39 tag += variant
40
41 from TriggerMenuMT.HLT.Egamma.TrigEgammaKeys import getTrigEgammaKeys
42
43 # makes datakeys based on LRT, GSF, noGSF, LRTGSF
44 TrigEgammaKeys = getTrigEgammaKeys(flags, variant, ion=ion)
45
46 # taking care of VDV before GSF related data comes in
47 if doLRT:
48 TrigEgammaKeys_noGSF = getTrigEgammaKeys(flags, '_LRT')
49 else:
50 TrigEgammaKeys_noGSF = getTrigEgammaKeys(flags)
51
52 # following reduces if-else checking for later implementations
53 if doGSF:
54 useBremAssoc = True
55 trackParticles = TrigEgammaKeys.precisionElectronTrackParticleContainerGSF
56 else:
57 useBremAssoc = False
58 trackParticles = TrigEgammaKeys_noGSF.precisionTrackingContainer
59
60 # Arranging required data keys
61 caloClusters = TrigEgammaKeys.precisionElectronCaloClusterContainer
62 egammaRecContainer = TrigEgammaKeys.precisionEgammaRecCollection
63 superElectronRecCollectionName = TrigEgammaKeys.precisionElectronSuperClusterCollection
64 superPhotonRecCollectionName = TrigEgammaKeys.precisionPhotonSuperClusterCollection
65 photonOutputName = TrigEgammaKeys.precisionPhotonContainer
66 trackParticles_noGSF = TrigEgammaKeys_noGSF.precisionTrackingContainer
67 TrackParticleLocation = TrigEgammaKeys.precisionTrackingContainer
68 electronOutputName = TrigEgammaKeys.precisionElectronContainer
69 #electronCollectionContainerName_noGSF = TrigEgammaKeys_noGSF.precisionElectronContainer
70 OutputClusterContainerName = TrigEgammaKeys.precisionElectronEMClusterContainer
71 #useBremAssoc = True
72
73 cellsName = "CaloCells" if not ion else "CorrectedRoICaloCells"
74 dataObjects = [( 'CaloCellContainer' , 'StoreGateSvc+%s' % cellsName ),
75 ( 'xAOD::CaloClusterContainer' , 'StoreGateSvc+%s' % caloClusters ),
76 ( 'xAOD::TrackParticleContainer','StoreGateSvc+%s' % trackParticles_noGSF)]
77 if doGSF:
78 dataObjects += [
79 # verifier object needed by GSF
80 ( 'xAOD::TrackParticleContainer','StoreGateSvc+%s' % trackParticles),
81 ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing' ),
82 ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.AveIntPerXDecor' )]
83
84 if flags.Detector.GeometryTRT:
85 dataObjects += [( 'InDet::TRT_DriftCircleContainer' , 'StoreGateSvc+%s' % "TRT_TrigDriftCircles" )]
86 if flags.Input.isMC:
87 dataObjects += [( 'TRT_RDO_Container' , 'StoreGateSvc+TRT_RDOs' )]
88 else:
89 dataObjects += [( 'TRT_RDO_Cache' , f'StoreGateSvc+{flags.Trigger.InDetTracking.TRTRDOCacheKey}' )]
90
91 ambimap = flags.Trigger.InDetTracking.ClusterAmbiguitiesMap
92 if flags.Detector.GeometryITk:
93 ambimap = flags.Trigger.ITkTracking.ClusterAmbiguitiesMap
94
95 dataObjects += [('InDet::PixelGangedClusterAmbiguities' , 'StoreGateSvc+%s' % ambimap )]
96
97 if not flags.Input.isMC:
98 dataObjects += [( 'IDCInDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' )]
99
100 precisionElectronVDV = CompFactory.AthViews.ViewDataVerifier("precisionElectron"+tag+"VDV")
101 precisionElectronVDV.DataObjects = dataObjects
102 acc.addEventAlgo(precisionElectronVDV)
103
104 """ Retrieve the factories now """
105 from TriggerMenuMT.HLT.Electron.TrigElectronFactoriesCfg import TrigEgammaRecElectronCfg, TrigElectronSuperClusterBuilderCfg, TrigTopoEgammaElectronCfg, TrigElectronIsoBuilderCfg
106
107 # Create the sequence of steps:
108 # - TrigEgammaRecElectron, TrigElectronSuperClusterBuilder, TrigTopoEgammaElectron
109 #The sequence of these algorithms
110
111
112 TrigEgammaRecAlgo = TrigEgammaRecElectronCfg(flags, tag, trackParticles, caloClusters, egammaRecContainer)
113 acc.merge(TrigEgammaRecAlgo)
114
115
116 TrigSuperElectronAlgo = TrigElectronSuperClusterBuilderCfg(flags, tag, egammaRecContainer, superElectronRecCollectionName,trackParticles)
117 acc.merge(TrigSuperElectronAlgo)
118
119
120 TrigTopoEgammaAlgo = TrigTopoEgammaElectronCfg(flags, tag, variant, cellsName, superElectronRecCollectionName, superPhotonRecCollectionName, electronOutputName, photonOutputName,OutputClusterContainerName)
121
122 acc.merge(TrigTopoEgammaAlgo)
123
124 collectionOut = electronOutputName
125
126
127 isoBuilder = TrigElectronIsoBuilderCfg(flags, tag, TrackParticleLocation, electronOutputName, useBremAssoc)
128 acc.merge(isoBuilder)
129
130 isoVarKeys = [ '%s.ptcone20' % collectionOut,
131 '%s.ptvarcone20' % collectionOut,
132 '%s.ptcone30' % collectionOut,
133 '%s.ptvarcone30' % collectionOut ]
134
135 #online monitoring for topoEgammaBuilder_GSF
136 from TriggerMenuMT.HLT.Electron.TrigElectronFactoriesCfg import PrecisionElectronTopoMonitorCfg
137 PrecisionElectronRecoMonAlgo = PrecisionElectronTopoMonitorCfg(flags, tag, collectionOut, isoVarKeys)
138
139 acc.merge(PrecisionElectronRecoMonAlgo)
140
141 #online monitoring for TrigElectronSuperClusterBuilder
142 from TriggerMenuMT.HLT.Electron.TrigElectronFactoriesCfg import PrecisionElectronSuperClusterMonitorCfg
143 PrecisionElectronSuperClusterMonAlgo = PrecisionElectronSuperClusterMonitorCfg(flags, tag, superElectronRecCollectionName)
144
145 acc.merge(PrecisionElectronSuperClusterMonAlgo)
146
147 return acc
148
149
precisionElectronRecoSequence(flags, RoIs, ion=False, doGSF=True, doLRT=False)