ATLAS Offline Software
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 
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("--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
20 MyArgs = GetCustomAthArgs()
21 
22 from AthenaConfiguration.AllConfigFlags import initConfigFlags
23 flags = initConfigFlags()
24 
25 flags.Input.Files = []
26 for path in MyArgs.filesInput.split(','):
27  flags.Input.Files += glob(path)
28 
29 flags.Exec.SkipEvents = MyArgs.skipEvents
30 flags.Exec.MaxEvents = MyArgs.maxEvents
31 
32 flags.Trigger.triggerConfig = "DB"
33 flags.DQ.enableLumiAccess = False
34 flags.Output.HISTFileName = MyArgs.outputMonFile
35 
36 flags.lock()
37 
38 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
39 acc = MainServicesCfg(flags)
40 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
41 acc.merge(PoolReadCfg(flags))
42 
43 from InDetBeamSpotFinder.InDetBeamSpotFinderConfig import InDetBeamSpotFinderCfg
44 acc.merge(InDetBeamSpotFinderCfg(flags))
45 
46 from AthenaConfiguration.ComponentFactory import CompFactory
47 acc.addService(CompFactory.THistSvc(
48  Output = ["INDETBEAMSPOTFINDER DATAFILE='%s' OPT='RECREATE'" % MyArgs.outputHistFile]))
49 
50 if 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 
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())
runVertexTemplate.GetCustomAthArgs
def GetCustomAthArgs()
Definition: runVertexTemplate.py:6
InDetBeamSpotFinderConfig.InDetBeamSpotFinderCfg
def InDetBeamSpotFinderCfg(flags, jobConfig={}, name="InDetBeamSpotFinder", **kwargs)
Definition: InDetBeamSpotFinderConfig.py:36
InDetGlobalBeamSpotMonAlgCfg
Definition: InDetGlobalBeamSpotMonAlgCfg.py:1
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69