ATLAS Offline Software
MooRTT_makePage.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
4 
5 import os
6 import sys
7 import glob
8 from Logger import Logger
9 
11  def __init__(self,argDict={}):
12 
13  # access my args from the dictionary passed in, and convert any basic types
14  # self.myArg = argDict.get('MyArg') # = the Python string type '3'
15  # self.myArg = int(self.myArg) # = the Python integer type 3
16 
17  # access the RTT descriptor instance
18  rttDescriptor = argDict.get('JobDescriptor')
19 
20  # grab some stuff from it
21  self.branch = str(rttDescriptor.paths.branch)
22  self.jobDisplayName = str(rttDescriptor.jobDisplayName)
23  self.jobGroup = str(rttDescriptor.jobGroup)
24  self.name = str(rttDescriptor.name)
25  self.package = str(rttDescriptor.package)
26  self.release = str(rttDescriptor.paths.release)
27  self.runPath = str(rttDescriptor.runPath)
28 
29  self.logger = Logger()
30 
31  def run(self):
32  logfile = open(self.runPath + "/makePage.log",'a')
33  logfile.write("Starting makePage.py run method\n")
34  jobinfolist = { "Package" : self.package ,
35  "Name" : self.name ,
36  "Branch" : self.branch ,
37  "Release" : self.release }
38  logfile.write("jobinfolist: \n")
39 
40  output = open("ALL_MooPerformanceResults.html","w")
41  output.write("<h2><TABLE BORDER=6 CELLSPACING=4 CELLPADDING=4>\n")
42  for key in jobinfolist.keys():
43  logfile.write(" " + key + ": " + jobinfolist[key] +"\n")
44  output.write(" <TR><TD><b>" + key + "</b></TD><TD>" + jobinfolist[key] + "</TD></TR>\n")
45  output.write(" <TR><TD><b>" + "Date" + "</b></TD><TD>" + os.popen("date").readline().strip() + "</TD></TR>\n")
46  output.write("</TABLE>\n\n")
47  output.write("</h2>")
48 
49  # output the relevant text files
50  txtFiles = ["trkPerformance_CombinedMuonTracks.txt",
51  "trkPerformance_ExtrapolatedMuonTracks.txt",
52  "trkSummary.txt"]
53  for fileName in txtFiles:
54  strArray = glob.glob(fileName)
55  if (len(strArray) > 0):
56  fIn = open(strArray[0])
57  lines = fIn.readlines()
58  output.write("<h3>" + str(fileName).strip() + "</h3>")
59  output.write("<pre>")
60  for i in range(len(lines)):
61  output.write(str(lines[i].strip()) + "\n")
62  output.write("</pre>")
63 
64  # add the gif plots
65  gifFiles = ["MS_Bdl", "MS_material", "match_quality", "fit_chi2",
66  "qOverP_res", "qOverP_pull", "qOverP_CB_resByRegion", "qOverP_SA_resByRegion", "qOverP_CB_pullByRegion", "qOverP_SA_pullByRegion",
67  "Pt_res", "Pt_pull", "Pt_CB_resByRegion", "Pt_SA_resByRegion", "Pt_CB_pullByRegion", "Pt_SA_pullByRegion", "Pt_MG_pullByRegion",
68  "D0_res", "D0_resLow", "D0_pull", "D0_SA_resByRegion", "D0_SA_resByRegionLow", "D0_SA_pullByRegion",
69  "Z0_res", "Z0_resLow", "Z0_pull", "Z0_SA_resByRegion", "Z0_SA_resByRegionLow", "Z0_SA_pullByRegion",
70  "Phi_res", "Phi_pull", "Phi_SA_resByRegion", "Phi_SA_pullByRegion",
71  "Theta_res", "Theta_pull", "Theta_SA_resByRegion", "Theta_SA_pullByRegion", "Theta_CB_pullByRegion",
72  "MG-CB", "CMF-CB", "ID-CB", "ID-CMF", "qOverP_ratio"]
73  gifTitle = ["MS field integral", "MS material", "ID+MS match quality", "fit chi2/DOF",
74  "qOverP resolution", "pull qOverP", "CB qOverP resolution", "SA qOverP resolution", "CB qOverP pull", "SA qOverP pull",
75  "Pt resolution", "pull Pt", "CB Pt resolution", "SA Pt resolution", "CB Pt pull", "SA pull Pt", "MG pull Pt",
76  "D0 resolution", "D0 resolution", "pull D0", "SA D0 resolution", "SA D0 resolution", "SA D0 pull",
77  "Z0 resolution", "Z0 resolution", "pull Z0", "SA Z0 resolution", "SA Z0 resolution", "SA Z0 pull",
78  "Phi resolution", "pull Phi", "SA Phi resolution", "SA Phi pull",
79  "Theta resolution", "pull Theta", "SA Theta resolution", "SA Theta pull", "CB Theta pull",
80  "MuGirl - combined", "CombinedMuonFit - combined", "Indet - combined", "Indet - CombinedMuonFit", "qOverP ratio"]
81 
82  #for i in range(len(gifFiles)):
83  # # print i
84  # path = str(gifFiles[i]).strip('\n') + ".gif"
85  # if os.path.isfile(str(path)):
86  # # print "File exists at path ",path
87  # output.write("<h3>" + str(gifTitle[i]).strip() + "</h3>")
88  # line = "<img src=\""+ path + "\">"
89  # output.write(line+'\n')
90 
91  output.close()
92  return 0
93 
MooRTT_makePage.MooRTT_makePage.name
name
Definition: MooRTT_makePage.py:24
MooRTT_makePage.MooRTT_makePage.branch
branch
Definition: MooRTT_makePage.py:21
MooRTT_makePage.MooRTT_makePage.__init__
def __init__(self, argDict={})
Definition: MooRTT_makePage.py:11
MooRTT_makePage.MooRTT_makePage.run
def run(self)
Definition: MooRTT_makePage.py:31
MooRTT_makePage.MooRTT_makePage.package
package
Definition: MooRTT_makePage.py:25
MooRTT_makePage.MooRTT_makePage
Definition: MooRTT_makePage.py:10
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
MooRTT_makePage.MooRTT_makePage.runPath
runPath
Definition: MooRTT_makePage.py:27
Trk::open
@ open
Definition: BinningType.h:40
MooRTT_makePage.MooRTT_makePage.release
release
Definition: MooRTT_makePage.py:26
MooRTT_makePage.MooRTT_makePage.logger
logger
Definition: MooRTT_makePage.py:29
MooRTT_makePage.MooRTT_makePage.jobDisplayName
jobDisplayName
Definition: MooRTT_makePage.py:22
str
Definition: BTagTrackIpAccessor.cxx:11
MooRTT_makePage.MooRTT_makePage.jobGroup
jobGroup
Definition: MooRTT_makePage.py:23