7 Plot histograms from beam spot monitoring file.
9 __author__ =
'Juerg Beringer'
11 __usage__ =
'%prog [options] beamspotmonitoring.root'
17 from InDetBeamSpotExample.Utils
import getRunFromName
22 'trkDPhi': {
'opts':
'COLZ',
'stats':
'n'},
23 'trkDPhiCorr': {
'opts':
'COLZ',
'stats':
'n'},
24 'pvYX': {
'opts':
'COLZ',
'stats': 111},
25 'pvXZ': {
'opts':
'COLZ',
'stats': 111},
26 'pvYZ': {
'opts':
'COLZ',
'stats': 111},
27 'pvX': {
'stats': 111111},
28 'pvY': {
'stats': 111111},
29 'pvZ': {
'stats': 111111},
30 'pvChiSqDof': {
'stats': 101111},
31 'pvNTracks': {
'stats': 101111},
32 'pvTrackPt': {
'stats': 101111},
37 from optparse
import OptionParser
38 parser = OptionParser(usage=__usage__, version=__version__)
39 parser.add_option(
'-i',
'--interactive', dest=
'interactive', action=
'store_true', default=
False, help=
'interactive')
40 parser.add_option(
'-b',
'--batch', dest=
'batch', action=
'store_true', default=
False, help=
'run in batch mode')
41 parser.add_option(
'-o',
'--output', dest=
'output', default=
'.gif', help=
'comma-separated list of output files or formats (default: .gif')
42 (options,args) = parser.parse_args()
44 parser.error(
'wrong number of command line arguments')
56 os.unsetenv(
'DISPLAY')
58 from InDetBeamSpotExample
import ROOTUtils
60 ROOT.gStyle.SetPalette(1)
61 c = ROOT.TCanvas(
'BeamSpotMonitoring',
'Beam Spot Monitoring',750,1000)
66 mon = ROOT.TFile(filename)
67 mondir =
'InDetGlobal/BeamSpot/'
68 mondirCA =
'run_'+run+
'/InDetGlobal/BeamSpot/'
77 dsname = b.split(
'-')[0]
78 taskname =
'-'.
join(b.split(
'-')[1:-1])
83 for hname
in [
'trkDPhi',
'trkDPhiCorr',
84 'pvYX',
'pvXZ',
'pvYZ',
86 'pvChiSqDof',
'pvNTracks',
'pvTrackPt'
89 print (
'Processing histogram',hname)
90 ROOT.gStyle.SetOptStat(hDef[hname].
get(
'stats',0))
91 h = mon.Get(mondir+hname)
93 h = mon.Get(mondirCA+hname)
95 h.Draw(hDef[hname].
get(
'opts',
''))
97 print (
"... no histogram with name %s" % hname)
104 for o
in options.output.split(
','):
106 c.SaveAs(basename+
'beamspotmon'+o)
111 if options.interactive:
112 os.environ[
'PYTHONINSPECT'] =
'1'