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

Constructor & Destructor Documentation

◆ __init__()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.__init__ ( self)

Definition at line 221 of file TrackingAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

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

Definition at line 279 of file TrackingAnalysisConfig.py.

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

◆ makeAlgs()

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.makeAlgs ( self,
config )

Definition at line 286 of file TrackingAnalysisConfig.py.

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

Member Data Documentation

◆ additionalCuts

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.additionalCuts

Definition at line 316 of file TrackingAnalysisConfig.py.

◆ calibFile

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.calibFile

Definition at line 355 of file TrackingAnalysisConfig.py.

◆ containerName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.containerName

Definition at line 367 of file TrackingAnalysisConfig.py.

◆ cutLevel

str TrackingAnalysisConfig.InDetTrackWorkingPointConfig.cutLevel = "Loose":

Definition at line 327 of file TrackingAnalysisConfig.py.

◆ fFakeLoose

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeLoose

Definition at line 357 of file TrackingAnalysisConfig.py.

◆ fFakeTight

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.fFakeTight

Definition at line 346 of file TrackingAnalysisConfig.py.

◆ filterToolSeed

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.filterToolSeed

Definition at line 361 of file TrackingAnalysisConfig.py.

◆ runTruthFilter

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.runTruthFilter

Definition at line 321 of file TrackingAnalysisConfig.py.

◆ selectionName

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.selectionName

Definition at line 367 of file TrackingAnalysisConfig.py.

◆ trkEffSystScale

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.trkEffSystScale

Definition at line 363 of file TrackingAnalysisConfig.py.


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