337 def makeAlgs (self, config) :
338
339
340 if config.geometry() is LHCPeriod.Run1:
341 raise ValueError ("Can't set up the PhotonWorkingPointConfig with %s, there must be something wrong!" % config.geometry().value)
342
343 postfix = self.postfix
344 if postfix is None :
345 postfix = self.selectionName
346 if postfix != '' and postfix[0] != '_' :
347 postfix = '_' + postfix
348
349 if self.qualityWP == 'Tight' :
350 quality = ROOT.egammaPID.PhotonTight
351 elif self.qualityWP == 'Medium' :
352 quality = ROOT.egammaPID.PhotonMedium
353 elif self.qualityWP == 'Loose' :
354 quality = ROOT.egammaPID.PhotonLoose
355 else :
356 raise Exception ('unknown photon quality working point "' + self.qualityWP + '" should be Tight, Medium or Loose')
357
358
359 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'PhotonIsEMSelectorAlg' )
360 alg.selectionDecoration = 'selectEM' + postfix + ',as_char'
361 if self.recomputeIsEM:
362
363 config.addPrivateTool( 'selectionTool', 'AsgPhotonIsEMSelector' )
364 alg.selectionTool.isEMMask = quality
365 if config.geometry() is LHCPeriod.Run2:
366 if self.qualityWP == 'Tight':
367 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMTightSelectorCutDefs_pTdep_mc20_smooth.conf'
368 elif self.qualityWP == 'Loose':
369 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
370 elif self.qualityWP == 'Medium':
371 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMMediumSelectorCutDefs_pTdep_smooth.conf'
372 if config.geometry() is LHCPeriod.Run3:
373 if self.qualityWP == 'Tight':
374 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/20180825/PhotonIsEMTightSelectorCutDefs.conf'
375 elif self.qualityWP == 'Loose':
376 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
377 elif self.qualityWP == 'Medium':
378 raise ValueError('No Medium menu available for Run-3. Please get in contact with egamma')
379 else:
380
381 config.addPrivateTool( 'selectionTool', 'CP::AsgFlagSelectionTool' )
382 dfFlag = 'DFCommonPhotonsIsEM' + self.qualityWP
383 alg.selectionTool.selectionFlags = [ dfFlag ]
384 alg.particles = config.readName (self.containerName)
385 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
386 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
387 preselection=self.addSelectionToPreselection)
388
389
390 if self.doFSRSelection :
391
392 wpFlag = alg.selectionDecoration.split(",")[0]
393 alg = config.createAlgorithm( 'CP::EgammaFSRForMuonsCollectorAlg', 'EgammaFSRForMuonsCollectorAlg')
394 alg.selectionDecoration = wpFlag
395 alg.ElectronOrPhotonContKey = config.readName (self.containerName)
396
397
398 if self.isolationWP != 'NonIso' :
399 alg = config.createAlgorithm( 'CP::EgammaIsolationSelectionAlg',
400 'PhotonIsolationSelectionAlg' )
401 alg.selectionDecoration = 'isolated' + postfix + ',as_char'
402 config.addPrivateTool( 'selectionTool', 'CP::IsolationSelectionTool' )
403 alg.selectionTool.PhotonWP = self.isolationWP
404 if self.closeByCorrection:
405 alg.selectionTool.IsoDecSuffix = "CloseByCorr"
406 alg.isPhoton = True
407 alg.egammas = config.readName (self.containerName)
408 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
409 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
410 preselection=self.addSelectionToPreselection)
411
412