ATLAS Offline Software
Loading...
Searching...
No Matches
PlotServer.py
Go to the documentation of this file.
1# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3"""
4ATLAS beam spot plot server.
5"""
6
7__author__ = 'Juerg Beringer'
8__version__ = 'DebugPage.py atlas/athena'
9
10from BeamSpotWebPage import BeamSpotWebPage
12
13import sys
14import cherrypy
15
16errorMsg = """\
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
content(self, **args)
Definition PlotServer.py:24
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)