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