source: ETALON/SPESO/ana2015/offline_analysis/offline_analyse_colormaps_2016JanFeb.m @ 419

Last change on this file since 419 was 419, checked in by malovyts, 8 years ago

Fixed names

File size: 13.4 KB
Line 
1function offline_analyse_colorpmaps(date_mask)
2% function to create analysis web-page, with signas/bg analysis
3% and colorplots
4%load data to analyse
5load_analysis_data(date_mask);
6
7data_select_reset()
8
9
10global dvar;
11global allData;
12global plots_basedir;
13
14define_data_var();
15define_dirs_analysis();
16
17data_select_reset();
18
19% array of datas
20data_types=[dvar.DATA1_VAL_LPM dvar.DATA2_VAL_LPM dvar.DATA1_VAL_SPM dvar.DATA2_VAL_SPM];
21data_names={'DATA1_LPM','DATA2_LPM','DATA1_SPM','DATA2_SPM'}';
22
23
24% 9 histograms displaying selected data
25fih=figure(1);
26        data_vars_plot();
27        set(gcf,'PaperUnits','inches','PaperPosition',[0 0 24 18]);
28        print(fih, '-dpng', '-r300',[ plots_basedir  '9plots_monthly.png' ]);
29close(fih);
30
31% for each detector and sigla type make colorplot
32for data_loop = 1:length(data_types);
33
34fih = figure(1);
35        data_colorplot(dvar.DETECT_SPOS, dvar.DETECT_XPOS, data_types(data_loop),...
36                                         [-800000:12500:-300000], [-500000 -300000 -100000]);
37        set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9]);
38        print(fih, '-dpng', '-r300',[ plots_basedir 'colorplot_monthly_'...
39                                      sprintf('%07d',(data_loop))...
40                                      '.png' ]);
41close(fih);
42end; % data_loop
43
44% selection definitions
45
46        pos_hublot_Z=-66000;
47        pos_hublot_Y=-575000;
48       
49        % XPOS  = -200000;
50        XPOS_selection{1}{1}={dvar.DETECT_XPOS, '<', -190000};
51        XPOS_selection{1}{2}={dvar.DETECT_XPOS, '>', -210000};
52
53        % XPOS = -400000;
54        XPOS_selection{2}{1}={dvar.DETECT_XPOS, '<', -390000};
55        XPOS_selection{2}{2}={dvar.DETECT_XPOS, '>', -410000};
56
57        % exclude pos_hublot_Z
58        POS_selection{1}{1}={dvar.DETECT_ZPOS, '<', pos_hublot_Z-100};
59        POS_selection{1}{2}={dvar.DETECT_ZPOS, '>', pos_hublot_Z+100};
60        POS_var{1}=dvar.DETECT_ZPOS;
61        POS_edges{1}=[-140000:3500:0];
62        POS_offset{1}(1)=0;
63        POS_offset{1}(2)=0;
64
65        % exclude pos_hublot_S
66        POS_selection{2}{1}={dvar.DETECT_SPOS, '<', pos_hublot_Y-100};
67        POS_selection{2}{2}={dvar.DETECT_SPOS, '>', pos_hublot_Y+100};
68        POS_var{2}=dvar.DETECT_SPOS;
69        POS_edges{2}=[-800000:12500:-300000];
70        POS_offset{2}(1)=-300000;
71        POS_offset{2}(2)=-500000;
72
73        % RESEAU_POS > 1000000
74        RESEAU_POS_selection{1}{1}={dvar.RESEAU_POS, '>', 1000000};
75
76        % RESEAU_POS < 1000000
77        RESEAU_POS_selection{2}{1}={dvar.RESEAU_POS, '<', 1000000};
78       
79        % QICT1 = 3.5
80        QICT1_selection{1}{1}={dvar.QICT1, '>', 3};
81        QICT1_selection{1}{2}={dvar.QICT1, '<', 4};
82
83        % QICT1 = 3.5
84        QICT1_selection{2}{1}={dvar.QICT1, '>', 3.65};
85        QICT1_selection{2}{2}={dvar.QICT1, '<', 4};
86
87        % QICT1 = 0.5
88        QICT1_selection{3}{1}={dvar.QICT1, '>', 0.25};
89        QICT1_selection{3}{2}={dvar.QICT1, '<', 0.75};
90
91        % LPM=2
92        LPM_selection{1}{1}={dvar.LPM, '=', 2};
93
94        %LPM=0 
95        LPM_selection{2}{1}={dvar.LPM, '=', 0};
96
97data_select_reset();
98
99
100% make html page
101fid = fopen([plots_basedir 'main.html'], 'w');
102fprintf(fid, '<HTML>\n');
103fprintf(fid, '\t%s\n', '<head></head>');
104fprintf(fid, '\t%s\n', '<body>');
105
106% all selection
107        img_name=[ '9plots_monthly.png' ];
108        fprintf(fid, '\t\t\t\t\t%s\n', ['<a href="' img_name '">']);
109        fprintf(fid, '\t\t\t\t\t\t%s\n', ['<img src="' img_name '" width="500px">']);
110        fprintf(fid, '\t\t\t\t\t%s\n', '</a>');
111
112% colormaps
113for dataloop =1:length(data_types)
114        img_name=[ 'colorplot_monthly_'...
115                                              sprintf('%07d',(dataloop))...
116                                              '.png' ];
117        fprintf(fid, '\t\t\t\t\t%s\n', ['<a href="' img_name '">']);
118        fprintf(fid, '\t\t\t\t\t\t%s\n', ['<img src="' img_name '" width="500px">']);
119        fprintf(fid, '\t\t\t\t\t%s\n', '</a>');
120end; % dataloop
121
122fprintf(fid, '\t\t%s\n','<table border="1">');
123
124% combinations of selections
125for POSloop  =1:length(POS_selection)
126        for dataloop =1:length(data_types)
127                for LPMloop  =1:length(LPM_selection)
128                       
129                % each new LPM value - drab black line
130                        fprintf(fid, '\t\t\t%s\n', '<tr>');
131
132                        for QICT1loop=1:length(QICT1_selection)+1
133                                fprintf(fid, '\t\t\t\t%s\n', '<td bgcolor="black"></td>');
134                        end; % QICT1loop
135                        fprintf(fid, '\t\t\t%s\n', '</tr>');
136
137                        % empty row
138                        fprintf(fid, '\t\t\t%s\n', '<tr>');
139                        fprintf(fid, '\t\t\t\t%s\n', '<td></td>');
140                        fprintf(fid, '\t\t\t\t%s\n', ['<td colspan="' num2str(length(QICT1_selection)) '"><H2>'...
141                                '<H2></td>']);
142                         fprintf(fid, '\t\t\t%s\n', '</tr>');
143
144                        % 9 plots for current selection
145                        fprintf(fid, '\t\t\t%s\n', '<tr>');
146                        fprintf(fid, '\t\t\t\t%s\n', '<td>');
147                        fprintf(fid, '\t\t\t\t\t%s\n', '<H2></H2>');
148                        fprintf(fid, '\t\t\t\t%s\n', '</td>');
149
150                       
151                        for QICT1loop=1:length(QICT1_selection)
152                                img_name=[data_names{dataloop} '_monthly_9plots_'...
153                                                         sprintf('%07d',(1+QICT1loop*10+LPMloop*100+POSloop*1000))...
154                                                         '.png'];
155                                fprintf(fid, '\t\t\t\t%s\n', '<td>');
156                                fprintf(fid, '\t\t\t\t\t%s\n', ['<a href="' img_name '">']);
157                                fprintf(fid, '\t\t\t\t\t\t%s\n', ['<img src="' img_name '" width="500px">']);
158                                fprintf(fid, '\t\t\t\t\t%s\n', '</a>');
159                                fprintf(fid, '\t\t\t\t%s\n', '</td>');
160                        end; % QICT1loop
161                        fprintf(fid, '\t\t\t%s\n', '</tr>');
162
163                        % empty row
164                        fprintf(fid, '\t\t\t%s\n','<tr>');
165                        fprintf(fid, '\t\t\t\t%s\n', '<td>');
166                        fprintf(fid, '\t\t\t\t\t%s\n', '<H2></H2>');
167                        fprintf(fid, '\t\t\t\t%s\n', '</td>');
168
169                        for QICT1loop=1:length(QICT1_selection)
170                                fprintf(fid, '\t\t\t\t%s\n', '<td>');
171                                fprintf(fid, '\t\t\t\t%s\n', '</td>');
172                        end; % QICT1loop
173                        fprintf(fid, '\t\t\t%s\n', '</tr>');
174
175                        % two rows for signal and bg
176                        for RESEAUloop=1:length(RESEAU_POS_selection)
177                                fprintf(fid, '\t\t\t%s\n', '<tr>');
178                                fprintf(fid, '\t\t\t\t%s\n','<td>');
179                                fprintf(fid, '\t\t\t\t\t%s\n','<H3>');
180                                fprintf(fid, '\t\t\t\t\t\t%s\n', [data_names{dataloop} '<br>']);
181                                if RESEAUloop==1
182                                        fprintf(fid, '\t\t\t\t\t\t%s\n', 'Signal');
183                                elseif RESEAUloop==2
184                                        fprintf(fid, '\t\t\t\t\t\t%s\n', 'Background');
185                                end; % if RESEAUloop==1
186                                fprintf(fid, '\t\t\t\t\t%s\n','</H3>');
187                                fprintf(fid, '\t\t\t\t%s\n','</td>');
188
189                                for QICT1loop=1:length(QICT1_selection)
190                                        img_name=[data_names{dataloop} '_monthly_'...
191                                                                         sprintf('%07d',(RESEAUloop*1+QICT1loop*10+LPMloop*100+POSloop*1000))...
192                                                                         '.png'];
193                                        fprintf(fid, '\t\t\t\t%s\n', '<td>');
194                                        fprintf(fid, '\t\t\t\t\t%s\n', ['<a href="' img_name '">']);
195                                        fprintf(fid, '\t\t\t\t\t\t%s\n', ['<img src="' img_name '" width="500px">']);
196                                        fprintf(fid, '\t\t\t\t\t%s\n', '</a>');
197                                        fprintf(fid, '\t\t\t\t%s\n', '</td>');
198                                end; % QICT1loop
199                                fprintf(fid, '\t\t\t%s\n', '</tr>');
200                        end; % RESEAUloop
201
202                        % for different XPOS signal/bg
203                        for XPOSloop=1:length(XPOS_selection)
204                                fprintf(fid, '\t\t\t%s\n', '<tr>');
205                                fprintf(fid, '\t\t\t\t%s\n','<td>');
206                                fprintf(fid, '\t\t\t\t\t%s\n','<H3>');
207                                fprintf(fid, '\t\t\t\t\t\t%s\n', '<font color="red">Signal</font>/<font color="blue">Background</font>');
208                                fprintf(fid, '\t\t\t\t\t%s\n','</H3>');
209                                fprintf(fid, '\t\t\t\t%s\n','</td>');
210
211                                for QICT1loop=1:length(QICT1_selection)
212                                        img_name=[data_names{dataloop} '_monthly_'...
213                                                                         sprintf('%07d',(0+QICT1loop*10+LPMloop*100+POSloop*1000+XPOSloop*10000))...
214                                                                         '.png'];
215                                        fprintf(fid, '\t\t\t\t%s\n', '<td>');
216                                        fprintf(fid, '\t\t\t\t\t%s\n', ['<a href="' img_name '">']);
217                                        fprintf(fid, '\t\t\t\t\t\t%s\n', ['<img src="' img_name '" width="500px">']);
218                                        fprintf(fid, '\t\t\t\t\t%s\n', '</a>');
219                                        fprintf(fid, '\t\t\t\t%s\n', '</td>');
220                                end;
221                                fprintf(fid, '\t\t\t%s\n', '</tr>');
222
223                                fprintf(fid, '\t\t\t%s\n', '<tr>');
224                                fprintf(fid, '\t\t\t\t%s\n','<td>');
225                                fprintf(fid, '\t\t\t\t\t%s\n','<H3>');
226                                fprintf(fid, '\t\t\t\t\t\t%s\n', '<font color="red">Signal</font>/<font color="blue">Background</font>');
227                                fprintf(fid, '\t\t\t\t\t%s\n','</H3>');
228                                fprintf(fid, '\t\t\t\t%s\n','</td>');
229
230                                % histigrams for different XPOS
231                                for QICT1loop=1:length(QICT1_selection)
232                                        img_name=['histc_monthly_'...
233                                                                         sprintf('%07d',(1+QICT1loop*10+LPMloop*100+POSloop*1000+XPOSloop*10000))...
234                                                                         '.png'];
235                                        fprintf(fid, '\t\t\t\t%s\n', '<td>');
236                                        fprintf(fid, '\t\t\t\t\t%s\n', ['<a href="' img_name '">']);
237                                        fprintf(fid, '\t\t\t\t\t\t%s\n', ['<img src="' img_name '" width="500px">']);
238                                        fprintf(fid, '\t\t\t\t\t%s\n', '</a>');
239                                        fprintf(fid, '\t\t\t\t%s\n', '</td>');
240                                end; % QICTloop
241                                fprintf(fid, '\t\t\t%s\n', '</tr>');
242                               
243                                % each 2nd datatype - comparison of two detectors
244                                if mod(dataloop,2)==0
245                                        fprintf(fid, '\t\t\t%s\n', '<tr>');
246                                        fprintf(fid, '\t\t\t\t%s\n','<td>');
247                                        fprintf(fid, '\t\t\t\t\t%s\n','<H3>');
248                                        fprintf(fid, '\t\t\t\t\t\t%s\n', [get_var_name(data_types(dataloop-1)) '<br/> vs <br/>' get_var_name(data_types(dataloop))]);
249                                        fprintf(fid, '\t\t\t\t\t%s\n','</H3>');
250                                        fprintf(fid, '\t\t\t\t%s\n','</td>');
251                                        % histigrams for different XPOS
252                                        for QICT1loop=1:length(QICT1_selection)
253                                                img_name=['histc_monthly_'...
254                                                                                 sprintf('%07d',(3+QICT1loop*10+LPMloop*100+POSloop*1000+XPOSloop*10000))...
255                                                                                 '.png'];
256                                                fprintf(fid, '\t\t\t\t%s\n', '<td>');
257                                                fprintf(fid, '\t\t\t\t\t%s\n', ['<a href="' img_name '">']);
258                                                fprintf(fid, '\t\t\t\t\t\t%s\n', ['<img src="' img_name '" width="500px">']);
259                                                fprintf(fid, '\t\t\t\t\t%s\n', '</a>');
260                                                fprintf(fid, '\t\t\t\t%s\n', '</td>');
261                                        end; % QICTloop
262                                        fprintf(fid, '\t\t\t%s\n', '</tr>');
263                                end; % mod(dataloop,2)==0
264                        end;%XPOSloop
265
266                end; % LPMloop
267        end; % dataloop
268end; % POSloop
269
270fprintf(fid, '\t\t%s\n','</table>');
271fprintf(fid, '\t%s\n','</body>');
272fprintf(fid, '%s','</HTML>');
273fclose(fid);
274
275% make plots
276selection_hat=[ 'Analysed on ' datestr(now) char(10)];
277for RESEAUloop=1:length(RESEAU_POS_selection)
278 for POSloop  =1:length(POS_selection)
279  for LPMloop  =1:length(LPM_selection)
280   for QICT1loop=1:length(QICT1_selection)
281    for dataloop =1:length(data_types)
282               
283                        data_select_reset();
284
285                        allData.selection=[selection_hat char(10)];
286
287                        data_select(LPM_selection{LPMloop}{1}{:});
288                        %data_select(LPM_selection{LPMloop}{2}{:});
289                        data_select(QICT1_selection{QICT1loop}{1}{:}); 
290                        data_select(QICT1_selection{QICT1loop}{2}{:}); 
291
292                        tmp_selected=allData.selected;
293                        data_select(POS_selection{POSloop}{1}{:});     
294                        first_part=allData.selected;
295                        allData.selected=tmp_selected;
296                        data_select(POS_selection{POSloop}{2}{:});     
297                        allData.selected=allData.selected+first_part;
298
299                        % base selection
300                        base_selected=allData.selected;
301                        base_selected_text=allData.selected;
302
303        if dataloop==1
304                %============ comparison of two detectors LPM, SPM ==============
305                fih = figure(1);
306                        bins=data_histc_multiDet(POS_var{POSloop}, data_types((RESEAUloop-1)*2+1), data_types((RESEAUloop-1)*2+2),...
307                                   {...
308                                    {RESEAU_POS_selection{1}{1}},...
309                                    {RESEAU_POS_selection{2}{1}}...
310                                   },...
311                                POS_edges{POSloop},POS_offset{POSloop}(1),POS_offset{POSloop}(2));
312                        set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9]);
313                        print(fih, '-dpng', '-r300',[ plots_basedir 'histc_monthly_'...
314                                                              sprintf('%07d',(3+QICT1loop*10+LPMloop*100+POSloop*1000+10000*RESEAUloop))...
315                                                              '.png' ]);
316                close(fih);
317                % --------------------------------------------
318        end; % if dataloop
319
320
321
322                        data_select(RESEAU_POS_selection{RESEAUloop}{1}{:});   
323       
324               
325                %============== for TX=-200k and -400k =================
326                fih=figure(300+dataloop);
327                        clf
328                        plot_handle = data_scatter2d_multi(...
329                                                           POS_var{POSloop}, data_types(dataloop),...
330                                                           {...
331                                                            {XPOS_selection{1}{1}, XPOS_selection{1}{2}},...
332                                                            {XPOS_selection{2}{1}, XPOS_selection{2}{2}}...
333                                                           }...
334                                                           );
335                       
336                set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9])
337                print(fih, '-dpng', '-r300',[ plots_basedir data_names{dataloop} '_monthly_'...
338                                              sprintf('%07d',(RESEAUloop*1+QICT1loop*10+LPMloop*100+POSloop*1000))...
339                                              '.png' ]);
340                close(fih);
341                %-------------------------------------------------------
342                %============= selection 9 plots =======================
343                fih=figure(300+dataloop);
344                        data_vars_plot();
345                set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9]);
346                print(fih, '-dpng', '-r300',[ plots_basedir data_names{dataloop} '_monthly_9plots_'...
347                                              sprintf('%07d',(RESEAUloop*1+QICT1loop*10+LPMloop*100+POSloop*1000+00000))...
348                                              '.png' ]);
349                close(fih);
350                %---------------------------------------------------------
351                allData.selected=base_selected;
352                allData.selected=base_selected_text;
353
354                data_select(XPOS_selection{RESEAUloop}{1}{:}); 
355                data_select(XPOS_selection{RESEAUloop}{2}{:}); 
356
357                %=============== x=-200k, -400k with BG ==================
358                fih=figure(300+dataloop);
359                        clf
360                        plot_handle = data_scatter2d_multi(POS_var{POSloop}, data_types(dataloop),...
361                                                           {...
362                                                            {RESEAU_POS_selection{1}{1}},...
363                                                            {RESEAU_POS_selection{2}{1}}...
364                                                           }...
365                                                          );
366                       
367                set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 9])
368                print(fih, '-dpng', '-r300',[ plots_basedir data_names{dataloop} '_monthly_'...
369                                              sprintf('%07d',(0+QICT1loop*10+LPMloop*100+POSloop*1000+10000*RESEAUloop))...
370                                              '.png' ]);
371                close(fih);
372                % -----------------------------------------------------
373                % ================ histogram signal/bg ===============
374                fih = figure(1);
375                        bins=data_histc(POS_var{POSloop}, data_types(dataloop),...
376                                   {...
377                                    {RESEAU_POS_selection{1}{1}},...
378                                    {RESEAU_POS_selection{2}{1}}...
379                                   },...
380                                POS_edges{POSloop});
381                        set(gcf,'PaperUnits','inches','PaperPosition',[0 0 12 16]);
382                        print(fih, '-dpng', '-r300',[ plots_basedir 'histc_monthly_'...
383                                                              sprintf('%07d',(1+QICT1loop*10+LPMloop*100+POSloop*1000+10000*RESEAUloop))...
384                                                              '.png' ]);
385                close(fih);
386                % -------------------------------------------------
387    end; %dataloop
388   end; % QICT1loop
389  end; % LPMloop
390 end; % POSloop
391end; % RESEAUloop
392data_select_reset;
393
394
395end % function
Note: See TracBrowser for help on using the repository browser.