ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimMapMakerConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
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, FPGATrackSimEventSelectionSvcCfg
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 eventSelector = acc.getPrimaryAndMerge(FPGATrackSimEventSelectionSvcCfg(flags)),
78 planes = getFirstStagePlanes(flags),
79 planes2 = getSecondStagePlanes(flags)
80 )
81
82 if flags.Trigger.FPGATrackSim.wrapperFileName and flags.Trigger.FPGATrackSim.wrapperFileName is not None:
83 alg.InputTool = acc.getPrimaryAndMerge(FPGATrackSimReadInputCfg(flags))
84 alg.SGInputTool = ""
85 else:
86 from ActsConfig.ActsGeometryConfig import ActsTrackingGeometryToolCfg
87 acc.getPrimaryAndMerge(ActsTrackingGeometryToolCfg(flags))
88 alg.InputTool = ""
89 from FPGATrackSimSGInput.FPGATrackSimSGInputConfig import FPGATrackSimSGInputToolCfg
90 alg.SGInputTool = acc.getPrimaryAndMerge(FPGATrackSimSGInputToolCfg(flags))
91 alg.SGInputTool.ReadOfflineClusters=False
92 alg.SGInputTool.ReadOfflineTracks=False
93
94 acc.addEventAlgo(alg)
95 return acc
96
97
98if __name__ == "__main__":
99 from AthenaConfiguration.AllConfigFlags import initConfigFlags
100 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
101 flags = initConfigFlags()
102 flags.addFlag("OutFileName", "MMTest")
103 flags.addFlag("KeyString", "strip,barrel,0")
104 flags.addFlag("nSlices", 6)
105 flags.addFlag("trim", 0.1)
106 flags.addFlag("globalTrim", 0)
107 flags.addFlag('doInsideOut', False)
108
109 from AthenaCommon.Logging import logging
110 log = logging.getLogger(__name__)
111
112 flags.fillFromArgs()
113
114 from FPGATrackSimConfTools import FPGATrackSimDataPrepConfig
115 flags = FPGATrackSimDataPrepConfig.FixITkMainPassFlags(flags)
116
117 flags.lock()
118
119 acc=MainServicesCfg(flags)
120 acc.store(open('FPGATrackSimMapMakerConfig.pkl','wb'))
121 acc.merge(FPGATrackSimMapMakerCfg(flags))
122 acc.merge(FPGATrackSimDataPrepConfig.FPGATrackSimDataPrepSetup(flags,runReco=False))
123
124
125 from AthenaConfiguration.Utils import setupLoggingLevels
126 setupLoggingLevels(flags, acc)
127
128 statusCode = acc.run()
129 assert statusCode.isSuccess() is True, "Application execution did not succeed"
130