ATLAS Offline Software
FPGATrackSimDataPrepConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from AthenaCommon.Logging import AthenaLogger
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 
7 def getBaseName(flags):
8  if (not (flags.Trigger.FPGATrackSim.baseName == '')):
9  return flags.Trigger.FPGATrackSim.baseName
10  elif (flags.Trigger.FPGATrackSim.region == 0):
11  return 'eta0103phi0305'
12  elif (flags.Trigger.FPGATrackSim.region == 1):
13  return 'eta0709phi0305'
14  elif (flags.Trigger.FPGATrackSim.region == 2):
15  return 'eta1214phi0305'
16  elif (flags.Trigger.FPGATrackSim.region == 3):
17  return 'eta2022phi0305'
18  elif (flags.Trigger.FPGATrackSim.region == 4):
19  return 'eta3234phi0305'
20  elif (flags.Trigger.FPGATrackSim.region == 5):
21  return 'eta0103phi1113'
22  elif (flags.Trigger.FPGATrackSim.region == 6):
23  return 'eta0103phi1921'
24  elif (flags.Trigger.FPGATrackSim.region == 7):
25  return 'eta0103phi3436'
26  else:
27  return 'default'
28 
30  result=ComponentAccumulator()
31  FPGATrackSimRawLogic = CompFactory.FPGATrackSimRawToLogicalHitsTool()
32  FPGATrackSimRawLogic.SaveOptional = 2
33  if (flags.Trigger.FPGATrackSim.ActiveConfig.sampleType == 'skipTruth'):
34  FPGATrackSimRawLogic.SaveOptional = 1
35  FPGATrackSimRawLogic.TowersToMap = [0] # TODO TODO why is this hardcoded?
36  FPGATrackSimRawLogic.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimEventSelectionCfg(flags))
37  FPGATrackSimRawLogic.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimMappingCfg(flags))
38  result.addPublicTool(FPGATrackSimRawLogic, primary=True)
39  return result
40 
42  result=ComponentAccumulator()
43  SpacePointTool = CompFactory.FPGATrackSimSpacePointsTool()
44  SpacePointTool.Filtering = flags.Trigger.FPGATrackSim.ActiveConfig.spacePointFiltering
45  SpacePointTool.FilteringClosePoints = False
46  SpacePointTool.PhiWindow = 0.004
47  SpacePointTool.Duplication = True
48  result.addPublicTool(SpacePointTool, primary=True)
49  return result
50 
51 
53  newFlags = flags.cloneAndReplace("Trigger.FPGATrackSim.ActiveConfig", "Trigger.FPGATrackSim." + flags.Trigger.FPGATrackSim.algoTag)
54  return newFlags
55 
56 
58  result=ComponentAccumulator()
59  FPGATrackSimWriteOutput = CompFactory.FPGATrackSimOutputHeaderTool("FPGATrackSimWriteOutputDataPrep")
60  FPGATrackSimWriteOutput.InFileName = ["test.root"]
61  FPGATrackSimWriteOutput.OutputTreeName = "FPGATrackSimDataPrepTree"
62  # RECREATE means that that this tool opens the file.
63  # HEADER would mean that something else (e.g. THistSvc) opens it and we just add the object.
64  FPGATrackSimWriteOutput.RWstatus = "HEADER"
65  FPGATrackSimWriteOutput.THistSvc = CompFactory.THistSvc()
66  result.addPublicTool(FPGATrackSimWriteOutput, primary=True)
67  return result
68 
69 def FPGAConversionAlgCfg(inputFlags, name = 'FPGAConversionAlg', stage = '', **kwargs):
70 
71  flags = prepareFlagsForFPGATrackSimDataPrepAlg(inputFlags)
72 
73  result=ComponentAccumulator()
74  from StripGeoModelXml.ITkStripGeoModelConfig import ITkStripReadoutGeometryCfg
75  result.merge(ITkStripReadoutGeometryCfg(flags))
76 
77  kwargs.setdefault("FPGATrackSimClusterKey", "FPGAClusters%s" %(stage))
78  kwargs.setdefault("FPGATrackSimHitKey", "FPGAHits%s" %(stage))
79  kwargs.setdefault("FPGATrackSimHitInRoadsKey", "FPGAHitsInRoads%s" %(stage))
80  kwargs.setdefault("FPGATrackSimRoadKey", "FPGARoads%s" %(stage))
81  kwargs.setdefault("FPGATrackSimTrackKey", "FPGATracks%s" %(stage))
82  kwargs.setdefault("xAODPixelClusterFromFPGAClusterKey", "xAODPixelClusters%sFromFPGACluster" %(stage))
83  kwargs.setdefault("xAODStripClusterFromFPGAClusterKey", "xAODStripClusters%sFromFPGACluster" %(stage))
84  kwargs.setdefault("xAODStripSpacePointFromFPGAKey", "xAODStripSpacePoints%sFromFPGA" %(stage))
85  kwargs.setdefault("xAODPixelSpacePointFromFPGAKey", "xAODPixelSpacePoints%sFromFPGA" %(stage))
86  kwargs.setdefault("xAODPixelClusterFromFPGAHitKey", "xAODPixelClusters%sFromFPGAHit" %(stage))
87  kwargs.setdefault("xAODStripClusterFromFPGAHitKey", "xAODStripClusters%sFromFPGAHit" %(stage))
88  kwargs.setdefault("ActsProtoTrackFromFPGARoadKey", "ActsProtoTracks%sFromFPGARoad" %(stage))
89  kwargs.setdefault("ActsProtoTrackFromFPGATrackKey", "ActsProtoTracks%sFromFPGATrack" %(stage))
90  kwargs.setdefault("doHits", True)
91  kwargs.setdefault("doClusters", True)
92  kwargs.setdefault("doActsTrk", False)
93  kwargs.setdefault("ClusterConverter", result.popToolsAndMerge(FPGAClusterConverterCfg(flags)))
94  kwargs.setdefault("ActsTrkConverter", result.popToolsAndMerge(FPGAActsTrkConverterCfg(flags)))
95 
96  result.addEventAlgo(CompFactory.FPGAConversionAlgorithm(name, **kwargs))
97 
98  return result
99 
101  result=ComponentAccumulator()
102  from SiLorentzAngleTool.ITkStripLorentzAngleConfig import ITkStripLorentzAngleToolCfg
103  FPGAClusterConverter = CompFactory.FPGAClusterConverter(LorentzAngleTool=result.popToolsAndMerge(ITkStripLorentzAngleToolCfg(flags)))
104  result.setPrivateTools(FPGAClusterConverter)
105 
106  return result
107 
109  result=ComponentAccumulator()
110  FPGAActsTrkConverter = CompFactory.FPGAActsTrkConverter()
111  result.setPrivateTools(FPGAActsTrkConverter)
112 
113  return result
114 
115 
116 def WriteToAOD(flags, stage = '',finalTrackParticles = ''): # store xAOD containers in AOD file
117  result = ComponentAccumulator()
118  from xAODMetaDataCnv.InfileMetaDataConfig import SetupMetaDataForStreamCfg
119  from OutputStreamAthenaPool.OutputStreamConfig import outputStreamName
120  from AthenaConfiguration.Enums import MetadataCategory
121 
122  result.merge( SetupMetaDataForStreamCfg( flags,"AOD",
123  createMetadata=[
124  MetadataCategory.ByteStreamMetaData,
125  MetadataCategory.LumiBlockMetaData,
126  MetadataCategory.TruthMetaData,
127  MetadataCategory.IOVMetaData,],)
128  )
129  log.info("AOD ItemList: %s", result.getEventAlgo(outputStreamName("AOD")).ItemList)
130  log.info("AOD MetadataItemList: %s", result.getEventAlgo(outputStreamName("AOD")).MetadataItemList)
131  log.info("---------- Configured AOD writing")
132 
133  from OutputStreamAthenaPool.OutputStreamConfig import addToAOD
134  toAOD = []
135  toAOD += [f"xAOD::PixelClusterContainer#xAODPixelClusters{stage}FromFPGACluster",f"xAOD::PixelClusterAuxContainer#xAODPixelClusters{stage}FromFPGAClusterAux.",
136  f"xAOD::StripClusterContainer#xAODStripClusters{stage}FromFPGACluster",f"xAOD::StripClusterAuxContainer#xAODStripClusters{stage}FromFPGAClusterAux.",
137  f"xAOD::TrackParticleContainer#{finalTrackParticles}",f"xAOD::TrackParticleAuxContainer#{finalTrackParticles}Aux.",
138  f"xAOD::SpacePointContainer#xAODPixelSpacePoints{stage}FromFPGA",f"xAOD::SpacePointAuxContainer#xAODPixelSpacePoints{stage}FromFPGAAux.-measurements",
139  f"xAOD::SpacePointContainer#xAODStripSpacePoints{stage}FromFPGA",f"xAOD::SpacePointAuxContainer#xAODStripSpacePoints{stage}FromFPGAAux.-measurements.-sctSpacePointLink",
140  ]
141 
142  result.merge(addToAOD(flags, toAOD))
143 
144  return result
145 
146 
148  result=ComponentAccumulator()
149  eventSelector = CompFactory.FPGATrackSimEventSelectionSvc()
150  eventSelector.regions = "HTT/TrigHTTMaps/V1/map_file/slices_v01_Jan21.txt"
151  eventSelector.regionID = flags.Trigger.FPGATrackSim.region
152  eventSelector.sampleType = flags.Trigger.FPGATrackSim.sampleType
153  eventSelector.withPU = False
154  result.addService(eventSelector, create=True, primary=True)
155  return result
156 
158  result=ComponentAccumulator()
159 
160  mappingSvc = CompFactory.FPGATrackSimMappingSvc()
161  mappingSvc.mappingType = "FILE"
162  mappingSvc.rmap = flags.Trigger.FPGATrackSim.mapsDir+"/"+getBaseName(flags)+".rmap" # we need more configurability here i.e. file choice should depend on some flag
163  mappingSvc.subrmap = flags.Trigger.FPGATrackSim.mapsDir+"/"+getBaseName(flags)+".subrmap" # presumably also here we want to be able to change the slices definition file
164  mappingSvc.pmap = flags.Trigger.FPGATrackSim.mapsDir+"/pmap"
165  mappingSvc.modulemap = flags.Trigger.FPGATrackSim.mapsDir+"/moduleidmap"
166  mappingSvc.radiiFile = flags.Trigger.FPGATrackSim.mapsDir + "/"+getBaseName(flags)+"_radii.txt"
167  mappingSvc.NNmap = ""
168  mappingSvc.layerOverride = []
169  result.addService(mappingSvc, create=True, primary=True)
170  return result
171 
172 
174  result=ComponentAccumulator()
175  InputTool = CompFactory.FPGATrackSimInputHeaderTool(name="FPGATrackSimReadInput",
176  InFileName = flags.Trigger.FPGATrackSim.wrapperFileName)
177  result.addPublicTool(InputTool, primary=True)
178  return result
179 
181  result=ComponentAccumulator()
182  InputTool2 = CompFactory.FPGATrackSimReadRawRandomHitsTool(name="FPGATrackSimReadInput2", InFileName = flags.Trigger.FPGATrackSim.wrapperFileName2)
183  result.addPublicTool(InputTool2, primary=True)
184  return result
185 
187  result=ComponentAccumulator()
188  HitFilteringTool = CompFactory.FPGATrackSimHitFilteringTool()
189  HitFilteringTool.barrelStubDphiCut = 3.0
190  HitFilteringTool.doRandomRemoval = False
191  HitFilteringTool.doStubs = False
192  HitFilteringTool.endcapStubDphiCut = 1.5
193  HitFilteringTool.pixelClusRmFrac = 0
194  HitFilteringTool.pixelHitRmFrac = 0
195  HitFilteringTool.stripClusRmFrac = 0
196  HitFilteringTool.stripHitRmFrac = 0
197  HitFilteringTool.useNstrips = False
198  result.addPublicTool(HitFilteringTool, primary=True)
199  return result
200 
201 
202 
204 
205  flags = prepareFlagsForFPGATrackSimDataPrepAlg(inputFlags)
206 
207  result=ComponentAccumulator()
208 
209  theFPGATrackSimDataPrepAlg=CompFactory.FPGATrackSimDataPrepAlg()
210  theFPGATrackSimDataPrepAlg.HitFiltering = flags.Trigger.FPGATrackSim.ActiveConfig.hitFiltering
211  theFPGATrackSimDataPrepAlg.writeOutputData = flags.Trigger.FPGATrackSim.ActiveConfig.writeOutputData
212  theFPGATrackSimDataPrepAlg.Clustering = flags.Trigger.FPGATrackSim.clustering
213  theFPGATrackSimDataPrepAlg.eventSelector = result.getPrimaryAndMerge(FPGATrackSimEventSelectionCfg(flags))
214  theFPGATrackSimDataPrepAlg.runOnRDO = not flags.Trigger.FPGATrackSim.wrapperFileName
215 
216  FPGATrackSimMaping = result.getPrimaryAndMerge(FPGATrackSimMappingCfg(flags))
217  theFPGATrackSimDataPrepAlg.FPGATrackSimMapping = FPGATrackSimMaping
218 
219  theFPGATrackSimDataPrepAlg.RawToLogicalHitsTool = result.getPrimaryAndMerge(FPGATrackSimRawLogicCfg(flags))
220 
221  if flags.Trigger.FPGATrackSim.wrapperFileName and flags.Trigger.FPGATrackSim.wrapperFileName is not None:
222  theFPGATrackSimDataPrepAlg.InputTool = result.getPrimaryAndMerge(FPGATrackSimReadInputCfg(flags))
223  if flags.Trigger.FPGATrackSim.wrapperFileName2 and flags.Trigger.FPGATrackSim.wrapperFileName2 is not None:
224  theFPGATrackSimDataPrepAlg.InputTool2 = result.getPrimaryAndMerge(FPGATrackSimReadInput2Cfg(flags))
225  theFPGATrackSimDataPrepAlg.SecondInputToolN = flags.Trigger.FPGATrackSim.secondInputToolN
226  theFPGATrackSimDataPrepAlg.SGInputTool = ""
227  else:
228  from ActsConfig.ActsGeometryConfig import ActsTrackingGeometryToolCfg
229  result.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags))
230  theFPGATrackSimDataPrepAlg.InputTool = ""
231  theFPGATrackSimDataPrepAlg.InputTool2 = ""
232  from FPGATrackSimSGInput.FPGATrackSimSGInputConfig import FPGATrackSimSGInputToolCfg
233  theFPGATrackSimDataPrepAlg.SGInputTool = result.getPrimaryAndMerge(FPGATrackSimSGInputToolCfg(flags))
234 
235  theFPGATrackSimDataPrepAlg.SpacePointTool = result.getPrimaryAndMerge(FPGATrackSimSpacePointsToolCfg(flags))
236 
237  theFPGATrackSimDataPrepAlg.HitFilteringTool = result.getPrimaryAndMerge(FPGATrackSimHitFilteringToolCfg(flags))
238 
239  theFPGATrackSimDataPrepAlg.ClusteringTool = CompFactory.FPGATrackSimClusteringTool()
240  theFPGATrackSimDataPrepAlg.OutputTool = result.getPrimaryAndMerge(FPGATrackSimDataPrepOutputCfg(flags))
241 
242  # Create SPRoadFilterTool if spacepoints are turned on. TODO: make things configurable?
243  if flags.Trigger.FPGATrackSim.spacePoints:
244  theFPGATrackSimDataPrepAlg.Spacepoints = True
245 
246  from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmConfig import FPGATrackSimLogicalHitsProcessAlgMonitoringCfg
247  theFPGATrackSimDataPrepAlg.MonTool = result.getPrimaryAndMerge(FPGATrackSimLogicalHitsProcessAlgMonitoringCfg(flags))
248 
249  result.addEventAlgo(theFPGATrackSimDataPrepAlg)
250 
251  return result
252 
253 
254 log = AthenaLogger(__name__)
255 
256 def FPGATrackSimDataPrepConnectToFastTracking(flags,FinalTracks="FPGADataPrep"):
257  result = ComponentAccumulator()
258  ACTSTracks="FPGADataPrepActsTracks"
259 
260  # ACTS Seeding
261  from ActsConfig.ActsSeedingConfig import ActsStripSeedingAlgCfg, ActsPixelSeedingAlgCfg
262  result.merge(ActsStripSeedingAlgCfg(flags, name="FPGADataPrepActsStripSeedingAlg",
263  InputSpacePoints=['xAODStripSpacePoints_1stFromFPGA'],
264  OutputSeeds="FPGADataPrepActsStripSeeds",
265  OutputEstimatedTrackParameters="FPGAActsStripEstimatedTrackParams"))
266 
267  result.merge(ActsPixelSeedingAlgCfg(flags, name="FPGADataPrepActsPixelSeedingAlg",
268  InputSpacePoints=['xAODPixelSpacePoints_1stFromFPGA'],
269  OutputSeeds="FPGADataPrepActsPixelSeeds",
270  OutputEstimatedTrackParameters="FPGAActsPixelEstimatedTrackParams"))
271 
272  # ACTS Tracking
273  from ActsConfig.ActsTrackFindingConfig import ActsMainTrackFindingAlgCfg
274  result.merge(ActsMainTrackFindingAlgCfg(flags, name="FPGADataPrepActsTrackFindingAlg",
275  SeedContainerKeys=['FPGADataPrepActsPixelSeeds','FPGADataPrepActsStripSeeds'],
276  EstimatedTrackParametersKeys=['FPGAActsPixelEstimatedTrackParams','FPGAActsStripEstimatedTrackParams'],
277  UncalibratedMeasurementContainerKeys=["xAODPixelClusters_1stFromFPGACluster","xAODStripClusters_1stFromFPGACluster"],
278  ACTSTracksLocation=ACTSTracks))
279 
280  # Track to Truth association and validation
281  from ActsConfig.ActsTruthConfig import ActsTruthParticleHitCountAlgCfg, ActsPixelClusterToTruthAssociationAlgCfg,ActsStripClusterToTruthAssociationAlgCfg
282  result.merge(ActsPixelClusterToTruthAssociationAlgCfg(flags,
283  name="FPGADataPrepActsPixelClusterToTruthAssociationAlg",
284  InputTruthParticleLinks="xAODFPGATruthLinks",
285  AssociationMapOut="ITkFPGAPixelClustersToTruthParticles",
286  Measurements="xAODPixelClusters_1stFromFPGACluster"))
287 
288  result.merge(ActsStripClusterToTruthAssociationAlgCfg(flags,
289  name="FPGADataPrepActsStripClusterToTruthAssociationAlg",
290  InputTruthParticleLinks="xAODFPGATruthLinks",
291  AssociationMapOut="ITkFPGAStripClustersToTruthParticles",
292  Measurements="xAODStripClusters_1stFromFPGACluster"))
293 
294  result.merge(ActsTruthParticleHitCountAlgCfg(flags,
295  name="FPGADataPrepActsTruthParticleHitCountAlg",
296  PixelClustersToTruthAssociationMap="ITkFPGAPixelClustersToTruthParticles",
297  StripClustersToTruthAssociationMap="ITkFPGAStripClustersToTruthParticles",
298  TruthParticleHitCountsOut="FPGATruthParticleHitCounts"))
299 
300  from ActsConfig.ActsTruthConfig import ActsTrackToTruthAssociationAlgCfg, ActsTrackFindingValidationAlgCfg
301  acts_tracks=f"{flags.Tracking.ActiveConfig.extension}Tracks" if not flags.Acts.doAmbiguityResolution else f"{flags.Tracking.ActiveConfig.extension}ResolvedTracks"
302  result.merge(ActsTrackToTruthAssociationAlgCfg(flags,
303  name=f"{acts_tracks}FPGADataPrepTrackToTruthAssociationAlg",
304  PixelClustersToTruthAssociationMap="ITkFPGAPixelClustersToTruthParticles",
305  StripClustersToTruthAssociationMap="ITkFPGAStripClustersToTruthParticles",
306  ACTSTracksLocation=ACTSTracks,
307  AssociationMapOut=acts_tracks+"FPGAToTruthParticleAssociation"))
308 
309 
310  result.merge(ActsTrackFindingValidationAlgCfg(flags,
311  name=f"{acts_tracks}FPGADataPrepTrackFindingValidationAlg",
312  TrackToTruthAssociationMap=acts_tracks+"FPGAToTruthParticleAssociation",
313  TruthParticleHitCounts="FPGATruthParticleHitCounts"
314  ))
315 
316 
318  prefix = flags.Tracking.ActiveConfig.extension
319  from ActsConfig.ActsTrackFindingConfig import ActsTrackToTrackParticleCnvAlgCfg
320  result.merge(ActsTrackToTrackParticleCnvAlgCfg(flags, name=f"{prefix}FPGADataPrepActsTrackToTrackParticleCnvAlg",
321  ACTSTracksLocation=[ACTSTracks,],
322  TrackParticlesOutKey=f"{FinalTracks}TrackParticles"))
323 
324  from ActsConfig.ActsTruthConfig import ActsTrackParticleTruthDecorationAlgCfg
325  result.merge(ActsTrackParticleTruthDecorationAlgCfg(flags, name=f"{prefix}FPGADataPrepActsTrackParticleTruthDecorationAlg",
326  TrackToTruthAssociationMaps=[acts_tracks+"FPGAToTruthParticleAssociation"],
327  TrackParticleContainerName=f"{FinalTracks}TrackParticles",
328  TruthParticleHitCounts="FPGATruthParticleHitCounts",
329  ComputeTrackRecoEfficiency=True))
330 
331  return result
332 
333 
335  from AthenaConfiguration.AllConfigFlags import initConfigFlags
336  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
337 
338 
339  FinalDataPrepTrackChainxAODTracksKeyPrefix="FPGADataPrep"
340 
341  flags = initConfigFlags()
342 
343  from AthenaConfiguration.TestDefaults import defaultGeometryTags
344  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
345 
346 
348  flags.Detector.EnableCalo = False
349 
350  # ensure that the xAOD SP and cluster containers are available
351  flags.Tracking.ITkMainPass.doAthenaToActsSpacePoint=True
352  flags.Tracking.ITkMainPass.doAthenaToActsCluster=True
353 
354  flags.Acts.doRotCorrection = False
355 
356 
358  flags.Detector.EnableITkPixel=True
359  flags.Detector.EnableITkStrip=True
360 
361  flags.Tracking.ITkMainPass.doActsSeed=True
362  flags.Tracking.ITkMainPass.doActsTrack = False # when set to True it seems to be causing issues related to TrackToTruthAssociation. To be investigated...
363  flags.Tracking.doITkFastTracking=False # turn to True to enable Fast Tracking chain
364 
365 
367  from InDetTrackPerfMon.InDetTrackPerfMonFlags import initializeIDTPMConfigFlags, initializeIDTPMTrkAnaConfigFlags
368  flags = initializeIDTPMConfigFlags(flags)
369 
370  flags.PhysVal.IDTPM.outputFilePrefix = "myIDTPM_CA"
371  flags.PhysVal.IDTPM.plotsDefFileList = "InDetTrackPerfMon/PlotsDefFileList_default.txt" # default value - not needed
372  flags.PhysVal.IDTPM.plotsCommonValuesFile = "InDetTrackPerfMon/PlotsDefCommonValues.json" # default value - not needed
373  flags.PhysVal.OutputFileName = flags.PhysVal.IDTPM.outputFilePrefix + '.HIST.root' # automatically set in IDTPM config - not needed
374  flags.Output.doWriteAOD_IDTPM = True
375  flags.Output.AOD_IDTPMFileName = flags.PhysVal.IDTPM.outputFilePrefix + '.AOD_IDTPM.pool.root' # automatically set in IDTPM config - not needed
376  flags.PhysVal.IDTPM.trkAnaCfgFile = "InDetTrackPerfMon/EFTrkAnaConfig_example.json"
377 
378  flags = initializeIDTPMTrkAnaConfigFlags(flags)
379 
380  flags.PhysVal.IDTPM.TrkAnaEF.TrigTrkKey = f"{FinalDataPrepTrackChainxAODTracksKeyPrefix}TrackParticles"
381  flags.PhysVal.IDTPM.TrkAnaDoubleRatio.TrigTrkKey = f"{FinalDataPrepTrackChainxAODTracksKeyPrefix}TrackParticles"
382 
383  flags.PhysVal.doExample = False
384 
385 
386  flags.Concurrency.NumThreads=1
387  flags.Scheduler.ShowDataDeps=True
388  flags.Debug.DumpEvtStore=False # Set to Truth to enable Event Store printouts
389  # flags.Exec.DebugStage="exec" # useful option to debug the execution of the job - we want it commented out for production
390  flags.fillFromArgs()
391  if isinstance(flags.Trigger.FPGATrackSim.wrapperFileName, str):
392  log.info("wrapperFile is string, converting to list")
393  flags.Trigger.FPGATrackSim.wrapperFileName = [flags.Trigger.FPGATrackSim.wrapperFileName]
394  flags.Input.Files = lambda f: [f.Trigger.FPGATrackSim.wrapperFileName]
395 
396  flags.lock()
397  flags = flags.cloneAndReplace("Tracking.ActiveConfig", "Tracking.MainPass", keepOriginal=True)
398  flags = flags.cloneAndReplace("Tracking.ActiveConfig", "Tracking.ITkMainPass", keepOriginal=True)
399  flags.dump()
400 
401  acc=MainServicesCfg(flags)
402  acc.addService(CompFactory.THistSvc(Output = [f"EXPERT DATAFILE='{flags.Trigger.FPGATrackSim.outputMonitorFile}', OPT='RECREATE'"]))
403  acc.addService(CompFactory.THistSvc(Output = ["FPGATRACKSIMOUTPUT DATAFILE='dataprep.root', OPT='RECREATE'"]))
404 
405 
406  if not flags.Trigger.FPGATrackSim.wrapperFileName:
407  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
408  acc.merge(PoolReadCfg(flags))
409 
410  if flags.Input.isMC:
411  from xAODTruthCnv.xAODTruthCnvConfig import GEN_AOD2xAODCfg
412  acc.merge(GEN_AOD2xAODCfg(flags))
413 
414  from JetRecConfig.JetRecoSteering import addTruthPileupJetsToOutputCfg # TO DO: check if this is indeed necessary for pileup samples
415  acc.merge(addTruthPileupJetsToOutputCfg(flags))
416 
417  if flags.Detector.EnableCalo:
418  from CaloRec.CaloRecoConfig import CaloRecoCfg
419  acc.merge(CaloRecoCfg(flags))
420 
421  if not flags.Reco.EnableTrackOverlay:
422  from InDetConfig.TrackRecoConfig import InDetTrackRecoCfg
423  acc.merge(InDetTrackRecoCfg(flags))
424 
425  if flags.Trigger.FPGATrackSim.connectToToITkTracking: # no point in running this if the seeding/tracking for FPGA SPs is off
426  from InDetConfig.ITkTrackRecoConfig import ITkTrackRecoCfg
427  acc.merge(ITkTrackRecoCfg(flags))
428 
429  # Use the imported configuration function for the data prep algorithm.
430  acc.merge(FPGATrackSimDataPrepAlgCfg(flags))
431 
432  if flags.Trigger.FPGATrackSim.doEDMConversion:
433  acc.merge(FPGAConversionAlgCfg(flags, name = 'FPGAConversionAlg_1st', stage = '_1st', doActsTrk=False, doSP = flags.Trigger.FPGATrackSim.spacePoints))
434  if flags.Trigger.FPGATrackSim.convertUnmappedHits: acc.merge(FPGAConversionAlgCfg(flags, name = 'FPGAConversionAlgUnmapped_1st', stage = 'Unmapped_1st', doClusters = False))
435 
436  if flags.Trigger.FPGATrackSim.connectToToITkTracking:
437  acc.merge(FPGATrackSimDataPrepConnectToFastTracking(flags, FinalTracks=FinalDataPrepTrackChainxAODTracksKeyPrefix))
438 
439  if flags.Trigger.FPGATrackSim.writeToAOD:
440  acc.merge(WriteToAOD(flags, stage = '_1st',))
441  if flags.Trigger.FPGATrackSim.spacePoints : acc.merge(WriteToAOD(flags,
442  stage = '_1st',
443  finalTrackParticles=f"{FinalDataPrepTrackChainxAODTracksKeyPrefix}TrackParticles"))
444 
445  # Printout for various FPGA-related objects
446  from FPGATrackSimReporting.FPGATrackSimReportingConfig import FPGATrackSimReportingCfg
447  acc.merge(FPGATrackSimReportingCfg(flags,perEventReports=True,isDataPrep=True))
448 
449  # IDTPM running
450  from InDetTrackPerfMon.InDetTrackPerfMonConfig import InDetTrackPerfMonCfg
451  acc.merge( InDetTrackPerfMonCfg(flags) )
452 
453  acc.store(open('AnalysisConfig.pkl','wb'))
454 
455  statusCode = acc.run(flags.Exec.MaxEvents)
456  assert statusCode.isSuccess() is True, "Application execution did not succeed"
457 
458 
459 if __name__ == "__main__":
AthenaPoolExample_WriteCond.outputStreamName
string outputStreamName
Definition: AthenaPoolExample_WriteCond.py:21
python.FPGATrackSimDataPrepConfig.WriteToAOD
def WriteToAOD(flags, stage='', finalTrackParticles='')
Definition: FPGATrackSimDataPrepConfig.py:116
python.FPGATrackSimDataPrepConfig.FPGATrackSimDataPrepAlgCfg
def FPGATrackSimDataPrepAlgCfg(inputFlags)
Definition: FPGATrackSimDataPrepConfig.py:203
python.ITkTrackRecoConfig.ITkTrackRecoCfg
ComponentAccumulator ITkTrackRecoCfg(flags)
Main ITk tracking config #####################.
Definition: ITkTrackRecoConfig.py:533
python.CaloRecoConfig.CaloRecoCfg
def CaloRecoCfg(flags, clustersname=None)
Definition: CaloRecoConfig.py:9
python.ITkStripLorentzAngleConfig.ITkStripLorentzAngleToolCfg
def ITkStripLorentzAngleToolCfg(flags, name="ITkStripLorentzAngleTool", **kwargs)
Definition: ITkStripLorentzAngleConfig.py:10
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
ActsSeedingConfig.ActsPixelSeedingAlgCfg
ComponentAccumulator ActsPixelSeedingAlgCfg(flags, str name='ActsPixelSeedingAlg', **kwargs)
Definition: ActsSeedingConfig.py:254
python.FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg
def FPGAConversionAlgCfg(inputFlags, name='FPGAConversionAlg', stage='', **kwargs)
Definition: FPGATrackSimDataPrepConfig.py:69
python.FPGATrackSimDataPrepConfig.FPGATrackSimReadInput2Cfg
def FPGATrackSimReadInput2Cfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:180
xAODTruthCnvConfig.GEN_AOD2xAODCfg
def GEN_AOD2xAODCfg(flags, name="GEN_AOD2xAOD", **kwargs)
Definition: xAODTruthCnvConfig.py:15
ActsTruthConfig.ActsTruthParticleHitCountAlgCfg
ComponentAccumulator ActsTruthParticleHitCountAlgCfg(flags, str name='ActsTruthParticleHitCountAlg', **dict kwargs)
Definition: ActsTruthConfig.py:69
ActsTruthConfig.ActsTrackToTruthAssociationAlgCfg
ComponentAccumulator ActsTrackToTruthAssociationAlgCfg(flags, str name='ActsTracksToTruthAssociationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:50
python.FPGATrackSimDataPrepConfig.FPGATrackSimSpacePointsToolCfg
def FPGATrackSimSpacePointsToolCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:41
python.FPGATrackSimDataPrepConfig.FPGAClusterConverterCfg
def FPGAClusterConverterCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:100
ActsTruthConfig.ActsPixelClusterToTruthAssociationAlgCfg
ComponentAccumulator ActsPixelClusterToTruthAssociationAlgCfg(flags, str name='ActsPixelClusterToTruthAssociationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:20
python.FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg
def FPGATrackSimEventSelectionCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:147
ActsSeedingConfig.ActsStripSeedingAlgCfg
ComponentAccumulator ActsStripSeedingAlgCfg(flags, str name='ActsStripSeedingAlg', **kwargs)
Definition: ActsSeedingConfig.py:318
ActsTruthConfig.ActsTrackFindingValidationAlgCfg
ComponentAccumulator ActsTrackFindingValidationAlgCfg(flags, str name='ActsTracksValidationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:141
python.FPGATrackSimDataPrepConfig.getBaseName
def getBaseName(flags)
Definition: FPGATrackSimDataPrepConfig.py:7
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
FPGATrackSimReportingConfig.FPGATrackSimReportingCfg
def FPGATrackSimReportingCfg(flags, name='FPGATrackSimReportingAlg', **kwargs)
Definition: FPGATrackSimReportingConfig.py:12
python.FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg
def FPGATrackSimMappingCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:157
FPGATrackSimSGInputConfig.FPGATrackSimSGInputToolCfg
def FPGATrackSimSGInputToolCfg(flags)
Definition: FPGATrackSimSGInputConfig.py:8
ActsGeometryConfig.ActsTrackingGeometryToolCfg
ComponentAccumulator ActsTrackingGeometryToolCfg(flags, str name="ActsTrackingGeometryTool")
Definition: ActsGeometryConfig.py:100
python.FPGATrackSimDataPrepConfig.FPGATrackSimHitFilteringToolCfg
def FPGATrackSimHitFilteringToolCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:186
python.FPGATrackSimDataPrepConfig.FPGATrackSimDataPrepConnectToFastTracking
def FPGATrackSimDataPrepConnectToFastTracking(flags, FinalTracks="FPGADataPrep")
Definition: FPGATrackSimDataPrepConfig.py:256
python.JetRecoSteering.addTruthPileupJetsToOutputCfg
def addTruthPileupJetsToOutputCfg(flags, toAOD=True, toESD=True)
Definition: JetRecoSteering.py:7
python.FPGATrackSimDataPrepConfig.FPGATrackSimReadInputCfg
def FPGATrackSimReadInputCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:173
FPGATrackSimAlgorithmConfig.FPGATrackSimLogicalHitsProcessAlgMonitoringCfg
def FPGATrackSimLogicalHitsProcessAlgMonitoringCfg(flags)
Definition: FPGATrackSimAlgorithmConfig.py:246
python.TrackRecoConfig.InDetTrackRecoCfg
def InDetTrackRecoCfg(flags)
Main ID tracking config #####################.
Definition: TrackRecoConfig.py:791
Trk::open
@ open
Definition: BinningType.h:40
ITkStripGeoModelConfig.ITkStripReadoutGeometryCfg
def ITkStripReadoutGeometryCfg(flags, setGeometryAlignable=False, setAlignmentFolderName="/Indet/Align")
Definition: ITkStripGeoModelConfig.py:39
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
InDetTrackPerfMonFlags.initializeIDTPMConfigFlags
def initializeIDTPMConfigFlags(flags)
General config flag category for IDTPM tool job configuration.
Definition: InDetTrackPerfMonFlags.py:145
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142
ActsTrackFindingConfig.ActsMainTrackFindingAlgCfg
ComponentAccumulator ActsMainTrackFindingAlgCfg(flags, str name="ActsTrackFindingAlg", **kwargs)
Definition: ActsTrackFindingConfig.py:53
python.FPGATrackSimDataPrepConfig.runDataPrepChain
def runDataPrepChain()
Definition: FPGATrackSimDataPrepConfig.py:334
python.FPGATrackSimDataPrepConfig.FPGATrackSimRawLogicCfg
def FPGATrackSimRawLogicCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:29
InDetTrackPerfMonFlags.initializeIDTPMTrkAnaConfigFlags
def initializeIDTPMTrkAnaConfigFlags(flags)
Create flags category and corresponding set of flags.
Definition: InDetTrackPerfMonFlags.py:155
python.FPGATrackSimDataPrepConfig.FPGATrackSimDataPrepOutputCfg
def FPGATrackSimDataPrepOutputCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:57
python.FPGATrackSimDataPrepConfig.FPGAActsTrkConverterCfg
def FPGAActsTrkConverterCfg(flags)
Definition: FPGATrackSimDataPrepConfig.py:108
InfileMetaDataConfig.SetupMetaDataForStreamCfg
def SetupMetaDataForStreamCfg(flags, streamName="", AcceptAlgs=None, createMetadata=None, propagateMetadataFromInput=True, *args, **kwargs)
Definition: InfileMetaDataConfig.py:219
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.FPGATrackSimDataPrepConfig.prepareFlagsForFPGATrackSimDataPrepAlg
def prepareFlagsForFPGATrackSimDataPrepAlg(flags)
Definition: FPGATrackSimDataPrepConfig.py:52
ActsTruthConfig.ActsTrackParticleTruthDecorationAlgCfg
ComponentAccumulator ActsTrackParticleTruthDecorationAlgCfg(flags, str name='ActsTrackParticleTruthDecorationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:116
InDetTrackPerfMonConfig.InDetTrackPerfMonCfg
def InDetTrackPerfMonCfg(flags)
Definition: InDetTrackPerfMonConfig.py:216
ActsTruthConfig.ActsStripClusterToTruthAssociationAlgCfg
ComponentAccumulator ActsStripClusterToTruthAssociationAlgCfg(flags, str name='ActsStripClusterToTruthAssociationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:35
ActsTrackFindingConfig.ActsTrackToTrackParticleCnvAlgCfg
ComponentAccumulator ActsTrackToTrackParticleCnvAlgCfg(flags, str name="ActsTrackToTrackParticleCnvAlg", **kwargs)
Definition: ActsTrackFindingConfig.py:322