ATLAS Offline Software
Loading...
Searching...
No Matches
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
4from 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
17
18from AthenaConfiguration.AllConfigFlags import initConfigFlags
19flags = initConfigFlags()
20
21flags.Input.Files = []
22for path in MyArgs.filesInput.split(','):
23 flags.Input.Files += glob(path)
24
25flags.Exec.SkipEvents = MyArgs.skipEvents
26flags.Exec.MaxEvents = MyArgs.maxEvents
27
28flags.Trigger.triggerConfig="DB"
29
30flags.lock()
31
32from AthenaConfiguration.MainServicesConfig import MainServicesCfg
33acc = MainServicesCfg(flags)
34from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
35acc.merge(PoolReadCfg(flags))
36
37from ZdcNtuple.ZdcNtupleConfig import ZdcNtupleCfg
38acc.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
54from AthenaConfiguration.ComponentFactory import CompFactory
55acc.addService(CompFactory.THistSvc(
56 Output = ["ANALYSIS DATAFILE='%s' OPT='RECREATE'" % MyArgs.outputFile]))
57
58acc.printConfig(withDetails=True)
59
60# Execute and finish
61sc = acc.run()
62
63# Success should be 0
64import sys
65sys.exit(not sc.isSuccess())