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