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