104 def makeAlgs (self, config) :
106 log = logging.getLogger(
'PhotonCalibrationConfig')
108 postfix = self.postfix
109 if postfix !=
'' and postfix[0] !=
'_' :
110 postfix =
'_' + postfix
112 if self.forceFullSimConfig:
113 log.warning(
"You are running PhotonCalibrationConfig forcing full sim config")
114 log.warning(
"This is only intended to be used for testing purposes")
116 if config.isPhyslite() :
117 config.setSourceName (self.containerName,
"AnalysisPhotons")
119 config.setSourceName (self.containerName,
"Photons")
121 cleaningWP =
'NoTime' if self.cleaningAllowLate
else ''
124 if config.wantCopy (self.containerName) :
125 alg = config.createAlgorithm(
'CP::AsgShallowCopyAlg',
'PhotonShallowCopyAlg' + postfix )
126 alg.input = config.readName (self.containerName)
127 alg.output = config.copyName (self.containerName)
130 alg = config.createAlgorithm(
'CP::AsgSelectionAlg',
'PhotonEtaCutAlg' + postfix )
131 alg.selectionDecoration =
'selectEta' + postfix +
',as_bits'
132 config.addPrivateTool(
'selectionTool',
'CP::AsgPtEtaSelectionTool' )
133 alg.selectionTool.maxEta = 2.37
135 alg.selectionTool.etaGapLow = 1.37
136 alg.selectionTool.etaGapHigh = 1.52
137 alg.selectionTool.useClusterEta =
True
138 alg.particles = config.readName (self.containerName)
139 alg.preselection = config.getPreselection (self.containerName,
'')
140 config.addSelection (self.containerName,
'', alg.selectionDecoration)
143 if self.recomputeIsEM
and config.dataType()
is DataType.FullSim:
144 alg = config.createAlgorithm(
'CP::PhotonShowerShapeFudgeAlg',
145 'PhotonShowerShapeFudgeAlg' + postfix )
146 config.addPrivateTool(
'showerShapeFudgeTool',
147 'ElectronPhotonVariableCorrectionTool' )
148 if config.geometry
is LHCPeriod.Run2:
149 alg.showerShapeFudgeTool.ConfigFile = \
150 'EGammaVariableCorrection/TUNE25/ElPhVariableNominalCorrection.conf'
151 if config.geometry
is LHCPeriod.Run3:
152 alg.showerShapeFudgeTool.ConfigFile = \
153 'EGammaVariableCorrection/TUNE23/ElPhVariableNominalCorrection.conf'
154 alg.photons = config.readName (self.containerName)
155 alg.photonsOut = config.copyName (self.containerName)
156 alg.preselection = config.getPreselection (self.containerName,
'')
159 alg = config.createAlgorithm(
'CP::AsgSelectionAlg',
'PhotonObjectQualityAlg' + postfix )
160 alg.selectionDecoration =
'goodOQ,as_bits'
161 config.addPrivateTool(
'selectionTool',
'CP::EgammaIsGoodOQSelectionTool' )
162 alg.selectionTool.Mask = xAOD.EgammaParameters.BADCLUSPHOTON
163 alg.particles = config.readName (self.containerName)
164 alg.preselection = config.getPreselection (self.containerName,
'')
165 config.addSelection (self.containerName,
'', alg.selectionDecoration)
168 if self.enableCleaning:
169 alg = config.createAlgorithm(
'CP::AsgSelectionAlg',
'PhotonCleaningAlg' + postfix)
170 config.addPrivateTool(
'selectionTool',
'CP::AsgFlagSelectionTool' )
171 alg.selectionDecoration =
'isClean,as_bits'
172 alg.selectionTool.selectionFlags = [
'DFCommonPhotonsCleaning' + cleaningWP]
173 alg.particles = config.readName (self.containerName)
174 alg.preselection = config.getPreselection (self.containerName,
'')
175 config.addSelection (self.containerName,
'', alg.selectionDecoration)
180 alg = config.createAlgorithm(
'CP::PhotonOriginCorrectionAlg',
181 'PhotonOriginCorrectionAlg' + postfix )
182 alg.photons = config.readName (self.containerName)
183 alg.photonsOut = config.copyName (self.containerName)
184 alg.preselection = config.getPreselection (self.containerName,
'')
186 if not self.splitCalibrationAndSmearing :
188 alg = self.makeCalibrationAndSmearingAlg (config,
'PhotonCalibrationAndSmearingAlg')
189 if config.isPhyslite()
and not self.recalibratePhyslite :
190 alg.skipNominal =
True
209 alg = self.makeCalibrationAndSmearingAlg (config,
'PhotonBaseCalibrationAlg')
211 alg.noToolSystematics =
True
213 alg.calibrationAndSmearingTool.doSmearing =
False
216 alg = self.makeCalibrationAndSmearingAlg (config,
'PhotonCalibrationSystematicsAlg')
218 alg.calibrationAndSmearingTool.doScaleCorrection =
False
219 alg.calibrationAndSmearingTool.useMVACalibration =
False
223 alg = config.createAlgorithm(
'CP::AsgSelectionAlg',
'PhotonPtCutAlg' + postfix )
224 alg.selectionDecoration =
'selectPt' + postfix +
',as_bits'
225 config.addPrivateTool(
'selectionTool',
'CP::AsgPtEtaSelectionTool' )
226 alg.selectionTool.minPt = self.minPt
227 alg.particles = config.readName (self.containerName)
228 alg.preselection = config.getPreselection (self.containerName,
'')
229 config.addSelection (self.containerName,
'', alg.selectionDecoration,
233 alg = config.createAlgorithm(
'CP::EgammaIsolationCorrectionAlg',
234 'PhotonIsolationCorrectionAlg' + postfix )
235 config.addPrivateTool(
'isolationCorrectionTool',
236 'CP::IsolationCorrectionTool' )
237 alg.isolationCorrectionTool.IsMC = config.dataType()
is not DataType.Data
238 alg.isolationCorrectionTool.AFII_corr = (
239 0
if self.forceFullSimConfig
240 else config.dataType()
is DataType.FastSim)
241 alg.egammas = config.readName (self.containerName)
242 alg.egammasOut = config.copyName (self.containerName)
243 alg.preselection = config.getPreselection (self.containerName,
'')
246 alg = config.createAlgorithm(
'CP::AsgEnergyDecoratorAlg',
'EnergyDecorator' + self.containerName + self.postfix )
247 alg.particles = config.readName (self.containerName)
249 config.addOutputVar (self.containerName,
'pt',
'pt')
250 config.addOutputVar (self.containerName,
'eta',
'eta', noSys=
True)
251 config.addOutputVar (self.containerName,
'phi',
'phi', noSys=
True)
252 config.addOutputVar (self.containerName,
'e_%SYS%',
'e')
255 if self.decorateTruth
and config.dataType()
is not DataType.Data:
256 config.addOutputVar (self.containerName,
"truthType",
"truth_type", noSys=
True)
257 config.addOutputVar (self.containerName,
"truthOrigin",
"truth_origin", noSys=
True)