7Plot histograms from beam spot monitoring file.
9__author__ =
'Juerg Beringer'
11__usage__ =
'%prog [options] beamspotmonitoring.root'
17from 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},
37from optparse
import OptionParser
38parser = OptionParser(usage=__usage__, version=__version__)
39parser.add_option(
'-i',
'--interactive', dest=
'interactive', action=
'store_true', default=
False, help=
'interactive')
40parser.add_option(
'-b',
'--batch', dest=
'batch', action=
'store_true', default=
False, help=
'run in batch mode')
41parser.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')
46run = getRunFromName(filename)
56 os.unsetenv(
'DISPLAY')
58from InDetBeamSpotExample
import ROOTUtils
60ROOT.gStyle.SetPalette(1)
61c = ROOT.TCanvas(
'BeamSpotMonitoring',
'Beam Spot Monitoring',750,1000)
66mon = ROOT.TFile(filename)
67mondir =
'InDetGlobal/BeamSpot/'
68mondirCA =
'run_'+run+
'/InDetGlobal/BeamSpot/'
77 dsname = b.split(
'-')[0]
78 taskname =
'-'.join(b.split(
'-')[1:-1])
83for 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)
111if options.interactive:
112 os.environ[
'PYTHONINSPECT'] =
'1'
void print(char *figname, TCanvas *c1)
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
drawText(x=0.74, y=0.87, dy=0.06, text='', font=62, color=1, align=11, linesep=';')