ATLAS Offline Software
runZdcNtuple.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 
4 from glob import glob
5 
7  from argparse import ArgumentParser
8  parser = ArgumentParser(description='Parser for IDPVM configuration')
9  parser.add_argument("--filesInput", required=True)
10  parser.add_argument("--maxEvents", help="Limit number of events. Default: all input events", default=-1, type=int)
11  parser.add_argument("--skipEvents", help="Skip this number of events. Default: no events are skipped", default=0, type=int)
12  parser.add_argument("--outputFile", help="Name of output file", default="ZdcNtuple.outputs.root", type=str)
13  return parser.parse_args()
14 
15 # Parse the arguments
16 MyArgs = GetCustomAthArgs()
17 
18 from AthenaConfiguration.AllConfigFlags import initConfigFlags
19 flags = initConfigFlags()
20 
21 flags.Input.Files = []
22 for path in MyArgs.filesInput.split(','):
23  flags.Input.Files += glob(path)
24 
25 flags.Exec.SkipEvents = MyArgs.skipEvents
26 flags.Exec.MaxEvents = MyArgs.maxEvents
27 
28 flags.Trigger.triggerConfig="DB"
29 
30 flags.lock()
31 
32 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
33 acc = MainServicesCfg(flags)
34 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
35 acc.merge(PoolReadCfg(flags))
36 
37 from ZdcNtuple.ZdcNtupleConfig import ZdcNtupleCfg
38 acc.merge(ZdcNtupleCfg(flags, name = "AnalysisAlg",
39  zdcConfig = "LHCf2022",
40  lhcf2022 = False,
41  lhcf2022zdc = True,
42  lhcf2022afp = False,
43  zdcOnly = False,
44  useGRL = False,
45  zdcCalib = False,
46  reprocZdc = False,
47  enableOutputTree = True,
48  enableOutputSamples = False,
49  enableTrigger = True,
50  enableTracks = True,
51  enableClusters = True,
52  writeOnlyTriggers = True))
53 
54 from AthenaConfiguration.ComponentFactory import CompFactory
55 acc.addService(CompFactory.THistSvc(
56  Output = ["ANALYSIS DATAFILE='%s' OPT='RECREATE'" % MyArgs.outputFile]))
57 
58 acc.printConfig(withDetails=True)
59 
60 # Execute and finish
61 sc = acc.run()
62 
63 # Success should be 0
64 import sys
65 sys.exit(not sc.isSuccess())
runZdcNtuple.GetCustomAthArgs
def GetCustomAthArgs()
Definition: runZdcNtuple.py:6
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
ZdcNtupleConfig.ZdcNtupleCfg
def ZdcNtupleCfg(flags, name="AnalysisAlg", **kwargs)
Definition: ZdcNtupleConfig.py:7
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69