ATLAS Offline Software
Loading...
Searching...
No Matches
TRTPreProcessing.py
Go to the documentation of this file.
1# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2# ------------------------------------------------------------
3#
4# ----------- TRT Data-Preparation stage
5#
6# ------------------------------------------------------------
7from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8from AthenaConfiguration.Enums import Format, BeamType
9
11 acc = ComponentAccumulator()
12 if not flags.Detector.EnableTRT:
13 return acc
14
15 if (flags.Input.Format is Format.BS
16 or 'TRT_RDOs' in flags.Input.Collections
17 or f'{flags.Overlay.BkgPrefix}TRT_RDOs' in flags.Input.Collections):
18
19 #
20 # --- TRT_RIO_Maker Algorithm
21 #
22 if flags.Beam.Type is BeamType.Cosmics:
23 from InDetConfig.InDetPrepRawDataFormationConfig import (
24 InDetTRT_NoTime_RIO_MakerCfg)
25 acc.merge(InDetTRT_NoTime_RIO_MakerCfg(flags))
26 else:
27 from InDetConfig.InDetPrepRawDataFormationConfig import (
28 InDetTRT_RIO_MakerCfg)
29 acc.merge(InDetTRT_RIO_MakerCfg(flags))
30
31 if flags.InDet.doSplitReco:
32 from InDetConfig.InDetPrepRawDataFormationConfig import (
33 InDetTRT_RIO_MakerPUCfg)
34 acc.merge(InDetTRT_RIO_MakerPUCfg(flags))
35
36 #
37 # Include alg to save the local occupancy inside xAOD::EventInfo
38 #
39 if flags.InDet.doTRTGlobalOccupancy:
40 from InDetConfig.TRT_ElectronPidToolsConfig import (
41 TRTOccupancyIncludeCfg)
42 acc.merge(TRTOccupancyIncludeCfg(flags))
43
44 #
45 # --- we need to do truth association if requested (not for uncalibrated hits in cosmics)
46 #
47 if flags.InDet.doTruth and (
48 flags.Beam.Type is not BeamType.Cosmics and
49 'PRD_MultiTruthTRT' not in flags.Input.Collections):
50 from InDetConfig.InDetTruthAlgsConfig import (
51 InDetPRD_MultiTruthMakerTRTCfg)
52 acc.merge(InDetPRD_MultiTruthMakerTRTCfg(flags))
53 if flags.InDet.doSplitReco:
54 from InDetConfig.InDetTruthAlgsConfig import (
55 InDetPRD_MultiTruthMakerTRTPUCfg)
56 acc.merge(InDetPRD_MultiTruthMakerTRTPUCfg(flags))
57 return acc
58
59
60if __name__ == "__main__":
61 from AthenaConfiguration.AllConfigFlags import initConfigFlags
62 flags = initConfigFlags()
63
64 from AthenaConfiguration.TestDefaults import defaultTestFiles
65 flags.Input.Files = defaultTestFiles.RDO_RUN2
66
67 # TODO: TRT only?
68
69 numThreads = 1
70 flags.Concurrency.NumThreads = numThreads
71 # Might change this later, but good enough for the moment.
72 flags.Concurrency.NumConcurrentEvents = numThreads
73
74 flags.lock()
75 flags.dump()
76
77 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
78 top_acc = MainServicesCfg(flags)
79
80 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
81 top_acc.merge(PoolReadCfg(flags))
82
83 from TRT_GeoModel.TRT_GeoModelConfig import TRT_ReadoutGeometryCfg
84 top_acc.merge(TRT_ReadoutGeometryCfg(flags))
85
86 from PixelGeoModel.PixelGeoModelConfig import PixelReadoutGeometryCfg
87 from SCT_GeoModel.SCT_GeoModelConfig import SCT_ReadoutGeometryCfg
88 top_acc.merge(PixelReadoutGeometryCfg(flags))
89 top_acc.merge(SCT_ReadoutGeometryCfg(flags))
90
91 top_acc.merge(TRTPreProcessingCfg(flags))
92
93 iovsvc = top_acc.getService('IOVDbSvc')
94 iovsvc.OutputLevel = 5
95 top_acc.run(25)
96 top_acc.store(open("test_TRTPrepocessing.pkl", "wb"))