ATLAS Offline Software
PlotServer.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2 
3 """
4 ATLAS beam spot plot server.
5 """
6 
7 __author__ = 'Juerg Beringer'
8 __version__ = 'DebugPage.py atlas/athena'
9 
10 from BeamSpotWebPage import BeamSpotWebPage
12 
13 import sys
14 import cherrypy
15 
16 errorMsg = """\
17 <div class="errormsg">
18 %s
19 </div>
20 """
21 
23 
24  def content(self,**args):
25  """When called without a run number argument in the URL, generate a web page with an error message"""
26  return errorMsg % 'ERROR: You must specify a run number in the URL (e.g. http://..../plots/160879)'
27 
28  def default(self,run):
29  """Return a summary gif image for the run specified in the URL. If no such image exists (or the run
30  doesn't exist), currently returns a zero-length image."""
31  cherrypy.response.headers['Content-Type'] = "image/gif"
32  try:
33  with TaskManager(self.globalConfig['taskDb']) as taskman:
34  t = taskman.taskIterDict('*',['where RUNNR =',DbParam(int(run)),"and TASKNAME like 'DB_BEAMSPOT%%' order by UPDATED desc"]).next()
35  wantedFile = 'PlotBeamSpot.gif'
36  for f in t['RESULTFILES'].split():
37  if f[-len(wantedFile):] == wantedFile: break
38  path = '/'.join([self.globalConfig['jobDir'],t['DSNAME'],t['TASKNAME'],f])
39  return open(path,'r').read()
40  except:
41  return None
42  default.exposed = True
PlotServer.PlotServer.default
def default(self, run)
Definition: PlotServer.py:28
read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition: openCoraCool.cxx:569
WebPage.WebPage.globalConfig
globalConfig
Definition: WebPage.py:290
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TaskManager
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
PlotServer.PlotServer
Definition: PlotServer.py:22
PlotServer.PlotServer.content
def content(self, **args)
Definition: PlotServer.py:24
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::open
@ open
Definition: BinningType.h:40
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
BeamSpotWebPage.BeamSpotWebPage
Definition: BeamSpotWebPage.py:47