Loading [MathJax]/jax/output/SVG/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ITkActsHelpers.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2 
3 def isPrimaryPass(flags) -> bool:
4  return f"{flags.Tracking.ITkPrimaryPassConfig.value}Pass" not in flags.Tracking
5 
6 def isFastPrimaryPass(flags) -> bool:
7  return flags.Tracking.doITkFastTracking and isPrimaryPass(flags)
8 
9 def isValidationPass(flags) -> bool:
10  return "Validate" in flags.Tracking.ActiveConfig.extension
11 
12 def isProductionPass(flags) -> bool:
13  return not isValidationPass(flags)
14 
15 def primaryPassUsesActs(flags) -> bool:
16  from TrkConfig.TrkConfigFlags import ITkPrimaryPassConfig
17  return flags.Tracking.ITkPrimaryPassConfig in [ITkPrimaryPassConfig.Acts, \
18  ITkPrimaryPassConfig.ActsLegacy, \
19  ITkPrimaryPassConfig.ActsHeavyIon]
20 
21 def primaryPassExtension(flags) -> str:
22  # we rely on the fact that flags.Tracking.ITkPrimaryPassConfig.value is
23  # equal to ITk{extension}
24  return flags.Tracking.ITkPrimaryPassConfig.value.replace("ITk", "")
25 
26 def extractTrackingPasses(flags) -> list:
27  # Function for extracting the requested tracking passes that need to be scheduled
28  trackingPasses = []
29 
30  # Check there is only one chain
31  # for the time being we still technically allow for a list, but we should move to a single value eventually
32  if len(flags.Tracking.recoChain) != 1:
33  raise ValueError(f"Conflicting reco configuration: Tracking.recoChain should have only one element but we found {flags.Tracking.recoChain}")
34 
35  # Quick check about fast tracking configuration
36  from TrkConfig.TrkConfigFlags import ITkPrimaryPassConfig
37  if flags.Tracking.ITkPrimaryPassConfig is ITkPrimaryPassConfig.Acts:
38  if not flags.Tracking.doITkFastTracking:
39  raise ValueError(f"Main pass is set to Acts Fast Tracking but Tracking.doITkFastTracking is set to {flags.Tracking.doITkFastTracking}")
40  else:
41  if flags.Tracking.doITkFastTracking:
42  raise ValueError(f"Main pass is NOT set to Fast Tracking but Tracking.doITkFastTracking is set to {flags.Tracking.doITkFastTracking}")
43 
44  # Primary pass
45  trackingPasses += [flags.cloneAndReplace(
46  "Tracking.ActiveConfig",
47  f"Tracking.{flags.Tracking.ITkPrimaryPassConfig.value}Pass")]
48 
49  # Large Radius pass
50  if flags.Acts.doLargeRadius:
51  trackingPasses += [flags.cloneAndReplace(
52  "Tracking.ActiveConfig",
53  "Tracking.ITkActsLargeRadiusPass")]
54 
55  # Conversion pass
56  if flags.Acts.doITkConversion:
57  # Check that we can schedule the conversion
58  if not flags.Detector.EnableCalo:
59  raise ValueError("Problem in the job configuration: required reconstruction of photon conversion tracks but Calorimeter Detector is not enabled")
60  trackingPasses += [flags.cloneAndReplace(
61  "Tracking.ActiveConfig",
62  "Tracking.ITkActsConversionPass")]
63 
64  # Low pT pass
65  if flags.Acts.doLowPt:
66  trackingPasses += [flags.cloneAndReplace(
67  "Tracking.ActiveConfig",
68  "Tracking.ITkActsLowPtPass")]
69 
70  print("List of scheduled passes:")
71  for trackingPass in trackingPasses:
72  print(f'- {trackingPass.Tracking.ActiveConfig.extension}')
73 
74  return trackingPasses
75 
python.ITkActsHelpers.isPrimaryPass
bool isPrimaryPass(flags)
Definition: ITkActsHelpers.py:3
python.ITkActsHelpers.primaryPassUsesActs
bool primaryPassUsesActs(flags)
Definition: ITkActsHelpers.py:15
python.ITkActsHelpers.isProductionPass
bool isProductionPass(flags)
Definition: ITkActsHelpers.py:12
python.ITkActsHelpers.extractTrackingPasses
list extractTrackingPasses(flags)
Definition: ITkActsHelpers.py:26
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.ITkActsHelpers.isValidationPass
bool isValidationPass(flags)
Definition: ITkActsHelpers.py:9
python.ITkActsHelpers.primaryPassExtension
str primaryPassExtension(flags)
Definition: ITkActsHelpers.py:21
python.ITkActsHelpers.isFastPrimaryPass
bool isFastPrimaryPass(flags)
Definition: ITkActsHelpers.py:6