ATLAS Offline Software
ZDCRecConfig.py
Go to the documentation of this file.
1 #!/bin/env python
2 
3 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
4 
5 # file ZDCRecConfig.py
6 # author Peter Steinberg <steinberg@bnl.gov>
7 # date 2022-07-31
8 
9 # brief A script that provides setup for ZDC reconstruction included in RecJobTransforms/RecoSteering.py.
10 # It also allows to run standalone ZDC reconstruction. To use it:
11 # 0. setup athena enviroment
12 # 1a. run this script:
13 # $ python ZDCRecConfig.py
14 # 1b. feel free to change the input file:
15 # $ python ZDCRecConfig.py --filesInput=/eos/atlas/atlascerngroupdisk/det-zdc/ZDCRuns/2021/data21_900GeV/main/data21_900GeV.00405396.physics_Main.daq.RAW/data21_900GeV.00405396.physics_Main.daq.RAW._lb0211._SFO-13._0001.data
16 # 1c. run the whole reconstruction with:
17 # $ RecoSteeringTest.py --filesInput=/eos/atlas/atlascerngroupdisk/det-zdc/ZDCRuns/2021/data21_900GeV/main/data21_900GeV.00405396.physics_Main.daq.RAW/data21_900GeV.00405396.physics_Main.daq.RAW._lb0211._SFO-13._0001.data --RAW
18 
19 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
20 from AthenaConfiguration.Enums import Format
21 
22 def ZDCRecOutputCfg(flags):
23  """defines outputs for ESD and AOD; provides the same information as in ForwardRec/ZDC_Rec_OutputItemList_jobOptions.py"""
24  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
25  acc = ComponentAccumulator()
26 
27  ZDC_ItemList=[]
28 
29  if flags.Input.Format is Format.BS:
30  # ZDC Silicon hits containers
31  ZDC_ItemList.append("xAOD::ZdcModuleContainer#ZdcModules")
32  ZDC_ItemList.append("xAOD::ZdcModuleAuxContainer#ZdcModulesAux.")
33 
34  if flags.Output.doWriteESD:
35  acc.merge(OutputStreamCfg(flags, "ESD", ZDC_ItemList))
36  if flags.Output.doWriteAOD:
37  acc.merge(OutputStreamCfg(flags, "AOD", ZDC_ItemList))
38  return acc
39 
40 
41 def ZDCRecCfg(flags):
42  """defines ZDC reconstruction; provides the same setup as used to be in ForwardRec/ForwardRec_jobOptions.py"""
43  acc = ComponentAccumulator()
44 
45  if flags.Input.Format is Format.BS:
46  from AthenaConfiguration.ComponentFactory import CompFactory
47 
48  acc.addEventAlgo(CompFactory.ZdcByteStreamLucrodData("ZdcByteStreamLucrodData"))
49  acc.addEventAlgo(CompFactory.ZdcRecRun3("ZdcRecRun3"))
50 
51  # Setup output
52  if flags.Output.doWriteESD or flags.Output.doWriteAOD:
53  acc.merge(ZDCRecOutputCfg(flags))
54 
55  return acc
56 
57 
58 if __name__ == "__main__":
59 
60  from AthenaConfiguration.AllConfigFlags import initConfigFlags
61  flags = initConfigFlags()
62  flags.Scheduler.CheckDependencies = True
63  flags.Scheduler.ShowDataDeps = True
64  flags.Scheduler.ShowDataFlow = True
65  flags.Scheduler.ShowControlFlow = True
66  flags.Scheduler.EnableVerboseViews = True
67 
68  flags.Input.Files = ["/eos/atlas/atlascerngroupdisk/det-zdc/ZDCRuns/2021/data21_900GeV/main/data21_900GeV.00405396.physics_Main.daq.RAW/data21_900GeV.00405396.physics_Main.daq.RAW._lb0211._SFO-13._0001.data"]
69 
70  flags.Exec.MaxEvents=500
71  flags.Concurrency.NumThreads=4
72 
73  flags.fillFromArgs() # enable unit tests to switch only parts of reco: python -m HIRecConfig.HIRecConfig HeavyIon.doGlobal = 0 and so on
74  flags.lock()
75  flags.dump()
76 
77  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
78  acc = MainServicesCfg(flags)
79  acc.getEventAlgo("SGInputLoader").FailIfNoProxy = True # enforce no missing data
80 
81 
82  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
83  acc.merge(ByteStreamReadCfg(flags))
84 
85  acc.merge(ZDCRecCfg(flags))
86 
87  from AthenaCommon.Constants import DEBUG
88  acc.foreach_component("*ZDC*").OutputLevel=DEBUG
89 
90  acc.printConfig(withDetails=True, summariseProps=True)
91 
92  status = acc.run()
93  if status.isFailure():
94  import sys
95  sys.exit(-1)
96 
97 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
ZDCRecConfig.ZDCRecCfg
def ZDCRecCfg(flags)
Definition: ZDCRecConfig.py:41
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
ZDCRecConfig.ZDCRecOutputCfg
def ZDCRecOutputCfg(flags)
Definition: ZDCRecConfig.py:22
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19