245 def makeAlgs (self, config) :
246 log = logging.getLogger(
'InDetTrackWorkingPointConfig')
248 selectionPostfix = self.selectionName
249 if selectionPostfix !=
'' and selectionPostfix[0] !=
'_' :
250 selectionPostfix =
'_' + selectionPostfix
252 postfix = self.postfix
254 postfix = self.selectionName
255 if postfix !=
'' and postfix[0] !=
'_' :
256 postfix =
'_' + postfix
258 cutLevels = [
"NoCut",
"Loose",
"LoosePrimary",
"TightPrimary",
"LooseMuon",
259 "LooseElectron",
"LooseTau",
"MinBias",
"HILoose",
"HITight",
260 "HILooseOptimized",
"HITightOptimized"]
261 alg = config.createAlgorithm(
'CP::InDetTrackSelectionAlg',
'InDetTrackSelectionAlg' )
262 alg.selectionDecoration =
'selectTrack' + postfix +
'_%SYS%,as_bits'
263 config.addPrivateTool(
'selectionTool',
'InDet::InDetTrackSelectionTool')
264 if self.cutLevel
is None:
265 log.warning(
"No selection WP chosen, not setting up InDetTrackSelectionTool.")
266 elif self.cutLevel
not in cutLevels:
267 raise ValueError (
'Invalid cut level: \"' + self.cutLevel +
'\", has '
268 'to be one of: ' +
', '.
join(cutLevels))
269 elif self.cutLevel
in [
"Loose",
"TightPrimary"]:
270 alg.selectionTool.CutLevel = self.cutLevel
272 log.warning(
'Using cut level: \"' + self.cutLevel +
'\" that is not '
273 'meant for general use, but only expert studies.')
274 alg.selectionTool.CutLevel = self.cutLevel
275 if self.additionalCuts:
276 for cutName, value
in self.additionalCuts.
items():
277 setattr(alg.selectionTool, cutName, value)
279 if config.dataType()
is not DataType.Data:
280 if not self.runTruthFilter:
281 log.warning(
'Disabling the TruthFilterTool.')
283 config.addPrivateTool(
'filterTool',
'InDet::InDetTrackTruthFilterTool' )
284 config.addPrivateTool(
'filterTool.trackOriginTool',
'InDet::InDetTrackTruthOriginTool' )
286 if self.cutLevel ==
"Loose":
287 alg.filterWP =
"LOOSE"
288 elif self.cutLevel ==
"TightPrimary":
289 alg.filterWP =
"TIGHT"
291 raise ValueError (
'Attempting to set TruthFilter WP based on cut level: \"'
292 + self.efficiencyWP +
'\" that is not supported.')
294 if config.geometry()
is LHCPeriod.Run2:
296 alg.filterTool.calibFileNomEff =
"InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
297 alg.filterTool.fFakeLoose = 0.10
298 alg.filterTool.fFakeTight = 1.00
299 elif config.geometry()
is LHCPeriod.Run3:
300 if config.campaign()
is Campaign.MC23a:
302 alg.filterTool.calibFileNomEff =
"InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
303 alg.filterTool.fFakeLoose = 0.40
304 alg.filterTool.fFakeTight = 1.00
305 elif config.campaign()
is Campaign.MC23d:
307 alg.filterTool.calibFileNomEff =
"InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
308 alg.filterTool.fFakeLoose = 0.40
309 alg.filterTool.fFakeTight = 1.00
310 elif not (self.calibFile
and self.fFakeLoose
and self.fFakeTight):
311 raise ValueError (
'No efficiency recommendations found for capaign \"'
312 + config.campaign().value +
'\" in Run 3. '
313 'Please check that the recommendations exist.')
314 elif not (self.calibFile
and self.fFakeLoose
and self.fFakeTight):
315 raise ValueError (
'No efficiency recommendations found for geometry \"'
316 + config.geometry().value +
'\". Please check '
317 'the configuration.')
320 alg.filterTool.calibFileNomEff = self.calibFile
322 alg.filterTool.fFakeLoose = self.fFakeLoose
324 alg.filterTool.fFakeTight = self.fFakeTight
325 if self.filterToolSeed:
326 alg.filterTool.Seed = self.filterToolSeed
327 if self.trkEffSystScale:
328 alg.filterTool.trkEffSystScale = self.trkEffSystScale
329 alg.inDetTracks = config.readName (self.containerName)
330 alg.preselection = config.getPreselection (self.containerName,
'')
331 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
332 preselection=self.addSelectionToPreselection)