ATLAS Offline Software
InDetCosmicsEventPhaseConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2 # Configuration of InDetCosmicsEventPhase package
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 def InDetCosmicsEventPhaseToolCfg(flags, name='InDetCosmicsEventPhaseTool', **kwargs) :
7  from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTPhaseCondCfg
8  acc = TRTPhaseCondCfg(flags) # To produce input TRTCond::AverageT0 conditions
9 
10  kwargs.setdefault("UseNewEP", True)
11  kwargs.setdefault("GlobalOffset", -3.125 if flags.Input.isMC else 8)
12 
13  if "TRTCalDbTool" not in kwargs:
14  from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
15  kwargs.setdefault("TRTCalDbTool", acc.popToolsAndMerge(
16  TRT_CalDbToolCfg(flags)))
17 
18  acc.setPrivateTools(CompFactory.InDet.InDetCosmicsEventPhaseTool(name, **kwargs))
19  return acc
20 
21 def InDetFixedWindowTrackTimeToolCfg(flags, name='InDetFixedWindowTrackTimeTool', **kwargs) :
22  from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTPhaseCondCfg
23  acc = TRTPhaseCondCfg(flags) # To produce input TRTCond::AverageT0 conditions
24 
25  kwargs.setdefault("UseNewEP" , True)
26  kwargs.setdefault("WindowCenter" , -8.5)
27  kwargs.setdefault("WindowSize" , 7)
28  kwargs.setdefault("GlobalOffset", -3.125 if flags.Input.isMC else 8)
29 
30  if "TRTCalDbTool" not in kwargs:
31  from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
32  kwargs.setdefault("TRTCalDbTool", acc.popToolsAndMerge(
33  TRT_CalDbToolCfg(flags)))
34 
35  acc.setPrivateTools(CompFactory.InDet.InDetFixedWindowTrackTimeTool(name, **kwargs))
36  return acc
37 
38 def InDetSlidingWindowTrackTimeToolCfg(flags, name='InDetSlidingWindowTrackTimeTool', **kwargs) :
39  from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTPhaseCondCfg
40  acc = TRTPhaseCondCfg(flags) # To produce input TRTCond::AverageT0 conditions
41 
42  kwargs.setdefault("UseNewEP" , True)
43  kwargs.setdefault("NumberIterations" , 5)
44  kwargs.setdefault("WindowSize" , 7)
45  kwargs.setdefault("GlobalOffset", -3.125 if flags.Input.isMC else 8)
46 
47  if "TRTCalDbTool" not in kwargs:
48  from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
49  kwargs.setdefault("TRTCalDbTool", acc.popToolsAndMerge(
50  TRT_CalDbToolCfg(flags)))
51 
52  acc.setPrivateTools(CompFactory.InDet.InDetSlidingWindowTrackTimeTool(name, **kwargs))
53  return acc
54 
55 def InDetCosmicsEventPhaseCfg(flags, name='InDetCosmicsEventPhase', **kwargs):
56  acc = ComponentAccumulator()
57 
58  if "TRTCalDbTool" not in kwargs:
59  from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
60  kwargs.setdefault("TRTCalDbTool", acc.popToolsAndMerge(
61  TRT_CalDbToolCfg(flags)))
62 
63  if "TrackSummaryTool" not in kwargs:
64  from TrkConfig.TrkTrackSummaryToolConfig import InDetTrackSummaryToolCfg
65  InDetTrackSummaryTool = acc.popToolsAndMerge(InDetTrackSummaryToolCfg(flags))
66  acc.addPublicTool(InDetTrackSummaryTool)
67  kwargs.setdefault("TrackSummaryTool" , InDetTrackSummaryTool)
68 
69  if "EventPhaseTool" not in kwargs:
70  EventPhaseTool = acc.popToolsAndMerge(InDetCosmicsEventPhaseToolCfg(flags))
71  acc.addPublicTool(EventPhaseTool)
72  kwargs.setdefault("EventPhaseTool", EventPhaseTool)
73 
74  acc.addEventAlgo(CompFactory.InDet.InDetCosmicsEventPhase(name, **kwargs))
75  return acc
76 
77 
78 if __name__ == "__main__":
79  from AthenaConfiguration.AllConfigFlags import initConfigFlags
80  flags = initConfigFlags()
81 
82  numThreads=1
83  flags.Concurrency.NumThreads=numThreads
84  flags.Concurrency.NumConcurrentEvents=numThreads # Might change this later, but good enough for the moment.
85 
86  from AthenaConfiguration.TestDefaults import defaultTestFiles
87  flags.Input.Files = defaultTestFiles.RDO_RUN2
88  flags.lock()
89  flags.dump()
90 
91  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
92  top_acc = MainServicesCfg(flags)
93 
94  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
95  top_acc.merge(PoolReadCfg(flags))
96 
97  from TRT_GeoModel.TRT_GeoModelConfig import TRT_ReadoutGeometryCfg
98  top_acc.merge(TRT_ReadoutGeometryCfg( flags ))
99 
100  top_acc.merge(InDetCosmicsEventPhaseCfg(flags,
101  InputTracksNames=['TRTTracks_Phase', 'ExtendedTracksPhase']))
102 
103  iovsvc = top_acc.getService('IOVDbSvc')
104  iovsvc.OutputLevel=5
105  top_acc.printConfig()
106  top_acc.run(25)
107  top_acc.store(open("test_InDetCosmicsEventPhaseConfig.pkl", "wb"))
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TRT_GeoModelConfig.TRT_ReadoutGeometryCfg
def TRT_ReadoutGeometryCfg(flags)
Definition: TRT_GeoModelConfig.py:55
python.InDetCosmicsEventPhaseConfig.InDetSlidingWindowTrackTimeToolCfg
def InDetSlidingWindowTrackTimeToolCfg(flags, name='InDetSlidingWindowTrackTimeTool', **kwargs)
Definition: InDetCosmicsEventPhaseConfig.py:38
python.InDetCosmicsEventPhaseConfig.InDetFixedWindowTrackTimeToolCfg
def InDetFixedWindowTrackTimeToolCfg(flags, name='InDetFixedWindowTrackTimeTool', **kwargs)
Definition: InDetCosmicsEventPhaseConfig.py:21
python.TrkTrackSummaryToolConfig.InDetTrackSummaryToolCfg
def InDetTrackSummaryToolCfg(flags, name='InDetTrackSummaryTool', **kwargs)
Definition: TrkTrackSummaryToolConfig.py:22
python.InDetCosmicsEventPhaseConfig.InDetCosmicsEventPhaseCfg
def InDetCosmicsEventPhaseCfg(flags, name='InDetCosmicsEventPhase', **kwargs)
Definition: InDetCosmicsEventPhaseConfig.py:55
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.TRT_ConditionsAlgsConfig.TRTPhaseCondCfg
def TRTPhaseCondCfg(flags, name="TRTPhaseCondAlg", **kwargs)
Definition: TRT_ConditionsAlgsConfig.py:68
python.InDetCosmicsEventPhaseConfig.InDetCosmicsEventPhaseToolCfg
def InDetCosmicsEventPhaseToolCfg(flags, name='InDetCosmicsEventPhaseTool', **kwargs)
Definition: InDetCosmicsEventPhaseConfig.py:6
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
python.TRT_ConditionsServicesConfig.TRT_CalDbToolCfg
def TRT_CalDbToolCfg(flags, name="TRT_CalDbTool", **kwags)
Definition: TRT_ConditionsServicesConfig.py:9