ATLAS Offline Software
Functions | Variables
plotBeamSpotCompare Namespace Reference

Functions

def getVarDef (what, property, default='')
 
def drawSummary (var='')
 

Variables

string __author__ = 'Martina Hurwitz'
 
string __version__ = '$Id $'
 
string __usage__ = '%prog [options] file1/tag1 file2/tag2'
 
dictionary varDef
 
 parser = OptionParser(usage=__usage__, version=__version__)
 
 dest
 
 action
 
 default
 
 False
 
 help
 
 type
 
 options
 
 args
 
string tag1 = ''
 
string tag2 = ''
 
 runNumber = int(options.runNumber)
 
int ndp = 5
 
int ndptilt = 8
 
bool fromDB = False
 
bool fromCSV = False
 
 BSData1 = BeamSpotFinderNt(tag1)
 
 BSData2 = BeamSpotFinderNt(tag2)
 
list varColl = []
 
bool doOnePlot = True
 
 runMin
 
 runMax
 
 lbmin = BS1.lbStart
 
 lbmax = BS1.lbEnd
 
 BS2_status = options.status
 
 statusList
 
 BS2Dict = BSData2.getDataCache()
 
int numNew = 0
 
int numOld = 0
 
 x1 = array('d')
 
 ex1 = array('d')
 
 x2 = array('d')
 
 ex2 = array('d')
 
 xd = array('d')
 
 exd = array('d')
 
dictionary y1Dict = {}
 
dictionary ey1Dict = {}
 
dictionary y2Dict = {}
 
dictionary ey2Dict = {}
 
dictionary ydDict = {}
 
dictionary eydDict = {}
 
bool pass1 = False
 
 run = BS1.run
 
 BS2 = BS2Dict[run][lb]
 
bool pass2 = False
 
 diff = getattr(BS1, var) - getattr(BS2, var)
 
 ediff = max(getattr(BS1, var+'Err'), getattr(BS2, var+'Err'))
 
 percdiff = diff / max(getattr(BS1, var), getattr(BS2, var))
 
 sigmaChange = diff/ediff
 
 canvas = ROOT.TCanvas('BeamSpotComparison', 'BeamSpotComparison', 600, 500)
 
dictionary canvases = {}
 
dictionary ratiopad = {}
 
dictionary primarypad = {}
 
dictionary zeroline = {}
 
int ivar = 0
 
list graphColl = []
 
list dummyColl = []
 
list histColl = []
 
 gr1 = ROOT.TGraphErrors(len(x1), x1, y1Dict[var], ex1, ey1Dict[var])
 
 gr2 = ROOT.TGraphErrors(len(x2), x2, y2Dict[var], ex2, ey2Dict[var])
 
 grdiff = ROOT.TGraphErrors(len(xd), xd, ydDict[var], exd, eydDict[var])
 
 xmin = min(min(x1), min(x2))
 
 xmax = max(max(x1), max(x2))
 
 ymin = min(min(y1Dict[var]), min(y2Dict[var]))
 
 ymax = max(max(y1Dict[var]), max(y2Dict[var]))
 
tuple h = (ymax-ymin)
 
 diffmin = min(ydDict[var])
 
 diffmax = max(ydDict[var])
 
 histo = ROOT.TH1F(var, var, 40, diffmin, diffmax)
 
 hdummy = ROOT.TH2D('hd'+var, 'hd'+var, 10, xmin, xmax, 10, ymin, ymax)
 
int primarytextscale = 1./(primarypad[var].GetWh()*primarypad[var].GetAbsHNDC());
 
int ratiotextscale = 1./(ratiopad[var].GetWh()*ratiopad[var].GetAbsHNDC())
 
 minyaxis = hdummy.GetYaxis().GetXmin()
 
 maxyaxis = hdummy.GetYaxis().GetXmax()
 
 rangeyaxis = abs(minyaxis-maxyaxis)
 
 diffymax = grdiff.GetYaxis().GetXmax()
 
 diffymin = grdiff.GetYaxis().GetXmin()
 
