ATLAS Offline Software
Loading...
Searching...
No Matches
InnerDetector
InDetExample
InDetBeamSpotExample
www
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
11
from
InDetBeamSpotExample.TaskManager
import
*
12
13
import
sys
14
import
cherrypy
15
16
errorMsg =
"""\
17
<div class="errormsg">
18
%s
19
</div>
20
"""
21
22
class
PlotServer
(
BeamSpotWebPage
):
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
BeamSpotWebPage.BeamSpotWebPage
Definition
BeamSpotWebPage.py:47
PlotServer.PlotServer
Definition
PlotServer.py:22
PlotServer.PlotServer.content
content(self, **args)
Definition
PlotServer.py:24
PlotServer.PlotServer.default
default(self, run)
Definition
PlotServer.py:28
WebPage.WebPage.globalConfig
globalConfig
Definition
WebPage.py:290
split
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition
hcg.cxx:177
TaskManager
read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition
openCoraCool.cxx:569
Generated on
for ATLAS Offline Software by
1.14.0