ATLAS Offline Software
Loading...
Searching...
No Matches
python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig Class Reference
Inheritance diagram for python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig:
Collaboration diagram for python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig:

Public Member Functions

 __init__ (self)
 instanceName (self)
 makeAlgs (self, config)

Public Attributes

str qualityWP = 'Tight' :
 recomputeIsEM
 doFSRSelection
 containerName
 selectionName
 closeByCorrection

Detailed Description

the ConfigBlock for the photon working point selection

Definition at line 319 of file PhotonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 322 of file PhotonAnalysisConfig.py.

322 def __init__ (self) :
323 super (PhotonWorkingPointSelectionConfig, self).__init__ ()
324 self.setBlockName('PhotonWorkingPointSelection')
325 self.addOption ('containerName', '', type=str,
326 noneAction='error',
327 info="the name of the input container.")
328 self.addOption ('selectionName', '', type=str,
329 noneAction='error',
330 info="the name of the photon selection to define (e.g. `tight` or "
331 "`loose`).")
332 self.addOption ('postfix', None, type=str,
333 info="a postfix to apply to decorations and algorithm names. "
334 "Typically not needed here as `selectionName` is used internally.")
335 self.addOption ('qualityWP', None, type=str,
336 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, `Loose`.")
337 self.addOption ('isolationWP', None, type=str,
338 info="the isolation WP to use. Supported isolation WPs: "
339 "`FixedCutLoose`, `FixedCutTight`, `TightCaloOnly`, `NonIso`.")
340 self.addOption ('addSelectionToPreselection', True, type=bool,
341 info="whether to retain only photons satisfying the working point "
342 "requirements.")
343 self.addOption ('closeByCorrection', False, type=bool,
344 info="whether to use close-by-corrected isolation working points.")
345 self.addOption ('recomputeIsEM', False, type=bool,
346 info="whether to rerun the cut-based selection (`True`), or rely on derivation flags (`False`).")
347 self.addOption ('doFSRSelection', False, type=bool,
348 info="whether to accept additional photons close to muons for the "
349 "purpose of FSR corrections to these muons. Expert feature "
350 "requested by the H4l analysis running on PHYSLITE.",
351 expertMode=True)
352 self.addOption ('muonsForFSRSelection', None, type=str,
353 info="the name of the muon container to use for the FSR selection. "
354 "If not specified, AnalysisMuons is used.",
355 expertMode=True)
356

Member Function Documentation

◆ instanceName()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.instanceName ( self)
Return the instance name for this block

Definition at line 357 of file PhotonAnalysisConfig.py.

357 def instanceName (self) :
358 """Return the instance name for this block"""
359 if self.postfix is not None :
360 return self.containerName + '_' + self.selectionName + self.postfix
361 return self.containerName + '_' + self.selectionName
362

◆ makeAlgs()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.makeAlgs ( self,
config )

Definition at line 363 of file PhotonAnalysisConfig.py.

363 def makeAlgs (self, config) :
364
365 # The setup below is inappropriate for Run 1
366 if config.geometry() is LHCPeriod.Run1:
367 raise ValueError ("Can't set up the PhotonWorkingPointConfig with %s, there must be something wrong!" % config.geometry().value)
368
369 postfix = self.postfix
370 if postfix is None :
371 postfix = self.selectionName
372 if postfix != '' and postfix[0] != '_' :
373 postfix = '_' + postfix
374
375 if self.qualityWP == 'Tight' :
376 quality = ROOT.egammaPID.PhotonTight
377 elif self.qualityWP == 'Medium' :
378 quality = ROOT.egammaPID.PhotonMedium
379 elif self.qualityWP == 'Loose' :
380 quality = ROOT.egammaPID.PhotonLoose
381 else :
382 raise Exception ('unknown photon quality working point "' + self.qualityWP + '" should be Tight, Medium or Loose')
383
384 # Set up the photon selection algorithm:
385 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'PhotonIsEMSelectorAlg' )
386 alg.selectionDecoration = 'selectEM' + postfix + ',as_char'
387 if self.recomputeIsEM:
388 # Rerun the cut-based ID
389 config.addPrivateTool( 'selectionTool', 'AsgPhotonIsEMSelector' )
390 alg.selectionTool.isEMMask = quality
391 if config.geometry() is LHCPeriod.Run2:
392 if self.qualityWP == 'Tight':
393 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMTightSelectorCutDefs_pTdep_mc20_smooth.conf'
394 elif self.qualityWP == 'Loose':
395 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
396 elif self.qualityWP == 'Medium':
397 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc20_20240510/PhotonIsEMMediumSelectorCutDefs_pTdep_smooth.conf'
398 if config.geometry() is LHCPeriod.Run3:
399 if self.qualityWP == 'Tight':
400 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/20180825/PhotonIsEMTightSelectorCutDefs.conf'
401 elif self.qualityWP == 'Loose':
402 alg.selectionTool.ConfigFile = 'ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf'
403 elif self.qualityWP == 'Medium':
404 raise ValueError('No Medium menu available for Run-3. Please get in contact with egamma')
405 else:
406 # Select from Derivation Framework flags
407 config.addPrivateTool( 'selectionTool', 'CP::AsgFlagSelectionTool' )
408 dfFlag = 'DFCommonPhotonsIsEM' + self.qualityWP
409 alg.selectionTool.selectionFlags = [ dfFlag ]
410 alg.particles = config.readName (self.containerName)
411 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
412
413 # Set up the FSR selection
414 if self.doFSRSelection :
415 # wpSelection needs the ',as_char' suffix so SysReadSelectionHandle knows the type
416 wpDecoration = alg.selectionDecoration
417 wpDecorationName = wpDecoration.split(',')[0]
418 # Insert FSR before the postfix (e.g., selectEM_loose -> selectEMFSR_loose)
419 underscorePos = wpDecorationName.index('_')
420 outputDecorationName = wpDecorationName[:underscorePos] + 'FSR' + wpDecorationName[underscorePos:]
421
422 alg = config.createAlgorithm( 'CP::EgammaFSRForMuonsCollectorAlg', 'EgammaFSRForMuonsCollectorAlg')
423 alg.wpSelection = wpDecoration # Input: read the WP selection (with type suffix)
424 alg.selectionDecoration = outputDecorationName # Output: combined WP||FSR (name only for SysWriteDecorHandle)
425 alg.ElectronOrPhotonContKey = config.readName (self.containerName)
426 if self.muonsForFSRSelection is not None:
427 alg.MuonContKey = config.readName (self.muonsForFSRSelection)
428
429 # Register the FSR COMBINED selection
430 config.addSelection (self.containerName, self.selectionName,
431 alg.selectionDecoration + ',as_char',
432 preselection=self.addSelectionToPreselection)
433 else:
434 # No FSR - register the WP selection directly
435 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
436 preselection=self.addSelectionToPreselection)
437
438 # Set up the isolation selection algorithm:
439 if self.isolationWP != 'NonIso' :
440 alg = config.createAlgorithm( 'CP::EgammaIsolationSelectionAlg',
441 'PhotonIsolationSelectionAlg' )
442 alg.selectionDecoration = 'isolated' + postfix + ',as_char'
443 config.addPrivateTool( 'selectionTool', 'CP::IsolationSelectionTool' )
444 alg.selectionTool.PhotonWP = self.isolationWP
445 if self.closeByCorrection:
446 alg.selectionTool.IsoDecSuffix = "CloseByCorr"
447 alg.isPhoton = True
448 alg.egammas = config.readName (self.containerName)
449 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
450 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
451 preselection=self.addSelectionToPreselection)
452
453

Member Data Documentation

◆ closeByCorrection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.closeByCorrection

Definition at line 445 of file PhotonAnalysisConfig.py.

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.containerName

Definition at line 430 of file PhotonAnalysisConfig.py.

◆ doFSRSelection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.doFSRSelection

Definition at line 414 of file PhotonAnalysisConfig.py.

◆ qualityWP

str python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.qualityWP = 'Tight' :

Definition at line 375 of file PhotonAnalysisConfig.py.

◆ recomputeIsEM

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.recomputeIsEM

Definition at line 387 of file PhotonAnalysisConfig.py.

◆ selectionName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.selectionName

Definition at line 430 of file PhotonAnalysisConfig.py.


The documentation for this class was generated from the following file: