Commit db8f7e10fbda3df753c92f17d370646ca7ed3640
1 parent
98a42d52
Add database for DESY Prod2 files.
Showing
1 changed file
with
111 additions
and
17 deletions
scripts/cta_root2caldb.py
| @@ -933,7 +933,93 @@ class caldb(): | @@ -933,7 +933,93 @@ class caldb(): | ||
| 933 | 933 | ||
| 934 | # Return | 934 | # Return |
| 935 | return | 935 | return |
| 936 | - | 936 | + |
| 937 | + | ||
| 938 | +#=========================# | ||
| 939 | +# Set Prod2 DESY database # | ||
| 940 | +#=========================# | ||
| 941 | +def set_prod2_desy(): | ||
| 942 | + """ | ||
| 943 | + Set Prod2 database. | ||
| 944 | + """ | ||
| 945 | + # Set database attributes | ||
| 946 | + path = "/project-data/cta/performance/prod2/Performance_DESY_20140128" | ||
| 947 | + rebin = False | ||
| 948 | + | ||
| 949 | + # Set database content | ||
| 950 | + db = [{'inst': "aar", 'id': "DESY20140105_50h", | ||
| 951 | + 'path': path, 'rebin': rebin, | ||
| 952 | + 'file': "DESY.d20140105.Erec1.V2.ID0NIM2.prod2-Aar-NS.S.2a.180000s.root"}, | ||
| 953 | + {'inst': "aar", 'id': "DESY20140105_50h_0deg", | ||
| 954 | + 'path': path, 'rebin': rebin, | ||
| 955 | + 'file': "DESY.d20140105.Erec1.V2.ID0_0degNIM2.prod2-Aar-NS.S.2a.180000s.root"}, | ||
| 956 | + {'inst': "aar", 'id': "DESY20140105_50h_180deg", | ||
| 957 | + 'path': path, 'rebin': rebin, | ||
| 958 | + 'file': "DESY.d20140105.Erec1.V2.ID0_180degNIM2.prod2-Aar-NS.S.2a.180000s.root"}, | ||
| 959 | + | ||
| 960 | + {'inst': "aar500", 'id': "DESY20140105_50h", | ||
| 961 | + 'path': path, 'rebin': rebin, | ||
| 962 | + 'file': "DESY.d20140105.Erec1.V2.ID0NIM2.prod2-Aar-500m-NS.S.2a.180000s.root"}, | ||
| 963 | + {'inst': "aar500", 'id': "DESY20140105_50h_0deg", | ||
| 964 | + 'path': path, 'rebin': rebin, | ||
| 965 | + 'file': "DESY.d20140105.Erec1.V2.ID0_0degNIM2.prod2-Aar-500m-NS.S.2a.180000s.root"}, | ||
| 966 | + {'inst': "aar500", 'id': "DESY20140105_50h_180deg", | ||
| 967 | + 'path': path, 'rebin': rebin, | ||
| 968 | + 'file': "DESY.d20140105.Erec1.V2.ID0_180degNIM2.prod2-Aar-500m-NS.S.2a.180000s.root"}, | ||
| 969 | + | ||
| 970 | + {'inst': "leoncito", 'id': "DESY20140105_50h", | ||
| 971 | + 'path': path, 'rebin': rebin, | ||
| 972 | + 'file': "DESY.d20140105.Erec1.V2.ID0NIM2.prod2-LeoncitoPP-NS.S.2a.180000s.root"}, | ||
| 973 | + {'inst': "leoncito", 'id': "DESY20140105_50h_0deg", | ||
| 974 | + 'path': path, 'rebin': rebin, | ||
| 975 | + 'file': "DESY.d20140105.Erec1.V2.ID0_0degNIM2.prod2-LeoncitoPP-NS.S.2a.180000s.root"}, | ||
| 976 | + {'inst': "leoncito", 'id': "DESY20140105_50h_180deg", | ||
| 977 | + 'path': path, 'rebin': rebin, | ||
| 978 | + 'file': "DESY.d20140105.Erec1.V2.ID0_180degNIM2.prod2-LeoncitoPP-NS.S.2a.180000s.root"}, | ||
| 979 | + | ||
| 980 | + {'inst': "sac", 'id': "DESY20140105_50h", | ||
| 981 | + 'path': path, 'rebin': rebin, | ||
| 982 | + 'file': "DESY.d20140105.Erec1.V2.ID0NIM2.prod2-SAC100-NS.S.2a.180000s.root"}, | ||
| 983 | + {'inst': "sac", 'id': "DESY20140105_50h_0deg", | ||
| 984 | + 'path': path, 'rebin': rebin, | ||
| 985 | + 'file': "DESY.d20140105.Erec1.V2.ID0_0degNIM2.prod2-SAC100-NS.S.2a.180000s.root"}, | ||
| 986 | + {'inst': "sac", 'id': "DESY20140105_50h_180deg", | ||
| 987 | + 'path': path, 'rebin': rebin, | ||
| 988 | + 'file': "DESY.d20140105.Erec1.V2.ID0_180degNIM2.prod2-SAC100-NS.S.2a.180000s.root"}, | ||
| 989 | + | ||
| 990 | + {'inst': "spm", 'id': "DESY20140105_50h", | ||
| 991 | + 'path': path, 'rebin': rebin, | ||
| 992 | + 'file': "DESY.d20140105.Erec1.V2.ID0NIM2.prod2-SPM-NS.N.2NN.180000s.root"}, | ||
| 993 | + {'inst': "spm", 'id': "DESY20140105_50h_0deg", | ||
| 994 | + 'path': path, 'rebin': rebin, | ||
| 995 | + 'file': "DESY.d20140105.Erec1.V2.ID0_0degNIM2.prod2-SPM-NS.N.2NN.180000s.root"}, | ||
| 996 | + {'inst': "spm", 'id': "DESY20140105_50h_180deg", | ||
| 997 | + 'path': path, 'rebin': rebin, | ||
| 998 | + 'file': "DESY.d20140105.Erec1.V2.ID0_180degNIM2.prod2-SPM-NS.N.2NN.180000s.root"}, | ||
| 999 | + | ||
| 1000 | + {'inst': "tenerife", 'id': "DESY20140105_50h", | ||
| 1001 | + 'path': path, 'rebin': rebin, | ||
| 1002 | + 'file': "DESY.d20140105.Erec1.V2.ID0NIM2.prod2-Tenerife-NS.N.2NN.180000s.root"}, | ||
| 1003 | + {'inst': "tenerife", 'id': "DESY20140105_50h_0deg", | ||
| 1004 | + 'path': path, 'rebin': rebin, | ||
| 1005 | + 'file': "DESY.d20140105.Erec1.V2.ID0_0degNIM2.prod2-Tenerife-NS.N.2NN.180000s.root"}, | ||
| 1006 | + {'inst': "tenerife", 'id': "DESY20140105_50h_180deg", | ||
| 1007 | + 'path': path, 'rebin': rebin, | ||
| 1008 | + 'file': "DESY.d20140105.Erec1.V2.ID0_180degNIM2.prod2-Tenerife-NS.N.2NN.180000s.root"}, | ||
| 1009 | + | ||
| 1010 | + {'inst': "us", 'id': "DESY20140105_50h", | ||
| 1011 | + 'path': path, 'rebin': rebin, | ||
| 1012 | + 'file': "DESY.d20140105.Erec1.V2.ID0NIM2.prod2-US-NS.N.2NN.180000s.root"}, | ||
| 1013 | + {'inst': "us", 'id': "DESY20140105_50h_0deg", | ||
| 1014 | + 'path': path, 'rebin': rebin, | ||
| 1015 | + 'file': "DESY.d20140105.Erec1.V2.ID0_0degNIM2.prod2-US-NS.N.2NN.180000s.root"}, | ||
| 1016 | + {'inst': "us", 'id': "DESY20140105_50h_180deg", | ||
| 1017 | + 'path': path, 'rebin': rebin, | ||
| 1018 | + 'file': "DESY.d20140105.Erec1.V2.ID0_180degNIM2.prod2-US-NS.N.2NN.180000s.root"}] | ||
| 1019 | + | ||
| 1020 | + # Return database | ||
| 1021 | + return db | ||
| 1022 | + | ||
| 937 | 1023 | ||
| 938 | #==========================# | 1024 | #==========================# |
| 939 | # Main routine entry point # | 1025 | # Main routine entry point # |
| @@ -958,30 +1044,38 @@ if __name__ == '__main__': | @@ -958,30 +1044,38 @@ if __name__ == '__main__': | ||
| 958 | - ERes_offaxis (2D) - Energy Resolution | 1044 | - ERes_offaxis (2D) - Energy Resolution |
| 959 | - Ebias_offaxis (2D) - Energy bias | 1045 | - Ebias_offaxis (2D) - Energy bias |
| 960 | """ | 1046 | """ |
| 961 | - # Set path and root file | ||
| 962 | - #path = "/project-data/cta/performance/prod1/IFAEOffaxisPerformanceBEI_May2012" | ||
| 963 | - #irf = "SubarrayE_IFAE_50hours_20120510_offaxis.root" | ||
| 964 | - #rebin = True | ||
| 965 | - path = "/project-data/cta/performance/prod2/Performance_DESY_20140128" | ||
| 966 | - irf = "DESY.d20140105.Erec1.V2.ID0_180degNIM2.prod2-Aar-NS.S.2a.180000s.root" | ||
| 967 | - rebin = False | 1047 | + # Get database |
| 1048 | + entries = set_prod2_desy() | ||
| 968 | 1049 | ||
| 969 | - # Set filename | ||
| 970 | - filename = path+"/"+irf | 1050 | + # Loop over entries |
| 1051 | + for entry in entries: | ||
| 1052 | + | ||
| 1053 | + # Get attributes | ||
| 1054 | + inst = entry['inst'] | ||
| 1055 | + path = entry['path'] | ||
| 1056 | + rebin = entry['rebin'] | ||
| 1057 | + id = entry['id'] | ||
| 1058 | + filename = path+"/"+entry['file'] | ||
| 1059 | + | ||
| 1060 | + # Allocate caldb entry | ||
| 1061 | + irf = caldb(inst, id) | ||
| 1062 | + | ||
| 1063 | + # Open calibration file | ||
| 1064 | + irf.open("file") | ||
| 1065 | + | ||
| 1066 | + # Translate ROOT to CALDB information | ||
| 1067 | + irf.root2caldb(filename, rebin=rebin) | ||
| 971 | 1068 | ||
| 972 | - # Set observation identifiers | ||
| 973 | - #obsids = ["000001", "000002", "000003"] | ||
| 974 | - obsids = ["000001"] | ||
| 975 | 1069 | ||
| 976 | # Generate CALDB entries, one for each observation (or run) | 1070 | # Generate CALDB entries, one for each observation (or run) |
| 977 | - for obsid in obsids: | 1071 | + #for obsid in obsids: |
| 978 | 1072 | ||
| 979 | # Allocate caldb | 1073 | # Allocate caldb |
| 980 | - db = caldb("E", obsid) | 1074 | + # db = caldb("E", obsid) |
| 981 | 1075 | ||
| 982 | # Open calibration | 1076 | # Open calibration |
| 983 | - db.open("test") | 1077 | + # db.open("test") |
| 984 | 1078 | ||
| 985 | # Translate ROOT to CALDB information | 1079 | # Translate ROOT to CALDB information |
| 986 | - db.root2caldb(filename, rebin=rebin) | 1080 | + # db.root2caldb(filename, rebin=rebin) |
| 987 | 1081 | ||
| 988 | \ No newline at end of file | 1082 | \ No newline at end of file |