ATLAS Offline Software
runBeamSpotMonitor.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 
6 from AthenaConfiguration.AllConfigFlags import initConfigFlags
7 flags = initConfigFlags()
8 
9 import configMy
10 
11 #Job options
12 if 'outputlevel' not in configMy.jobConfig: configMy.jobConfig['outputlevel'] = 3
13 if 'maxEvents' not in configMy.jobConfig: configMy.jobConfig['maxEvents'] = -1
14 if 'skipEvents' not in configMy.jobConfig: configMy.jobConfig['skipEvents'] = 0
15 if 'MsgLimit' not in configMy.jobConfig: configMy.jobConfig['MsgLimit'] = 20
16 
17 if 'outputfileprefix' not in configMy.jobConfig: configMy.jobConfig['outputfileprefix'] = ''
18 if 'outputfile' not in configMy.jobConfig: configMy.jobConfig['outputfile'] = configMy.jobConfig['outputfileprefix']+'beamspot.db'
19 if 'histfile' not in configMy.jobConfig: configMy.jobConfig['histfile'] = configMy.jobConfig['outputfileprefix']+'nt.root'
20 if 'monfile' not in configMy.jobConfig: configMy.jobConfig['monfile'] = configMy.jobConfig['outputfileprefix']+'beamspotmonitoring.root'
21 if 'jobpostprocsteps' not in configMy.jobConfig: configMy.jobConfig['jobpostprocsteps'] = 'MergeNt PlotBeamSpot LinkResults AveBeamSpot DQBeamSpot'
22 
23 #Job options for Monitoring algorithm
24 if 'beamspottag' not in configMy.jobConfig: configMy.jobConfig['beamspottag'] = ''
25 if 'MinTracksPerVtx' not in configMy.jobConfig: configMy.jobConfig['MinTracksPerVtx'] = 5
26 if 'MinTrackPt' not in configMy.jobConfig: configMy.jobConfig['MinTrackPt'] = 500.
27 if 'useBeamSpot' not in configMy.jobConfig:
28  # change to True as soon as I have PrimaryVertexMonitoring in as well
29  configMy.jobConfig['useBeamSpot'] = configMy.jobConfig.get('beamspottag','')!='' or configMy.jobConfig.get('beamspotfile','')!=''
30 
31 #Printout of job configuration
32 print("Job configuration: ")
33 for option in configMy.jobConfig:
34  print(" ",option,': ',configMy.jobConfig[option])
35 print(" ")
36 
37 flags.Exec.OutputLevel = configMy.jobConfig['outputlevel']
38 flags.Exec.SkipEvents = configMy.jobConfig['skipEvents']
39 flags.Exec.MaxEvents = configMy.jobConfig['maxEvents']
40 
41 flags.Input.Files = []
42 for path in configMy.jobConfig['inputfiles']:
43  print("path: ",path)
44  print("glob: ",glob(path))
45  flags.Input.Files += glob(path)
46 
47 flags.Trigger.triggerConfig = "DB"
48 flags.DQ.enableLumiAccess = False
49 flags.Output.HISTFileName = configMy.jobConfig['monfile']
50 flags.Exec.EventPrintoutInterval = 10000
51 flags.fillFromArgs()
52 flags.lock()
53 
54 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
55 acc = MainServicesCfg(flags)
56 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
57 acc.merge(PoolReadCfg(flags))
58 acc.getService("MessageSvc").defaultLimit = configMy.jobConfig['MsgLimit']
59 
60 if configMy.jobConfig['beamspottag']:
61  from IOVDbSvc.IOVDbSvcConfig import addOverride
62  acc.merge(addOverride(flags, "/Indet/Beampos", configMy.jobConfig['beamspottag']))
63 
64 from AthenaMonitoring import AthMonitorCfgHelper
65 helper = AthMonitorCfgHelper(flags, "BeamSpotMonitoring")
66 from InDetGlobalMonitoringRun3Test.InDetGlobalBeamSpotMonAlgCfg import (
67  InDetGlobalBeamSpotMonAlgCfg )
68 InDetGlobalBeamSpotMonAlgCfg(helper, acc, flags,configMy.jobConfig)
69 acc.merge(helper.result())
70 
71 acc.printConfig(withDetails=True)
72 
73 # Execute and finish
74 sc = acc.run()
75 
76 # Success should be 0
77 import sys
78 sys.exit(not sc.isSuccess())
79 
80 
81 
82 
InDetGlobalBeamSpotMonAlgCfg
Definition: InDetGlobalBeamSpotMonAlgCfg.py:1
python.IOVDbSvcConfig.addOverride
def addOverride(flags, folder, tag, db=None)
Definition: IOVDbSvcConfig.py:224
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69