Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FPGATrackSimMapMakerConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 def getFirstStagePlanes(flags):
7  """ Default logic for selecting logical layer / plane configuration for first stage.
8  This used to be hardcoded in the map maker header file. Now it's hardcoded here."""
9  planes = getSecondStagePlanes(flags)
10 
11  # The first stage planes should always be either the first 5, 9, or 8 layers.
12  # For additional algorithms more permutations here could be added.
13  # This could also fire based off of the "pipeline" setting if we want.
14  if flags.doInsideOut:
15  return planes[:5]
16  elif flags.Trigger.FPGATrackSim.spacePoints:
17  return planes[:9]
18  else:
19  return planes[:8]
20 
21 
23  """ Default logic for selecting logical layer / plane configuration for first stage.
24  This used to be hardcoded in the map maker header file. Now it's hardcoded here."""
25  if (not flags.Trigger.FPGATrackSim.oldRegionDefs) or flags.doInsideOut:
26  # Use a very generic assignment that just maps all modules to a layer to ensure they are turned on.
27  # NOTE: this will *not* work in the forward region. There we need to be more subtle about what pixel layers
28  # are "first stage" vs "second stage". Everywhere else though it's sufficient to assume strip == second stage, pixel == first stage.
29  # (for the inside out algorithm).
30  # Numbers here are taken from boundaries in FPGATrackSimModuleRelabel.h
31  return [
32  ["pb0"] + [f"pe{x}+" for x in range(0, 21)],
33  ["pb1"] + [f"pe{x}+" for x in range(21, 44)],
34  ["pb2"] + [f"pe{x}+" for x in range(44, 61)],
35  ["pb3"] + [f"pe{x}+" for x in range(61, 77)],
36  ["pb4"] + [f"pe{x}+" for x in range(77, 95)],
37  ["sb0", "se4+", "se0+"],
38  ["sb1", "se5+", "se1+"],
39  ["sb2", "se6+", "se2+"],
40  ["sb3", "se7+", "se3+"],
41  ["sb4", "se8+"],
42  ["sb5", "se9+"],
43  ["sb6", "se10+"],
44  ["sb7", "se11+"]
45  ]
46  else:
47  # Use layer assignments for the old regions for the Hough-like algorithms.
48  if flags.Trigger.FPGATrackSim.spacePoints:
49  # New as of Python 3.10! (We are using 3.11)
50  match flags.Trigger.FPGATrackSim.region:
51  case 0 | 1 | 5 | 6 | 7:
52  return [["pb4"],["sb0"],["sb1"],["sb2"],["sb3"],["sb4"],["sb5"],["sb6"],["sb7"],["pb0"],["pb1"],["pb2"],["pb3"]]
53  case 3:
54  return [["pb4","pe83+","pe84+","pe85+","pe86+","pe87+","pe88+","pe89+"],["se4+"],["se5+"],["se6+"],["se7+"],["se8+"],["se9+"],["se10+"],["se11+"],["pb2"],["pb3","pe58+"],["se2+"],["se3+"]]
55  case 2 | 4 | _:
56  return [["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"]]
57  else:
58  match flags.Trigger.FPGATrackSim.region:
59  case 0 | 1 | 5 | 6 | 7:
60  return [["pb4"],["sb0"],["sb2"],["sb3"],["sb4"],["sb5"],["sb6"],["sb7"],["pb0"],["pb1"],["pb2"],["pb3"], ["sb1"]]
61  case 3:
62  return [["pb4","pe83+","pe84+","pe85+","pe86+","pe87+","pe88+","pe89+"],["se5+"],["se6+"],["se7+"],["se8+"],["se9+"],["se10+"],["se11+"],["pb2"],["pb3","pe58+"],["se2+"],["se3+"], ["se4+"]]
63  case 2 | 4 | _:
64  return [["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"],["-1"]]
65 
67  acc = ComponentAccumulator()
68  from FPGATrackSimConfTools.FPGATrackSimDataPrepConfig import FPGATrackSimReadInputCfg, FPGATrackSimEventSelectionCfg
69  alg = CompFactory.FPGATrackSimMapMakerAlg(
70  GeometryVersion=flags.GeoModel.AtlasVersion,
71  OutFileName=flags.OutFileName,
72  KeyString=flags.KeyString,
73  nSlices=flags.nSlices,
74  region=flags.Trigger.FPGATrackSim.region,
75  trim=flags.trim,
76  globalTrim=flags.globalTrim,
77  InputTool = acc.getPrimaryAndMerge(FPGATrackSimReadInputCfg(flags)),
78  eventSelector = acc.getPrimaryAndMerge(FPGATrackSimEventSelectionCfg(flags)),
79  planes = getFirstStagePlanes(flags),
80  planes2 = getSecondStagePlanes(flags)
81  )
82 
83  acc.addEventAlgo(alg)
84  return acc
85 
86 
87 if __name__ == "__main__":
88  from AthenaConfiguration.AllConfigFlags import initConfigFlags
89  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
90  flags = initConfigFlags()
91  flags.addFlag("OutFileName", "MMTest")
92  flags.addFlag("KeyString", "strip,barrel,0")
93  flags.addFlag("nSlices", 6)
94  flags.addFlag("trim", 0.1)
95  flags.addFlag("globalTrim", 0)
96  flags.addFlag('doInsideOut', False)
97 
98  from AthenaCommon.Logging import logging
99  log = logging.getLogger(__name__)
100 
101  flags.fillFromArgs()
102  if not flags.Trigger.FPGATrackSim.wrapperFileName and flags.Input.Files:
103  flags.Trigger.FPGATrackSim.wrapperFileName = flags.Input.Files
104  log.info("Taken wrapper input files from Input.Files(set via cmd line --filesInput option) property: %s", str(flags.Trigger.FPGATrackSim.wrapperFileName))
105  flags.lock()
106 
107  acc=MainServicesCfg(flags)
108  acc.store(open('FPGATrackSimMapMakerConfig.pkl','wb'))
109  acc.merge(FPGATrackSimMapMakerCfg(flags))
110 
111  from AthenaConfiguration.Utils import setupLoggingLevels
112  setupLoggingLevels(flags, acc)
113 
114  statusCode = acc.run()
115  assert statusCode.isSuccess() is True, "Application execution did not succeed"
116 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.FPGATrackSimMapMakerConfig.FPGATrackSimMapMakerCfg
def FPGATrackSimMapMakerCfg(flags)
Definition: FPGATrackSimMapMakerConfig.py:66
python.FPGATrackSimMapMakerConfig.getSecondStagePlanes
def getSecondStagePlanes(flags)
Definition: FPGATrackSimMapMakerConfig.py:22
python.FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg
def FPGATrackSimEventSelectionCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:248
python.Utils.setupLoggingLevels
def setupLoggingLevels(flags, ca)
Definition: Control/AthenaConfiguration/python/Utils.py:50
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.FPGATrackSimDataPrepConfig.FPGATrackSimReadInputCfg
def FPGATrackSimReadInputCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:289
Trk::open
@ open
Definition: BinningType.h:40
python.FPGATrackSimMapMakerConfig.getFirstStagePlanes
def getFirstStagePlanes(flags)
Definition: FPGATrackSimMapMakerConfig.py:6
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
str
Definition: BTagTrackIpAccessor.cxx:11