131 def makeAlgs (self, config) :
133 selectionPostfix = self.selectionName
134 if selectionPostfix !=
'' and selectionPostfix[0] !=
'_' :
135 selectionPostfix =
'_' + selectionPostfix
137 postfix = self.postfix
139 postfix = self.selectionName
140 if postfix !=
'' and postfix[0] !=
'_' :
141 postfix =
'_' + postfix
144 nameFormat =
'TauAnalysisAlgorithms/tau_selection_gntau_{}_eleid.conf'
145 if not self.use_eVeto:
146 nameFormat =
'TauAnalysisAlgorithms/tau_selection_gntau_{}_noeleid.conf'
148 nameFormat =
'TauAnalysisAlgorithms/tau_selection_{}_eleid.conf'
149 if not self.use_eVeto:
150 nameFormat =
'TauAnalysisAlgorithms/tau_selection_{}_noeleid.conf'
152 if self.quality
not in [
'Tight',
'Medium',
'Loose',
'VeryLoose',
'Baseline'] :
153 raise ValueError (
"invalid tau quality: \"" + self.quality +
154 "\", allowed values are Tight, Medium, Loose, " +
155 "VeryLoose, Baseline")
156 inputfile = nameFormat.format(self.quality.lower())
159 alg = config.createAlgorithm(
'CP::AsgSelectionAlg',
'TauSelectionAlg' + postfix )
160 config.addPrivateTool(
'selectionTool',
'TauAnalysisTools::TauSelectionTool' )
161 alg.selectionTool.ConfigPath = inputfile
162 alg.selectionDecoration =
'selected_tau' + selectionPostfix +
',as_bits'
163 alg.particles = config.readName (self.containerName)
164 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
165 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration)
169 if config.dataType()
is not DataType.Data
and not self.noEffSF
and not self.useGNTau:
175 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
176 'TauEfficiencyCorrectionsAlgReco' + postfix )
177 config.addPrivateTool(
'efficiencyCorrectionsTool',
178 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
179 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [0]
180 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
181 alg.scaleFactorDecoration =
'tau_Reco_effSF' + selectionPostfix +
'_%SYS%'
182 alg.outOfValidity = 2
183 alg.outOfValidityDeco =
'bad_Reco_eff' + selectionPostfix
184 alg.taus = config.readName (self.containerName)
185 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
186 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
'Reco_effSF' + postfix)
189 if self.quality
not in (
'VeryLoose',
'Baseline'):
191 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
192 'TauEfficiencyCorrectionsAlgID' + postfix )
193 config.addPrivateTool(
'efficiencyCorrectionsTool',
194 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
195 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [4]
196 if self.quality==
"Loose":
198 elif self.quality==
"Medium":
200 elif self.quality==
"Tight":
203 raise ValueError (
"invalid tauID: \"" + self.quality +
"\". Allowed values are loose, medium, tight")
205 alg.efficiencyCorrectionsTool.JetIDLevel = JetIDLevel
206 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
207 alg.scaleFactorDecoration =
'tau_ID_effSF' + selectionPostfix +
'_%SYS%'
208 alg.outOfValidity = 2
209 alg.outOfValidityDeco =
'bad_ID_eff' + selectionPostfix
210 alg.taus = config.readName (self.containerName)
211 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
212 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
'ID_effSF' + postfix)
218 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
219 'TauEfficiencyCorrectionsAlgEvetoFakeTau' + postfix )
220 config.addPrivateTool(
'efficiencyCorrectionsTool',
221 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
223 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [10]
225 alg.efficiencyCorrectionsTool.EleIDLevel = 2
226 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
227 alg.scaleFactorDecoration =
'tau_EvetoFakeTau_effSF' + selectionPostfix +
'_%SYS%'
228 alg.outOfValidity = 2
229 alg.outOfValidityDeco =
'bad_EvetoFakeTau_eff' + selectionPostfix
230 alg.taus = config.readName (self.containerName)
231 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
232 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
'EvetoFakeTau_effSF' + postfix)
235 alg = config.createAlgorithm(
'CP::TauEfficiencyCorrectionsAlg',
236 'TauEfficiencyCorrectionsAlgEvetoTrueTau' + postfix )
237 config.addPrivateTool(
'efficiencyCorrectionsTool',
238 'TauAnalysisTools::TauEfficiencyCorrectionsTool' )
240 alg.efficiencyCorrectionsTool.EfficiencyCorrectionTypes = [8]
241 alg.efficiencyCorrectionsTool.useFastSim = config.dataType()
is DataType.FastSim
242 alg.scaleFactorDecoration =
'tau_EvetoTrueTau_effSF' + selectionPostfix +
'_%SYS%'
243 alg.outOfValidity = 2
244 alg.outOfValidityDeco =
'bad_EvetoTrueTau_eff' + selectionPostfix
245 alg.taus = config.readName (self.containerName)
246 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
247 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
'EvetoTrueTau_effSF' + postfix)