286 def makeAlgs (self, config) :
287 log = logging.getLogger('InDetTrackWorkingPointConfig')
288
289 selectionPostfix = self.selectionName
290 if selectionPostfix != '' and selectionPostfix[0] != '_' :
291 selectionPostfix = '_' + selectionPostfix
292
293 postfix = self.postfix
294 if postfix is None :
295 postfix = self.selectionName
296 if postfix != '' and postfix[0] != '_' :
297 postfix = '_' + postfix
298
299 cutLevels = ["NoCut", "Loose", "LoosePrimary", "TightPrimary", "LooseMuon",
300 "LooseElectron", "LooseTau", "MinBias", "HILoose", "HITight",
301 "HILooseOptimized", "HITightOptimized"]
302 alg = config.createAlgorithm( 'CP::InDetTrackSelectionAlg', 'InDetTrackSelectionAlg' )
303 alg.selectionDecoration = 'selectTrack' + postfix + '_%SYS%,as_bits'
304 config.addPrivateTool( 'selectionTool', 'InDet::InDetTrackSelectionTool')
305 if self.cutLevel is None:
306 log.warning("No selection WP chosen, not setting up InDetTrackSelectionTool.")
307 elif self.cutLevel not in cutLevels:
308 raise ValueError ('Invalid cut level: \"' + self.cutLevel + '\", has '
309 'to be one of: ' + ', '.join(cutLevels))
310 elif self.cutLevel in ["Loose", "TightPrimary"]:
311 alg.selectionTool.CutLevel = self.cutLevel
312 else:
313 log.warning('Using cut level: \"' + self.cutLevel + '\" that is not '
314 'meant for general use, but only expert studies.')
315 alg.selectionTool.CutLevel = self.cutLevel
316 if self.additionalCuts:
317 for cutName, value in self.additionalCuts.items():
318 setattr(alg.selectionTool, cutName, value)
319
320 if config.dataType() is not DataType.Data:
321 if not self.runTruthFilter:
322 log.warning('Disabling the TruthFilterTool.')
323 else:
324 config.addPrivateTool( 'filterTool', 'InDet::InDetTrackTruthFilterTool' )
325 config.addPrivateTool( 'filterTool.trackOriginTool', 'InDet::InDetTrackTruthOriginTool' )
326
327 if self.cutLevel == "Loose":
328 alg.filterWP = "LOOSE"
329 elif self.cutLevel == "TightPrimary":
330 alg.filterWP = "TIGHT"
331 else:
332 raise ValueError ('Attempting to set TruthFilter WP based on cut level: \"'
333 + self.efficiencyWP + '\" that is not supported.')
334
335 if config.geometry() is LHCPeriod.Run2:
336
337 alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
338 alg.filterTool.fFakeLoose = 0.10
339 alg.filterTool.fFakeTight = 1.00
340 elif config.geometry() is LHCPeriod.Run3:
341 if config.campaign() in [Campaign.MC23a, Campaign.MC23d, Campaign.MC23e]:
342
343 alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
344 alg.filterTool.fFakeLoose = 0.40
345 alg.filterTool.fFakeTight = 1.00
346 elif not (self.calibFile and self.fFakeLoose and self.fFakeTight):
347 raise ValueError ('No efficiency recommendations found for campaign \"'
348 + config.campaign().value + '\" in Run 3. '
349 'Please check that the recommendations exist.')
350 elif not (self.calibFile and self.fFakeLoose and self.fFakeTight):
351 raise ValueError ('No efficiency recommendations found for geometry \"'
352 + config.geometry().value + '\". Please check '
353 'the configuration.')
354
355 if self.calibFile:
356 alg.filterTool.calibFileNomEff = self.calibFile
357 if self.fFakeLoose:
358 alg.filterTool.fFakeLoose = self.fFakeLoose
359 if self.fFakeTight:
360 alg.filterTool.fFakeTight = self.fFakeTight
361 if self.filterToolSeed:
362 alg.filterTool.Seed = self.filterToolSeed
363 if self.trkEffSystScale:
364 alg.filterTool.trkEffSystScale = self.trkEffSystScale
365 alg.inDetTracks = config.readName (self.containerName)
366 alg.preselection = config.getPreselection (self.containerName, '')
367 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
368 preselection=self.addSelectionToPreselection)