ATLAS Offline Software
Loading...
Searching...
No Matches
runVertexTemplate.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("--outputDBFile", help="Name of output DB file", default="beamspot.db", type=str)
13 parser.add_argument("--outputHistFile", help="Name of output hist file", default="nt.root", type=str)
14 parser.add_argument("--doMonitoring", help="Run monitoring", action='store_true')
15 parser.add_argument("--outputMonFile", help="Name of output monitoring file",
16 default="beamspotmonitoring.root", type=str)
17 return parser.parse_args()
18
19# Parse the arguments
21
22from AthenaConfiguration.AllConfigFlags import initConfigFlags
23flags = initConfigFlags()
24
25flags.Input.Files = []
26for path in MyArgs.filesInput.split(','):
27 flags.Input.Files += glob(path)
28
29flags.Exec.SkipEvents = MyArgs.skipEvents
30flags.Exec.MaxEvents = MyArgs.maxEvents
31
32flags.Trigger.triggerConfig = "DB"
33flags.DQ.enableLumiAccess = False
34flags.Output.HISTFileName = MyArgs.outputMonFile
35
36flags.lock()
37
38from AthenaConfiguration.MainServicesConfig import MainServicesCfg
39acc = MainServicesCfg(flags)
40from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
41acc.merge(PoolReadCfg(flags))
42
43from InDetBeamSpotFinder.InDetBeamSpotFinderConfig import InDetBeamSpotFinderCfg
44acc.merge(InDetBeamSpotFinderCfg(flags))
45
46from AthenaConfiguration.ComponentFactory import CompFactory
47acc.addService(CompFactory.THistSvc(
48 Output = ["INDETBEAMSPOTFINDER DATAFILE='%s' OPT='RECREATE'" % MyArgs.outputHistFile]))
49
50if MyArgs.doMonitoring:
51 from AthenaMonitoring import AthMonitorCfgHelper
52 helper = AthMonitorCfgHelper(flags, "BeamSpotMonitoring")
53 from InDetGlobalMonitoringRun3Test.InDetGlobalBeamSpotMonAlgCfg import (
54 InDetGlobalBeamSpotMonAlgCfg )
55 InDetGlobalBeamSpotMonAlgCfg(helper, acc, flags)
56 acc.merge(helper.result())
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())