]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/PiKaPr/TestAOD/createNames.py
q vector calibration for generated data
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TestAOD / createNames.py
1 #!/usr/bin/python
2
3 def main():
4     print "I need to be debugged, please fix me"
5     return
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")
27     output.append ("}\n")
28
29     # write file
30     outfile = open("HistogramNames.h", "w")
31     outfile.write("#ifndef HISTOGRAMNAMES_H\n");
32     outfile.write("#define HISTOGRAMNAMES_H\n\n");
33     outfile.write("//This file was generated automatically, please do not edit!!\n\n");
34     outfile.writelines(output)
35     outfile.write("\n#endif\n");
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()