ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
TrackingAnalysisConfig.InDetTrackWorkingPointConfig Class Reference
Inheritance diagram for TrackingAnalysisConfig.InDetTrackWorkingPointConfig:
Collaboration diagram for TrackingAnalysisConfig.InDetTrackWorkingPointConfig:

Public Member Functions

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

Public Attributes

 cutLevel
 

Detailed Description

the ConfigBlock for the track working point

Definition at line 185 of file TrackingAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def TrackingAnalysisConfig.InDetTrackWorkingPointConfig.__init__ (   self)

Definition at line 188 of file TrackingAnalysisConfig.py.

188  def __init__ (self) :
189  super (InDetTrackWorkingPointConfig, self).__init__ ()
190  self.addOption ('containerName', '', type=str,
191  noneAction='error',
192  info="the name of the input container.")
193  self.addOption ('selectionName', '', type=str,
194  noneAction='error',
195  info="the name of the track selection to define (e.g. tightPrimary "
196  "or loose).")
197  self.addOption ('postfix', None, type=str,
198  info="a postfix to apply to decorations and algorithm names. "
199  "Typically not needed here as selectionName is used internally.")
200  self.addOption ('cutLevel', None, type=str,
201  noneAction='error',
202  info="the selection WP (str) to use. Supported WPs for general "
203  "use: `Loose` and `TightPrimary`. For expert studies, further "
204  "WPs are available: `NoCut`, `LoosePrimary`, `LooseElectron`, "
205  "`LooseMuon`, `LooseTau`, `MinBias`, `HILoose`, `HITight`, "
206  "`HILooseOptimized`, `HITightOptimized`.")
207  self.addOption ('additionalCuts', None, type=None,
208  info="additional cuts to modify the selection WP. Only meant for "
209  "expert studies of track selection. Passed as pairs of `cutName: value`. "
210  "For an overview of available cuts, see twiki.cern.ch/twiki/bin/viewauth/"
211  "AtlasProtected/InDetTrackSelectionTool#List_of_possible_cuts.")
212  self.addOption ('runTruthFilter', True, type=bool,
213  info="whether to run the TruthFilterTool. This tool is only compatible "
214  "with the cut levels 'Loose' and 'TightPrimary'.")
215  self.addOption ('calibFile', None, type=str,
216  info="name (str) of the calibration file to use for efficiencies "
217  "in the TruthFilter tool. Expert option to override the "
218  "recommendations based on the campaign. The default is None.")
219  self.addOption ('filterToolSeed', None, type=int,
220  info="random seed (int) to be used by the InDetTrackTruthFilterTool. "
221  "Expert option. The default is 0.")
222  self.addOption ('fFakeLoose', None, type=float,
223  info="the fraction of fake tracks (float) in the Loose working point. "
224  "Will be used by the InDetTrackTruthFilterTool. Expert option to "
225  "override the recommendations.")
226  self.addOption ('fFakeTight', None, type=float,
227  info="the fraction of fake tracks (float) in the TightPrimary working "
228  "point. Will be used by the InDetTrackTruthFilterTool. Expert option "
229  "to override the recommendations.")
230  self.addOption ('trkEffSystScale', None, type=float,
231  info="the track efficiency systematic scale (float). Will be used "
232  "by the InDetTrackTruthFilterTool. Expert option to override the "
233  "recommendations. Default is 1.0")
234  self.addOption ('addSelectionToPreselection', True, type=bool,
235  info="whether to retain only tracks satisfying the cutLevel "
236  "requirements. The default is True.")
237 

Member Function Documentation

◆ instanceName()

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

Definition at line 238 of file TrackingAnalysisConfig.py.

238  def instanceName (self) :
239  """Return the instance name for this block"""
240  if self.postfix is not None:
241  return self.containerName + self.selectionName + self.postfix
242  else:
243  return self.containerName + self.selectionName
244 

◆ makeAlgs()

def TrackingAnalysisConfig.InDetTrackWorkingPointConfig.makeAlgs (   self,
  config 
)

Definition at line 245 of file TrackingAnalysisConfig.py.

