4 from AnalysisAlgorithmsConfig.ConfigBlock
import ConfigBlock
5 from AnalysisAlgorithmsConfig.ConfigAccumulator
import DataType
9 """the ConfigBlock for the tau four-momentum correction"""
12 super (DiTauCalibrationConfig, self).__init__ ()
21 if postfix !=
'' and postfix[0] !=
'_' :
22 postfix =
'_' + postfix
25 alg = config.createAlgorithm(
'CP::DiTauSmearingAlg',
'DiTauSmearingAlg' + postfix )
26 config.addPrivateTool(
'smearingTool',
'TauAnalysisTools::DiTauSmearingTool' )
29 alg.preselection = config.getPreselection (self.
containerName,
'')
33 alg = config.createAlgorithm(
'CP::DiTauTruthMatchingAlg',
34 'DiTauTruthMatchingAlg' + postfix )
35 config.addPrivateTool(
'matchingTool',
36 'TauAnalysisTools::DiTauTruthMatchingTool' )
38 alg.preselection = config.getPreselection (self.
containerName,
'')
45 """the ConfigBlock for the tau working point
47 This may at some point be split into multiple blocks (16 Mar 22)."""
49 def __init__ (self, containerName, postfix, quality) :
50 super (DiTauWorkingPointConfig, self).__init__ ()
61 if postfix !=
'' and postfix[0] !=
'_' :
62 postfix =
'_' + postfix
73 raise ValueError (
"invalid tau quality: \"" + self.
quality +
74 "\", allowed values are Tight, Medium, Loose")
79 if config.dataType()
is not DataType.Data:
80 alg = config.createAlgorithm(
'CP::DiTauEfficiencyCorrectionsAlg',
81 'DiTauEfficiencyCorrectionsAlg' + postfix )
82 config.addPrivateTool(
'efficiencyCorrectionsTool',
83 'TauAnalysisTools::DiTauEfficiencyCorrectionsTool' )
84 alg.efficiencyCorrectionsTool.IDLevel = IDLevel
85 alg.scaleFactorDecoration =
'tau_effSF' + postfix
96 rerunTruthMatching = True):
97 """Create tau calibration analysis algorithms
99 This makes all the algorithms that need to be run first befor
100 all working point specific algorithms and that can be shared
101 between the working points.
104 postfix -- a postfix to apply to decorations and algorithm
105 names. this is mostly used/needed when using this
106 sequence with multiple working points to ensure all
108 rerunTruthMatching -- Whether or not to rerun truth matching
111 config = DiTauCalibrationConfig (containerName, postfix)
112 config.rerunTruthMatching = rerunTruthMatching
120 legacyRecommendations = False):
121 """Create tau analysis algorithms for a single working point
124 legacyRecommendations -- use legacy tau BDT and electron veto recommendations
125 postfix -- a postfix to apply to decorations and algorithm
126 names. this is mostly used/needed when using this
127 sequence with multiple working points to ensure all
131 splitWP = workingPoint.split (
'.')
132 if len (splitWP) != 1 :
133 raise ValueError (
'working point should be of format "quality", not ' + workingPoint)
135 config = DiTauWorkingPointConfig (containerName, postfix, splitWP[0])
136 config.legacyRecommendations = legacyRecommendations