string newText = 'New fits: %i' % numNew
 
string oldText = 'Missing fits: %i' %numOld
 
 basename = options.outtag
 
int htmlstart = 0
 
string htmlfilename = basename[htmlstart:-1]+".html"
 
 html = open(htmlfilename,'w')
 

Function Documentation

◆ drawSummary()

def plotBeamSpotCompare.drawSummary (   var = '')

Definition at line 562 of file plotBeamSpotCompare.py.

562 def drawSummary(var=''):
563  # description
564  descrText=''
565  if options.config == 'OnlineOffline':
566  descrText += 'Online - Offline comparison'
567  legText1 = 'Offine'
568  legText2 = 'Online'
569  elif options.config == 'Reproc':
570  if not options.multicanv:
571  descrText += 'Reprocessed - Tier0 comparison'
572  if options.label1 == '':
573  legText1 = 'Tier0'
574  if options.label2 == '':
575  legText2 = 'Reproc'
576  else:
577  legText1 = 'Beamspots 1'
578  legText2 = 'Beamspots 2'
579 
580  if options.label1 != '':
581  legText1 = options.label1
582 
583  if options.label2 != '':
584  legText2 = options.label2
585 
586 
587  if options.multicanv:
588  primarypad[var].cd()
589  if not options.multicanv:
590  ROOTUtils.drawText(0.14, 0.95, 0.1, descrText)
591  else:
592  ROOTUtils.drawText(0.14, 0.95, 0.1, descrText)
593 
594  # legend
595  legendList = []
596 
597  legendList.append([gr1, legText1, 'LP'])
598  legendList.append([gr2, legText2, 'LP'])
599  legendList.append([grdiff, 'Difference', 'LP'])
600  if options.multicanv:
601  ROOTUtils.drawLegend(0.25, 0.6, 0.60, 0.92, legendList)
602  elif not options.plotHistos:
603  ROOTUtils.drawLegend(0.14, 0.67, 0.9, 0.9, legendList)
604  if runNumber != 0:
605  if options.multicanv:
606  ROOTUtils.drawText(0.6, 0.7, 0.1, 'Run = %i' %runNumber)
607  else:
608  ROOTUtils.drawText(0.14, 0.55, 0.1, 'Run = %i' %runNumber)
609  if options.multicanv:
610  primarypad[var].Update()
611 

◆ getVarDef()

def plotBeamSpotCompare.getVarDef (   what,
  property,
  default = '' 
)

Definition at line 37 of file plotBeamSpotCompare.py.

37 def getVarDef(what,property,default=''):
38  try:
39  return varDef[what][property]
40  except:
41  return default
42  global __usage__
43  __usage__ += '\n\nPossible variables to plot are:\n'
44  __usage__ += ' '.join(sorted(ntDef.keys()))
45 
46 # Argument parsing

Variable Documentation

◆ __author__

string plotBeamSpotCompare.__author__ = 'Martina Hurwitz'
private

Definition at line 10 of file plotBeamSpotCompare.py.

◆ __usage__

string plotBeamSpotCompare.__usage__ = '%prog [options] file1/tag1 file2/tag2'
private

Definition at line 12 of file plotBeamSpotCompare.py.

◆ __version__

string plotBeamSpotCompare.__version__ = '$Id $'
private

Definition at line 11 of file plotBeamSpotCompare.py.

◆ action

plotBeamSpotCompare.action

Definition at line 49 of file plotBeamSpotCompare.py.

◆ args

plotBeamSpotCompare.args

Definition at line 72 of file plotBeamSpotCompare.py.

◆ basename

string plotBeamSpotCompare.basename = options.outtag

Definition at line 632 of file plotBeamSpotCompare.py.

◆ BS2

