ATLAS Offline Software
TrigInDetConfig.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 from AthenaCommon.Logging import logging
9 
10 
12  #Create IdentifiableCaches
13  acc = ComponentAccumulator()
14  InDet__CacheCreator=CompFactory.getComp("InDet::CacheCreator")
15  InDetCacheCreatorTrig = InDet__CacheCreator(name = "InDetCacheCreatorTrig",
16  TRT_DriftCircleKey = flags.Trigger.InDetTracking.TRT_DriftCircleCacheKey,
17  Pixel_ClusterKey = flags.Trigger.InDetTracking.PixelClusterCacheKey,
18  SCT_ClusterKey = flags.Trigger.InDetTracking.SCTClusterCacheKey,
19  SpacePointCachePix = flags.Trigger.InDetTracking.SpacePointCachePix,
20  SpacePointCacheSCT = flags.Trigger.InDetTracking.SpacePointCacheSCT,
21  SCTRDOCacheKey = flags.Trigger.InDetTracking.SCTRDOCacheKey,
22  SCTBSErrCacheKey = flags.Trigger.InDetTracking.SCTBSErrCacheKey,
23  SCTFlaggedCondCacheKey = flags.Trigger.InDetTracking.SCTFlaggedCondCacheKey,
24  PixRDOCacheKey = flags.Trigger.InDetTracking.PixRDOCacheKey,
25  PixBSErrCacheKey = flags.Trigger.InDetTracking.PixBSErrCacheKey,
26  TRTRDOCacheKey = flags.Trigger.InDetTracking.TRTRDOCacheKey)
27 
28  if not flags.Detector.GeometryTRT:
29  InDetCacheCreatorTrig.disableTRT = True
30 
31  acc.addEventAlgo( InDetCacheCreatorTrig )
32  return acc
33 
35  #Create IdentifiableCaches
36  acc = ComponentAccumulator()
37 
38  creator = CompFactory.ActsTrk.Cache.CreatorAlg(name="ActsCacheCreatorTrig",
39  PixelClustersCacheKey="ActsPixelClusterCache_Back",
40  StripClustersCacheKey="ActsStripClusterCache_Back",
41  PixelSpacePointCacheKey="ActsPixelSpacePointCache_Back",
42  StripSpacePointCacheKey="ActsStripSpacePointCache_Back",
43  StripOverlapSpacePointCacheKey="ActsStripOverlapSpacePointCache_Back")
44 
45  acc.addEventAlgo(creator)
46 
47  return acc
48 
49 
50 
51 
52 
53 @AccumulatorCache
54 def trigInDetFastTrackingCfg( inflags, roisKey="EMRoIs", signatureName='', patternMode='FTF', in_view=True ):
55 
56  log = logging.getLogger("trigInDetFastTrackingCfg")
57  from TrigInDetConfig.utils import getFlagsForActiveConfig
58  flags = getFlagsForActiveConfig(inflags, signatureName, log)
59 
60  """ Generates fast tracking config, it is a primary config function """
61 
62  from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
63 
64  seq = InnerTrackingTrigSequence.create(flags,
65  flags.Tracking.ActiveConfig.input_name,
66  rois = roisKey,
67  inView = "VDVInDetFTF" if in_view else None)
68  if patternMode=='FTF':
69  acc = seq.sequence("FastTrackFinder")
70  elif patternMode=="fastTracking":
71  acc = seq.sequence("offlinePattern")
72 
73  return acc
74 
75 
76 
77 
78 
79 @AccumulatorCache
80 def trigInDetLRTCfg(flags, LRTInputCollection, roisKey, in_view, extra_view_inputs=tuple()):
81  from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
82  viewname = "VDVInDetLRT" if in_view else None
83  seq = InnerTrackingTrigSequence.create(flags,
84  flags.Tracking.ActiveConfig.input_name,
85  rois = roisKey,
86  inView = viewname)
87  acc = ComponentAccumulator()
88  if in_view:
89  acc.addEventAlgo( CompFactory.AthViews.ViewDataVerifier(
90  name = "LRTInputVDV_"+viewname + "_" + flags.Tracking.ActiveConfig.input_name,
91  DataObjects = { ( 'TrigRoiDescriptorCollection' , f'StoreGateSvc+{roisKey}' ),
92  ( 'TrackCollection' , 'StoreGateSvc+HLT_IDTrkTrack_FS_FTF' ),
93  } | set(extra_view_inputs) ) )
94 
95  #need to make sure the cache containers are available
96  acc.merge(seq.viewDataVerifier(viewname))
97  acc.merge(seq.dataPreparation())
98  acc.merge(seq.spacePointFormation())
99 
100  acc.merge(seq.fastTrackFinder(inputTracksName = LRTInputCollection))
101 
102  return acc
103 
104 
105 
106 
107 
108 
111 
112 @AccumulatorCache
113 def trigInDetPrecisionTrackingCfg( inflags, rois, signatureName, in_view=True ):
114 
115  """ Generates precision tracking config, it is a primary config function """
116 
117  acc = ComponentAccumulator()
118  log = logging.getLogger("trigInDetPrecisionTrackingCfg")
119  from TrigInDetConfig.utils import getFlagsForActiveConfig
120  flags = getFlagsForActiveConfig(inflags, signatureName, log)
121 
122  if in_view:
123 
124  verifier = CompFactory.AthViews.ViewDataVerifier( name = 'VDVInDetPrecision'+flags.Tracking.ActiveConfig.input_name,
125  DataObjects= {('xAOD::EventInfo', 'StoreGateSvc+EventInfo'),
126  ( 'TrigRoiDescriptorCollection' , f'StoreGateSvc+{rois}' ),
127  ( 'TagInfo', 'DetectorStore+ProcessingTags' ),
128  ( ('ActsTrk::TrackContainer' if "Acts" in flags.Tracking.ActiveConfig.trkTracks_FTF else 'TrackCollection'), flags.Tracking.ActiveConfig.trkTracks_FTF )} )
129 
130  acc.addEventAlgo(verifier)
131 
132  from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
133 
134  seq = InnerTrackingTrigSequence.create(flags,
135  flags.Tracking.ActiveConfig.input_name,
136  rois = flags.Tracking.ActiveConfig.roi,
137  inView = verifier.getName() if in_view else '')
138 
139  acc.merge(seq.sequenceAfterPattern(rois = rois))
140 
141  return acc
142 
143 
144 
145 
146 
147 def trigInDetVertexingCfg(flags, inputTracks, outputVtx):
148 
149  acc = ComponentAccumulator()
150 
151  acc.addEventAlgo( CompFactory.AthViews.ViewDataVerifier(
152  name = "VtxVDV_" + flags.Tracking.ActiveConfig.input_name,
153  DataObjects = {
154  ( 'ActsGeometryContext' , 'StoreGateSvc+ActsAlignment' )
155  }
156  ))
157 
158  from InDetConfig.InDetPriVxFinderConfig import InDetTrigPriVxFinderCfg
159  acc.merge(InDetTrigPriVxFinderCfg(flags, inputTracks = inputTracks, outputVtx =outputVtx))
160 
161  return acc
162 
163 
164 
165 
166 if __name__ == "__main__":
167  from AthenaConfiguration.AllConfigFlags import initConfigFlags
168  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
169  ComponentAccumulator.debugMode = "trackCA trackPublicTool trackEventAlgo trackCondAlgo trackPrivateTool"
170  flags = initConfigFlags()
171  flags.Input.Files = defaultTestFiles.RAW_RUN2
172  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
173  flags.lock()
174  # this configuration is not runable, the test checks if there is no mistake in python scripts above
175  # output can be used by experts to check actual configuration (e.g. here we configure to run on RAW and it should be reflected in settings)
176  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
177  acc = MainServicesCfg( flags )
178  roisKey = "ElectronRoIs"
179 
180  flags = flags.cloneAndReplace("Tracking.ActiveConfig", "Trigger.InDetTracking.electron")
181  acc.merge( trigInDetFastTrackingCfg( flags, roisKey=roisKey, signatureName="electron" ) )
182  acc.merge( trigInDetPrecisionTrackingCfg( flags, rois=roisKey, signatureName="electron", in_view=True) )
183  acc.merge( trigInDetVertexingCfg( flags, inputTracks=flags.Tracking.ActiveConfig.tracks_FTF, outputVtx="testVtx") )
184 
185 
186  acc.printConfig(withDetails=True, summariseProps=True)
187  acc.store( open("test.pkl", "wb") )
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrigInDetConfig.trigInDetLRTCfg
def trigInDetLRTCfg(flags, LRTInputCollection, roisKey, in_view, extra_view_inputs=tuple())
Definition: TrigInDetConfig.py:80
python.InDetPriVxFinderConfig.InDetTrigPriVxFinderCfg
ComponentAccumulator InDetTrigPriVxFinderCfg(flags, str inputTracks, str outputVtx, str name="InDetTrigPriVxFinder", **kwargs)
Definition: InDetPriVxFinderConfig.py:43
python.TrigInDetConfig.trigInDetPrecisionTrackingCfg
def trigInDetPrecisionTrackingCfg(inflags, rois, signatureName, in_view=True)
precision tracking
Definition: TrigInDetConfig.py:113
python.TrigInDetConfig.trigInDetFastTrackingCfg
def trigInDetFastTrackingCfg(inflags, roisKey="EMRoIs", signatureName='', patternMode='FTF', in_view=True)
Definition: TrigInDetConfig.py:54
python.utils.getFlagsForActiveConfig
AthConfigFlags getFlagsForActiveConfig(AthConfigFlags flags, str config_name, logging.Logger log)
Definition: Trigger/TrigTools/TrigInDetConfig/python/utils.py:9
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
python.TrigInDetConfig.ActsIDCCacheCreatorCfg
def ActsIDCCacheCreatorCfg(flags)
Definition: TrigInDetConfig.py:34
python.TrigInDetConfig.trigInDetVertexingCfg
def trigInDetVertexingCfg(flags, inputTracks, outputVtx)
Definition: TrigInDetConfig.py:147
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TrigInDetConfig.InDetIDCCacheCreatorCfg
def InDetIDCCacheCreatorCfg(flags)
Definition: TrigInDetConfig.py:11