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
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
44 TrigEgammaKeys = getTrigEgammaKeys(flags, variant, ion=ion)
45
46
47 if doLRT:
48 TrigEgammaKeys_noGSF = getTrigEgammaKeys(flags, '_LRT')
49 else:
50 TrigEgammaKeys_noGSF = getTrigEgammaKeys(flags)
51
52
53 if doGSF:
54 useBremAssoc = True
55 trackParticles = TrigEgammaKeys.precisionElectronTrackParticleContainerGSF
56 else:
57 useBremAssoc = False
58 trackParticles = TrigEgammaKeys_noGSF.precisionTrackingContainer
59
60
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
70 OutputClusterContainerName = TrigEgammaKeys.precisionElectronEMClusterContainer
71
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
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
108
109
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
136 from TriggerMenuMT.HLT.Electron.TrigElectronFactoriesCfg import PrecisionElectronTopoMonitorCfg
137 PrecisionElectronRecoMonAlgo = PrecisionElectronTopoMonitorCfg(flags, tag, collectionOut, isoVarKeys)
138
139 acc.merge(PrecisionElectronRecoMonAlgo)
140
141
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