ATLAS Offline Software
root2html.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4 # @file: root2html.py
5 # @purpose: Generate the index.htm for a list of root files
6 # @author: Will Buttinger
7 #
8 
9 html_template = """
10 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
11 <html lang="en">
12  <head>
13  <meta charset="UTF-8" http-equiv="X-UA-Compatible" content="IE=Edge">
14  <title>Read a ROOT file</title>
15  <link rel="shortcut icon" href="https://root.cern.ch/js/latest/img/RootIcon.ico">
16  <!-- To make use of RequireJS, un-comment the following line and comment the second line below -->
17  <!--script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.19/require.min.js" data-main="scripts/JSRootCore.js"></script-->
18  <script type="text/javascript" src="https://root.cern.ch/js/latest/scripts/JSRootCore.js?gui"></script>
19  </head>
20  <body>
21  <div id="simpleGUI" path="./" files="%(file_list)s">
22  loading scripts ...
23  </div>
24  </body>
25 </html>
26 """
27 
28 
29 import sys
30 
31 def main():
32 
33  # Parse arguments
34  from optparse import OptionParser
35  parser = OptionParser(usage = "usage: %prog [options] file1 [file2] ..." )
36 
37  (opts, args) = parser.parse_args()
38 
39  if len(args)<1:
40  parser.print_help()
41  return
42 
43  #create an index.htm with the input file and rootcomp.root
44  d = {"file_list":";".join(args)}
45  o_html = open('index.htm', 'w')
46  o_html.writelines(html_template%d)
47  o_html.flush()
48  o_html.close()
49  print("Wrote index.htm file")
50 
51  return 0
52 
53 
54 if __name__ == "__main__":
55  sys.exit(main())
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
root2html.main
def main()
Definition: root2html.py:31
Trk::open
@ open
Definition: BinningType.h:40
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28