plotBeamSpotCompare.BS2 = BS2Dict[run][lb]

Definition at line 266 of file plotBeamSpotCompare.py.

◆ BS2_status

int plotBeamSpotCompare.BS2_status = options.status

Definition at line 192 of file plotBeamSpotCompare.py.

◆ BS2Dict

plotBeamSpotCompare.BS2Dict = BSData2.getDataCache()

Definition at line 200 of file plotBeamSpotCompare.py.

◆ BSData1

plotBeamSpotCompare.BSData1 = BeamSpotFinderNt(tag1)

Definition at line 121 of file plotBeamSpotCompare.py.

◆ BSData2

plotBeamSpotCompare.BSData2 = BeamSpotFinderNt(tag2)

Definition at line 139 of file plotBeamSpotCompare.py.

◆ canvas

plotBeamSpotCompare.canvas = ROOT.TCanvas('BeamSpotComparison', 'BeamSpotComparison', 600, 500)

Definition at line 360 of file plotBeamSpotCompare.py.

◆ canvases

dictionary plotBeamSpotCompare.canvases = {}

Definition at line 371 of file plotBeamSpotCompare.py.

◆ default

plotBeamSpotCompare.default

Definition at line 49 of file plotBeamSpotCompare.py.

◆ dest

plotBeamSpotCompare.dest

Definition at line 49 of file plotBeamSpotCompare.py.

◆ diff

plotBeamSpotCompare.diff = getattr(BS1, var) - getattr(BS2, var)

Definition at line 293 of file plotBeamSpotCompare.py.

◆ diffmax

plotBeamSpotCompare.diffmax = max(ydDict[var])

Definition at line 409 of file plotBeamSpotCompare.py.

◆ diffmin

plotBeamSpotCompare.diffmin = min(ydDict[var])

Definition at line 408 of file plotBeamSpotCompare.py.

◆ diffymax

plotBeamSpotCompare.diffymax = grdiff.GetYaxis().GetXmax()

Definition at line 518 of file plotBeamSpotCompare.py.

◆ diffymin

plotBeamSpotCompare.diffymin = grdiff.GetYaxis().GetXmin()

Definition at line 519 of file plotBeamSpotCompare.py.

◆ doOnePlot

bool plotBeamSpotCompare.doOnePlot = True

Definition at line 157 of file plotBeamSpotCompare.py.

◆ dummyColl

list plotBeamSpotCompare.dummyColl = []

Definition at line 384 of file plotBeamSpotCompare.py.

◆ ediff

float plotBeamSpotCompare.ediff = max(getattr(BS1, var+'Err'), getattr(BS2, var+'Err'))

Definition at line 295 of file plotBeamSpotCompare.py.

◆ ex1

plotBeamSpotCompare.ex1 = array('d')

Definition at line 216 of file plotBeamSpotCompare.py.

◆ ex2

plotBeamSpotCompare.ex2 = array('d')

Definition at line 218 of file plotBeamSpotCompare.py.

◆ exd

plotBeamSpotCompare.exd = array('d')

Definition at line 220 of file plotBeamSpotCompare.py.

◆ ey1Dict

dictionary plotBeamSpotCompare.ey1Dict = {}

Definition at line 223 of file plotBeamSpotCompare.py.

◆ ey2Dict

dictionary plotBeamSpotCompare.ey2Dict = {}

Definition at line 225 of file plotBeamSpotCompare.py.

◆ eydDict

dictionary plotBeamSpotCompare.eydDict = {}

Definition at line 227 of file plotBeamSpotCompare.py.

◆ False

plotBeamSpotCompare.False

Definition at line 49 of file plotBeamSpotCompare.py.

◆ fromCSV

bool plotBeamSpotCompare.fromCSV = False

Definition at line 115 of file plotBeamSpotCompare.py.

◆ fromDB

bool plotBeamSpotCompare.fromDB = False

Definition at line 114 of file plotBeamSpotCompare.py.

◆ gr1

plotBeamSpotCompare.gr1 = ROOT.TGraphErrors(len(x1), x1, y1Dict[var], ex1, ey1Dict[var])

Definition at line 390 of file plotBeamSpotCompare.py.

◆ gr2

plotBeamSpotCompare.gr2 = ROOT.TGraphErrors(len(x2), x2, y2Dict[var], ex2, ey2Dict[var])

Definition at line 392 of file plotBeamSpotCompare.py.

◆ graphColl

list plotBeamSpotCompare.graphColl = []

Definition at line 383 of file plotBeamSpotCompare.py.

◆ grdiff

plotBeamSpotCompare.grdiff = ROOT.TGraphErrors(len(xd), xd, ydDict[var], exd, eydDict[var])

Definition at line 394 of file plotBeamSpotCompare.py.

◆ h

tuple plotBeamSpotCompare.h = (ymax-ymin)

Definition at line 402 of file plotBeamSpotCompare.py.

◆ hdummy

plotBeamSpotCompare.hdummy = ROOT.TH2D('hd'+var, 'hd'+var, 10, xmin, xmax, 10, ymin, ymax)

Definition at line 431 of file plotBeamSpotCompare.py.

◆ help

plotBeamSpotCompare.help

Definition at line 49 of file plotBeamSpotCompare.py.

◆ histColl

list plotBeamSpotCompare.histColl = []

Definition at line 385 of file plotBeamSpotCompare.py.

◆ histo

plotBeamSpotCompare.histo = ROOT.TH1F(var, var, 40, diffmin, diffmax)

Definition at line 414 of file plotBeamSpotCompare.py.

◆ html

plotBeamSpotCompare.html = open(htmlfilename,'w')

Definition at line 654 of file plotBeamSpotCompare.py.

◆ htmlfilename

string plotBeamSpotCompare.htmlfilename = basename[htmlstart:-1]+".html"

Definition at line 653 of file plotBeamSpotCompare.py.

◆ htmlstart

int plotBeamSpotCompare.htmlstart = 0

Definition at line 650 of file plotBeamSpotCompare.py.

◆ ivar

int plotBeamSpotCompare.ivar = 0

Definition at line 382 of file plotBeamSpotCompare.py.

◆ lbmax

int plotBeamSpotCompare.lbmax = BS1.lbEnd

Definition at line 188 of file plotBeamSpotCompare.py.

◆ lbmin

plotBeamSpotCompare.lbmin = BS1.lbStart

Definition at line 184 of file plotBeamSpotCompare.py.

◆ maxyaxis

plotBeamSpotCompare.maxyaxis = hdummy.GetYaxis().GetXmax()

Definition at line 510 of file plotBeamSpotCompare.py.

◆ minyaxis

plotBeamSpotCompare.minyaxis = hdummy.GetYaxis().GetXmin()

Definition at line 509 of file plotBeamSpotCompare.py.

◆ ndp

int plotBeamSpotCompare.ndp = 5

Definition at line 103 of file plotBeamSpotCompare.py.

◆ ndptilt

int plotBeamSpotCompare.ndptilt = 8

Definition at line 104 of file plotBeamSpotCompare.py.

◆ newText

string plotBeamSpotCompare.newText = 'New fits: %i' % numNew

Definition at line 626 of file plotBeamSpotCompare.py.

◆ numNew

int plotBeamSpotCompare.numNew = 0

Definition at line 212 of file plotBeamSpotCompare.py.

◆ numOld

int plotBeamSpotCompare.numOld = 0

Definition at line 213 of file plotBeamSpotCompare.py.

◆ oldText

string plotBeamSpotCompare.oldText = 'Missing fits: %i' %numOld

Definition at line 627 of file plotBeamSpotCompare.py.

◆ options

plotBeamSpotCompare.options

Definition at line 72 of file plotBeamSpotCompare.py.

◆ parser

plotBeamSpotCompare.parser = OptionParser(usage=__usage__, version=__version__)

Definition at line 48 of file plotBeamSpotCompare.py.

◆ pass1

plotBeamSpotCompare.pass1 = False

Definition at line 230 of file plotBeamSpotCompare.py.

◆ pass2

plotBeamSpotCompare.pass2 = False

Definition at line 268 of file plotBeamSpotCompare.py.

◆ percdiff

int plotBeamSpotCompare.percdiff = diff / max(getattr(BS1, var), getattr(BS2, var))

Definition at line 302 of file plotBeamSpotCompare.py.

◆ primarypad

dictionary plotBeamSpotCompare.primarypad = {}

Definition at line 373 of file plotBeamSpotCompare.py.

◆ primarytextscale

int plotBeamSpotCompare.primarytextscale = 1./(primarypad[var].GetWh()*primarypad[var].GetAbsHNDC());

Definition at line 490 of file plotBeamSpotCompare.py.

◆ rangeyaxis

plotBeamSpotCompare.rangeyaxis = abs(minyaxis-maxyaxis)

Definition at line 511 of file plotBeamSpotCompare.py.

◆ ratiopad

dictionary plotBeamSpotCompare.ratiopad = {}

Definition at line 372 of file plotBeamSpotCompare.py.

◆ ratiotextscale

int plotBeamSpotCompare.ratiotextscale = 1./(ratiopad[var].GetWh()*ratiopad[var].GetAbsHNDC())

Definition at line 497 of file plotBeamSpotCompare.py.

◆ run

plotBeamSpotCompare.run = BS1.run

Definition at line 233 of file plotBeamSpotCompare.py.

◆ runMax

plotBeamSpotCompare.runMax

Definition at line 171 of file plotBeamSpotCompare.py.

◆ runMin

plotBeamSpotCompare.runMin

Definition at line 170 of file plotBeamSpotCompare.py.

◆ runNumber

int plotBeamSpotCompare.runNumber = int(options.runNumber)

Definition at line 90 of file plotBeamSpotCompare.py.

◆ sigmaChange

int plotBeamSpotCompare.sigmaChange = diff/ediff

Definition at line 307 of file plotBeamSpotCompare.py.

◆ statusList

plotBeamSpotCompare.statusList

Definition at line 199 of file plotBeamSpotCompare.py.

◆ tag1

plotBeamSpotCompare.tag1 = ''

Definition at line 74 of file plotBeamSpotCompare.py.

◆ tag2

plotBeamSpotCompare.tag2 = ''

Definition at line 75 of file plotBeamSpotCompare.py.

◆ type

plotBeamSpotCompare.type

Definition at line 52 of file plotBeamSpotCompare.py.

◆ varColl

list plotBeamSpotCompare.varColl = []

Definition at line 155 of file plotBeamSpotCompare.py.

◆ varDef

