590 """History of variable what vs LB or time."""
591 ROOT.gStyle.SetOptStat(0)
593 calc = BeamSpotAverage([what],weightedAverage=
not options.simpleaverage)
596 arescale =
varDef(what,
'arescale',1.0)
598 if b.sigmaX < 0.01
or b.sigmaY < 0.01:
599 print (
"OUTLIER ", b.run, b.lbStart, b.lbEnd, b.sigmaX, b.sigmaY)
600 if not b.bcid
in grDict:
601 grDict[b.bcid] = BeamSpotGraph(timeAxis=options.timeaxis, separationAxis=options.separation)
604 grDict[b.bcid].
add(b,what,arescale)
608 print (
'Plotting data from %i BCID ...\n' % len(grDict))
615 for gr
in [grDict.get(bcid)
for bcid
in grDict]:
616 xmin =
min(xmin,gr.xmin)
617 xmax =
max(xmax,gr.xmax)
618 ymin =
min(ymin,gr.ymin)
619 ymax =
max(ymax,gr.ymax)
628 xmax += .05*h
if len(grDict)==1
else 0.3*h
630 h = (ymax-ymin)/2*options.yscale
633 if options.xmin!=
None:
634 xmin = time.mktime(time.strptime(options.xmin,
'%b %d %H:%M:%S %Y'))
if options.timeaxis
else float(options.xmin)
635 if options.xmax!=
None:
636 xmax = time.mktime(time.strptime(options.xmax,
'%b %d %H:%M:%S %Y'))
if options.timeaxis
else float(options.xmax)
638 ymin =
varDef(what,
'min',-100)
639 ymax =
varDef(what,
'max',+100)
640 if options.ymin!=
None:
642 if options.ymax!=
None:
647 atit =
';%s;%s' % (timeLabel,
varDef(what,
'atit',what))
648 elif options.separation:
649 atit =
';%s;%s' % (
'Nominal Separation [mm]',
varDef(what,
'atit',what))
651 atit =
';%s;%s' % (
'Luminosity block number',
varDef(what,
'atit',what))
654 ROOT.gPad.SetLogy(options.logy)
656 xAxis = frame.GetXaxis()
657 yAxis = frame.GetYaxis()
658 xAxis.SetTimeDisplay(1)
663 xAxis.SetTimeOffset(0)
665 if (xmax-xmin)/86400 < 1:
666 xAxis.SetTimeFormat(
'%H:%M')
673 xAxis.SetTimeFormat(
'%b %d')
675 xAxis.SetTimeFormat(
'#splitline{%b %d}{%H:%M}')
676 xAxis.SetLabelOffset(0.02)
677 xAxis.SetTitleOffset(1.6)
679 xAxis.SetLabelSize(options.lsize)
680 xAxis.SetTitleSize(options.lsize)
681 yAxis.SetLabelSize(options.lsize)
682 yAxis.SetTitleSize(options.lsize)
684 xAxis.SetLabelSize(0.044)
686 xAxis.SetTimeFormat(options.adatefmt)
688 xAxis.SetNdivisions(options.ndivs,0)
689 frame.LabelsOption(
'd',
'X')
691 if options.xtitoffset:
692 xAxis.SetTitleOffset(options.xtitoffset)
693 if options.ytitoffset:
694 yAxis.SetTitleOffset(options.ytitoffset)
708 legendList.append([b,options.alegend,
'FL'])
709 legendList.append([
None,
'%s %s #pm %s %s' % (
fmtVal(what,mean,
True),
varDef(what,
'units'),
714 for bcid
in sorted(grDict.keys()):
718 name = what
if bcid==0
else '%s-bcid%04i' % (what,bcid)
719 tgraph = self.protect( gr.getTGraph(name) )
722 if options.tgraphfile:
723 print (
'Saving TGraphErrors',tgraph.GetName(),
'to file',options.tgraphfile)
724 tgraphfile = ROOT.TFile(options.tgraphfile,
'UPDATE')
730 tgraph.SetMarkerSize(options.msize
if options.msize
else 0.8)
732 legendList.append([tgraph,options.plegend,
'PLE'])
734 tgraph.SetMarkerColor(styleFactory.nextColorStyle())
735 tgraph.SetMarkerStyle(styleFactory.nextMarkerStyle())
736 tgraph.SetMarkerSize(options.msize
if options.msize
else 1.2)
737 if len(legendList)<options.maxlegends:
738 text =
'All' if bcid==0
else 'BCID %i' % bcid
739 legendList.append([tgraph,text,
'PLE'])
743 if len(grDict)>options.maxlegends:
744 legendList.append([
None,
'...',
''])
747 if options.fit
and len(grDict)==1:
748 ROOT.gStyle.SetOptFit(1111)
750 tgraph.Fit(options.fit,
'',
'SAME', gr.xmin,gr.xmax)
753 legendX = 0.6
if len(grDict)==1
else 0.8
754 self.writeText(what,legendList
if not options.public
else [],
not options.public,legendX=legendX)