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

Constructor & Destructor Documentation

◆ __init__()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.__init__ ( self)

Definition at line 238 of file TrackingAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 296 of file TrackingAnalysisConfig.py.

296 def instanceName (self) :
297 """Return the instance name for this block"""
298 if self.postfix is not None:
299 return self.containerName + self.selectionName + self.postfix
300 else:
301 return self.containerName + self.selectionName
302

◆ makeAlgs()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.makeAlgs ( self,
config )

Definition at line 303 of file TrackingAnalysisConfig.py.

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

Member Data Documentation

◆ additionalCuts

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.additionalCuts

Definition at line 333 of file TrackingAnalysisConfig.py.

◆ calibFile

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.calibFile

Definition at line 372 of file TrackingAnalysisConfig.py.

◆ containerName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.containerName

Definition at line 384 of file TrackingAnalysisConfig.py.

◆ cutLevel

str TrackingAnalysisConfig.InDetTrackWorkingPointConfig.cutLevel = "Loose":

Definition at line 344 of file TrackingAnalysisConfig.py.

◆ fFakeLoose

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeLoose

Definition at line 374 of file TrackingAnalysisConfig.py.

◆ fFakeTight

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeTight

Definition at line 363 of file TrackingAnalysisConfig.py.

◆ filterToolSeed

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.filterToolSeed

Definition at line 378 of file TrackingAnalysisConfig.py.

◆ runTruthFilter

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.runTruthFilter

Definition at line 338 of file TrackingAnalysisConfig.py.

◆ selectionName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.selectionName

Definition at line 384 of file TrackingAnalysisConfig.py.

◆ trkEffSystScale

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.trkEffSystScale

Definition at line 380 of file TrackingAnalysisConfig.py.


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