dictionary plotBeamSpotCompare.varDef
Initial value:
1 = {
2  'nEvents': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(N_{vert})', 'ytit2': 'Number of vertices', 'title': 'Difference in number of vertices', 'bigchange': 300, 'cannr':2},
3  'k': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(k)', 'ytit2': 'Error scale factor k', 'title': 'Difference in error scale factor k', 'bigchange': 0.2, 'cannr':3},
4  'posX': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(x) [mm]', 'ytit2': 'X position [mm]', 'title': 'Difference in beamspot x', 'bigchange': 10, 'cannr':7},
5  'posY': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(y) [mm]', 'ytit2': 'Y position [mm]', 'title': 'Difference in beamspot y', 'bigchange': 10, 'cannr':8},
6  'posZ': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(z) [mm]', 'ytit2': 'Z position [mm]', 'title': 'Difference in beamspot z', 'bigchange': 3, 'cannr':9},
7  'sigmaX': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(#sigma_{x}) [mm]', 'ytit2': '#sigma_{x} [mm]', 'title': 'Difference in beamspot #sigma_{x}', 'bigchange': 3,'cannr':13},
8  'sigmaY': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(#sigma_{y}) [mm]', 'ytit2': '#sigma_{y} [mm]', 'title': 'Difference in beamspot #sigma_{y}', 'bigchange': 3,'cannr':14},
9  'sigmaZ': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(#sigma_{z}) [mm]', 'ytit2': '#sigma_{z} [mm]', 'title': 'Difference in beamspot #sigma_{z}', 'bigchange': 2, 'cannr':15},
10  'tiltX': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(Tilt_{x-z}) [rad]', 'ytit2': 'Tilt in x-z [rad]', 'title': 'Difference in beamspot tilt in x-z', 'bigchange': 0.15,'cannr':19},
11  'tiltY': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(Tilt_{y-z}) [rad]', 'ytit2': 'Tilt in y-z [rad]', 'title': 'Difference in beamspot tilt in y-z', 'bigchange': 0.15,'cannr':20},
12  'rhoXY': {'xtit': 'Luminosity Block Number', 'ytit': '#Delta(#rho_{xy})', 'ytit2': '#rho_{xy}', 'title': 'Difference in #rho', 'bigchange': 0.15,'cannr':21}
13  }

Definition at line 24 of file plotBeamSpotCompare.py.

◆ x1

plotBeamSpotCompare.x1 = array('d')

Definition at line 215 of file plotBeamSpotCompare.py.

◆ x2

plotBeamSpotCompare.x2 = array('d')

Definition at line 217 of file plotBeamSpotCompare.py.

◆ xd

plotBeamSpotCompare.xd = array('d')

Definition at line 219 of file plotBeamSpotCompare.py.

◆ xmax

plotBeamSpotCompare.xmax = max(max(x1), max(x2))

Definition at line 398 of file plotBeamSpotCompare.py.

◆ xmin

plotBeamSpotCompare.xmin = min(min(x1), min(x2))

Definition at line 397 of file plotBeamSpotCompare.py.

◆ y1Dict

dictionary plotBeamSpotCompare.y1Dict = {}

Definition at line 222 of file plotBeamSpotCompare.py.

◆ y2Dict

dictionary plotBeamSpotCompare.y2Dict = {}

Definition at line 224 of file plotBeamSpotCompare.py.

◆ ydDict

dictionary plotBeamSpotCompare.ydDict = {}

Definition at line 226 of file plotBeamSpotCompare.py.

◆ ymax

plotBeamSpotCompare.ymax = max(max(y1Dict[var]), max(y2Dict[var]))

Definition at line 400 of file plotBeamSpotCompare.py.

◆ ymin

plotBeamSpotCompare.ymin = min(min(y1Dict[var]), min(y2Dict[var]))

Definition at line 399 of file plotBeamSpotCompare.py.

◆ zeroline

dictionary plotBeamSpotCompare.zeroline = {}

Definition at line 374 of file plotBeamSpotCompare.py.

DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename R::value_type > sorted(const R &r, PROJ proj={})
Helper function to create a sorted vector from an unsorted range.
ROOTUtils.drawText
def drawText(x=0.74, y=0.87, dy=0.06, text='', font=62, color=1, align=11, linesep=';')
Definition: roofit/ROOTUtils.py:243
plotBeamSpotCompare.drawSummary
def drawSummary(var='')
Definition: plotBeamSpotCompare.py:562
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
plotBeamSpotCompare.getVarDef
def getVarDef(what, property, default='')
Definition: plotBeamSpotCompare.py:37
calibdata.cd
cd
Definition: calibdata.py:50
ROOTUtils.drawLegend
def drawLegend(x1, y1, x2, y2, legendList=[], fillColor=0, lineColor=0, textSize=None, protectLegend=True)
Definition: roofit/ROOTUtils.py:259