ATLAS Offline Software
Loading...
Searching...
No Matches
TrackingAnalysisConfig.InDetTrackWorkingPointConfig Class Reference
Inheritance diagram for TrackingAnalysisConfig.InDetTrackWorkingPointConfig:
Collaboration diagram for TrackingAnalysisConfig.InDetTrackWorkingPointConfig:

Public Member Functions

 __init__ (self)
 instanceName (self)
 makeAlgs (self, config)

Public Attributes

 additionalCuts
 runTruthFilter
str cutLevel = "Loose":
 fFakeTight
 calibFile
 fFakeLoose
 filterToolSeed
 trkEffSystScale
 containerName
 selectionName

Detailed Description

the ConfigBlock for the track working point

Definition at line 289 of file TrackingAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.__init__ ( self)

Definition at line 292 of file TrackingAnalysisConfig.py.

292 def __init__ (self) :
293 super (InDetTrackWorkingPointConfig, self).__init__ ()
294 self.addOption ('containerName', '', type=str,
295 noneAction='error',
296 info="the name of the input container.")
297 self.addOption ('selectionName', '', type=str,
298 noneAction='error',
299 info="the name of the track selection to define (e.g. `tightPrimary` "
300 "or `loose`).")
301 self.addOption ('postfix', None, type=str,
302 info="a postfix to apply to decorations and algorithm names. "
303 "Typically not needed here as `selectionName` is used internally.")
304 self.addOption ('cutLevel', None, type=str,
305 noneAction='error',
306 info="the selection WP to use. Supported WPs for general "
307 "use: `Loose` and `TightPrimary`. For expert studies, further "
308 "WPs are available: `NoCut`, `LoosePrimary`, `LooseElectron`, "
309 "`LooseMuon`, `LooseTau`, `MinBias`, `HILoose`, `HITight`, "
310 "`HILooseOptimized`, `HITightOptimized`.",
311 expertMode=["NoCut", "LoosePrimary", "LooseElectron",
312 "LooseMuon", "LooseTau", "MinBias", "HILoose", "HITight",
313 "HILooseOptimized", "HITightOptimized"])
314 self.addOption ('additionalCuts', None, type=dict,
315 info="additional cuts to modify the selection WP. Only meant for "
316 "expert studies of track selection. Passed as pairs of `cutName: value`. "
317 "For an overview of available cuts, see twiki.cern.ch/twiki/bin/viewauth/"
318 "AtlasProtected/InDetTrackSelectionTool#List_of_possible_cuts.",
319 expertMode=True)
320 self.addOption ('runTruthFilter', True, type=bool,
321 info="whether to run the `TruthFilterTool`. This tool is only compatible "
322 "with the cut levels `Loose` and `TightPrimary`.")
323 self.addOption ('calibFile', None, type=str,
324 info="name of the calibration file to use for efficiencies "
325 "in the `TruthFilter` tool. Expert option to override the "
326 "recommendations based on the campaign.",
327 expertMode=True)
328 self.addOption ('filterToolSeed', None, type=int,
329 info="random seed to be used by the `InDetTrackTruthFilterTool`.",
330 expertMode=True)
331 self.addOption ('fFakeLoose', None, type=float,
332 info="the fraction of fake tracks in the `Loose` working point. "
333 "Will be used by the `InDetTrackTruthFilterTool`. Expert option to "
334 "override the recommendations.",
335 expertMode=True)
336 self.addOption ('fFakeTight', None, type=float,
337 info="the fraction of fake tracks in the `TightPrimary` working "
338 "point. Will be used by the `InDetTrackTruthFilterTool`. Expert option "
339 "to override the recommendations.",
340 expertMode=True)
341 self.addOption ('trkEffSystScale', None, type=float,
342 info="the track efficiency systematic scale. Will be used "
343 "by the `InDetTrackTruthFilterTool`. Expert option to override the "
344 "recommendations.",
345 expertMode=True)
346 self.addOption ('addSelectionToPreselection', True, type=bool,
347 info="whether to retain only tracks satisfying the `cutLevel` "
348 "requirements.")
349

Member Function Documentation

◆ instanceName()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.instanceName ( self)
Return the instance name for this block

Definition at line 350 of file TrackingAnalysisConfig.py.

350 def instanceName (self) :
351 """Return the instance name for this block"""
352 if self.postfix is not None:
353 return self.containerName + self.selectionName + self.postfix
354 else:
355 return self.containerName + self.selectionName
356

◆ makeAlgs()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.makeAlgs ( self,
config )

Definition at line 357 of file TrackingAnalysisConfig.py.

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 # Set up the truth filtering algorithm:
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 # Set working point based on cut level
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 # Set calibFile and fake rates based on campaign
406 if config.geometry() is LHCPeriod.Run2:
407 # Run 2 recommendations (MC20)
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 # 2022/23/24 recommendations (MC23a/d/e)
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 # Set custom calibFile, fake rates, or random seed
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)

Member Data Documentation

◆ additionalCuts

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.additionalCuts

Definition at line 387 of file TrackingAnalysisConfig.py.

◆ calibFile

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.calibFile

Definition at line 426 of file TrackingAnalysisConfig.py.

◆ containerName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.containerName

Definition at line 438 of file TrackingAnalysisConfig.py.

◆ cutLevel

str TrackingAnalysisConfig.InDetTrackWorkingPointConfig.cutLevel = "Loose":

Definition at line 398 of file TrackingAnalysisConfig.py.

◆ fFakeLoose

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeLoose

Definition at line 428 of file TrackingAnalysisConfig.py.

◆ fFakeTight

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeTight

Definition at line 417 of file TrackingAnalysisConfig.py.

◆ filterToolSeed

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.filterToolSeed

Definition at line 432 of file TrackingAnalysisConfig.py.

◆ runTruthFilter

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.runTruthFilter

Definition at line 392 of file TrackingAnalysisConfig.py.

◆ selectionName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.selectionName

Definition at line 438 of file TrackingAnalysisConfig.py.

◆ trkEffSystScale

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.trkEffSystScale

Definition at line 434 of file TrackingAnalysisConfig.py.


The documentation for this class was generated from the following file: