]>
Commit | Line | Data |
---|---|---|
4290905b | 1 | #!/usr/bin/python |
2 | ||
3 | def main(): | |
4 | ||
5 | # print header | |
6 | output = list() | |
7 | output.append ("namespace AliSpectraNameSpace\n") | |
8 | output.append ("{\n") | |
9 | output.append (" const char * kHistName[] =\n") | |
10 | output.append (" {\n") | |
11 | ||
12 | # print histogram names | |
13 | ifile = open("Histograms.h", "rb") | |
14 | for line in ifile: | |
15 | lineNoWS = line.strip() | |
16 | if(not lineNoWS.startswith("k")): # skip everything which is not an entry in the enum | |
17 | continue | |
18 | if("=" in lineNoWS): # skip histogram type delimeters | |
19 | continue | |
20 | col=line.split(",") | |
21 | ||
22 | output.append(" \"h"+col[0].strip()[1:]+"\",\n"); | |
23 | ||
24 | output.append (" };\n") | |
61c066d5 | 25 | output.append ("}\n") |
4290905b | 26 | |
27 | # write file | |
28 | outfile = open("HistogramNames.h", "w") | |
29 | outfile.write("//This file was generated automatically, please do not edit!!\n\n"); | |
30 | outfile.writelines(output) | |
31 | outfile.close() | |
32 | ||
33 | ||
34 | ## def skipLines(lineNoWS): | |
35 | ## beginningsToSkip = ["//", "{", "namespace", "enum"] | |
36 | ## for entry in beginningsToSkip: | |
37 | ## if lineNoWS.startswith(entry): | |
38 | ## return 1 | |
39 | ## return 0 | |
40 | ||
41 | ||
42 | ||
43 | ####################################################################### | |
44 | if __name__ == "__main__": | |
45 | main() |