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