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 236 of file TrackingAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.__init__ ( self)

Definition at line 239 of file TrackingAnalysisConfig.py.

239 def __init__ (self) :
240 super (InDetTrackWorkingPointConfig, self).__init__ ()
241 self.addOption ('containerName', '', type=str,
242 noneAction='error',
243 info="the name of the input container.",
244 meta={'role':'containerRef'})
245 self.addOption ('selectionName', '', type=str,
246 noneAction='error',
247 info="the name of the track selection to define (e.g. `tightPrimary` "
248 "or `loose`).",
249 meta={'role':'selection'})
250 self.addOption ('postfix', None, type=str,
251 info="a postfix to apply to decorations and algorithm names. "
252 "Typically not needed here as `selectionName` is used internally.")
253 self.addOption ('cutLevel', None, type=str,
254 noneAction='error',
255 info="the selection WP to use. Supported WPs for general "
256 "use: `Loose` and `TightPrimary`. For expert studies, further "
257 "WPs are available: `NoCut`, `LoosePrimary`, `LooseElectron`, "
258 "`LooseMuon`, `LooseTau`, `MinBias`, `HILoose`, `HITight`, "
259 "`HILooseOptimized`, `HITightOptimized`.",
260 expertMode=["NoCut", "LoosePrimary", "LooseElectron",
261 "LooseMuon", "LooseTau", "MinBias", "HILoose", "HITight",
262 "HILooseOptimized", "HITightOptimized"],
263 meta={'choices':(['Loose','TightPrimary','NoCut','LoosePrimary','LooseElectron','LooseMuon','LooseTau','MinBias','HILoose','HITight','HILooseOptimized','HITightOptimized'],1)})
264 self.addOption ('additionalCuts', None, type=dict,
265 info="additional cuts to modify the selection WP. Only meant for "
266 "expert studies of track selection. Passed as pairs of `cutName: value`. "
267 "For an overview of available cuts, see twiki.cern.ch/twiki/bin/viewauth/"
268 "AtlasProtected/InDetTrackSelectionTool#List_of_possible_cuts.",
269 expertMode=True)
270 self.addOption ('vertexContainer', None, type=str,
271 info="A vertex collection to be used by the additionalCuts. The leading "
272 "primary vertex is passed to the selectionTool to calculate the distance "
273 "in the maxZ0 cuts.",
274 expertMode=True)
275 self.addOption ('runTruthFilter', True, type=bool,
276 info="whether to run the `TruthFilterTool`. This tool is only compatible "
277 "with the cut levels `Loose` and `TightPrimary`.")
278 self.addOption ('calibFile', None, type=str,
279 info="name of the calibration file to use for efficiencies "
280 "in the `TruthFilter` tool. Expert option to override the "
281 "recommendations based on the campaign.",
282 expertMode=True)
283 self.addOption ('filterToolSeed', None, type=int,
284 info="random seed to be used by the `InDetTrackTruthFilterTool`.",
285 expertMode=True)
286 self.addOption ('fFakeLoose', None, type=float,
287 info="the fraction of fake tracks in the `Loose` working point. "
288 "Will be used by the `InDetTrackTruthFilterTool`. Expert option to "
289 "override the recommendations.",
290 expertMode=True)
291 self.addOption ('fFakeTight', None, type=float,
292 info="the fraction of fake tracks in the `TightPrimary` working "
293 "point. Will be used by the `InDetTrackTruthFilterTool`. Expert option "
294 "to override the recommendations.",
295 expertMode=True)
296 self.addOption ('trkEffSystScale', None, type=float,
297 info="the track efficiency systematic scale. Will be used "
298 "by the `InDetTrackTruthFilterTool`. Expert option to override the "
299 "recommendations.",
300 expertMode=True)
301 self.addOption ('addSelectionToPreselection', True, type=bool,
302 info="whether to retain only tracks satisfying the `cutLevel` "
303 "requirements.")
304

Member Function Documentation

◆ instanceName()

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

Definition at line 305 of file TrackingAnalysisConfig.py.

305 def instanceName (self) :
306 """Return the instance name for this block"""
307 if self.postfix is not None:
308 return self.containerName + self.selectionName + self.postfix
309 else:
310 return self.containerName + self.selectionName
311

◆ makeAlgs()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.makeAlgs ( self,
config )

Definition at line 312 of file TrackingAnalysisConfig.py.

