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 13 of file TauAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.TauAnalysisConfig.TauCalibrationConfig.__init__ (   self)

Definition at line 16 of file TauAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 36 of file TauAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 40 of file TauAnalysisConfig.py.

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

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