-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path005z_get_BSRT_calib.py
58 lines (42 loc) · 2.03 KB
/
005z_get_BSRT_calib.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from LHCMeasurementTools.LHC_Fill_LDB_Query import load_fill_dict_from_json
from data_folders import data_folder_list, recalc_h5_folder
filln = 7875
#~ filln = 6055
# merge jsons and add info on location
dict_fill_bmodes={}
for df in data_folder_list:
this_dict_fill_bmodes = load_fill_dict_from_json(
df+'/fills_and_bmodes.json')
for kk in this_dict_fill_bmodes:
this_dict_fill_bmodes[kk]['data_folder'] = df
dict_fill_bmodes.update(this_dict_fill_bmodes)
import pytimber
ldb = pytimber.LoggingDB(source='nxcals')
#ldb = pytimber.LoggingDB(source='ldb')
device_name = {1:'5R4', 2:'5L4'}
event = {450:'t_stop_INJPHYS', 6500:'t_start_FLATTOP'}
e_dict = {'betaf_h':{}, 'betaf_v':{}, 'gamma':{},
'sigma_corr_h':{}, 'sigma_corr_v':{},
'rescale_sigma_h':{}, 'rescale_sigma_v':{}, 'scale_h': {}, 'scale_v': {}}
for kk in list(e_dict.keys()):
e_dict[kk] = {450:{}, 6500:{}}
e_dict['gamma'][450] = 479.6
e_dict['gamma'][6500] = 6927.6
for ene in [450, 6500]:
t_ref = dict_fill_bmodes[filln][event[ene]]
for beam in [1, 2]:
data = {}
data.update(ldb.get([
'LHC.BSRT.%s.B%d:LSF_H'%(device_name[beam], beam),
'LHC.BSRT.%s.B%s:LSF_V'%(device_name[beam], beam),
'LHC.BSRT.%s.B%d:BETA_H'%(device_name[beam], beam),
'LHC.BSRT.%s.B%s:BETA_V'%(device_name[beam], beam)
],
t1=t_ref, t2='last'))
e_dict['betaf_h'][ene][beam] = data['LHC.BSRT.%s.B%d:BETA_H'%(device_name[beam], beam)][1][0]
e_dict['betaf_v'][ene][beam] = data['LHC.BSRT.%s.B%d:BETA_V'%(device_name[beam], beam)][1][0]
e_dict['sigma_corr_h'][ene][beam] = data['LHC.BSRT.%s.B%d:LSF_H'%(device_name[beam], beam)][1][0]*1e-3
e_dict['sigma_corr_v'][ene][beam] = data['LHC.BSRT.%s.B%d:LSF_V'%(device_name[beam], beam)][1][0]*1e-3
e_dict['rescale_sigma_h'][ene][beam] = 1.
e_dict['rescale_sigma_v'][ene][beam] = 1.
print(e_dict)