312 def makeAlgs (self, config) :
313 log = logging.getLogger('InDetTrackWorkingPointConfig')
314
315 selectionPostfix = self.selectionName
316 if selectionPostfix != '' and selectionPostfix[0] != '_' :
317 selectionPostfix = '_' + selectionPostfix
318
319 postfix = self.postfix
320 if postfix is None :
321 postfix = self.selectionName
322 if postfix != '' and postfix[0] != '_' :
323 postfix = '_' + postfix
324
325 cutLevels = ["NoCut", "Loose", "LoosePrimary", "TightPrimary", "LooseMuon",
326 "LooseElectron", "LooseTau", "MinBias", "HILoose", "HITight",
327 "HILooseOptimized", "HITightOptimized"]
328 alg = config.createAlgorithm( 'CP::InDetTrackSelectionAlg', 'InDetTrackSelectionAlg' )
329 alg.selectionDecoration = 'selectTrack' + postfix + '_%SYS%,as_bits'
330 config.addPrivateTool( 'selectionTool', 'InDet::InDetTrackSelectionTool')
331 if self.cutLevel is None:
332 log.warning("No selection WP chosen, not setting up InDetTrackSelectionTool.")
333 elif self.cutLevel not in cutLevels:
334 raise ValueError ('Invalid cut level: \"' + self.cutLevel + '\", has '
335 'to be one of: ' + ', '.join(cutLevels))
336 elif self.cutLevel in ["Loose", "TightPrimary"]:
337 alg.selectionTool.CutLevel = self.cutLevel
338 else:
339 log.warning('Using cut level: \"' + self.cutLevel + '\" that is not '
340 'meant for general use, but only expert studies.')
341 alg.selectionTool.CutLevel = self.cutLevel
342
343 if self.additionalCuts:
344 for cutName, value in self.additionalCuts.items():
345 setattr(alg.selectionTool, cutName, value)
346 if self.vertexContainer is not None:
347 alg.vertices = self.vertexContainer
348
349 # Set up the truth filtering algorithm:
350 if config.dataType() is not DataType.Data:
351 if self.runTruthFilter:
352 if config.isPhyslite():
353 log.warning ('The TruthFilterTool is not compatible with Physlite mode. '
354 'This tool is skipped for now. Please set \"runTruthFilter: '
355 'False\" to get rid of this warning.')
356 else:
357 config.addPrivateTool( 'filterTool', 'InDet::InDetTrackTruthFilterTool' )
358 config.addPrivateTool( 'filterTool.trackOriginTool', 'InDet::InDetTrackTruthOriginTool' )
359 # Set working point based on cut level
360 if self.cutLevel == "Loose":
361 alg.filterWP = "LOOSE"
362 elif self.cutLevel == "TightPrimary":
363 alg.filterWP = "TIGHT"
364 else:
365 raise ValueError ('Attempting to set TruthFilter WP based on cut level: \"'
366 + self.efficiencyWP + '\" that is not supported.')
367 # Set calibFile and fake rates based on campaign
368 if config.geometry() is LHCPeriod.Run2:
369 # Run 2 recommendations (MC20)
370 alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
371 alg.filterTool.fFakeLoose = 0.10
372 alg.filterTool.fFakeTight = 1.00
373 elif config.geometry() is LHCPeriod.Run3:
374 if config.campaign() in [Campaign.MC23a, Campaign.MC23d, Campaign.MC23e]:
375 # 2022/23/24 recommendations (MC23a/d/e)
376 alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
377 alg.filterTool.fFakeLoose = 0.40
378 alg.filterTool.fFakeTight = 1.00
379 elif not (self.calibFile and self.fFakeLoose and self.fFakeTight):
380 raise ValueError ('No efficiency recommendations found for campaign \"'
381 + config.campaign().value + '\" in Run 3. '
382 'Please check that the recommendations exist.')
383 elif not (self.calibFile and self.fFakeLoose and self.fFakeTight):
384 raise ValueError ('No efficiency recommendations found for geometry \"'
385 + config.geometry().value + '\". Please check '
386 'the configuration.')
387 # Set custom calibFile, fake rates, or random seed
388 if self.calibFile:
389 alg.filterTool.calibFileNomEff = self.calibFile
390 if self.fFakeLoose:
391 alg.filterTool.fFakeLoose = self.fFakeLoose
392 if self.fFakeTight:
393 alg.filterTool.fFakeTight = self.fFakeTight
394 if self.filterToolSeed:
395 alg.filterTool.Seed = self.filterToolSeed
396 if self.trkEffSystScale:
397 alg.filterTool.trkEffSystScale = self.trkEffSystScale
398 alg.inDetTracks = config.readName (self.containerName)
399 alg.preselection = config.getPreselection (self.containerName, '')
400 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
401 preselection=self.addSelectionToPreselection)

Member Data Documentation

◆ additionalCuts

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.additionalCuts

Definition at line 343 of file TrackingAnalysisConfig.py.

◆ calibFile

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.calibFile

Definition at line 388 of file TrackingAnalysisConfig.py.

◆ containerName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.containerName

Definition at line 400 of file TrackingAnalysisConfig.py.

◆ cutLevel

str TrackingAnalysisConfig.InDetTrackWorkingPointConfig.cutLevel = "Loose":

Definition at line 360 of file TrackingAnalysisConfig.py.

◆ fFakeLoose

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeLoose

Definition at line 390 of file TrackingAnalysisConfig.py.

◆ fFakeTight

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeTight

Definition at line 379 of file TrackingAnalysisConfig.py.

◆ filterToolSeed

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.filterToolSeed

Definition at line 394 of file TrackingAnalysisConfig.py.

◆ runTruthFilter

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.runTruthFilter

Definition at line 351 of file TrackingAnalysisConfig.py.

◆ selectionName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.selectionName

Definition at line 400 of file TrackingAnalysisConfig.py.

◆ trkEffSystScale

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.trkEffSystScale

Definition at line 396 of file TrackingAnalysisConfig.py.


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