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 563 of file plotBeamSpotCompare.py.

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

◆ getVarDef()

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

Definition at line 38 of file plotBeamSpotCompare.py.

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

Variable Documentation

◆ __author__

string plotBeamSpotCompare.__author__ = 'Martina Hurwitz'
private

Definition at line 11 of file plotBeamSpotCompare.py.

◆ __usage__

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

Definition at line 13 of file plotBeamSpotCompare.py.

◆ __version__

string plotBeamSpotCompare.__version__ = '$Id $'
private

Definition at line 12 of file plotBeamSpotCompare.py.

◆ action

plotBeamSpotCompare.action

Definition at line 50 of file plotBeamSpotCompare.py.

◆ args

plotBeamSpotCompare.args

Definition at line 73 of file plotBeamSpotCompare.py.

◆ basename

string plotBeamSpotCompare.basename = options.outtag

Definition at line 633 of file plotBeamSpotCompare.py.

◆ BS2

plotBeamSpotCompare.BS2 = BS2Dict[run][lb]

Definition at line 267 of file plotBeamSpotCompare.py.

◆ BS2_status

int plotBeamSpotCompare.BS2_status = options.status

Definition at line 193 of file plotBeamSpotCompare.py.

◆ BS2Dict

plotBeamSpotCompare.BS2Dict = BSData2.getDataCache()

Definition at line 201 of file plotBeamSpotCompare.py.

◆ BSData1

plotBeamSpotCompare.BSData1 = BeamSpotFinderNt(tag1)

Definition at line 122 of file plotBeamSpotCompare.py.

◆ BSData2

plotBeamSpotCompare.BSData2 = BeamSpotFinderNt(tag2)

Definition at line 140 of file plotBeamSpotCompare.py.

◆ canvas

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

Definition at line 361 of file plotBeamSpotCompare.py.

◆ canvases

dictionary plotBeamSpotCompare.canvases = {}

Definition at line 372 of file plotBeamSpotCompare.py.

◆ default

plotBeamSpotCompare.default

Definition at line 50 of file plotBeamSpotCompare.py.

◆ dest

plotBeamSpotCompare.dest

Definition at line 50 of file plotBeamSpotCompare.py.

◆ diff

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

Definition at line 294 of file plotBeamSpotCompare.py.

◆ diffmax

plotBeamSpotCompare.diffmax = max(ydDict[var])

Definition at line 410 of file plotBeamSpotCompare.py.

◆ diffmin

plotBeamSpotCompare.diffmin = min(ydDict[var])

Definition at line 409 of file plotBeamSpotCompare.py.

◆ diffymax

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

Definition at line 519 of file plotBeamSpotCompare.py.

◆ diffymin

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

Definition at line 520 of file plotBeamSpotCompare.py.

◆ doOnePlot

bool plotBeamSpotCompare.doOnePlot = True

Definition at line 158 of file plotBeamSpotCompare.py.

◆ dummyColl

list plotBeamSpotCompare.dummyColl = []

Definition at line 385 of file plotBeamSpotCompare.py.

◆ ediff

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

Definition at line 296 of file plotBeamSpotCompare.py.

◆ ex1

plotBeamSpotCompare.ex1 = array('d')

Definition at line 217 of file plotBeamSpotCompare.py.

◆ ex2

plotBeamSpotCompare.ex2 = array('d')

Definition at line 219 of file plotBeamSpotCompare.py.

◆ exd

plotBeamSpotCompare.exd = array('d')

Definition at line 221 of file plotBeamSpotCompare.py.

◆ ey1Dict

dictionary plotBeamSpotCompare.ey1Dict = {}

Definition at line 224 of file plotBeamSpotCompare.py.

◆ ey2Dict

dictionary plotBeamSpotCompare.ey2Dict = {}

Definition at line 226 of file plotBeamSpotCompare.py.

◆ eydDict

dictionary plotBeamSpotCompare.eydDict = {}

Definition at line 228 of file plotBeamSpotCompare.py.

◆ False

plotBeamSpotCompare.False

Definition at line 50 of file plotBeamSpotCompare.py.

◆ fromCSV

bool plotBeamSpotCompare.fromCSV = False

Definition at line 116 of file plotBeamSpotCompare.py.

◆ fromDB

bool plotBeamSpotCompare.fromDB = False

Definition at line 115 of file plotBeamSpotCompare.py.

◆ gr1

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

Definition at line 391 of file plotBeamSpotCompare.py.

◆ gr2

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

Definition at line 393 of file plotBeamSpotCompare.py.

◆ graphColl

list plotBeamSpotCompare.graphColl = []

Definition at line 384 of file plotBeamSpotCompare.py.

◆ grdiff

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

Definition at line 395 of file plotBeamSpotCompare.py.

◆ h

tuple plotBeamSpotCompare.h = (ymax-ymin)

Definition at line 403 of file plotBeamSpotCompare.py.

◆ hdummy

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

Definition at line 432 of file plotBeamSpotCompare.py.

◆ help

plotBeamSpotCompare.help

Definition at line 50 of file plotBeamSpotCompare.py.

◆ histColl

list plotBeamSpotCompare.histColl = []

Definition at line 386 of file plotBeamSpotCompare.py.

◆ histo

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

Definition at line 415 of file plotBeamSpotCompare.py.

◆ html

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

Definition at line 655 of file plotBeamSpotCompare.py.

◆ htmlfilename

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

Definition at line 654 of file plotBeamSpotCompare.py.

◆ htmlstart

int plotBeamSpotCompare.htmlstart = 0

