Rev 343 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 343 | Rev 344 | ||
---|---|---|---|
Line 10... | Line 10... | ||
10 | <script src="js/en.js"></script> |
10 | <script src="js/en.js"></script> |
11 | <script src="js/belle2_def.js"></script> |
11 | <script src="js/belle2_def.js"></script> |
12 | <script src="js/belle2_gen.js"></script> |
12 | <script src="js/belle2_gen.js"></script> |
13 | <script src="js/workspace.js"></script> |
13 | <script src="js/workspace.js"></script> |
14 | <script src="js/FileSaver.min.js"></script> |
14 | <script src="js/FileSaver.min.js"></script> |
- | 15 | ||
- | 16 | <link rel="shortcut icon" href="https://root.cern/js/latest/img/RootIcon.ico"/> |
|
- | 17 | <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> |
|
- | 18 | <link rel="stylesheet" type="text/css" href="style.css"> |
|
- | 19 | ||
- | 20 | <script src="JSRootExtend.js"></script> |
|
- | 21 | <script src="https://code.jquery.com/jquery-1.12.4.js"></script> |
|
- | 22 | <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> |
|
- | 23 | <script src="polFitPanel.js"></script> |
|
- | 24 | <script src="fminsearch.js"></script> |
|
- | 25 | <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML"></script> |
|
- | 26 | <script type="text/javascript" src="displayFormula.js"></script> |
|
- | 27 | <script type="text/x-mathjax-config"> |
|
- | 28 | MathJax.Hub.Config({ |
|
- | 29 | tex2jax: { |
|
- | 30 | inlineMath: [["$","$"],["\\(","\\)"]] |
|
- | 31 | } |
|
- | 32 | }); |
|
- | 33 | </script> |
|
- | 34 | ||
15 | 35 | ||
16 | <style> |
36 | <style> |
17 | table { |
37 | table { |
18 | border-collapse: collapse; |
38 | border-collapse: collapse; |
19 | width: 100%; |
39 | width: 100%; |
20 | } |
40 | } |
21 | 41 | ||
22 | th, td { |
42 | th, td { |
23 | padding: 0px; |
43 | padding: 0px; |
24 | text |
44 | /*text-align: right;*/ |
25 | } |
45 | } |
26 | 46 | ||
27 | tr:hover{background-color:#ffffff} |
47 | tr:hover{background-color:#ffffff} |
28 | </style> |
48 | </style> |
29 | 49 | ||
Line 36... | Line 56... | ||
36 | 56 | ||
37 | var es; |
57 | var es; |
38 | function addLog(message) { |
58 | function addLog(message) { |
39 | var r = document.getElementById('results'); |
59 | var r = document.getElementById('results'); |
40 | r.insertAdjacentHTML('beforeend', message +'<br/>'); |
60 | r.insertAdjacentHTML('beforeend', message +'<br/>'); |
41 | } |
61 | } |
42 | 62 | ||
43 | function showStat(message) { |
63 | function showStat(message) { |
44 | var r = document.getElementById('sbar'); |
64 | var r = document.getElementById('sbar'); |
45 | r.innerHTML = message ; |
65 | r.innerHTML = message ; |
46 | } |
66 | } |
47 | 67 | ||
48 | 68 | ||
49 | 69 | ||
50 | function startGUI() { |
70 | function startGUI() { |
51 | // d3.select('html').style('height','100%'); |
71 | // d3.select('html').style('height','100%'); |
52 | // d3.select('body').style({'min-height':'100%', 'margin':'0px', "overflow" :"hidden"}); |
72 | // d3.select('body').style({'min-height':'100%', 'margin':'0px', "overflow" :"hidden"}); |
53 | // var r = document.getElementById('results'); |
73 | // var r = document.getElementById('results'); |
54 | // r.style.display = 'none'; |
74 | // r.style.display = 'none'; |
55 | var r0 = document.getElementById('sbar'); |
75 | var r0 = document.getElementById('sbar'); |
56 | r0.style.display = 'none'; |
76 | r0.style.display = 'none'; |
57 | JSROOT.gStyle.fOptFit = 1111; |
77 | JSROOT.gStyle.fOptFit = 1111; |
58 | 78 | ||
59 | } |
79 | } |
60 | 80 | ||
61 | 81 | ||
62 | function fitpanel(oFormElement) |
82 | function fitpanel(oFormElement) |
63 | { |
83 | { |
64 | var xhr = new XMLHttpRequest(); |
84 | var xhr = new XMLHttpRequest(); |
65 | xhr.onreadystatechange = function() { |
85 | xhr.onreadystatechange = function() { |
66 | if(xhr.readyState == 4 && xhr.status == 200) { |
86 | if(xhr.readyState == 4 && xhr.status == 200) { |
Line 84... | Line 104... | ||
84 | document.getElementById('data'+ hname).value=result.message; |
104 | document.getElementById('data'+ hname).value=result.message; |
85 | //frame.scrollIntoView(); |
105 | //frame.scrollIntoView(); |
86 | } |
106 | } |
87 | } |
107 | } |
88 | xhr.open (oFormElement.method, oFormElement.action, true); |
108 | xhr.open (oFormElement.method, oFormElement.action, true); |
89 | 109 | ||
90 | var data = new FormData (oFormElement); |
110 | var data = new FormData (oFormElement); |
91 | xhr.send (data); |
111 | xhr.send (data); |
92 | 112 | ||
93 | return false; // Markus had to return true |
113 | return false; // Markus had to return true |
94 | } |
114 | } |
95 | 115 | ||
96 | 116 | ||
97 | 117 | ||
98 | function startTask() { |
118 | function startTask() { |
99 | 119 | ||
100 | var r = document.getElementById('results'); |
120 | var r = document.getElementById('results'); |
101 | //if ( r.style.display == 'none' ) switchTask(); |
121 | //if ( r.style.display == 'none' ) switchTask(); |
102 | r.innerHTML = ''; |
122 | r.innerHTML = ''; |
103 | var btnstart = document.getElementById('btnstart'); |
123 | var btnstart = document.getElementById('btnstart'); |
104 | btnstart.value= "Stop Analysis"; |
124 | btnstart.value= "Stop Analysis"; |
105 | 125 | ||
106 | 126 | ||
107 | document.getElementById('drawing').innerHTML = ''; |
127 | document.getElementById('drawing').innerHTML = ''; |
108 | 128 | ||
109 | Blockly.JavaScript.INFINITE_LOOP_TRAP = null; |
129 | Blockly.JavaScript.INFINITE_LOOP_TRAP = null; |
110 | var code = Blockly.JavaScript.workspaceToCode(workspace); |
130 | var code = Blockly.JavaScript.workspaceToCode(workspace); |
111 | code = code.replace(/\(|\)/gi, ''); |
131 | code = code.replace(/\(|\)/gi, ''); |
112 | 132 | ||
113 | addLog(code + '<br>'); |
133 | addLog(code + '<br>'); |
Line 123... | Line 143... | ||
123 | }); |
143 | }); |
124 | } |
144 | } |
125 | 145 | ||
126 | function startAction() { |
146 | function startAction() { |
127 | var btnstart = document.getElementById('btnstart'); |
147 | var btnstart = document.getElementById('btnstart'); |
- | 148 | first = 0; |
|
128 | if (btnstart.value=== "Stop Analysis"){ |
149 | if (btnstart.value=== "Stop Analysis"){ |
129 | stopTask(); |
150 | stopTask(); |
130 | } else { |
151 | } else { |
131 | startTask(); |
152 | startTask(); |
132 | } |
153 | } |
133 | } |
154 | } |
134 | 155 | ||
135 | function toProcess() { |
156 | function toProcess() { |
136 | window.location.hash='#btnstart'; |
157 | window.location.hash='#btnstart'; |
137 | //window.location.hash='#blocklyDiv'; |
158 | //window.location.hash='#blocklyDiv'; |
138 | } |
159 | } |
139 | 160 | ||
140 | function showDebug() { |
161 | function showDebug() { |
141 | var btnstart = document.getElementById('btndebug'); |
162 | var btnstart = document.getElementById('btndebug'); |
142 | var div = document.getElementById('results'); |
163 | var div = document.getElementById('results'); |
143 | 164 | ||
Line 183... | Line 204... | ||
183 | 204 | ||
184 | //addLog('Histogram :'+ sframe ); |
205 | //addLog('Histogram :'+ sframe ); |
185 | //var r = document.getElementById('results'); |
206 | //var r = document.getElementById('results'); |
186 | var r = document.getElementById('drawing'); |
207 | var r = document.getElementById('drawing'); |
187 | if (document.getElementById(sframe) == null ){ |
208 | if (document.getElementById(sframe) == null ){ |
- | 209 | //console.log('insert HTML for', sframe) |
|
188 | r.insertAdjacentHTML('beforeend', '<div id="' + sframe +'" style="width: |
210 | r.insertAdjacentHTML('beforeend', '<div id="' + sframe +'" style="width:800px; height:500px"></div><br/>');//narise histogram |
- | 211 | ||
189 | r.insertAdjacentHTML('beforeend', '<div id="fit' + sframe +'" style="display: none"></div><br/>'); |
212 | r.insertAdjacentHTML('beforeend', '<div id="fit' + sframe +'" style="display: none"></div><br/>'); |
190 | var fit = document.getElementById('fit'+ sframe); |
- | |
191 | mform ='<form method="post" action="th1fit.php" onsubmit="return fitpanel(this);">'; |
- | |
192 | mform += ' Function:<input type="text" size="20" value="gaus" name="fitfun" /><br/>'; |
- | |
193 | mform += ' Range: min=<input type="text" size="2" value="0" name="min" />'; |
- | |
194 | mform += ' max=<input type="text" size="2" value="20" name="max" /><br/>'; |
- | |
195 | mform += ' Initial parameters (separated by ,)<input type="text" size="20" value="" name="prm" /><br/>'; |
- | |
196 | mform += ' <input id="data'+ sframe +'" type="hidden" value="'+ result.message +'" name="data" />'; |
- | |
197 | mform += ' <input type="hidden" value="'+ sframe +'" name="name" />'; |
- | |
198 | mform += ' <input class="mybutton" type="submit" value=" Fit "/>'; |
- | |
199 | mform += '</form>'; |
- | |
200 | fit.insertAdjacentHTML('beforeend', '<div id="param' + sframe +'"></div><br/>'); |
- | |
201 |
|
213 | insertHTML(sframe); |
202 | r.insertAdjacentHTML('beforeend','<input type="button" onclick="togglevisibility(\'fit'+sframe+'\');" class="mybutton" value="Show/Hide Fit Panel" />' ); |
214 | r.insertAdjacentHTML('beforeend','<input type="button" onclick="togglevisibility(\'fit'+sframe+'\');" class="mybutton" value="Show/Hide Fit Panel" />' ); |
203 | r.insertAdjacentHTML('beforeend',' <input type="button" onclick="toProcess();" class="mybutton" value="To Process" /><hr/>' ); |
215 | r.insertAdjacentHTML('beforeend',' <input type="button" onclick="toProcess();" class="mybutton" value="To Process" /><hr/>' ); |
204 |
|
216 | |
205 | //r.insertAdjacentHTML('beforeend', JSON.stringify(result.message)); |
217 | //r.insertAdjacentHTML('beforeend', JSON.stringify(result.message)); |
206 | } |
218 | } |
207 | var frame = document.getElementById(sframe); |
219 | var frame = document.getElementById(sframe); |
- | 220 | JSROOT.redraw(sframe, jsonobj, "hist", function(){ |
|
- | 221 | initSliders(sframe); |
|
208 | 222 | }); |
|
209 |
|
223 | |
210 | 224 | ||
211 | 225 | ||
212 | frame.scrollIntoView(); |
226 | frame.scrollIntoView(); |
213 | } |
227 | } |
214 | } |
228 | } |
215 | var pBar = document.getElementById('progressor'); |
229 | var pBar = document.getElementById('progressor'); |
216 | pBar.value = result.progress; |
230 | pBar.value = result.progress; |
217 | var perc = document.getElementById('percentage'); |
231 | var perc = document.getElementById('percentage'); |
218 | perc.innerHTML = result.progress + "%"; |
232 | perc.innerHTML = result.progress + "%"; |
219 | perc.style.width = (Math.floor(pBar.clientWidth * (result.progress/100)) + 15) + 'px'; |
233 | perc.style.width = (Math.floor(pBar.clientWidth * (result.progress/100)) + 15) + 'px'; |
220 | } |
234 | } |
221 | } |
235 | } |
222 | 236 | ||
223 | 237 | ||
224 | 238 | ||
225 | function stopTask() { |
239 | function stopTask() { |
226 | es.close(); |
240 | es.close(); |
227 | //addLog('Task end'); |
241 | //addLog('Task end'); |
228 | var btnstart = document.getElementById('btnstart'); |
242 | var btnstart = document.getElementById('btnstart'); |
229 | 243 | ||
230 | btnstart.value= "Run Analysis"; |
244 | btnstart.value= "Run Analysis"; |
231 | 245 | ||
232 | } |
246 | } |
233 | 247 | ||
234 | 248 | ||
235 | /* |
249 | /* |
236 | function switchTask() { |
250 | function switchTask() { |
237 | var div = document.getElementById('results'); |
251 | var div = document.getElementById('results'); |
238 | var divs = document.getElementById('sbar'); |
252 | var divs = document.getElementById('sbar'); |
Line 345... | Line 359... | ||
345 | eval(code); |
359 | eval(code); |
346 | } catch (e) { |
360 | } catch (e) { |
347 | alert(e); |
361 | alert(e); |
348 | } |
362 | } |
349 | } |
363 | } |
- | 364 | ||
- | 365 | Blockly.Blocks['simple_analysis'] = { |
|
- | 366 | init: function() { |
|
- | 367 | this.appendDummyInput() |
|
- | 368 | .appendField("Belle II Masterclass"); |
|
- | 369 | this.appendDummyInput() |
|
- | 370 | .appendField("Number of events: ") |
|
- | 371 | .appendField(new Blockly.FieldNumber(5000, 0), "neve"); |
|
- | 372 | this.appendDummyInput() |
|
- | 373 | .appendField("First event: ") |
|
- | 374 | .appendField(new Blockly.FieldNumber(0, 0), "first"); |
|
- | 375 | this.appendDummyInput() |
|
- | 376 | .appendField("Data Source") |
|
- | 377 | .appendField(new Blockly.FieldDropdown([ |
|
- | 378 | <?php |
|
- | 379 | $files = array_slice(scandir('../data/'), 2); |
|
- | 380 | $cnt=0; |
|
- | 381 | foreach($files as $f){ |
|
- | 382 | echo "[\"$f\",\"$f\"],"; |
|
- | 383 | $cnt++; |
|
- | 384 | } |
|
- | 385 | ?>]), "datasource"); |
|
- | 386 | this.appendDummyInput() |
|
- | 387 | .appendField("Print particle list?") |
|
- | 388 | .appendField(new Blockly.FieldDropdown([["No", "0"], ["Yes", "1"]]), "print"); |
|
- | 389 | this.appendValueInput("list") |
|
- | 390 | .setCheck("particle list") |
|
- | 391 | .appendField("Particle List"); |
|
- | 392 | this.setColour(230); |
|
- | 393 | this.setTooltip('Run the analysis, specify data source, number of events, first event and a list of particles to process.'); |
|
- | 394 | this.setHelpUrl('http://belle2.jp/'); |
|
350 | 395 | } |
|
- | 396 | }; |
|
- | 397 | ||
351 | 398 | ||
352 | </script> |
399 | </script> |
353 | 400 | ||
354 | </head> |
401 | </head> |
355 | <body> |
402 | <body> |
- | 403 | ||
356 | <h1>Belle II Particle Discovery: Describe process →Analyse →Fit results →Discover</h1> |
404 | <h1>Belle II Particle Discovery: Describe process →Analyse →Fit results →Discover</h1> |
357 | <!-- <input type="button" onclick="showCode();" class="mybutton" value="Show JavaScript" /> --> |
405 | <!-- <input type="button" onclick="showCode();" class="mybutton" value="Show JavaScript" /> --> |
358 | <input type="button" id="btnstart" onclick="startAction();" class="mybutton" value="Run Analysis" /> |
406 | <input type="button" id="btnstart" onclick="startAction();" class="mybutton" value="Run Analysis" /> |
359 | 407 | ||
360 | <input type="button" onclick="saveBlockly();" class="mybutton" value="Save Diagram" /> |
408 | <input type="button" onclick="saveBlockly();" class="mybutton" value="Save Diagram" /> |