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

Constructor & Destructor Documentation

◆ __init__()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.__init__ ( self)

Definition at line 223 of file TrackingAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 282 of file TrackingAnalysisConfig.py.

282 def instanceName (self) :
283 """Return the instance name for this block"""
284 if self.postfix is not None:
285 return self.containerName + self.selectionName + self.postfix
286 else:
287 return self.containerName + self.selectionName
288

◆ makeAlgs()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.makeAlgs ( self,
config )

Definition at line 289 of file TrackingAnalysisConfig.py.

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

Member Data Documentation

◆ additionalCuts

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.additionalCuts

Definition at line 319 of file TrackingAnalysisConfig.py.

◆ calibFile

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.calibFile

Definition at line 358 of file TrackingAnalysisConfig.py.

◆ containerName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.containerName

Definition at line 370 of file TrackingAnalysisConfig.py.

◆ cutLevel

str TrackingAnalysisConfig.InDetTrackWorkingPointConfig.cutLevel = "Loose":

Definition at line 330 of file TrackingAnalysisConfig.py.

◆ fFakeLoose

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeLoose

Definition at line 360 of file TrackingAnalysisConfig.py.

◆ fFakeTight

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeTight

Definition at line 349 of file TrackingAnalysisConfig.py.

◆ filterToolSeed

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.filterToolSeed

Definition at line 364 of file TrackingAnalysisConfig.py.

◆ runTruthFilter

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.runTruthFilter

Definition at line 324 of file TrackingAnalysisConfig.py.

◆ selectionName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.selectionName

Definition at line 370 of file TrackingAnalysisConfig.py.

◆ trkEffSystScale

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.trkEffSystScale

Definition at line 366 of file TrackingAnalysisConfig.py.


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