ATLAS Offline Software
Public Member Functions | List of all members
python.TauAnalysisConfig.TauCalibrationConfig Class Reference
Inheritance diagram for python.TauAnalysisConfig.TauCalibrationConfig:
Collaboration diagram for python.TauAnalysisConfig.TauCalibrationConfig:

Public Member Functions

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

Detailed Description

the ConfigBlock for the tau four-momentum correction

Definition at line 11 of file TauAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TauAnalysisConfig.TauCalibrationConfig.__init__ (   self)

Definition at line 14 of file TauAnalysisConfig.py.

14  def __init__ (self) :
15  super (TauCalibrationConfig, self).__init__ ()
16  self.setBlockName('Taus')
17  self.addOption ('inputContainer', '', type=str,
18  info="select tau input container, by default set to TauJets")
19  self.addOption ('containerName', '', type=str,
20  noneAction='error',
21  info="the name of the output container after calibration.")
22  self.addOption ('postfix', '', type=str,
23  info="a postfix to apply to decorations and algorithm names. "
24  "Typically not needed here since the calibration is common to "
25  "all taus.")
26  self.addOption ('rerunTruthMatching', True, type=bool,
27  info="whether to rerun truth matching (sets up an instance of "
28  "CP::TauTruthMatchingAlg). The default is True.")
29  self.addOption ('decorateTruth', False, type=bool,
30  info="decorate truth particle information on the reconstructed one")
31  self.addOption ('decorateExtraVariables', True, type=bool,
32  info="decorate extra variables for the reconstructed tau")
33 

Member Function Documentation

◆ instanceName()

def python.TauAnalysisConfig.TauCalibrationConfig.instanceName (   self)
Return the instance name for this block

Definition at line 34 of file TauAnalysisConfig.py.

34  def instanceName (self) :
35  """Return the instance name for this block"""
36  return self.containerName + self.postfix
37 

◆ makeAlgs()

def python.TauAnalysisConfig.TauCalibrationConfig.makeAlgs (   self,
  config 
)

Definition at line 38 of file TauAnalysisConfig.py.

38  def makeAlgs (self, config) :
39 
40  # protection for EleRM taus, which are available only from 2024 onward
41  if 'EleRM' in self.inputContainer:
42  if config.dataType() is DataType.Data and config.dataYear() <= 2023:
43  raise RuntimeError("EleRM taus are only available from 2024 dataset onward")
44  elif config.dataType() is not DataType.Data and config.campaign() <= Campaign.MC23d:
45  raise RuntimeError("EleRM taus are only available from 2024 dataset onward")
46 
47  postfix = self.postfix
48  if postfix != '' and postfix[0] != '_' :
49  postfix = '_' + postfix
50 
51  inputContainer = "AnalysisTauJets" if config.isPhyslite() else "TauJets"
52  if self.inputContainer:
53  inputContainer = self.inputContainer
54  config.setSourceName (self.containerName, inputContainer)
55 
56  # Set up the tau truth matching algorithm:
57  if self.rerunTruthMatching and config.dataType() is not DataType.Data:
58  alg = config.createAlgorithm( 'CP::TauTruthMatchingAlg',
59  'TauTruthMatchingAlg' )
60  config.addPrivateTool( 'matchingTool',
61  'TauAnalysisTools::TauTruthMatchingTool' )
62  alg.matchingTool.TruthJetContainerName = 'AntiKt4TruthDressedWZJets'
63  alg.taus = config.readName (self.containerName)
64  alg.preselection = config.getPreselection (self.containerName, '')
65 
66  # decorate truth tau information on the reconstructed object:
67  if self.decorateTruth and config.dataType() is not DataType.Data:
68  alg = config.createAlgorithm( 'CP::TauTruthDecorationsAlg',
69  'TauTruthDecorationsAlg',
70  reentrant=True )
71  alg.taus = config.readName (self.containerName)
72  alg.doubleDecorations = ['pt_vis', 'pt_invis', 'eta_vis', 'eta_invis', 'phi_vis', 'phi_invis', 'm_vis', 'm_invis']
73  alg.floatDecorations = []
74  alg.intDecorations = ['pdgId']
75  alg.unsignedIntDecorations = ['classifierParticleOrigin', 'classifierParticleType']
76  alg.charDecorations = ['IsHadronicTau']
77  alg.prefix = 'truth_'
78 
79  # these are "_ListHelper" objects, and not "list", need to copy to lists to allow concatenate
80  for var in ['DecayMode', 'ParticleType', 'PartonTruthLabelID'] + alg.doubleDecorations[:] + alg.floatDecorations[:] + alg.intDecorations[:] + alg.unsignedIntDecorations[:] + alg.charDecorations[:]:
81  branchName = alg.prefix + var
82  if 'classifierParticle' in var:
83  branchOutput = alg.prefix + var.replace('classifierParticle', '').lower()
84  else:
85  branchOutput = branchName
86  config.addOutputVar (self.containerName, branchName, branchOutput, noSys=True)
87 
88  # Decorate extra variables
89  if self.decorateExtraVariables:
90  alg = config.createAlgorithm( 'CP::TauExtraVariablesAlg',
91  'TauExtraVariablesAlg',
92  reentrant=True )
93  alg.taus = config.readName (self.containerName)
94 
95  # Set up the tau 4-momentum smearing algorithm:
96  alg = config.createAlgorithm( 'CP::TauSmearingAlg', 'TauSmearingAlg' )
97  config.addPrivateTool( 'smearingTool', 'TauAnalysisTools::TauSmearingTool' )
98  alg.smearingTool.useFastSim = config.dataType() is DataType.FastSim
99  alg.smearingTool.Campaign = "mc23" if config.geometry() is LHCPeriod.Run3 else "mc20"
100  alg.taus = config.readName (self.containerName)
101  alg.tausOut = config.copyName (self.containerName)
102  alg.preselection = config.getPreselection (self.containerName, '')
103 
104  # Additional decorations
105  alg = config.createAlgorithm( 'CP::AsgEnergyDecoratorAlg', 'EnergyDecorator' )
106  alg.particles = config.readName (self.containerName)
107 
108  config.addOutputVar (self.containerName, 'pt', 'pt')
109  config.addOutputVar (self.containerName, 'eta', 'eta', noSys=True)
110  config.addOutputVar (self.containerName, 'phi', 'phi', noSys=True)
111  config.addOutputVar (self.containerName, 'e_%SYS%', 'e')
112  config.addOutputVar (self.containerName, 'charge', 'charge', noSys=True)
113  config.addOutputVar (self.containerName, 'NNDecayMode', 'NNDecayMode', noSys=True)
114  config.addOutputVar (self.containerName, 'passTATTauMuonOLR', 'passTATTauMuonOLR', noSys=True)
115  config.addOutputVar (self.containerName, 'TESCompatibility', 'TESCompatibility')
116  if self.decorateExtraVariables:
117  config.addOutputVar (self.containerName, 'nTracksCharged', 'nTracksCharged', noSys=True)
118 
119 

The documentation for this class was generated from the following file:
python.processes.powheg.ZZj_MiNNLO.ZZj_MiNNLO.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZj_MiNNLO.py:18