245  def makeAlgs (self, config) :
246  log = logging.getLogger('InDetTrackWorkingPointConfig')
247 
248  selectionPostfix = self.selectionName
249  if selectionPostfix != '' and selectionPostfix[0] != '_' :
250  selectionPostfix = '_' + selectionPostfix
251 
252  postfix = self.postfix
253  if postfix is None :
254  postfix = self.selectionName
255  if postfix != '' and postfix[0] != '_' :
256  postfix = '_' + postfix
257 
258  cutLevels = ["NoCut", "Loose", "LoosePrimary", "TightPrimary", "LooseMuon",
259  "LooseElectron", "LooseTau", "MinBias", "HILoose", "HITight",
260  "HILooseOptimized", "HITightOptimized"]
261  alg = config.createAlgorithm( 'CP::InDetTrackSelectionAlg', 'InDetTrackSelectionAlg' )
262  alg.selectionDecoration = 'selectTrack' + postfix + '_%SYS%,as_bits'
263  config.addPrivateTool( 'selectionTool', 'InDet::InDetTrackSelectionTool')
264  if self.cutLevel is None:
265  log.warning("No selection WP chosen, not setting up InDetTrackSelectionTool.")
266  elif self.cutLevel not in cutLevels:
267  raise ValueError ('Invalid cut level: \"' + self.cutLevel + '\", has '
268  'to be one of: ' + ', '.join(cutLevels))
269  elif self.cutLevel in ["Loose", "TightPrimary"]:
270  alg.selectionTool.CutLevel = self.cutLevel
271  else:
272  log.warning('Using cut level: \"' + self.cutLevel + '\" that is not '
273  'meant for general use, but only expert studies.')
274  alg.selectionTool.CutLevel = self.cutLevel
275  if self.additionalCuts:
276  for cutName, value in self.additionalCuts.items():
277  setattr(alg.selectionTool, cutName, value)
278  # Set up the truth filtering algorithm:
279  if config.dataType() is not DataType.Data:
280  if not self.runTruthFilter:
281  log.warning('Disabling the TruthFilterTool.')
282  else:
283  config.addPrivateTool( 'filterTool', 'InDet::InDetTrackTruthFilterTool' )
284  config.addPrivateTool( 'filterTool.trackOriginTool', 'InDet::InDetTrackTruthOriginTool' )
285  # Set working point based on cut level
286  if self.cutLevel == "Loose":
287  alg.filterWP = "LOOSE"
288  elif self.cutLevel == "TightPrimary":
289  alg.filterWP = "TIGHT"
290  else:
291  raise ValueError ('Attempting to set TruthFilter WP based on cut level: \"'
292  + self.efficiencyWP + '\" that is not supported.')
293  # Set calibFile and fake rates based on campaign
294  if config.geometry() is LHCPeriod.Run2:
295  # Run 2 recommendations (MC20)
296  alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
297  alg.filterTool.fFakeLoose = 0.10
298  alg.filterTool.fFakeTight = 1.00
299  elif config.geometry() is LHCPeriod.Run3:
300  if config.campaign() is Campaign.MC23a:
301  # 2022 recommendations (MC23a)
302  alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
303  alg.filterTool.fFakeLoose = 0.40
304  alg.filterTool.fFakeTight = 1.00
305  elif config.campaign() is Campaign.MC23d:
306  # 2023 recommendations (MC23d)
307  alg.filterTool.calibFileNomEff = "InDetTrackSystematicsTools/CalibData_22.0_2022-v00/TrackingRecommendations_prelim_rel22.root"
308  alg.filterTool.fFakeLoose = 0.40
309  alg.filterTool.fFakeTight = 1.00
310  elif not (self.calibFile and self.fFakeLoose and self.fFakeTight):
311  raise ValueError ('No efficiency recommendations found for capaign \"'
312  + config.campaign().value + '\" in Run 3. '
313  'Please check that the recommendations exist.')
314  elif not (self.calibFile and self.fFakeLoose and self.fFakeTight):
315  raise ValueError ('No efficiency recommendations found for geometry \"'
316  + config.geometry().value + '\". Please check '
317  'the configuration.')
318  # Set custom calibFile, fake rates, or random seed
319  if self.calibFile:
320  alg.filterTool.calibFileNomEff = self.calibFile
321  if self.fFakeLoose:
322  alg.filterTool.fFakeLoose = self.fFakeLoose
323  if self.fFakeTight:
324  alg.filterTool.fFakeTight = self.fFakeTight
325  if self.filterToolSeed:
326  alg.filterTool.Seed = self.filterToolSeed
327  if self.trkEffSystScale:
328  alg.filterTool.trkEffSystScale = self.trkEffSystScale
329  alg.inDetTracks = config.readName (self.containerName)
330  alg.preselection = config.getPreselection (self.containerName, '')
331  config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration,
332  preselection=self.addSelectionToPreselection)

Member Data Documentation

◆ cutLevel

TrackingAnalysisConfig.InDetTrackWorkingPointConfig.cutLevel

Definition at line 286 of file TrackingAnalysisConfig.py.


The documentation for this class was generated from the following file:
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:71
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18