5 from __future__
import print_function
8 Plot histograms from beam spot monitoring file.
10 __author__ =
'Juerg Beringer'
12 __usage__ =
'%prog [options] beamspotmonitoring.root'
18 from InDetBeamSpotExample.Utils
import getRunFromName
23 'trkDPhi': {
'opts':
'COLZ',
'stats':
'n'},
24 'trkDPhiCorr': {
'opts':
'COLZ',
'stats':
'n'},
25 'pvYX': {
'opts':
'COLZ',
'stats': 111},
26 'pvXZ': {
'opts':
'COLZ',
'stats': 111},
27 'pvYZ': {
'opts':
'COLZ',
'stats': 111},
28 'pvX': {
'stats': 111111},
29 'pvY': {
'stats': 111111},
30 'pvZ': {
'stats': 111111},
31 'pvChiSqDof': {
'stats': 101111},
32 'pvNTracks': {
'stats': 101111},
33 'pvTrackPt': {
'stats': 101111},
38 from optparse
import OptionParser
39 parser = OptionParser(usage=__usage__, version=__version__)
40 parser.add_option(
'-i',
'--interactive', dest=
'interactive', action=
'store_true', default=
False, help=
'interactive')
41 parser.add_option(
'-b',
'--batch', dest=
'batch', action=
'store_true', default=
False, help=
'run in batch mode')
42 parser.add_option(
'-o',
'--output', dest=
'output', default=
'.gif', help=
'comma-separated list of output files or formats (default: .gif')
43 (options,args) = parser.parse_args()
45 parser.error(
'wrong number of command line arguments')
57 os.unsetenv(
'DISPLAY')
59 from InDetBeamSpotExample
import ROOTUtils
61 ROOT.gStyle.SetPalette(1)
62 c = ROOT.TCanvas(
'BeamSpotMonitoring',
'Beam Spot Monitoring',750,1000)
67 mon = ROOT.TFile(filename)
68 mondir =
'InDetGlobal/BeamSpot/'
69 mondirCA =
'run_'+run+
'/InDetGlobal/BeamSpot/'
78 dsname = b.split(
'-')[0]
79 taskname =
'-'.
join(b.split(
'-')[1:-1])
84 for hname
in [
'trkDPhi',
'trkDPhiCorr',
85 'pvYX',
'pvXZ',
'pvYZ',
87 'pvChiSqDof',
'pvNTracks',
'pvTrackPt'
90 print (
'Processing histogram',hname)
91 ROOT.gStyle.SetOptStat(hDef[hname].
get(
'stats',0))
92 h = mon.Get(mondir+hname)
94 h = mon.Get(mondirCA+hname)
96 h.Draw(hDef[hname].
get(
'opts',
''))
98 print (
"... no histogram with name %s" % hname)
105 for o
in options.output.split(
','):
107 c.SaveAs(basename+
'beamspotmon'+o)
112 if options.interactive:
113 os.environ[
'PYTHONINSPECT'] =
'1'