Loading [MathJax]/extensions/tex2jax.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 primaryPassUsesActs(flags) -> bool:
7  from TrkConfig.TrkConfigFlags import ITkPrimaryPassConfig
8  return flags.Tracking.ITkPrimaryPassConfig in [ITkPrimaryPassConfig.Acts, \
9  ITkPrimaryPassConfig.ActsLegacy, \
10  ITkPrimaryPassConfig.ActsHeavyIon]
11 
12 
13 def primaryPassExtension(flags) -> str:
14  # we rely on the fact that flags.Tracking.ITkPrimaryPassConfig.value is
15  # equal to ITk{extension}
16  return flags.Tracking.ITkPrimaryPassConfig.value.replace("ITk", "")
17 
18 def extractTrackingPasses(flags) -> list:
19  # Function for extracting the requested tracking passes that need to be scheduled
20  trackingPasses = []
21 
22  # Check there is only one chain
23  # for the time being we still technically allow for a list, but we should move to a single value eventually
24  if len(flags.Tracking.recoChain) != 1:
25  raise ValueError(f"Conflicting reco configuration: Tracking.recoChain should have only one element but we found {flags.Tracking.recoChain}")
26 
27  # Quick check about fast tracking configuration
28  from TrkConfig.TrkConfigFlags import ITkPrimaryPassConfig
29  if flags.Tracking.ITkPrimaryPassConfig is ITkPrimaryPassConfig.Acts:
30  if not flags.Tracking.doITkFastTracking:
31  raise ValueError(f"Main pass is set to Acts Fast Tracking but Tracking.doITkFastTracking is set to {flags.Tracking.doITkFastTracking}")
32  else:
33  if flags.Tracking.doITkFastTracking:
34  raise ValueError(f"Main pass is NOT set to Fast Tracking but Tracking.doITkFastTracking is set to {flags.Tracking.doITkFastTracking}")
35 
36  # Primary pass
37  trackingPasses += [flags.cloneAndReplace(
38  "Tracking.ActiveConfig",
39  f"Tracking.{flags.Tracking.ITkPrimaryPassConfig.value}Pass")]
40 
41  # Large Radius pass
42  if flags.Acts.doLargeRadius:
43  trackingPasses += [flags.cloneAndReplace(
44  "Tracking.ActiveConfig",
45  "Tracking.ITkActsLargeRadiusPass")]
46 
47  # Conversion pass
48  if flags.Acts.doITkConversion:
49  # Check that we can schedule the conversion
50  if not flags.Detector.EnableCalo:
51  raise ValueError("Problem in the job configuration: required reconstruction of photon conversion tracks but Calorimeter Detector is not enabled")
52  trackingPasses += [flags.cloneAndReplace(
53  "Tracking.ActiveConfig",
54  "Tracking.ITkActsConversionPass")]
55 
56  # Low pT pass
57  if flags.Acts.doLowPt:
58  trackingPasses += [flags.cloneAndReplace(
59  "Tracking.ActiveConfig",
60  "Tracking.ITkActsLowPtPass")]
61 
62  print("List of scheduled passes:")
63  for trackingPass in trackingPasses:
64  print(f'- {trackingPass.Tracking.ActiveConfig.extension}')
65 
66  return trackingPasses
67 
python.ITkActsHelpers.isPrimaryPass
bool isPrimaryPass(flags)
Definition: ITkActsHelpers.py:3
python.ITkActsHelpers.primaryPassUsesActs
bool primaryPassUsesActs(flags)
Definition: ITkActsHelpers.py:6
python.ITkActsHelpers.extractTrackingPasses
list extractTrackingPasses(flags)
Definition: ITkActsHelpers.py:18
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.ITkActsHelpers.primaryPassExtension
str primaryPassExtension(flags)
Definition: ITkActsHelpers.py:13