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