Subversion Repositories f9daq

Rev

Rev 267 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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');
  7.   var number_mass0 = block.getFieldValue('mass0');
  8.   var number_mass1 = block.getFieldValue('mass1');
  9.   var value_histogram = Blockly.JavaScript.valueToCode(block, 'histogram', Blockly.JavaScript.ORDER_ATOMIC);
  10.   if (value_histogram.length==0) value_histogram='""';
  11.   // TODO: Assemble JavaScript into code variable.
  12.   var code = '{"combiner":{"list1":' + value_list1 + ',"list2":' +  value_list2 + ',"pid":"' + dropdown_simplepid +  '","m0":"' + number_mass0 +  '","m1":"' + number_mass1 + '","histogram":' + value_histogram + '}}\n';
  13.   // TODO: Change ORDER_NONE to the correct strength.
  14.   return [code, Blockly.JavaScript.ORDER_NONE];
  15. };
  16.  
  17. Blockly.JavaScript['particle_selector'] = function(block) {
  18.   var value_list1 = Blockly.JavaScript.valueToCode(block, 'list1', Blockly.JavaScript.ORDER_ATOMIC);
  19.   if (value_list1.length==0) value_list1='""';
  20.   var dropdown_chargelist = block.getFieldValue('chargelist');
  21.   var dropdown_simplepid = block.getFieldValue('simplepid');
  22.   var value_histogram = Blockly.JavaScript.valueToCode(block, 'histogram', Blockly.JavaScript.ORDER_ATOMIC);
  23.   if (value_histogram.length==0) value_histogram='""';
  24.   // TODO: Assemble JavaScript into code variable.
  25.   var code = '{"selector":{"list1":' + value_list1 + ',"charge":"' +  dropdown_chargelist + '","pid":"' + dropdown_simplepid +  '","histogram":' + value_histogram + '}}\n';
  26.   // TODO: Change ORDER_NONE to the correct strength.
  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');
  36.   // TODO: Assemble JavaScript into code variable.
  37.  
  38.   var code = '{"h1d":{"varname":"'+ dropdown_varname + '","name":"' +  text_name + '","nbins":"' + number_nbins + '","min":"' + number_min +  '","max":"' + number_max + '"}}\n';
  39.   // TODO: Change ORDER_NONE to the correct strength.
  40.   return [code, Blockly.JavaScript.ORDER_NONE];
  41. };
  42.  
  43. Blockly.JavaScript['simple_analysis'] = function(block) {
  44.   var number_neve = block.getFieldValue('neve');
  45.   var dropdown_datasource = block.getFieldValue('datasource');
  46.   var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC);
  47.   if (value_list.length==0) value_list='""';
  48.   // TODO: Assemble JavaScript into code variable.
  49.   var code = '{"analysis":{"neve":"' + number_neve +  '","datasource":"' + dropdown_datasource + '","list":' + value_list + '}}\n';
  50.   return code;
  51. };
  52.  
  53. Blockly.JavaScript['particle_mass_fix'] = function(block) {
  54.   var value_list = Blockly.JavaScript.valueToCode(block, 'list', Blockly.JavaScript.ORDER_ATOMIC);
  55.   if (value_list.length==0) value_list='""';
  56.   // TODO: Assemble JavaScript into code variable.
  57.   var code = '{"fix_mass":{"list":' + value_list + '}}\n';
  58.   // TODO: Change ORDER_NONE to the correct strength.
  59.   return [code, Blockly.JavaScript.ORDER_NONE];
  60. };
  61.  
  62. Blockly.JavaScript['primary_list'] = function(block) {
  63.   var value_histogram = Blockly.JavaScript.valueToCode(block, 'histogram', Blockly.JavaScript.ORDER_ATOMIC);
  64.    if (value_histogram.length==0) value_histogram='""';
  65.   // TODO: Assemble JavaScript into code variable.
  66.   var code = '{"primary":' +  '{"histogram":' + value_histogram + '}}\n';
  67.   // TODO: Change ORDER_NONE to the correct strength.
  68.   return [code, Blockly.JavaScript.ORDER_NONE];
  69. };