6 make ordered list of .xml histogram definitions for
7 * input histogram title list (one per line)
8 * and an input .xml file (containing unordered superset
9 of input histo definitions)
10 use-case: introducing some order in ~ 1k histograms InDetPVM produces
18 from hist_bookkeep_utils
import *
20 parser = argparse.ArgumentParser(
21 description=
'Get histogram xml blocks for list of id-s')
23 parser.add_argument(
'--id',
27 help=
'list of histogram id-s, one per line')
29 parser.add_argument(
'--xml',
33 help=
'xml file with histogram definitions')
35 parser.add_argument(
'--c',
39 help=
'comment to put above each of the histograms')
41 args = parser.parse_args()
45 in_histid_name=args.in_histid.name
46 in_xmldef_name=args.in_xmldef.name
48 out_xmldef_name=in_xmldef_name.split(
".")[0]+
"_"+in_histid_name.split(
".")[0]+
".xml"
49 out_missingdef_name=in_xmldef_name.split(
".")[0]+
"_"+in_histid_name.split(
".")[0]+
"_missing.txt"
52 print ' reading input histogram ids in: ', in_histid_name
53 print ' reading histogram xml definitions in: ', in_xmldef_name
54 print ' writing histogram definitions to: ', out_xmldef_name
55 print ' writing histos missing definitions to: ', out_missingdef_name
58 out_xmldef=
open(out_xmldef_name,
'w')
59 out_missingdef=
open(out_missingdef_name,
'w')
62 for line
in args.in_histid:
63 id=re.sub(
'\n',
'',line)
66 out_missingdef.write(id+
'\n')
69 out_xmldef.write(bline)
75 out_missingdef.close()