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

Constructor & Destructor Documentation

◆ __init__()

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 314 of file PhotonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 349 of file PhotonAnalysisConfig.py.

349 def instanceName (self) :
350 """Return the instance name for this block"""
351 if self.postfix is not None :
352 return self.containerName + '_' + self.selectionName + self.postfix
353 return self.containerName + '_' + self.selectionName
354

◆ makeAlgs()

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

Definition at line 355 of file PhotonAnalysisConfig.py.

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

Member Data Documentation

◆ closeByCorrection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.closeByCorrection

Definition at line 437 of file PhotonAnalysisConfig.py.

◆ containerName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.containerName

Definition at line 422 of file PhotonAnalysisConfig.py.

◆ doFSRSelection

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.doFSRSelection

Definition at line 406 of file PhotonAnalysisConfig.py.

◆ qualityWP

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

Definition at line 367 of file PhotonAnalysisConfig.py.

◆ recomputeIsEM

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.recomputeIsEM

Definition at line 379 of file PhotonAnalysisConfig.py.

◆ selectionName

python.PhotonAnalysisConfig.PhotonWorkingPointSelectionConfig.selectionName

Definition at line 422 of file PhotonAnalysisConfig.py.


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