Subversion Repositories f9daq

Rev

Rev 267 | Go to most recent revision | 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
 
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');
319 f9daq 23
  var histograms = Blockly.JavaScript.statementToCode(block, 'histogram');
24
  var code = '{"selector":{"list1":' + value_list1 ;
25
      code  += ',"charge":"' +  dropdown_chargelist ;
26
      code  += '","pid":"' + dropdown_simplepid +  '","histogram":[' + histograms + ']}}\n';
193 f9daq 27
  return [code, Blockly.JavaScript.ORDER_NONE];
28
};
29
 
30
Blockly.JavaScript['histogram_creator'] = function(block) {
31
  var text_name = block.getFieldValue('name');
32
  var number_nbins = block.getFieldValue('nbins');
33
  var number_min = block.getFieldValue('min');
34
  var number_max = block.getFieldValue('max');
35
  var dropdown_varname = block.getFieldValue('varname');
319 f9daq 36
  var code = '{"h1d":{"varname":"'+ dropdown_varname + '",';
37
      code = code  + ' "name":"' +  text_name + '","nbins":"' + number_nbins + '",';
38
      code = code  + ' "min":"' + number_min +  '","max":"' + number_max + '"}}\n';
39
  return code;
193 f9daq 40
};
41
 
42
Blockly.JavaScript['simple_analysis'] = function(block) {
43
  var number_neve = block.getFieldValue('neve');
267 f9daq 44
  var number_first= block.getFieldValue('first');
45
  var number_print= block.getFieldValue('print');
193 f9daq 46
  var dropdown_datasource = block.getFieldValue('datasource');
47
  var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC);
48
  if (value_list.length==0) value_list='""';
267 f9daq 49
  var code = '{"analysis":{"neve":"' + number_neve + '","first":"' + number_first + '","print":"' + number_print +  '","datasource":"' + dropdown_datasource + '","list":' + value_list + '}}\n';
50
 
193 f9daq 51
  return code;
52
};
53
 
54
Blockly.JavaScript['particle_mass_fix'] = function(block) {
55
  var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC);
56
  if (value_list.length==0) value_list='""';
57
  var code = '{"fix_mass":{"list":' + value_list + '}}\n';
58
  return [code, Blockly.JavaScript.ORDER_NONE];
59
};
60
 
61
Blockly.JavaScript['primary_list'] = function(block) {
62
  var value_histogram = Blockly.JavaScript.valueToCode(block, 'histogram', Blockly.JavaScript.ORDER_ATOMIC);
63
   if (value_histogram.length==0) value_histogram='""';
64
  var code = '{"primary":' +  '{"histogram":' + value_histogram + '}}\n';
65
  return [code, Blockly.JavaScript.ORDER_NONE];
267 f9daq 66
};