Rev 319 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
319 | f9daq | 1 | |
193 | f9daq | 2 | Blockly.JavaScript['particle_combiner'] = function(block) { |
3 | var value_list1 = Blockly.JavaScript.valueToCode(block, 'list1', Blockly.JavaScript.ORDER_ATOMIC); |
||
4 | if (value_list1.length==0) value_list1='""'; |
||
5 | var value_list2 = Blockly.JavaScript.valueToCode(block, 'list2', Blockly.JavaScript.ORDER_ATOMIC); |
||
6 | if (value_list2.length==0) value_list2='""'; |
||
7 | var dropdown_simplepid = block.getFieldValue('simplepid'); |
||
267 | f9daq | 8 | var dropdown_sameparticles = block.getFieldValue('sameparticles'); |
193 | f9daq | 9 | var number_mass0 = block.getFieldValue('mass0'); |
10 | var number_mass1 = block.getFieldValue('mass1'); |
||
319 | f9daq | 11 | var histograms = Blockly.JavaScript.statementToCode(block, 'histogram'); |
12 | var code = '{"combiner":{"list1":' + value_list1 + ',"list2":' + value_list2 ; |
||
13 | code += ',"sameparticles":"'+ dropdown_sameparticles +'","pid":"' + dropdown_simplepid ; |
||
14 | code += '","m0":"' + number_mass0 + '","m1":"' + number_mass1 + '","histogram":[' + histograms + ']}}\n'; |
||
193 | f9daq | 15 | return [code, Blockly.JavaScript.ORDER_NONE]; |
16 | }; |
||
17 | |||
330 | f9daq | 18 | Blockly.JavaScript['particle_combiner3'] = function(block) { |
19 | var value_list1 = Blockly.JavaScript.valueToCode(block, 'list1', Blockly.JavaScript.ORDER_ATOMIC); |
||
20 | if (value_list1.length==0) value_list1='""'; |
||
21 | var value_list2 = Blockly.JavaScript.valueToCode(block, 'list2', Blockly.JavaScript.ORDER_ATOMIC); |
||
22 | if (value_list2.length==0) value_list2='""'; |
||
23 | var value_list3 = Blockly.JavaScript.valueToCode(block, 'list3', Blockly.JavaScript.ORDER_ATOMIC); |
||
24 | if (value_list3.length==0) value_list3='""'; |
||
25 | var dropdown_simplepid = block.getFieldValue('simplepid'); |
||
26 | var dropdown_sameparticles = block.getFieldValue('sameparticles'); |
||
27 | var number_mass0 = block.getFieldValue('mass0'); |
||
28 | var number_mass1 = block.getFieldValue('mass1'); |
||
29 | var histograms = Blockly.JavaScript.statementToCode(block, 'histogram'); |
||
30 | var code = '{"combiner3":{"list1":' + value_list1 + ',"list2":' + value_list2 + ',"list3":' + value_list3 ; |
||
31 | code += ',"sameparticles":"'+ dropdown_sameparticles +'","pid":"' + dropdown_simplepid ; |
||
32 | code += '","m0":"' + number_mass0 + '","m1":"' + number_mass1 + '","histogram":[' + histograms + ']}}\n'; |
||
33 | return [code, Blockly.JavaScript.ORDER_NONE]; |
||
34 | }; |
||
35 | |||
193 | f9daq | 36 | Blockly.JavaScript['particle_selector'] = function(block) { |
37 | var value_list1 = Blockly.JavaScript.valueToCode(block, 'list1', Blockly.JavaScript.ORDER_ATOMIC); |
||
38 | if (value_list1.length==0) value_list1='""'; |
||
39 | var dropdown_chargelist = block.getFieldValue('chargelist'); |
||
40 | var dropdown_simplepid = block.getFieldValue('simplepid'); |
||
319 | f9daq | 41 | var histograms = Blockly.JavaScript.statementToCode(block, 'histogram'); |
42 | var code = '{"selector":{"list1":' + value_list1 ; |
||
43 | code += ',"charge":"' + dropdown_chargelist ; |
||
44 | code += '","pid":"' + dropdown_simplepid + '","histogram":[' + histograms + ']}}\n'; |
||
193 | f9daq | 45 | return [code, Blockly.JavaScript.ORDER_NONE]; |
46 | }; |
||
47 | |||
48 | Blockly.JavaScript['histogram_creator'] = function(block) { |
||
49 | var text_name = block.getFieldValue('name'); |
||
50 | var number_nbins = block.getFieldValue('nbins'); |
||
51 | var number_min = block.getFieldValue('min'); |
||
52 | var number_max = block.getFieldValue('max'); |
||
53 | var dropdown_varname = block.getFieldValue('varname'); |
||
319 | f9daq | 54 | var code = '{"h1d":{"varname":"'+ dropdown_varname + '",'; |
55 | code = code + ' "name":"' + text_name + '","nbins":"' + number_nbins + '",'; |
||
56 | code = code + ' "min":"' + number_min + '","max":"' + number_max + '"}}\n'; |
||
57 | return code; |
||
193 | f9daq | 58 | }; |
59 | |||
60 | Blockly.JavaScript['simple_analysis'] = function(block) { |
||
61 | var number_neve = block.getFieldValue('neve'); |
||
267 | f9daq | 62 | var number_first= block.getFieldValue('first'); |
63 | var number_print= block.getFieldValue('print'); |
||
193 | f9daq | 64 | var dropdown_datasource = block.getFieldValue('datasource'); |
65 | var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC); |
||
66 | if (value_list.length==0) value_list='""'; |
||
267 | f9daq | 67 | var code = '{"analysis":{"neve":"' + number_neve + '","first":"' + number_first + '","print":"' + number_print + '","datasource":"' + dropdown_datasource + '","list":' + value_list + '}}\n'; |
68 | |||
193 | f9daq | 69 | return code; |
70 | }; |
||
71 | |||
72 | Blockly.JavaScript['particle_mass_fix'] = function(block) { |
||
73 | var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC); |
||
74 | if (value_list.length==0) value_list='""'; |
||
75 | var code = '{"fix_mass":{"list":' + value_list + '}}\n'; |
||
76 | return [code, Blockly.JavaScript.ORDER_NONE]; |
||
77 | }; |
||
78 | |||
79 | Blockly.JavaScript['primary_list'] = function(block) { |
||
80 | var value_histogram = Blockly.JavaScript.valueToCode(block, 'histogram', Blockly.JavaScript.ORDER_ATOMIC); |
||
81 | if (value_histogram.length==0) value_histogram='""'; |
||
82 | var code = '{"primary":' + '{"histogram":' + value_histogram + '}}\n'; |
||
83 | return [code, Blockly.JavaScript.ORDER_NONE]; |
||
267 | f9daq | 84 | }; |