ATLAS Offline Software
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 # ------------------------------------------------------------
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from 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 
60 if __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"))
python.TRTPreProcessing.TRTPreProcessingCfg
def TRTPreProcessingCfg(flags)
Definition: TRTPreProcessing.py:10
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TRT_ElectronPidToolsConfig.TRTOccupancyIncludeCfg
def TRTOccupancyIncludeCfg(flags, name="TRTOccupancyInclude", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:45
TRT_GeoModelConfig.TRT_ReadoutGeometryCfg
def TRT_ReadoutGeometryCfg(flags)
Definition: TRT_GeoModelConfig.py:59
SCT_GeoModelConfig.SCT_ReadoutGeometryCfg
def SCT_ReadoutGeometryCfg(flags)
Definition: SCT_GeoModelConfig.py:51
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.InDetPrepRawDataFormationConfig.InDetTRT_NoTime_RIO_MakerCfg
def InDetTRT_NoTime_RIO_MakerCfg(flags, name="InDetTRT_NoTime_RIO_Maker", **kwargs)
Definition: InDetPrepRawDataFormationConfig.py:279
PixelGeoModelConfig.PixelReadoutGeometryCfg
def PixelReadoutGeometryCfg(flags)
Definition: PixelGeoModelConfig.py:52
python.InDetTruthAlgsConfig.InDetPRD_MultiTruthMakerTRTCfg
def InDetPRD_MultiTruthMakerTRTCfg(flags, name="InDetTRT_PRD_MultiTruthMaker", **kwargs)
Definition: InDetTruthAlgsConfig.py:64
python.InDetPrepRawDataFormationConfig.InDetTRT_RIO_MakerPUCfg
def InDetTRT_RIO_MakerPUCfg(flags, name="InDetTRT_RIO_MakerPU", **kwargs)
Definition: InDetPrepRawDataFormationConfig.py:305
python.InDetTruthAlgsConfig.InDetPRD_MultiTruthMakerTRTPUCfg
def InDetPRD_MultiTruthMakerTRTPUCfg(flags, name="InDetTRT_PRD_MultiTruthMakerPU", **kwargs)
Definition: InDetTruthAlgsConfig.py:87
python.InDetPrepRawDataFormationConfig.InDetTRT_RIO_MakerCfg
def InDetTRT_RIO_MakerCfg(flags, name="InDetTRT_RIO_Maker", **kwargs)
Definition: InDetPrepRawDataFormationConfig.py:257
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69