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

Public Member Functions

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

Public Attributes

 inputContainer
 containerName
 decorateExtraVariables

Detailed Description

the ConfigBlock for the tau four-momentum correction

Definition at line 13 of file TauAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

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="the name of the input tau-jet container. If left empty, automatically defaults "
21 "to `'AnalysisTauJets'` for PHYSLITE and `'TauJets'` otherwise.")
22 self.addOption ('containerName', '', type=str,
23 noneAction='error',
24 info="the name of the output container after calibration.")
25 self.addOption ('postfix', '', type=str,
26 info="a postfix to apply to decorations and algorithm names. "
27 "Typically not needed here since the calibration is common to "
28 "all tau-jets.")
29 self.addOption ('rerunTruthMatching', True, type=bool,
30 info="whether to rerun truth matching (sets up an instance of "
31 "`CP::TauTruthMatchingAlg`).")
32 self.addOption ('decorateTruth', False, type=bool,
33 info="decorate the truth particle information on the reconstructed one.")
34 self.addOption ('decorateExtraVariables', True, type=bool,
35 info="decorate extra variables for the reconstructed tau-jet.")
36

Member Function Documentation

◆ instanceName()

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

Definition at line 37 of file TauAnalysisConfig.py.

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

◆ makeAlgs()

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

Definition at line 41 of file TauAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.TauAnalysisConfig.TauCalibrationConfig.containerName

Definition at line 57 of file TauAnalysisConfig.py.

◆ decorateExtraVariables

python.TauAnalysisConfig.TauCalibrationConfig.decorateExtraVariables

Definition at line 92 of file TauAnalysisConfig.py.

◆ inputContainer

python.TauAnalysisConfig.TauCalibrationConfig.inputContainer

Definition at line 44 of file TauAnalysisConfig.py.


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