Definition at line 651 of file plotBeamSpotCompare.py.

◆ ivar

int plotBeamSpotCompare.ivar = 0

Definition at line 383 of file plotBeamSpotCompare.py.

◆ lbmax

int plotBeamSpotCompare.lbmax = BS1.lbEnd

Definition at line 189 of file plotBeamSpotCompare.py.

◆ lbmin

plotBeamSpotCompare.lbmin = BS1.lbStart

Definition at line 185 of file plotBeamSpotCompare.py.

◆ maxyaxis

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

Definition at line 511 of file plotBeamSpotCompare.py.

◆ minyaxis

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

Definition at line 510 of file plotBeamSpotCompare.py.

◆ ndp

int plotBeamSpotCompare.ndp = 5

Definition at line 104 of file plotBeamSpotCompare.py.

◆ ndptilt

int plotBeamSpotCompare.ndptilt = 8

Definition at line 105 of file plotBeamSpotCompare.py.

◆ newText

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

Definition at line 627 of file plotBeamSpotCompare.py.

◆ numNew

int plotBeamSpotCompare.numNew = 0

Definition at line 213 of file plotBeamSpotCompare.py.

◆ numOld

int plotBeamSpotCompare.numOld = 0

Definition at line 214 of file plotBeamSpotCompare.py.

◆ oldText

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

Definition at line 628 of file plotBeamSpotCompare.py.

◆ options

plotBeamSpotCompare.options

Definition at line 73 of file plotBeamSpotCompare.py.

◆ parser

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

Definition at line 49 of file plotBeamSpotCompare.py.

◆ pass1

plotBeamSpotCompare.pass1 = False

Definition at line 231 of file plotBeamSpotCompare.py.

◆ pass2

plotBeamSpotCompare.pass2 = False

Definition at line 269 of file plotBeamSpotCompare.py.

◆ percdiff

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

Definition at line 303 of file plotBeamSpotCompare.py.

◆ primarypad

dictionary plotBeamSpotCompare.primarypad = {}

Definition at line 374 of file plotBeamSpotCompare.py.

◆ primarytextscale

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

Definition at line 491 of file plotBeamSpotCompare.py.

◆ rangeyaxis

plotBeamSpotCompare.rangeyaxis = abs(minyaxis-maxyaxis)

Definition at line 512 of file plotBeamSpotCompare.py.

◆ ratiopad

dictionary plotBeamSpotCompare.ratiopad = {}

Definition at line 373 of file plotBeamSpotCompare.py.

◆ ratiotextscale

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

Definition at line 498 of file plotBeamSpotCompare.py.

◆ run

plotBeamSpotCompare.run = BS1.run

Definition at line 234 of file plotBeamSpotCompare.py.

◆ runMax

plotBeamSpotCompare.runMax

Definition at line 172 of file plotBeamSpotCompare.py.

◆ runMin

plotBeamSpotCompare.runMin

Definition at line 171 of file plotBeamSpotCompare.py.

◆ runNumber

int plotBeamSpotCompare.runNumber = int(options.runNumber)

Definition at line 91 of file plotBeamSpotCompare.py.

◆ sigmaChange

int plotBeamSpotCompare.sigmaChange = diff/ediff

Definition at line 308 of file plotBeamSpotCompare.py.

◆ statusList

plotBeamSpotCompare.statusList

Definition at line 200 of file plotBeamSpotCompare.py.

◆ tag1

plotBeamSpotCompare.tag1 = ''

Definition at line 75 of file plotBeamSpotCompare.py.

◆ tag2

plotBeamSpotCompare.tag2 = ''

Definition at line 76 of file plotBeamSpotCompare.py.

◆ type

plotBeamSpotCompare.type

Definition at line 53 of file plotBeamSpotCompare.py.

◆ varColl

list plotBeamSpotCompare.varColl = []

Definition at line 156 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 25 of file plotBeamSpotCompare.py.

◆ x1

plotBeamSpotCompare.x1 = array('d')

Definition at line 216 of file plotBeamSpotCompare.py.

◆ x2

plotBeamSpotCompare.x2 = array('d')

Definition at line 218 of file plotBeamSpotCompare.py.

◆ xd

plotBeamSpotCompare.xd = array('d')

Definition at line 220 of file plotBeamSpotCompare.py.

◆ xmax

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

Definition at line 399 of file plotBeamSpotCompare.py.

◆ xmin

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

Definition at line 398 of file plotBeamSpotCompare.py.

◆ y1Dict

dictionary plotBeamSpotCompare.y1Dict = {}

Definition at line 223 of file plotBeamSpotCompare.py.

◆ y2Dict

dictionary plotBeamSpotCompare.y2Dict = {}

Definition at line 225 of file plotBeamSpotCompare.py.

◆ ydDict

dictionary plotBeamSpotCompare.ydDict = {}

Definition at line 227 of file plotBeamSpotCompare.py.

◆ ymax

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

Definition at line 401 of file plotBeamSpotCompare.py.

◆ ymin

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

Definition at line 400 of file plotBeamSpotCompare.py.

◆ zeroline

dictionary plotBeamSpotCompare.zeroline = {}

Definition at line 375 of file plotBeamSpotCompare.py.

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:563
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
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:38
calibdata.cd
cd
Definition: calibdata.py:51
ROOTUtils.drawLegend
def drawLegend(x1, y1, x2, y2, legendList=[], fillColor=0, lineColor=0, textSize=None, protectLegend=True)
Definition: roofit/ROOTUtils.py:259