-
Notifications
You must be signed in to change notification settings - Fork 0
/
totFlatMain.m
81 lines (67 loc) · 2.14 KB
/
totFlatMain.m
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
%% Variables This loads the variable file, please fill in any pointers there
'load variables'
Variables % load Variables file
SS = {' '}; % Spacer
%%
ToT_FF_size = (Chipnr * Dim_x * Dim_y); % creates the table size
ToT_FF_T_BIG = zeros(1024,5,ToT_FF_size);
ToT_FF_T_BIG2 = zeros(1024,5,ToT_FF_size);
% %% Load multiple files
% jString = 0;
% iString = 33;
%
% while jString < iString
%
% tic
% jString = jString +1;
% if jString == 2;
% yes = 'yes'
% else
% jString2 = strcat(NumberingFormat,num2str(jString));
% jString2 = jString2(end-4:end);
% filename = char(strcat(UserDIR, MainFILE, '_', jString2, FileTYPE))
% Hits = h5read(filename, '/hits');
% loady = toc
% tic
% totFlatfield2 %Runs the totFlatfield2 script
% ff = toc
% end
% end
% ToT_FF_T_BIG2 = ToT_FF_T_BIG;
% jString = 0;
%% Load multiple files ToT hit files
jString = 2;
iString = NumberofFiles;
count = 1;
while jString < iString
tic
if jString == 2;
yes = 'yes'
else
jString
end
jString2 = strcat(NumberingFormat,num2str(jString));
jString2 = jString2(end-1:end);
filename = char(strcat(UserDIR, MainFILE, '_', jString2, FileTYPE))
data = h5read(filename, '/freq_tot');
if count == 1
data2 = data;
else
data2 = data2 + data;
end
loady = toc
count = count + jString;
jString = jString +1;
end
%% creates data_bases and basic info
ToT_FF_T_BIG2(:,1,:) = data2(:,:);
ToT_FF_T_BIG2(1,2,:) = sum(ToT_FF_T_BIG2(:,1,:));
ToT_FF_T_BIG2(20,2,:) = ToT_FF_T_BIG2(1,2,:);
jString = 0;
%% Calls the NormaliseCurve scripts to caclualte the ToT correctionmap
normaliseCurve
%% write out result
WriteIO
%%
clear ans BadP VasP_T Chipnr count Dim_X Dim_y fromToT new NumberingFormat NumberofFiles resultfile stepAvg strength ToT_FF_size toToT UsePoly Dim_x BadP_T ToT_T_BIG UserDIR FileTUPE iString data data2 Hits jString jString2 filename SS MainFILE loady ff FileTYPE ToA_T ToT_T x_T y_T ChipID_T
clearvars data data2 iString jString jString2 loady