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 321 of file PhotonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 324 of file PhotonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 364 of file PhotonAnalysisConfig.py.

364 def instanceName (self) :
365 """Return the instance name for this block"""
366 if self.postfix is not None :
367 return self.containerName + '_' + self.selectionName + self.postfix
368 return self.containerName + '_' + self.selectionName
369

◆ makeAlgs()

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

Definition at line 370 of file PhotonAnalysisConfig.py.

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

Member Data Documentation

◆ closeByCorrection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.closeByCorrection

Definition at line 452 of file PhotonAnalysisConfig.py.

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.containerName

Definition at line 437 of file PhotonAnalysisConfig.py.

◆ doFSRSelection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.doFSRSelection

Definition at line 421 of file PhotonAnalysisConfig.py.

◆ qualityWP

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

Definition at line 382 of file PhotonAnalysisConfig.py.

◆ recomputeIsEM

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.recomputeIsEM

Definition at line 394 of file PhotonAnalysisConfig.py.

◆ selectionName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.selectionName

Definition at line 437 of file PhotonAnalysisConfig.py.


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