357 def makeAlgs (self, config) :
358 log = logging.getLogger('InDetTrackWorkingPointConfig')
359
360 selectionPostfix = self.selectionName
361 if selectionPostfix != '' and selectionPostfix[0] != '_' :
362 selectionPostfix = '_' + selectionPostfix
363
364 postfix = self.postfix
365 if postfix is None :
366 postfix = self.selectionName
367 if postfix != '' and postfix[0] != '_' :
368 postfix = '_' + postfix
369
370 cutLevels = ["NoCut", "Loose", "LoosePrimary", "TightPrimary", "LooseMuon",
371 "LooseElectron", "LooseTau", "MinBias", "HILoose", "HITight",
372 "HILooseOptimized", "HITightOptimized"]
373 alg = config.createAlgorithm( 'CP::InDetTrackSelectionAlg', 'InDetTrackSelectionAlg' )
374 alg.selectionDecoration = 'selectTrack' + postfix + '_%SYS%,as_bits'
375 config.addPrivateTool( 'selectionTool', 'InDet::InDetTrackSelectionTool')
376 if self.cutLevel is None:
377 log.warning("No selection WP chosen, not setting up InDetTrackSelectionTool.")
378 elif self.cutLevel not in cutLevels:
379 raise ValueError ('Invalid cut level: \"' + self.cutLevel + '\", has '
380 'to be one of: ' + ', '.join(cutLevels))
381 elif self.cutLevel in ["Loose", "TightPrimary"]:
382 alg.selectionTool.CutLevel = self.cutLevel
383 else:
384 log.warning('Using cut level: \"' + self.cutLevel + '\" that is not '
385 'meant for general use, but only expert studies.')
386 alg.selectionTool.CutLevel = self.cutLevel
387 if self.additionalCuts:
388 for cutName, value in self.additionalCuts.items():
389 setattr(alg.selectionTool, cutName, value)
390
391 if config.dataType() is not DataType.Data:
392 if not self.runTruthFilter:
393 log.warning('Disabling the TruthFilterTool.')
394 else:
395 config.addPrivateTool( 'filterTool', 'InDet::InDetTrackTruthFilterTool' )
396 config.addPrivateTool( 'filterTool.trackOriginTool', 'InDet::InDetTrackTruthOriginTool' )
397
398 if self.cutLevel == "Loose":
399 alg.filterWP = "LOOSE"
400 elif self.cutLevel == "TightPrimary":
401 alg.filterWP = "TIGHT"
402 else:
403 raise ValueError ('Attempting to set TruthFilter WP based on cut level: \"'
404 + self.efficiencyWP + '\" that is not supported.')
405
406 if config.geometry() is LHCPeriod.Run2:
407
408 alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
409 alg.filterTool.fFakeLoose = 0.10
410 alg.filterTool.fFakeTight = 1.00
411 elif config.geometry() is LHCPeriod.Run3:
412 if config.campaign() in [Campaign.MC23a, Campaign.MC23d, Campaign.MC23e]:
413
414 alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
415 alg.filterTool.fFakeLoose = 0.40
416 alg.filterTool.fFakeTight = 1.00
417 elif not (self.calibFile and self.fFakeLoose and self.fFakeTight):
418 raise ValueError ('No efficiency recommendations found for campaign \"'
419 + config.campaign().value + '\" in Run 3. '
420 'Please check that the recommendations exist.')
421 elif not (self.calibFile and self.fFakeLoose and self.fFakeTight):
422 raise ValueError ('No efficiency recommendations found for geometry \"'
423 + config.geometry().value + '\". Please check '
424 'the configuration.')
425
426 if self.calibFile:
427 alg.filterTool.calibFileNomEff = self.calibFile
428 if self.fFakeLoose:
429 alg.filterTool.fFakeLoose = self.fFakeLoose
430 if self.fFakeTight:
431 alg.filterTool.fFakeTight = self.fFakeTight
432 if self.filterToolSeed:
433 alg.filterTool.Seed = self.filterToolSeed
434 if self.trkEffSystScale:
435 alg.filterTool.trkEffSystScale = self.trkEffSystScale
436 alg.inDetTracks = config.readName (self.containerName)
437 alg.preselection = config.getPreselection (self.containerName, '')
438 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
439 preselection=self.addSelectionToPreselection)